Fixed bugs with click coordinates messing up mouse-down targeting.

This commit is contained in:
Nick Winter 2014-09-11 13:05:20 -07:00
parent 5551c622fa
commit e9968b648f

View file

@ -457,12 +457,12 @@ module.exports = Surface = class Surface extends CocoClass
onMouseDown: (e) =>
return if @disabled
newPos = @camera.screenToCanvas({x: e.stageX, y: e.stageY})
cap = @camera.screenToCanvas({x: e.stageX, y: e.stageY})
# getObject(s)UnderPoint is broken, so we have to use the private method to get what we want
onBackground = not @stage._getObjectsUnderPoint(newPos.x, newPos.y, null, true)
onBackground = not @stage._getObjectsUnderPoint(e.stageX, e.stageY, null, true)
worldPos = @camera.screenToWorld x: e.stageX, y: e.stageY
event = onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e, worldPos: worldPos
wop = @camera.screenToWorld x: e.stageX, y: e.stageY
event = onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e, worldPos: wop
Backbone.Mediator.publish 'surface:stage-mouse-down', event
Backbone.Mediator.publish 'tome:focus-editor', {}