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
|
||||
@include box-sizing(border-box)
|
||||
margin-top: 40px
|
||||
width: 100%
|
||||
width: 98%
|
||||
height: 83%
|
||||
height: -webkit-calc(100% - 60px - 40px)
|
||||
height: calc(100% - 60px - 40px)
|
||||
|
@ -63,7 +63,7 @@
|
|||
.executing
|
||||
background-color: rgba(216, 255, 255, 0.85)
|
||||
.executed
|
||||
background-color: rgba(200, 200, 255, 0.25)
|
||||
background-color: rgba(245, 255, 6, 0.18)
|
||||
.problem-marker-info
|
||||
background-color: rgba(96, 63, 84, 0.25)
|
||||
.problem-marker-warning
|
||||
|
@ -79,7 +79,7 @@
|
|||
.ace_marker-layer
|
||||
.ace_bracket
|
||||
// Override faint gray
|
||||
border-color: #8FF
|
||||
border-color: #BFF
|
||||
|
||||
.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: ->
|
||||
super()
|
||||
@ace.on "mousemove", @onMouseMove
|
||||
#@ace.on "click", onClick # same ACE API as mousemove
|
||||
|
||||
setVariableStates: (@variableStates) ->
|
||||
@update()
|
||||
|
||||
onMouseMove: (e) =>
|
||||
pos = e.getDocumentPosition()
|
||||
endOfDoc = pos.row is @ace.getSession().getDocument().getLength() - 1
|
||||
it = new TokenIterator e.editor.session, pos.row, pos.column
|
||||
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())
|
||||
it.stepBackward()
|
||||
break unless token
|
||||
break if endOfDoc # Don't iterate backward on last line, since we might be way below.
|
||||
if isIdentifier token
|
||||
# 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.
|
||||
|
|
|
@ -446,21 +446,19 @@ module.exports = class SpellView extends View
|
|||
marked = {}
|
||||
lastExecuted = lastExecuted[0 .. @toolbarView.statementIndex] if @toolbarView?.statementIndex?
|
||||
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'
|
||||
if clazz is 'executed'
|
||||
key = state.range[0] + '_' + state.range[1]
|
||||
continue if marked[key] > 2 # don't allow more than three of the same marker
|
||||
marked[key] ?= 0
|
||||
++marked[key]
|
||||
continue if marked[start.row]
|
||||
marked[start.row] = true
|
||||
markerType = "fullLine"
|
||||
else
|
||||
@debugView.setVariableStates state.variables
|
||||
#console.log "at", state.userInfo.time, "vars are now:", state.variables
|
||||
[start, end] = [offsetToPos(state.range[0]), offsetToPos(state.range[1])]
|
||||
markerType = "text"
|
||||
markerRange = new Range(start.row, start.column, end.row, end.column)
|
||||
markerRange.start = @aceDoc.createAnchor markerRange.start
|
||||
markerRange.end = @aceDoc.createAnchor markerRange.end
|
||||
markerRange.id = @aceSession.addMarker markerRange, clazz, "text"
|
||||
markerRange.id = @aceSession.addMarker markerRange, clazz, markerType
|
||||
@markerRanges.push markerRange
|
||||
@aceSession.addGutterDecoration start.row, clazz if clazz is 'executing'
|
||||
null
|
||||
|
|
Loading…
Reference in a new issue