enable toggling between list- and table view inside a watcher cell

pull/95/head
jmoenig 2020-04-12 16:31:11 +02:00
rodzic c04d692cb4
commit 9fa9ec2146
2 zmienionych plików z 12 dodań i 4 usunięć

Wyświetl plik

@ -62,7 +62,7 @@ CellMorph, ArrowMorph, MenuMorph, snapEquals, Morph, isNil, localize, isString,
MorphicPreferences, TableDialogMorph, SpriteBubbleMorph, SpeechBubbleMorph,
TableFrameMorph, TableMorph, Variable, isSnapObject, Costume, contains*/
modules.lists = '2020-April-11';
modules.lists = '2020-April-12';
var List;
var ListWatcherMorph;
@ -958,7 +958,11 @@ ListWatcherMorph.prototype.showTableView = function () {
view.contents = new TableFrameMorph(new TableMorph(this.list, 10));
view.contents.expand(this.extent());
} else { // watcher cell
view.drawNew(true, 'table');
view.changed();
view.contentsMorph.destroy();
view.contentsMorph = new TableFrameMorph(new TableMorph(this.list, 10));
view.add(view.contentsMorph);
view.contentsMorph.setPosition(this.position());
view.contentsMorph.expand(this.extent());
}
view.fixLayout();

Wyświetl plik

@ -70,7 +70,7 @@ SpriteMorph, Context, Costume, BlockEditorMorph, SymbolMorph, List,
SyntaxElementMorph, MenuMorph, SpriteBubbleMorph, SpeechBubbleMorph, Sound,
CellMorph, ListWatcherMorph, isNil, BoxMorph, Variable, isSnapObject*/
modules.tables = '2020-April-11';
modules.tables = '2020-April-12';
var Table;
var TableCellMorph;
@ -1089,7 +1089,11 @@ TableMorph.prototype.showListView = function () {
view.contents.step = view.contents.update;
view.contents.expand(this.extent());
} else { // watcher cell
view.drawNew(true);
view.changed();
view.contentsMorph.destroy();
view.contentsMorph = new ListWatcherMorph(this.table);
view.add(view.contentsMorph);
view.contentsMorph.setPosition(this.position());
view.contentsMorph.expand(this.extent());
}
view.fixLayout();