Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 39 lines (28 sloc) 0.827 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
class AreaTitle extends Spine.Controller
  className: 'areaTitle'

  change: (area) ->
    @html("width: #{area.width}px   height: #{area.height}px")

  move: (position) ->
    @el.css(left: position.left, top: position.top)

class Resizing extends Spine.Controller
  events:
    'start.resize': 'resizeStart'
    'resize.element': 'resized'
    'end.resize': 'resizeEnd'

  constructor: (@stage) ->
    super(el: @stage.el)

  resizeStart: ->
    @stage.history.record()

  resized: (e, element) ->
    area = element.area()

    unless @areaTitle
      @append(@areaTitle = new AreaTitle)

    @areaTitle.move(
      left: area.left + area.width + 10,
      top: area.top + area.height + 10
    )

    @areaTitle.change(area)

  resizeEnd: ->
    @areaTitle?.release()
    @areaTitle = null

module.exports = Resizing
Something went wrong with that request. Please try again.