kopia lustrzana https://github.com/backface/turtlestitch
recategorize blocks from a deleted palette to "other"
rodzic
5bd3c2df7e
commit
1b0dc04942
23
src/gui.js
23
src/gui.js
|
@ -4956,16 +4956,26 @@ IDE_Morph.prototype.deleteUserCategory = function () {
|
|||
};
|
||||
|
||||
IDE_Morph.prototype.deletePaletteCategory = function (name) {
|
||||
var allCustomBlocks = this.stage.globalBlocks.slice();
|
||||
this.sprites.asArray().concat(this.stage).forEach(obj =>
|
||||
allCustomBlocks.push(...obj.customBlocks)
|
||||
);
|
||||
allCustomBlocks.forEach(def => {
|
||||
this.stage.globalBlocks.forEach(def =>{
|
||||
if (def.category === name) {
|
||||
def.category = 'other';
|
||||
// to do: refresh all block instances
|
||||
this.currentSprite.allBlockInstances(def).reverse().forEach(
|
||||
block => block.refresh()
|
||||
);
|
||||
}
|
||||
});
|
||||
this.sprites.asArray().concat(this.stage).forEach(obj => {
|
||||
obj.customBlocks.forEach(def => {
|
||||
if (def.category === name) {
|
||||
def.category = 'other';
|
||||
obj.allDependentInvocationsOf(
|
||||
def.blockSpec()
|
||||
).reverse().forEach(
|
||||
block => block.refresh(def)
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
SpriteMorph.prototype.customCategories.delete(name);
|
||||
this.createCategories();
|
||||
this.createPaletteHandle();
|
||||
|
@ -4973,6 +4983,7 @@ IDE_Morph.prototype.deletePaletteCategory = function (name) {
|
|||
this.flushPaletteCache();
|
||||
this.refreshPalette();
|
||||
this.fixLayout();
|
||||
this.recordUnsavedChanges();
|
||||
};
|
||||
|
||||
IDE_Morph.prototype.save = function () {
|
||||
|
|
Ładowanie…
Reference in New Issue