tweaked unified palette formatting for hidden categories

snap7
jmoenig 2021-10-12 17:01:25 +02:00
rodzic e6aabeb1e8
commit aa31916165
2 zmienionych plików z 11 dodań i 3 usunięć

Wyświetl plik

@ -45,6 +45,7 @@
* gui, scenes, objects: added scene-setting to hide/show category names in the unified palette
* store: made "hide/show categories in unified palette" setting persistent
* byob: hide unused blocks in palette
* objects: tweaked unified palette formatting for hidden categories
### 2021-10-11
* objects: sort order of blocks in custom categories alphabetically in the unified palette

Wyświetl plik

@ -3079,7 +3079,7 @@ SpriteMorph.prototype.freshPalette = function (category) {
showCategories = this.parentThatIsA(IDE_Morph).scene.showCategories;
blocks = SpriteMorph.prototype.allCategories().reduce(
(blocks, category) => {
let header = [this.categoryText(category), '-' ],
let header = [this.categoryText(category), '-'],
primitives = this.getPrimitiveTemplates(category),
customs = this.customBlockTemplatesForCategory(category),
showHeader = showCategories &&
@ -3087,10 +3087,17 @@ SpriteMorph.prototype.freshPalette = function (category) {
(primitives.some(item =>
item instanceof BlockMorph) || customs.length);
if (!showCategories && category !== 'variables') {
primitives = primitives.filter(each =>
each !== '-' && each !== '=');
}
return blocks.concat(
showHeader ? header : [],
primitives, '=',
customs, '='
primitives,
showHeader ? '=' : null,
customs,
showHeader ? '=' : '-'
);
},
[]