Fixed #1038. Focus should now remain on code editor when after clicking on Surface.

This commit is contained in:
Nick Winter 2014-08-28 14:00:54 -07:00
parent 1094d09aa5
commit f79a2848fd
6 changed files with 6 additions and 3 deletions

View file

@ -53,6 +53,7 @@ module.exports = class CoordinateDisplay extends createjs.Container
wop = @camera.screenToWorld x: e.x, y: e.y
wop.x = Math.round wop.x
wop.y = Math.round wop.y
Backbone.Mediator.publish 'tome:focus-editor', {}
Backbone.Mediator.publish 'surface:coordinate-selected', wop
onZoomUpdated: (e) ->

View file

@ -483,11 +483,13 @@ module.exports = Surface = class Surface extends CocoClass
worldPos = @camera.screenToWorld x: e.stageX, y: e.stageY
event = onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e, worldPos: worldPos
Backbone.Mediator.publish 'surface:stage-mouse-down', event
Backbone.Mediator.publish 'tome:focus-editor', {}
onMouseUp: (e) =>
return if @disabled
onBackground = not @stage.hitTest e.stageX, e.stageY
Backbone.Mediator.publish 'surface:stage-mouse-up', onBackground: onBackground, x: e.stageX, y: e.stageY, originalEvent: e
Backbone.Mediator.publish 'tome:focus-editor', {}
onMouseWheel: (e) =>
# https://github.com/brandonaaron/jquery-mousewheel

View file

@ -23,5 +23,5 @@ module.exports =
bus: {$ref: 'bus'}
'bus:player-states-changed': c.object {title: 'Player state changes', description: 'State of the players has changed'},
states: c.array {}, {type: 'object'}
states: {type: 'object', additionalProperties: {type: 'object'}}
bus: {$ref: 'bus'}

View file

@ -66,6 +66,7 @@ module.exports = # /app/lib/surface
'surface:coordinate-selected': c.object {required: ['x', 'y']},
x: {type: 'number'}
y: {type: 'number'}
z: {type: 'number'}
'surface:coordinates-shown': c.object {}

View file

@ -6,7 +6,7 @@ module.exports = class LevelSearchView extends SearchView
model: require 'models/Level'
modelURL: '/db/level'
tableTemplate: require 'templates/editor/level/table'
page: 'editor'
page: 'level'
getRenderData: ->
context = super()

View file

@ -221,7 +221,6 @@ module.exports = class SpectateLevelView extends RootView
else
console.log 'World scripts don\'t exist!'
nonVictoryPlaybackScripts = []
console.log nonVictoryPlaybackScripts
@scriptManager = new ScriptManager({scripts: nonVictoryPlaybackScripts, view:@, session: @session})
@scriptManager.loadFromSession()