added method to check whether an arbitrary block is hidden in the palette

snap7
jmoenig 2021-10-06 19:24:08 +02:00
rodzic 13590e4b91
commit 4e80d7cb0c
2 zmienionych plików z 16 dodań i 0 usunięć

Wyświetl plik

@ -43,6 +43,7 @@
* threads: keep hidden variables out of the palette and drop-down menus
* objects: added utilities to enumerate all palette blocks for hiding & showing
* objects, threads, extensions: refactored block hiding methods
* objects: added method to check whether an arbitrary block is hidden in the palette
### 2021-10-05
* threads, store: added infrastructure for hiding individual variables in palette

Wyświetl plik

@ -3248,6 +3248,19 @@ SpriteMorph.prototype.allPaletteBlocks = function () {
return blocks.filter(each => each instanceof BlockMorph);
};
SpriteMorph.prototype.isHidingBlock = function (aBlock) {
if (aBlock.isCustomBlock) {
return (
aBlock.isGlobal ? aBlock.definition
: this.getLocalMethod(aBlock.semanticSpec)
).isHelper;
}
if (aBlock.selector === 'reportGetVar') {
return this.variables.find(name).vars[aBlock.blockSpec].isHidden;
}
return StageMorph.prototype.hiddenPrimitives[aBlock.selector] === true;
};
SpriteMorph.prototype.changeBlockVisibility = function (aBlock, hideIt) {
if (aBlock.isCustomBlock) {
this.changeCustomBlockVisibility(aBlock, hideIt);
@ -9394,6 +9407,8 @@ StageMorph.prototype.searchBlocks = SpriteMorph.prototype.searchBlocks;
StageMorph.prototype.allPaletteBlocks
= SpriteMorph.prototype.allPaletteBlocks;
StageMorph.prototype.isHidingBlock = SpriteMorph.prototype.isHidingBlock;
StageMorph.prototype.changeBlockVisibility
= SpriteMorph.prototype.changeBlockVisibility;