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:
parent
788562f2ea
commit
17ba4bc8a7
4 changed files with 18 additions and 7 deletions
app
|
@ -65,6 +65,8 @@ module.exports = class Mark extends CocoClass
|
||||||
buildBounds: ->
|
buildBounds: ->
|
||||||
@mark = new createjs.Container()
|
@mark = new createjs.Container()
|
||||||
@mark.mouseChildren = false
|
@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
|
# Confusingly make some semi-random colors that'll be consistent based on the drawsBoundsIndex
|
||||||
@drawsBoundsIndex = @sprite.thang.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)"
|
color = "rgba(#{colors[0]}, #{colors[1]}, #{colors[2]}, 0.5)"
|
||||||
[w, h] = [@sprite.thang.width * Camera.PPM, @sprite.thang.height * Camera.PPM * @camera.y2x]
|
[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()
|
@drawsBoundsBorderShape = shape = new createjs.Shape()
|
||||||
shape.graphics.setStrokeStyle 5
|
shape.graphics.setStrokeStyle 5
|
||||||
shape.graphics.beginStroke color
|
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')
|
shape.graphics.beginFill color.replace('0.5', '0.25')
|
||||||
else
|
else
|
||||||
shape.graphics.beginFill color
|
shape.graphics.beginFill color
|
||||||
|
@ -88,13 +90,13 @@ module.exports = class Mark extends CocoClass
|
||||||
shape.graphics.endFill()
|
shape.graphics.endFill()
|
||||||
@mark.addChild shape
|
@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 = new createjs.Text '' + @drawsBoundsIndex, '20px Arial', color.replace('0.5', '1')
|
||||||
text.regX = text.getMeasuredWidth() / 2
|
text.regX = text.getMeasuredWidth() / 2
|
||||||
text.regY = text.getMeasuredHeight() / 2
|
text.regY = text.getMeasuredHeight() / 2
|
||||||
text.shadow = new createjs.Shadow('#000000', 1, 1, 0)
|
text.shadow = new createjs.Shadow('#000000', 1, 1, 0)
|
||||||
@mark.addChild text
|
@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
|
return if @sprite.thang.world.age is 0
|
||||||
letter = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[@drawsBoundsIndex % 26]
|
letter = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[@drawsBoundsIndex % 26]
|
||||||
text = new createjs.Text letter, '14px Arial', '#333333' # color.replace('0.5', '1')
|
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
|
text.y = -h / 2 + 2
|
||||||
@mark.addChild text
|
@mark.addChild text
|
||||||
else
|
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
|
@mark.cache -w / 2, -h / 2, w, h, 2
|
||||||
@lastWidth = @sprite.thang.width
|
@lastWidth = @sprite.thang.width
|
||||||
@lastHeight = @sprite.thang.height
|
@lastHeight = @sprite.thang.height
|
||||||
|
@ -130,7 +132,7 @@ module.exports = class Mark extends CocoClass
|
||||||
@mark.regX = width / 2
|
@mark.regX = width / 2
|
||||||
@mark.regY = height / 2
|
@mark.regY = height / 2
|
||||||
@mark.layerIndex = 10
|
@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) ->
|
buildRadius: (range) ->
|
||||||
alpha = 0.15
|
alpha = 0.15
|
||||||
|
|
|
@ -23,6 +23,7 @@ PropertyDocumentationSchema = c.object {
|
||||||
required: ['name', 'type', 'description']
|
required: ['name', 'type', 'description']
|
||||||
},
|
},
|
||||||
name: {type: 'string', title: 'Name', description: 'Name of the property.'}
|
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...
|
# not actual JS types, just whatever they describe...
|
||||||
type: c.shortString(title: 'Type', description: 'Intended type of the property.')
|
type: c.shortString(title: 'Type', description: 'Intended type of the property.')
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -210,6 +210,12 @@ class CodeLanguagesObjectTreema extends TreemaNode.nodeMap.object
|
||||||
childPropertiesAvailable: ->
|
childPropertiesAvailable: ->
|
||||||
(key for key in _.keys(codeLanguages) when not @data[key]?)
|
(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
|
class CodeTreema extends TreemaNode.nodeMap.ace
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super(arguments...)
|
super(arguments...)
|
||||||
|
@ -412,6 +418,7 @@ module.exports.setup = ->
|
||||||
TreemaNode.setNodeSubclass('version', VersionTreema)
|
TreemaNode.setNodeSubclass('version', VersionTreema)
|
||||||
TreemaNode.setNodeSubclass('markdown', LiveEditingMarkup)
|
TreemaNode.setNodeSubclass('markdown', LiveEditingMarkup)
|
||||||
TreemaNode.setNodeSubclass('code-languages-object', CodeLanguagesObjectTreema)
|
TreemaNode.setNodeSubclass('code-languages-object', CodeLanguagesObjectTreema)
|
||||||
|
TreemaNode.setNodeSubclass('code-language', CodeLanguageTreema)
|
||||||
TreemaNode.setNodeSubclass('code', CodeTreema)
|
TreemaNode.setNodeSubclass('code', CodeTreema)
|
||||||
TreemaNode.setNodeSubclass('coffee', CoffeeTreema)
|
TreemaNode.setNodeSubclass('coffee', CoffeeTreema)
|
||||||
TreemaNode.setNodeSubclass('javascript', JavaScriptTreema)
|
TreemaNode.setNodeSubclass('javascript', JavaScriptTreema)
|
||||||
|
|
|
@ -599,6 +599,7 @@ module.exports = class SpellView extends View
|
||||||
null
|
null
|
||||||
|
|
||||||
highlightComments: ->
|
highlightComments: ->
|
||||||
|
return # Slightly buggy and not that great, so let's not do it.
|
||||||
lines = $(@ace.container).find('.ace_text-layer .ace_line_group')
|
lines = $(@ace.container).find('.ace_text-layer .ace_line_group')
|
||||||
session = @aceSession
|
session = @aceSession
|
||||||
top = Math.floor @ace.renderer.getScrollTopRow()
|
top = Math.floor @ace.renderer.getScrollTopRow()
|
||||||
|
|
Reference in a new issue