update palette when switching to a new scene / loading a new project

snap7
jmoenig 2021-07-16 15:28:26 +02:00
rodzic a3d0d9100e
commit 9379ba833c
2 zmienionych plików z 9 dodań i 2 usunięć

Wyświetl plik

@ -35,6 +35,7 @@
* byob: rearranged internal order of categories
* objects: fixed overlapping blocks bug in unified palette
* store, gui: fixed capturing global settings for serializing scenes
* gui: update palette when switching to a new scene / loading a new project
### 2021-07-15
* gui: made sprite-bar height independent of the number of categories

Wyświetl plik

@ -5637,7 +5637,10 @@ IDE_Morph.prototype.switchToScene = function (scene, refreshAlbum) {
}
});
scene.applyGlobalSettings();
this.setUnifiedPalette(scene.unifiedPalette);
if (!this.setUnifiedPalette(scene.unifiedPalette)) {
this.flushBlocksCache();
this.refreshPalette(true);
}
this.world().keyboardFocus = this.stage;
};
@ -6082,10 +6085,12 @@ IDE_Morph.prototype.toggleUnifiedPalette = function () {
};
IDE_Morph.prototype.setUnifiedPalette = function (bool) {
// answer true or false indicating whether the palette
// has already been refreshed by this operation
if (this.scene.unifiedPalette === bool &&
(bool === (this.currentCategory === 'unified'))
) {
return;
return false;
}
this.scene.unifiedPalette = bool;
this.currentCategory = bool ? 'unified' : 'motion';
@ -6096,6 +6101,7 @@ IDE_Morph.prototype.setUnifiedPalette = function (bool) {
this.flushBlocksCache();
this.currentSprite.palette(this.currentCategory);
this.refreshPalette(true);
return true;
};
IDE_Morph.prototype.setPaletteWidth = function (newWidth) {