Finished fixing #841.

This commit is contained in:
Nick Winter 2014-08-27 17:26:56 -07:00
parent 3f16aaab61
commit 92b29915e2
12 changed files with 43 additions and 15 deletions

View file

@ -486,7 +486,6 @@ module.exports = Surface = class Surface extends CocoClass
onMouseUp: (e) =>
return if @disabled
console.log 'yo on mouse up', e
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

View file

@ -511,6 +511,7 @@
toggle_grid: "Toggle grid overlay."
toggle_pathfinding: "Toggle pathfinding overlay."
beautify: "Beautify your code by standardizing its formatting."
maximize_editor: "Maximize/minimize code editor."
move_wizard: "Move your Wizard around the level."
admin:

View file

@ -50,4 +50,4 @@ module.exports =
'god:debug-value-return': c.object {required: ['key']},
key: {type: 'string'}
value: {type: 'any'}
value: {type: ['any', 'undefined']}

View file

@ -141,7 +141,7 @@ module.exports = # /app/lib/surface
originalEvent: {type: 'object'}
worldPos: {type: ['object', 'null', 'undefined']}
'surface:stage-mouse-up': c.object {required: ['onBackground', 'x', 'y', 'originalEvent']},
'surface:stage-mouse-up': c.object {required: ['onBackground', 'originalEvent']},
onBackground: {type: 'boolean'}
x: {type: 'number'}
y: {type: 'number'}

View file

@ -73,7 +73,7 @@ body.is-playing
right: 0
top: 0px
bottom: 0
transition: width 0.5s ease-in-out
@include transition(width 0.5s ease-in-out, right 0.5s ease-in-out)
#pointer
position: absolute
@ -186,9 +186,25 @@ body.is-playing
color: white
text-decoration: underline
#fullscreen-editor-background-screen
background-color: black
opacity: 0.5
cursor: pointer
display: none
position: absolute
left: 0
right: 0
bottom: 0
top: 0
z-index: 19
html.fullscreen-editor
#level-view
#fullscreen-editor-background-screen
display: block
#code-area
position: fixed
width: 100%
width: 95%
height: 100%
right: 0

View file

@ -2,6 +2,8 @@
.level-content
#control-bar-view
#fullscreen-editor-background-screen(title="Click to minimize the code editor")
#code-area
#code-area-gradient.gradient

View file

@ -5,15 +5,15 @@ block modal-header-content
block modal-body-content
dl.dl-horizontal
dt(title="Shift+" + enter)
dt(title=shift + "+" + enter)
code ⇧+#{enter}
dd(data-i18n="keyboard_shortcuts.cast_spell") Cast current spell.
dl.dl-horizontal
dt(title=ctrlName + "+Shift+" + enter)
dt(title=ctrlName + "+" + shift + "+" + enter)
code #{ctrl}+⇧+#{enter}
dd(data-i18n="keyboard_shortcuts.run_real_time") Run in real time.
dl.dl-horizontal
dt(title="Shift+" + space)
dt(title=shift + "+" + space)
code ⇧+#{space}
dd(data-i18n="keyboard_shortcuts.continue_script") Continue past current script.
dl.dl-horizontal
@ -55,9 +55,13 @@ block modal-body-content
code #{ctrl}+O
dd(data-i18n="keyboard_shortcuts.toggle_pathfinding") Toggle pathfinding overlay.
dl.dl-horizontal
dt(title=ctrlName + "+Shift+B")
dt(title=ctrlName + "+" + shift + "+B")
code #{ctrl}+⇧+B
dd(data-i18n="keyboard_shortcuts.beautify") Beautify your code by standardizing its formatting.
dl.dl-horizontal
dt(title=ctrlName + "+" + shift + "+M")
code #{ctrl}+⇧+M
dd(data-i18n="keyboard_shortcuts.maximize_editor") Maximize/minimize code editor.
dl.dl-horizontal
dt(title="Arrow keys")
code ←

View file

@ -7,14 +7,14 @@ img(src="/images/level/code_editor_tab_background.png").spell-tab-image-hidden.h
code #{methodSignature}
.spell-tool-buttons
.btn.btn-small.fullscreen-code(title="Expand code editor")
.btn.btn-small.fullscreen-code(title=maximizeShortcutVerbose)
i.icon-fullscreen
i.icon-resize-small
.btn.btn-small.reload-code(title="Reload original code for " + spell.name)
i.icon-repeat
.btn.btn-small.beautify-code(title="Ctrl+Shift+B: Beautify code for " + spell.name)
.btn.btn-small.beautify-code(title=beautifyShortcutVerbose)
i.icon-magnet
.clearfix

View file

@ -68,6 +68,7 @@ module.exports = class PlayLevelView extends RootView
events:
'click #level-done-button': 'onDonePressed'
'click #fullscreen-editor-background-screen': (e) -> Backbone.Mediator.publish 'tome:fullscreen-view', {}
shortcuts:
'ctrl+s': 'onCtrlS'

View file

@ -14,4 +14,5 @@ module.exports = class KeyboardShortcutsModal extends ModalView
c.enter = $.i18n.t 'keyboard_shortcuts.enter'
c.space = $.i18n.t 'keyboard_shortcuts.space'
c.escapeKey = $.i18n.t 'keyboard_shortcuts.escape'
c.shift = $.i18n.t 'keyboard_shortcuts.shift'
c

View file

@ -29,6 +29,10 @@ module.exports = class SpellListTabEntryView extends SpellListEntryView
getRenderData: (context={}) ->
context = super context
ctrl = if @isMac() then 'Cmd' else 'Ctrl'
shift = $.i18n.t 'keyboard_shortcuts.shift'
context.beautifyShortcutVerbose = "#{ctrl}+#{shift}+B: #{$.i18n.t 'keyboard_shortcuts.beautify'}"
context.maximizeShortcutVerbose = "#{ctrl}+#{shift}+M: #{$.i18n.t 'keyboard_shortcuts.maximize_editor'}"
context
afterRender: ->
@ -86,15 +90,15 @@ module.exports = class SpellListTabEntryView extends SpellListEntryView
return unless @controlsEnabled
Backbone.Mediator.publish 'tome:toggle-spell-list', {}
onCodeReload: ->
onCodeReload: (e) ->
return unless @controlsEnabled
Backbone.Mediator.publish 'tome:reload-code', spell: @spell
onBeautifyClick: ->
onBeautifyClick: (e) ->
return unless @controlsEnabled
Backbone.Mediator.publish 'tome:spell-beautify', spell: @spell
onFullscreenClick: ->
onFullscreenClick: (e) ->
$codearea = $('html')
$('#code-area').css 'z-index', 20 unless $codearea.hasClass 'fullscreen-editor'
$('html').toggleClass 'fullscreen-editor'

View file

@ -181,7 +181,7 @@ module.exports = class SpellView extends CocoView
exec: -> # just prevent default ACE go-to-line alert
addCommand
name: 'open-fullscreen-editor'
bindKey: {win: 'Alt-Shift-F', mac: 'Ctrl-Shift-F'}
bindKey: {win: 'Ctrl-Shift-M', mac: 'Command-Shift-M|Ctrl-Shift-M'}
exec: -> Backbone.Mediator.publish 'tome:fullscreen-view', {}
fillACE: ->