kopia lustrzana https://github.com/backface/turtlestitch
optimized bulk hiding & showing palette blocks
rodzic
98703c5bb8
commit
9acc2010b4
|
@ -41,7 +41,8 @@
|
|||
### 2021-10-07
|
||||
* objects, byob: new BlockVisibilityDialogMorph for bulk-selecting blocks to hide / show in the palette
|
||||
* ojects: simplified palette context menu
|
||||
* blocks: removed "hide" option from context menu of primitive blocks in the palette
|
||||
* blocks: removed "hide" option from context menu of primitive blocks in the palette
|
||||
* objects, byob: optimized bulk hiding & showing palette blocks
|
||||
|
||||
### 2021-10-06
|
||||
* threads: programmatically hide individual variables in palette
|
||||
|
|
|
@ -4584,13 +4584,14 @@ BlockVisibilityDialogMorph.prototype.hideBlocks = function () {
|
|||
var ide = this.target.parentThatIsA(IDE_Morph);
|
||||
this.blocks.forEach(block => this.target.changeBlockVisibility(
|
||||
block,
|
||||
contains(this.selection, block))
|
||||
);
|
||||
contains(this.selection, block),
|
||||
true // quick - without palette update
|
||||
));
|
||||
if (this.selection.length === 0) {
|
||||
StageMorph.prototype.hiddenPrimitives = [];
|
||||
ide.flushBlocksCache();
|
||||
ide.refreshPalette();
|
||||
}
|
||||
ide.flushBlocksCache();
|
||||
ide.refreshPalette();
|
||||
};
|
||||
|
||||
// BlockVisibilityDialogMorph layout
|
||||
|
|
|
@ -3175,28 +3175,22 @@ SpriteMorph.prototype.isHidingBlock = function (aBlock) {
|
|||
return StageMorph.prototype.hiddenPrimitives[aBlock.selector] === true;
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.changeBlockVisibility = function (aBlock, hideIt) {
|
||||
SpriteMorph.prototype.changeBlockVisibility = function (aBlock, hideIt, quick) {
|
||||
var ide, dict, cat;
|
||||
if (aBlock.isCustomBlock) {
|
||||
this.changeCustomBlockVisibility(aBlock, hideIt);
|
||||
(aBlock.isGlobal ? aBlock.definition
|
||||
: this.getLocalMethod(aBlock.semanticSpec)
|
||||
).isHelper = !!hideIt;
|
||||
} else if (aBlock.selector === 'reportGetVar') {
|
||||
this.changeVarBlockVisibility(aBlock.blockSpec, hideIt);
|
||||
this.variables.find(name).vars[name].isHidden = !!hideIt;
|
||||
} else {
|
||||
this.changePrimitiveVisibility(aBlock, hideIt);
|
||||
}
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.changePrimitiveVisibility = function (aBlock, hideIt) {
|
||||
var ide = this.parentThatIsA(IDE_Morph),
|
||||
dict,
|
||||
cat;
|
||||
if (!ide || (aBlock.selector === 'evaluateCustomBlock')) {
|
||||
return;
|
||||
}
|
||||
if (hideIt) {
|
||||
StageMorph.prototype.hiddenPrimitives[aBlock.selector] = true;
|
||||
} else {
|
||||
delete StageMorph.prototype.hiddenPrimitives[aBlock.selector];
|
||||
if (hideIt) {
|
||||
StageMorph.prototype.hiddenPrimitives[aBlock.selector] = true;
|
||||
} else {
|
||||
delete StageMorph.prototype.hiddenPrimitives[aBlock.selector];
|
||||
}
|
||||
}
|
||||
if (quick) {return; }
|
||||
dict = {
|
||||
doWarp: 'control',
|
||||
reifyScript: 'operators',
|
||||
|
@ -3210,25 +3204,6 @@ SpriteMorph.prototype.changePrimitiveVisibility = function (aBlock, hideIt) {
|
|||
ide.refreshPalette();
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.changeCustomBlockVisibility = function (aBlock, hideIt) {
|
||||
var ide = this.parentThatIsA(IDE_Morph),
|
||||
method = aBlock.isGlobal ? aBlock.definition
|
||||
: this.getLocalMethod(aBlock.semanticSpec);
|
||||
if (!ide || !method || (aBlock.selector !== 'evaluateCustomBlock')) {
|
||||
return;
|
||||
}
|
||||
method.isHelper = !!hideIt; // force type to be Boolean
|
||||
ide.flushBlocksCache(aBlock.category);
|
||||
ide.refreshPalette();
|
||||
};
|
||||
|
||||
SpriteMorph.prototype.changeVarBlockVisibility = function (name, hideIt) {
|
||||
var ide = this.parentThatIsA(IDE_Morph);
|
||||
this.variables.find(name).vars[name].isHidden = !!hideIt;
|
||||
ide.flushBlocksCache('variables');
|
||||
ide.refreshPalette();
|
||||
};
|
||||
|
||||
// SpriteMorph blocks searching
|
||||
|
||||
SpriteMorph.prototype.blocksMatching = function (
|
||||
|
|
Ładowanie…
Reference in New Issue