Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
79 lines (57 sloc) 1.79 KB
class CoordTitle extends Spine.Controller
className: 'coordTitle'
change: (area) ->
@html("x: #{area.left}px   y: #{}px")
move: (position) ->
@el.css(left: position.left, top:
class Dragging extends Spine.Controller
'mousedown .selected': 'listen'
constructor: (@stage) ->
super(el: @stage.el)
listen: (e) =>
# Copy elements when alt dragging
if e.altKey
clones = @stage.cloneSelected()
@dragPosition = {left: e.pageX, top: e.pageY}
@active = false
drag: (e) =>
if @active is false
@active = true
difference =
left: e.pageX - @dragPosition.left
top: e.pageY -
@dragPosition = {left: e.pageX, top: e.pageY}
@stageArea = @stage.area()
@selectionArea = @stage.selection.area()
if e.altKey or e.metaKey
# Check vertical/center stage snapping
difference = @stage.snapping.snap(@selectionArea, difference)
# Setup CoordTitle
drop: (e) =>
$(document).unbind('mousemove', @drag)
$(document).unbind('mouseup', @drop)
@el.trigger('end.dragging') if @active
# Reset coordTitle
@coordTitle = null
moveCoordTitle: ->
unless @coordTitle
@append(@coordTitle = new CoordTitle)
left: @dragPosition.left - @stageArea.left + 10,
top: - + 10
module.exports = Dragging
Something went wrong with that request. Please try again.