mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 08:08:15 -05:00
A few visual tweaks to the spell view flow.
This commit is contained in:
parent
e3b89da7fd
commit
d262dfaca7
3 changed files with 12 additions and 13 deletions
|
@ -33,7 +33,7 @@
|
||||||
.ace_editor
|
.ace_editor
|
||||||
@include box-sizing(border-box)
|
@include box-sizing(border-box)
|
||||||
margin-top: 40px
|
margin-top: 40px
|
||||||
width: 100%
|
width: 98%
|
||||||
height: 83%
|
height: 83%
|
||||||
height: -webkit-calc(100% - 60px - 40px)
|
height: -webkit-calc(100% - 60px - 40px)
|
||||||
height: calc(100% - 60px - 40px)
|
height: calc(100% - 60px - 40px)
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
.executing
|
.executing
|
||||||
background-color: rgba(216, 255, 255, 0.85)
|
background-color: rgba(216, 255, 255, 0.85)
|
||||||
.executed
|
.executed
|
||||||
background-color: rgba(200, 200, 255, 0.25)
|
background-color: rgba(245, 255, 6, 0.18)
|
||||||
.problem-marker-info
|
.problem-marker-info
|
||||||
background-color: rgba(96, 63, 84, 0.25)
|
background-color: rgba(96, 63, 84, 0.25)
|
||||||
.problem-marker-warning
|
.problem-marker-warning
|
||||||
|
@ -79,7 +79,7 @@
|
||||||
.ace_marker-layer
|
.ace_marker-layer
|
||||||
.ace_bracket
|
.ace_bracket
|
||||||
// Override faint gray
|
// Override faint gray
|
||||||
border-color: #8FF
|
border-color: #BFF
|
||||||
|
|
||||||
.ace_identifier
|
.ace_identifier
|
||||||
background-color: rgba(255, 128, 128, 0.15)
|
border-bottom: 1px dotted rgba(255, 128, 128, 0.45)
|
||||||
|
|
|
@ -25,18 +25,19 @@ module.exports = class DebugView extends View
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
super()
|
super()
|
||||||
@ace.on "mousemove", @onMouseMove
|
@ace.on "mousemove", @onMouseMove
|
||||||
#@ace.on "click", onClick # same ACE API as mousemove
|
|
||||||
|
|
||||||
setVariableStates: (@variableStates) ->
|
setVariableStates: (@variableStates) ->
|
||||||
@update()
|
@update()
|
||||||
|
|
||||||
onMouseMove: (e) =>
|
onMouseMove: (e) =>
|
||||||
pos = e.getDocumentPosition()
|
pos = e.getDocumentPosition()
|
||||||
|
endOfDoc = pos.row is @ace.getSession().getDocument().getLength() - 1
|
||||||
it = new TokenIterator e.editor.session, pos.row, pos.column
|
it = new TokenIterator e.editor.session, pos.row, pos.column
|
||||||
isIdentifier = (t) -> t and (t.type is 'identifier' or t.value is 'this')
|
isIdentifier = (t) -> t and (t.type is 'identifier' or t.value is 'this')
|
||||||
while it.getCurrentTokenRow() is pos.row and not isIdentifier(token = it.getCurrentToken())
|
while it.getCurrentTokenRow() is pos.row and not isIdentifier(token = it.getCurrentToken())
|
||||||
it.stepBackward()
|
it.stepBackward()
|
||||||
break unless token
|
break unless token
|
||||||
|
break if endOfDoc # Don't iterate backward on last line, since we might be way below.
|
||||||
if isIdentifier token
|
if isIdentifier token
|
||||||
# This could be a property access, like "enemy.target.pos" or "this.spawnedRectangles".
|
# This could be a property access, like "enemy.target.pos" or "this.spawnedRectangles".
|
||||||
# We have to realize this and dig into the nesting of the objects.
|
# We have to realize this and dig into the nesting of the objects.
|
||||||
|
|
|
@ -446,21 +446,19 @@ module.exports = class SpellView extends View
|
||||||
marked = {}
|
marked = {}
|
||||||
lastExecuted = lastExecuted[0 .. @toolbarView.statementIndex] if @toolbarView?.statementIndex?
|
lastExecuted = lastExecuted[0 .. @toolbarView.statementIndex] if @toolbarView?.statementIndex?
|
||||||
for state, i in lastExecuted
|
for state, i in lastExecuted
|
||||||
#clazz = if state.executing then 'executing' else 'executed' # doesn't work
|
[start, end] = [offsetToPos(state.range[0]), offsetToPos(state.range[1])]
|
||||||
clazz = if i is lastExecuted.length - 1 then 'executing' else 'executed'
|
clazz = if i is lastExecuted.length - 1 then 'executing' else 'executed'
|
||||||
if clazz is 'executed'
|
if clazz is 'executed'
|
||||||
key = state.range[0] + '_' + state.range[1]
|
continue if marked[start.row]
|
||||||
continue if marked[key] > 2 # don't allow more than three of the same marker
|
marked[start.row] = true
|
||||||
marked[key] ?= 0
|
markerType = "fullLine"
|
||||||
++marked[key]
|
|
||||||
else
|
else
|
||||||
@debugView.setVariableStates state.variables
|
@debugView.setVariableStates state.variables
|
||||||
#console.log "at", state.userInfo.time, "vars are now:", state.variables
|
markerType = "text"
|
||||||
[start, end] = [offsetToPos(state.range[0]), offsetToPos(state.range[1])]
|
|
||||||
markerRange = new Range(start.row, start.column, end.row, end.column)
|
markerRange = new Range(start.row, start.column, end.row, end.column)
|
||||||
markerRange.start = @aceDoc.createAnchor markerRange.start
|
markerRange.start = @aceDoc.createAnchor markerRange.start
|
||||||
markerRange.end = @aceDoc.createAnchor markerRange.end
|
markerRange.end = @aceDoc.createAnchor markerRange.end
|
||||||
markerRange.id = @aceSession.addMarker markerRange, clazz, "text"
|
markerRange.id = @aceSession.addMarker markerRange, clazz, markerType
|
||||||
@markerRanges.push markerRange
|
@markerRanges.push markerRange
|
||||||
@aceSession.addGutterDecoration start.row, clazz if clazz is 'executing'
|
@aceSession.addGutterDecoration start.row, clazz if clazz is 'executing'
|
||||||
null
|
null
|
||||||
|
|
Loading…
Reference in a new issue