diff options
| author | jmoenig <jens@moenig.org> | 2013-04-23 16:55:11 +0200 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2013-04-23 16:55:11 +0200 |
| commit | d098dbb4ba80b5fd10deba3a0085f68a95e05b79 (patch) | |
| tree | 35c6f7b681c95a48577508c17e96ac06810c48da /lists.js | |
| parent | 020f95992d6e452751199ec18ab066fe2cf9d78c (diff) | |
| download | snap-d098dbb4ba80b5fd10deba3a0085f68a95e05b79.tar.gz snap-d098dbb4ba80b5fd10deba3a0085f68a95e05b79.zip | |
Fixed #44
Circularity no longer breaks watchers
Diffstat (limited to 'lists.js')
| -rw-r--r-- | lists.js | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -61,7 +61,7 @@ PushButtonMorph, SyntaxElementMorph, Color, Point, WatcherMorph, StringMorph, SpriteMorph, ScrollFrameMorph, CellMorph, ArrowMorph, MenuMorph, snapEquals, Morph, isNil, localize*/ -modules.lists = '2013-April-12'; +modules.lists = '2013-April-23'; var List; var ListWatcherMorph; @@ -345,11 +345,11 @@ ListWatcherMorph.prototype.cellColor = // ListWatcherMorph instance creation: -function ListWatcherMorph(list) { - this.init(list); +function ListWatcherMorph(list, parentCell) { + this.init(list, parentCell); } -ListWatcherMorph.prototype.init = function (list) { +ListWatcherMorph.prototype.init = function (list, parentCell) { var myself = this; this.list = list || new List(); @@ -357,6 +357,7 @@ ListWatcherMorph.prototype.init = function (list) { this.range = 100; this.lastUpdated = Date.now(); this.lastCell = null; + this.parentCell = parentCell || null; // for circularity detection // elements declarations this.label = new StringMorph( @@ -434,6 +435,7 @@ ListWatcherMorph.prototype.update = function (anyway) { starttime, maxtime = 1000; this.frame.contents.children.forEach(function (m) { + if (m instanceof CellMorph && m.contentsMorph instanceof ListWatcherMorph) { m.contentsMorph.update(); @@ -529,7 +531,8 @@ ListWatcherMorph.prototype.update = function (anyway) { cell = new CellMorph( this.list.at(idx), this.cellColor, - idx + idx, + this.parentCell ); button = new PushButtonMorph( this.list.remove, |
