paste coordiante if click + shift

This commit is contained in:
Dominik Kundel 2014-03-13 01:50:59 +01:00
parent dd87215012
commit 8990b9d194
3 changed files with 16 additions and 2 deletions

View file

@ -4,6 +4,7 @@ module.exports = class CoordinateDisplay extends createjs.Container
'surface:mouse-moved': 'onMouseMove'
'surface:mouse-out': 'onMouseOut'
'surface:mouse-over': 'onMouseOver'
'surface:stage-mouse-down': 'onMouseDown'
'camera:zoom-updated': 'onZoomUpdated'
constructor: (options) ->
@ -38,6 +39,14 @@ module.exports = class CoordinateDisplay extends createjs.Container
@hide()
@show() # debounced
onMouseDown: (e) ->
return unless key.shift
wop = @camera.canvasToWorld x: e.x, y: e.y
wop.x = Math.round wop.x
wop.y = Math.round wop.y
console.log 'position', wop
Backbone.Mediator.publish 'surface:coordinate-selected', wop
onZoomUpdated: (e) ->
@hide()
@show()

View file

@ -238,14 +238,14 @@ module.exports = class SpriteBoss extends CocoClass
@dragged += 1
onSpriteMouseUp: (e) ->
return if key.shift and @options.choosing
return if key.shift #and @options.choosing
return @dragged = 0 if @dragged > 3
@dragged = 0
sprite = if e.sprite?.thang?.isSelectable then e.sprite else null
@selectSprite e, sprite
onStageMouseDown: (e) ->
return if key.shift and @options.choosing
return if key.shift #and @options.choosing
@selectSprite e if e.onBackground
selectThang: (thangID, spellName=null) ->

View file

@ -19,6 +19,7 @@ module.exports = class SpellView extends View
'level-disable-controls': 'onDisableControls'
'level-enable-controls': 'onEnableControls'
'surface:frame-changed': 'onFrameChanged'
'surface:coordinate-selected': 'onCoordinateSelected'
'god:new-world-created': 'onNewWorld'
'god:user-code-problem': 'onUserCodeProblem'
'tome:manual-cast': 'onManualCast'
@ -420,6 +421,10 @@ module.exports = class SpellView extends View
@thang = e.selectedThang # update our thang to the current version
@highlightCurrentLine()
onCoordinateSelected: (e) ->
return unless e.x? and e.y?
@ace.insert "{x: #{e.x}, y: #{e.y}}"
onStatementIndexUpdated: (e) ->
return unless e.ace is @ace
@highlightCurrentLine()