diff options
| author | jmoenig <jens@moenig.org> | 2013-03-19 08:12:57 +0100 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2013-03-19 08:12:57 +0100 |
| commit | cbdc6df58619742317fb35afaa4b60df5dd940fe (patch) | |
| tree | 54f0d8154cb6fa154ddab062ca2f9f2298126b23 | |
| parent | a4241f1a53fc6bce57ae22b5a351b08bbbe88e43 (diff) | |
| download | snap-cbdc6df58619742317fb35afaa4b60df5dd940fe.tar.gz snap-cbdc6df58619742317fb35afaa4b60df5dd940fe.zip | |
Blocks layout optimization
SyntaxElementMorph fixLayout() optimization for active highlights
| -rw-r--r-- | blocks.js | 28 | ||||
| -rwxr-xr-x | history.txt | 6 |
2 files changed, 18 insertions, 16 deletions
@@ -153,7 +153,7 @@ DialogBoxMorph, BlockInputFragmentMorph, PrototypeHatBlockMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2013-March-18'; +modules.blocks = '2013-March-19'; var SyntaxElementMorph; var BlockMorph; @@ -1151,8 +1151,6 @@ SyntaxElementMorph.prototype.fixLayout = function () { space = this.isPrototype ? 1 : Math.floor(fontHeight(this.fontSize) / 3), bottomCorrection, - needsHighlight = false, - top = this.topBlock(), initialExtent = this.extent(); if ((this instanceof MultiArgMorph) && (this.slotSpec !== '%c')) { @@ -1183,11 +1181,9 @@ SyntaxElementMorph.prototype.fixLayout = function () { lines.push([part]); } } else if (part instanceof BlockHighlightMorph) { - if (!(myself.parent.topBlock)) { // I am on top - needsHighlight = true; - } - myself.fullChanged(); - myself.removeChild(part); + nop(); // should be redundant now + // myself.fullChanged(); + // myself.removeChild(part); } else { if (part.isVisible) { x += part.fullBounds().width() + space; @@ -1363,24 +1359,26 @@ SyntaxElementMorph.prototype.fixLayout = function () { affected.fixLayout(); } } + if (affected) { + return; + } } else if (this instanceof ReporterBlockMorph) { if (this.parent) { if (this.parent.fixLayout) { - this.parent.fixLayout(); + return this.parent.fixLayout(); } } } - // fix highlights, if any + this.fixHighlight(); +}; + +SyntaxElementMorph.prototype.fixHighlight = function () { + var top = this.topBlock(); if (top.getHighlight && top.getHighlight()) { top.removeHighlight(); top.addHighlight(); } - - // restore highlight: - if (needsHighlight) { - this.addHighlight(); - } }; // SyntaxElementMorph evaluating: diff --git a/history.txt b/history.txt index c094146..75da99d 100755 --- a/history.txt +++ b/history.txt @@ -1529,4 +1529,8 @@ ______ * GUI, Blocks, BYOB, Widgets: Scaling Blocks and Scripts (shift-click on settings menu) * Widets: numerical prompts * GUI: #signup URL switch -* Blocks: adjusting highlights when modifying active scripts
\ No newline at end of file +* Blocks: adjusting highlights when modifying active scripts + +130319 +------ +* Blocks: SyntaxElementMorph fixLayout optimization for active highlights
\ No newline at end of file |
