save block-transparency in settings

pull/95/head
jmoenig 2020-07-22 15:56:02 +02:00
rodzic d2247c364b
commit 850dbe7618
2 zmienionych plików z 17 dodań i 3 usunięć

Wyświetl plik

@ -4,7 +4,8 @@
### 2020-07-22
* morphic, blocks, gui: tweaked block-fading mouse-over
* blocks, threads: tweaked context visualizations to be alpha-independent
* blocks, threads: tweaked context visualizations to be alpha-independent
* gui: save block-transparency in settings
### 2020-07-21
* blocks: tweaked block highlights for fade-out

Wyświetl plik

@ -2395,6 +2395,7 @@ IDE_Morph.prototype.refreshIDE = function () {
IDE_Morph.prototype.applySavedSettings = function () {
var design = this.getSetting('design'),
zoom = this.getSetting('zoom'),
fade = this.getSetting('fade'),
language = this.getSetting('language'),
click = this.getSetting('click'),
longform = this.getSetting('longform'),
@ -2419,6 +2420,11 @@ IDE_Morph.prototype.applySavedSettings = function () {
SpriteMorph.prototype.initBlocks();
}
// blocks fade
if (!isNil(fade)) {
this.setBlockTransparency(+fade);
}
// language
if (language && language !== 'en') {
this.userLanguage = language;
@ -5680,7 +5686,7 @@ IDE_Morph.prototype.userFadeBlocks = function () {
dlg = new DialogBoxMorph(
null,
num => this.setBlockTransparency(num)
num => this.setBlockTransparency(num, true) // and save setting
).withKey('fadeBlocks');
if (MorphicPreferences.isTouchDevice) {
dlg.isDraggable = false;
@ -5717,9 +5723,16 @@ IDE_Morph.prototype.userFadeBlocks = function () {
);
};
IDE_Morph.prototype.setBlockTransparency = function (num) {
IDE_Morph.prototype.setBlockTransparency = function (num, save) {
SyntaxElementMorph.prototype.setAlphaScaled(100 - num);
this.changed();
if (save) {
if (num === 0) {
this.removeSetting('fade');
} else {
this.saveSetting('fade', num);
}
}
};
// IDE_Morph stage size manipulation