summaryrefslogtreecommitdiff
path: root/lists.js
diff options
context:
space:
mode:
authorJens Mönig <jens@moenig.org>2015-06-25 13:07:57 +0200
committerJens Mönig <jens@moenig.org>2015-06-25 13:07:57 +0200
commit2a28dca75342eeffb013e0e2fc00ce29561e97ee (patch)
tree9db5099e7540dd931e79a3aaf9083f5b4f70f85b /lists.js
parent3885ced35aee903f74d48c293bc3f0665a38dba5 (diff)
parentaef56afebf1504a9ce09ee5668d00c3c1df17565 (diff)
downloadsnap-2a28dca75342eeffb013e0e2fc00ce29561e97ee.tar.gz
snap-2a28dca75342eeffb013e0e2fc00ce29561e97ee.zip
Merge pull request #837 from nathan/optim
Optimizations
Diffstat (limited to 'lists.js')
-rw-r--r--lists.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/lists.js b/lists.js
index bd856fe..769b8b3 100644
--- a/lists.js
+++ b/lists.js
@@ -363,7 +363,7 @@ List.prototype.equalTo = function (other) {
// ListWatcherMorph inherits from BoxMorph:
-ListWatcherMorph.prototype = new BoxMorph();
+ListWatcherMorph.prototype = Object.create(BoxMorph.prototype);
ListWatcherMorph.prototype.constructor = ListWatcherMorph;
ListWatcherMorph.uber = BoxMorph.prototype;
@@ -388,6 +388,13 @@ ListWatcherMorph.prototype.init = function (list, parentCell) {
this.lastCell = null;
this.parentCell = parentCell || null; // for circularity detection
+ ListWatcherMorph.uber.init.call(
+ this,
+ SyntaxElementMorph.prototype.rounding,
+ 1.000001, // shadow bug in Chrome,
+ new Color(120, 120, 120)
+ );
+
// elements declarations
this.label = new StringMorph(
localize('length: ') + this.list.length(),
@@ -436,13 +443,6 @@ ListWatcherMorph.prototype.init = function (list, parentCell) {
this.plusButton.drawNew();
this.plusButton.fixLayout();
- ListWatcherMorph.uber.init.call(
- this,
- SyntaxElementMorph.prototype.rounding,
- 1.000001, // shadow bug in Chrome,
- new Color(120, 120, 120)
- );
-
this.color = new Color(220, 220, 220);
this.isDraggable = true;
this.setExtent(new Point(80, 70).multiplyBy(
@@ -634,6 +634,7 @@ ListWatcherMorph.prototype.setStartIndex = function (index) {
};
ListWatcherMorph.prototype.fixLayout = function () {
+ if (!this.label) return;
Morph.prototype.trackChanges = false;
if (this.frame) {
this.arrangeCells();