Fixed a few tome / canvas resizing bugs.

This commit is contained in:
Nick Winter 2014-09-03 18:35:14 -07:00
parent 1094487072
commit 35f22e0f8c
4 changed files with 9 additions and 7 deletions
app
lib/surface
styles/play
views/play/level/tome

View file

@ -87,7 +87,7 @@ module.exports = Surface = class Surface extends CocoClass
@options = _.extend(@options, givenOptions) if givenOptions
@initEasel()
@initAudio()
@onResize = _.debounce @onResize, 250
@onResize = _.debounce @onResize, 500 # At least as much as $level-resize-transition-time.
$(window).on 'resize', @onResize
if @world.ended
_.defer => @setWorld @world
@ -489,7 +489,7 @@ module.exports = Surface = class Surface extends CocoClass
newPos = @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)
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

View file

@ -6,6 +6,8 @@ body.is-playing
.footer
background-color: black
$level-resize-transition-time: 0.5s
#level-view
margin: 0 auto
@include user-select(none)
@ -49,13 +51,13 @@ body.is-playing
width: 55%
position: relative
overflow: hidden
@include transition(0.5s ease-out)
@include transition($level-resize-transition-time ease-out)
canvas#surface
background-color: #333
display: block
z-index: 1
@include transition(0.5s ease-out)
@include transition($level-resize-transition-time ease-out)
&.flag-color-selected
cursor: crosshair
@ -73,7 +75,7 @@ body.is-playing
right: 0
top: 0px
bottom: 0
@include transition(width 0.5s ease-in-out, right 0.5s ease-in-out)
@include transition(width $level-resize-transition-time ease-in-out, right $level-resize-transition-time ease-in-out)
#pointer
position: absolute

View file

@ -171,4 +171,4 @@ module.exports = class Spell
@source = e.code[spellkeyComponents[0]][spellkeyComponents[1]]
@updateLanguageAether e.codeLanguage
else
console.error 'Spell onNewOpponentCode did not recieve code', e
console.error 'Spell onNewOpponentCode did not receive code', e

View file

@ -668,7 +668,7 @@ module.exports = class SpellView extends CocoView
@ace.setValue pretty
onMaximizeToggled: (e) ->
@ace.resize true
_.delay (=> @ace?.resize true), 500 # Wait $level-resize-transition-time.
onChangeEditorConfig: (e) ->
aceConfig = me.get('aceConfig') ? {}