+ resize: (wh) ->
+ @width = wh.w
+ @el.setAttribute 'width', @width
+ @height = wh.h
+ @el.setAttribute 'height', @height
+ if @controls.length > 1
+ @controls[1].move x: @x + @width, y: @y + @height
+ make_controls: (args) -> # create controls, return them
+ console.log 'make_controls'
+ if @controls.length > 0
+ console.log "warning: re-adding controls"
+ @kill_controls()
+ w = @
+ @controls = [
+ new ControlPoint svg: @svg, x: @x, y: @y, done: args.done, drag: (xy) ->
+ dx = xy.x - @x
+ dy = xy.y - @y
+ w.resize w: w.width - dx, h: w.height - dy
+ w.move x: w.x + dx, y: w.y + dy
+ new ControlPoint svg: @svg, x: @x + @width, y: @y + @height, done: args.done, drag: (xy) ->
+ dx = xy.x - @x
+ dy = xy.y - @y
+ w.resize w: w.width + dx, h: w.height + dy
+ ]
+ return @controls