Increased dimming behavior when parts of the DOM are locked.

This commit is contained in:
Nick Winter 2014-11-08 08:58:36 -08:00
parent a8700f5113
commit 4cb641689c
9 changed files with 32 additions and 7 deletions

View file

@ -15,6 +15,9 @@
font-family: Open Sans Condensed
font-weight: bold
&.controls-disabled
@include filter(brightness(50%))
.levels-link-area
position: absolute
left: 40px

View file

@ -7,6 +7,10 @@
position: relative
overflow: visible
&.controls-disabled
@include opacity(0.5)
pointer-events: none
.wood-background
position: absolute
left: 0

View file

@ -64,9 +64,9 @@
font-family: Monaco, Menlo, Ubuntu Mono, Consolas, "source-code-pro", monospace !important
&.disabled
@include opacity(80)
.ace_cursor
@include opacity(20)
@include opacity(0.8)
.ace_cursor, .executing, .ace_active-line, .ace_gutter-active-line
@include opacity(0.2)
.ace_gutter
background-color: transparent

View file

@ -41,8 +41,10 @@
left: 80%
&.read-only
background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.5) 100%), url(/images/level/code_editor_top_bar_wood_background.png)
background: linear-gradient(to bottom, rgba(0,0,0,0.25) 0%,rgba(0,0,0,0.25) 100%), url(/images/level/code_editor_top_bar_wood_background.png)
background-size: 100% 100%
> *
@include opacity(0.5)
.thang-avatar-view
width: $childSize - 10px

View file

@ -17,8 +17,12 @@
left: 0px
z-index: -1
&.disabled
@include opacity(0.80)
&.controls-disabled
.code-palette-background
@include filter(brightness(75%))
> :not(.code-palette-background)
@include opacity(0.50)
h4
color: white

View file

@ -12,6 +12,8 @@ module.exports = class ControlBarView extends CocoView
subscriptions:
'bus:player-states-changed': 'onPlayerStatesChanged'
'level:disable-controls': 'onDisableControls'
'level:enable-controls': 'onEnableControls'
events:
'click #next-game-button': -> Backbone.Mediator.publish 'level:next-game-pressed', {}
@ -74,3 +76,11 @@ module.exports = class ControlBarView extends CocoView
e.preventDefault()
e.stopImmediatePropagation()
Backbone.Mediator.publish 'router:navigate', route: @homeLink, viewClass: @homeViewClass, viewArgs: @homeViewArgs
onDisableControls: (e) -> @toggleControls e, false
onEnableControls: (e) -> @toggleControls e, true
toggleControls: (e, enabled) ->
return if e.controls and not ('level' in e.controls)
return if enabled is @controlsEnabled
@controlsEnabled = enabled
@$el.toggleClass 'controls-disabled', not enabled

View file

@ -36,10 +36,12 @@ module.exports = class LevelHUDView extends CocoView
onDisableControls: (e) ->
return if e.controls and not ('hud' in e.controls)
@disabled = true
@$el.addClass 'controls-disabled'
onEnableControls: (e) ->
return if e.controls and not ('hud' in e.controls)
@disabled = false
@$el.removeClass 'controls-disabled'
onSpriteSelected: (e) ->
return if @disabled

View file

@ -101,7 +101,6 @@ module.exports = class SpellListTabEntryView extends SpellListEntryView
#Backbone.Mediator.publish 'tome:reload-code', spell: @spell # Old: just reload the current code
@openModalView new ReloadLevelModal() # New: prompt them to restart the level
onBeautifyClick: (e) ->
return unless @controlsEnabled
Backbone.Mediator.publish 'tome:spell-beautify', spell: @spell

View file

@ -240,6 +240,7 @@ module.exports = class SpellPaletteView extends CocoView
return if enabled is @controlsEnabled
@controlsEnabled = enabled
@$el.find('*').attr('disabled', not enabled)
@$el.toggleClass 'controls-disabled', not enabled
@toggleBackground()
toggleBackground: =>