kopia lustrzana https://github.com/backface/turtlestitch
migrated list watcher basics
rodzic
1f706d2363
commit
0a8d63fde3
14
src/lists.js
14
src/lists.js
|
@ -62,7 +62,7 @@ CellMorph, ArrowMorph, MenuMorph, snapEquals, Morph, isNil, localize, isString,
|
||||||
MorphicPreferences, TableDialogMorph, SpriteBubbleMorph, SpeechBubbleMorph,
|
MorphicPreferences, TableDialogMorph, SpriteBubbleMorph, SpeechBubbleMorph,
|
||||||
TableFrameMorph, TableMorph, Variable, isSnapObject, Costume, contains*/
|
TableFrameMorph, TableMorph, Variable, isSnapObject, Costume, contains*/
|
||||||
|
|
||||||
modules.lists = '2019-December-08';
|
modules.lists = '2020-March-13';
|
||||||
|
|
||||||
var List;
|
var List;
|
||||||
var ListWatcherMorph;
|
var ListWatcherMorph;
|
||||||
|
@ -659,7 +659,6 @@ ListWatcherMorph.prototype.init = function (list, parentCell) {
|
||||||
this.plusButton.padding = 0;
|
this.plusButton.padding = 0;
|
||||||
this.plusButton.edge = 0;
|
this.plusButton.edge = 0;
|
||||||
this.plusButton.outlineColor = this.color;
|
this.plusButton.outlineColor = this.color;
|
||||||
this.plusButton.drawNew();
|
|
||||||
this.plusButton.fixLayout();
|
this.plusButton.fixLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,7 +680,7 @@ ListWatcherMorph.prototype.init = function (list, parentCell) {
|
||||||
this.add(this.plusButton);
|
this.add(this.plusButton);
|
||||||
}
|
}
|
||||||
this.add(this.handle);
|
this.add(this.handle);
|
||||||
this.handle.drawNew();
|
this.handle.fixLayout();
|
||||||
this.update();
|
this.update();
|
||||||
this.fixLayout();
|
this.fixLayout();
|
||||||
};
|
};
|
||||||
|
@ -804,7 +803,6 @@ ListWatcherMorph.prototype.update = function (anyway) {
|
||||||
button.edge = 0;
|
button.edge = 0;
|
||||||
button.corner = 1;
|
button.corner = 1;
|
||||||
button.outlineColor = this.color.darker();
|
button.outlineColor = this.color.darker();
|
||||||
button.drawNew();
|
|
||||||
button.fixLayout();
|
button.fixLayout();
|
||||||
|
|
||||||
this.frame.contents.add(cell);
|
this.frame.contents.add(cell);
|
||||||
|
@ -836,7 +834,6 @@ ListWatcherMorph.prototype.updateLength = function (notDone) {
|
||||||
} else {
|
} else {
|
||||||
this.label.color = new Color(0, 0, 0);
|
this.label.color = new Color(0, 0, 0);
|
||||||
}
|
}
|
||||||
this.label.drawNew();
|
|
||||||
this.label.setCenter(this.center());
|
this.label.setCenter(this.center());
|
||||||
this.label.setBottom(this.bottom() - 3);
|
this.label.setBottom(this.bottom() - 3);
|
||||||
};
|
};
|
||||||
|
@ -866,15 +863,14 @@ ListWatcherMorph.prototype.setStartIndex = function (index) {
|
||||||
|
|
||||||
ListWatcherMorph.prototype.fixLayout = function () {
|
ListWatcherMorph.prototype.fixLayout = function () {
|
||||||
if (!this.label) {return; }
|
if (!this.label) {return; }
|
||||||
Morph.prototype.trackChanges = false;
|
|
||||||
if (this.frame) {
|
if (this.frame) {
|
||||||
this.arrangeCells();
|
this.arrangeCells();
|
||||||
this.frame.silentSetPosition(this.position().add(3));
|
this.frame.setPosition(this.position().add(3));
|
||||||
this.frame.bounds.corner = this.bounds.corner.subtract(new Point(
|
this.frame.bounds.corner = this.bounds.corner.subtract(new Point(
|
||||||
3,
|
3,
|
||||||
17
|
17
|
||||||
));
|
));
|
||||||
this.frame.drawNew();
|
this.frame.fixLayout();
|
||||||
this.frame.contents.adjustBounds();
|
this.frame.contents.adjustBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -884,8 +880,6 @@ ListWatcherMorph.prototype.fixLayout = function () {
|
||||||
this.plusButton.setLeft(this.left() + 3);
|
this.plusButton.setLeft(this.left() + 3);
|
||||||
this.plusButton.setBottom(this.bottom() - 3);
|
this.plusButton.setBottom(this.bottom() - 3);
|
||||||
}
|
}
|
||||||
Morph.prototype.trackChanges = true;
|
|
||||||
this.changed();
|
|
||||||
|
|
||||||
if (this.parent && this.parent.fixLayout) {
|
if (this.parent && this.parent.fixLayout) {
|
||||||
this.parent.fixLayout();
|
this.parent.fixLayout();
|
||||||
|
|
Ładowanie…
Reference in New Issue