Starting to limit some property documentation to specific code languages. Fixed Criss-Cross squares on frame 0. Removed comment box highlighting from the gutter.

This commit is contained in:
Nick Winter 2014-07-11 18:07:00 -07:00
parent 788562f2ea
commit 17ba4bc8a7
4 changed files with 18 additions and 7 deletions
app
lib/surface
schemas/models
treema-ext.coffee
views/play/level/tome

View file

@ -65,6 +65,8 @@ module.exports = class Mark extends CocoClass
buildBounds: ->
@mark = new createjs.Container()
@mark.mouseChildren = false
style = @sprite.thang.drawsBoundsStyle
return if style is 'corner-text' and @sprite.thang.world.age is 0
# Confusingly make some semi-random colors that'll be consistent based on the drawsBoundsIndex
@drawsBoundsIndex = @sprite.thang.drawsBoundsIndex
@ -72,11 +74,11 @@ module.exports = class Mark extends CocoClass
color = "rgba(#{colors[0]}, #{colors[1]}, #{colors[2]}, 0.5)"
[w, h] = [@sprite.thang.width * Camera.PPM, @sprite.thang.height * Camera.PPM * @camera.y2x]
if @sprite.thang.drawsBoundsStyle in ['border-text', 'corner-text']
if style in ['border-text', 'corner-text']
@drawsBoundsBorderShape = shape = new createjs.Shape()
shape.graphics.setStrokeStyle 5
shape.graphics.beginStroke color
if @sprite.thang.drawsBoundsStyle is 'border-text'
if style is 'border-text'
shape.graphics.beginFill color.replace('0.5', '0.25')
else
shape.graphics.beginFill color
@ -88,13 +90,13 @@ module.exports = class Mark extends CocoClass
shape.graphics.endFill()
@mark.addChild shape
if @sprite.thang.drawsBoundsStyle is 'border-text'
if style is 'border-text'
text = new createjs.Text '' + @drawsBoundsIndex, '20px Arial', color.replace('0.5', '1')
text.regX = text.getMeasuredWidth() / 2
text.regY = text.getMeasuredHeight() / 2
text.shadow = new createjs.Shadow('#000000', 1, 1, 0)
@mark.addChild text
else if @sprite.thang.drawsBoundsStyle is 'corner-text'
else if style is 'corner-text'
return if @sprite.thang.world.age is 0
letter = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[@drawsBoundsIndex % 26]
text = new createjs.Text letter, '14px Arial', '#333333' # color.replace('0.5', '1')
@ -102,9 +104,9 @@ module.exports = class Mark extends CocoClass
text.y = -h / 2 + 2
@mark.addChild text
else
console.warn @sprite.thang.id, 'didn\'t know how to draw bounds style:', @sprite.thang.drawsBoundsStyle
console.warn @sprite.thang.id, 'didn\'t know how to draw bounds style:', style
if w > 0 and h > 0 and @sprite.thang.drawsBoundsStyle is 'border-text'
if w > 0 and h > 0 and style is 'border-text'
@mark.cache -w / 2, -h / 2, w, h, 2
@lastWidth = @sprite.thang.width
@lastHeight = @sprite.thang.height
@ -130,7 +132,7 @@ module.exports = class Mark extends CocoClass
@mark.regX = width / 2
@mark.regY = height / 2
@mark.layerIndex = 10
@mark.cache -1, 0, width+2, height # not actually faster than simple ellipse draw
@mark.cache -1, -1, width + 2, height + 2 # not actually faster than simple ellipse draw
buildRadius: (range) ->
alpha = 0.15

View file

@ -23,6 +23,7 @@ PropertyDocumentationSchema = c.object {
required: ['name', 'type', 'description']
},
name: {type: 'string', title: 'Name', description: 'Name of the property.'}
codeLanguages: c.array {title: 'Specific Code Languages', description: 'If present, then only the languages specified will show this documentation. Leave unset for language-independent documentation.', format: 'code-languages-array'}, c.shortString(title: 'Code Language', description: 'A specific code language to show this documentation for.', format: 'code-language')
# not actual JS types, just whatever they describe...
type: c.shortString(title: 'Type', description: 'Intended type of the property.')
description:

View file

@ -210,6 +210,12 @@ class CodeLanguagesObjectTreema extends TreemaNode.nodeMap.object
childPropertiesAvailable: ->
(key for key in _.keys(codeLanguages) when not @data[key]?)
class CodeLanguageTreema extends TreemaNode.nodeMap.string
buildValueForEditing: (valEl) ->
super(valEl)
valEl.find('input').autocomplete(source: _.keys(codeLanguages), minLength: 0, delay: 0, autoFocus: true)
valEl
class CodeTreema extends TreemaNode.nodeMap.ace
constructor: ->
super(arguments...)
@ -412,6 +418,7 @@ module.exports.setup = ->
TreemaNode.setNodeSubclass('version', VersionTreema)
TreemaNode.setNodeSubclass('markdown', LiveEditingMarkup)
TreemaNode.setNodeSubclass('code-languages-object', CodeLanguagesObjectTreema)
TreemaNode.setNodeSubclass('code-language', CodeLanguageTreema)
TreemaNode.setNodeSubclass('code', CodeTreema)
TreemaNode.setNodeSubclass('coffee', CoffeeTreema)
TreemaNode.setNodeSubclass('javascript', JavaScriptTreema)

View file

@ -599,6 +599,7 @@ module.exports = class SpellView extends View
null
highlightComments: ->
return # Slightly buggy and not that great, so let's not do it.
lines = $(@ace.container).find('.ace_text-layer .ace_line_group')
session = @aceSession
top = Math.floor @ace.renderer.getScrollTopRow()