mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-01 15:50:11 -04:00
Increased dimming behavior when parts of the DOM are locked.
This commit is contained in:
parent
a8700f5113
commit
4cb641689c
9 changed files with 32 additions and 7 deletions
app
styles/play/level
views/play/level
|
@ -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
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
position: relative
|
||||
overflow: visible
|
||||
|
||||
&.controls-disabled
|
||||
@include opacity(0.5)
|
||||
pointer-events: none
|
||||
|
||||
.wood-background
|
||||
position: absolute
|
||||
left: 0
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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: =>
|
||||
|
|
Loading…
Add table
Reference in a new issue