support various data types inside menus (sprites, costumes, blocks)

snap8
Jens Mönig 2022-03-31 16:21:03 +02:00
rodzic 12a2739cc1
commit ce391a48b0
2 zmienionych plików z 13 dodań i 6 usunięć

Wyświetl plik

@ -29,6 +29,7 @@
### 2022-03-31
* threads, objects: new menu functionality for ASK command, when passing a list
* objects: support various data types inside menus (sprites, costumes, blocks)
### 2022-03-28
* new "Tad" turtle costumes, thanks, Meghan and Brian!

Wyświetl plik

@ -12883,7 +12883,7 @@ StagePickerMorph.prototype.init = function (options) {
this.addLine();
} else {
this.addItem(
this.dataRepresentation(key),
key,
value,
null, // hint
null, // color
@ -12913,10 +12913,16 @@ StagePickerMorph.prototype.isSubmenu = function (options) {
StagePickerMorph.prototype.dataRepresentation = function (data) {
switch (Process.prototype.reportTypeOf(data)) {
case 'number':
return data.toString();
case 'costume':
case 'sprite':
case 'stage':
return data.thumbnail(new Point(40, 40).multiplyBy(this.scale));
case 'command':
case 'reporter':
case 'predicate':
return data.image();
default:
return data;
return data.toString();
}
};
@ -12949,7 +12955,7 @@ StagePickerMorph.prototype.createLabel = function () {
this.label.destroy();
}
text = new TextMorph(
localize(this.title),
this.title,
SpriteMorph.prototype.bubbleFontSize * this.scale,
null, // MorphicPreferences.menuFontName,
true,
@ -13040,7 +13046,7 @@ StagePickerMorph.prototype.createItems = function (scale) {
item = new StagePickerItemMorph(
this.target,
tuple[1],
tuple[0],
this.dataRepresentation(tuple[0]),
SpriteMorph.prototype.bubbleFontSize * this.scale,
null, // MorphicPreferences.menuFontName,
this.environment,