From 62e0bc4545a3154fef90136654e2b82c20c49e15 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Thu, 11 Nov 2021 19:10:21 +0100 Subject: [PATCH] made "pen color model" and "disable click-to-run" settings persistent per scene --- HISTORY.md | 5 ++++- snap.html | 4 ++-- src/gui.js | 29 ++++++++++++----------------- src/scenes.js | 10 ++++++++-- src/store.js | 9 +++++++-- sw.js | 2 +- 6 files changed, 34 insertions(+), 25 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index a213409c..ca0d5b6a 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -16,6 +16,8 @@ * block-instances can be dragged off from templates in the "export blocks", "unused blocks" and "hide blocks" dialogs * added "enter" key to key-pressed dropdown * added "green flag" symbol to message drop-down + * new preference setting per scene for pen color model and graphic effects, HSV or HSL, default is HSL + * new preference setting per scene to "disable click-to-run" on blocks, for use in micro-world extensions * **Notable Changes:** * saved projects remember the last edited sprite * libraries no longer rely on the JSF primitive, project may need to re-import their libraries to run without having to enable JS extensions @@ -24,7 +26,7 @@ * codification and js-func blocks don't appear in search results unless enabled * migrated SEND blocks to be BROADCAST TO blocks * "when I receive 'any message'" hat scripts are threadsafe (uninterruptable by other messages) - * changed the color model for pen/background colors from HSV to HSL + * changed the default color model for pen/background colors and graphic effects from HSV to HSL * changed the scale of the graphics color effect from 0-200 to 0-100 * new Birdbrain Technology extensions for Finch and Hummingbird, thanks, Kristina and Bambi! * retired Leap Motion library @@ -57,6 +59,7 @@ * German translation update, changed %hsva -> %clrdim * Brazilian Portuguese translation update, thank you, Cassiano D'Andrea!! * threads, gui: experimental "disalbe click-to-run" preference +* gui, scenes, store: made "pen color model" and "disable click-to-run" settings persistent per scene ### 2021-11-10 * objects, store: new "penColorModel" setting, can e 'hsv' or 'hsl' diff --git a/snap.html b/snap.html index 22cdd47f..861db2db 100755 --- a/snap.html +++ b/snap.html @@ -19,7 +19,7 @@ - + @@ -30,7 +30,7 @@ - + diff --git a/src/gui.js b/src/gui.js index c7a1faa8..7927f44a 100644 --- a/src/gui.js +++ b/src/gui.js @@ -3845,22 +3845,6 @@ IDE_Morph.prototype.settingsMenu = function () { true ); } - addPreference( - 'HSV pen color model', - () => SpriteMorph.prototype.penColorModel = 'hsv', - SpriteMorph.prototype.penColorModel === 'hsv', - null, - null, - true - ); - addPreference( - 'HSL pen color model', - () => SpriteMorph.prototype.penColorModel = 'hsl', - SpriteMorph.prototype.penColorModel === 'hsl', - null, - null, - true - ); addPreference( 'Input sliders', 'toggleInputSliders', @@ -4248,6 +4232,17 @@ IDE_Morph.prototype.settingsMenu = function () { 'check to enable\ndropping commands in all rings', true ); + + addPreference( + 'HSV pen color model', + () => SpriteMorph.prototype.penColorModel = + SpriteMorph.prototype.penColorModel === 'hsv' ? 'hsl' : 'hsv', + SpriteMorph.prototype.penColorModel === 'hsv', + 'uncheck to switch pen colors\nand graphic effects\nto HSL (default)', + 'check to switch pen colors\nand graphic effects\nfrom HSL to HSV', + false + ); + addPreference( 'Disable click-to-run', () => ThreadManager.prototype.disableClickToRun = @@ -4255,7 +4250,7 @@ IDE_Morph.prototype.settingsMenu = function () { ThreadManager.prototype.disableClickToRun, 'uncheck to enable\ndirectly running blocks\nby clicking on them', 'check to disable\ndirectly running blocks\nby clicking on them', - true + false ); menu.popup(world, pos); }; diff --git a/src/scenes.js b/src/scenes.js index 0c4777f0..0ba99fdb 100644 --- a/src/scenes.js +++ b/src/scenes.js @@ -47,13 +47,13 @@ */ /*global modules, VariableFrame, StageMorph, SpriteMorph, Process, List, -normalizeCanvas, SnapSerializer, Costume*/ +normalizeCanvas, SnapSerializer, Costume, ThreadManager*/ /*jshint esversion: 6*/ // Global stuff //////////////////////////////////////////////////////// -modules.scenes = '2021-October-12'; +modules.scenes = '2021-November-11'; // Projecct ///////////////////////////////////////////////////////// @@ -139,6 +139,8 @@ function Scene(aStageMorph) { this.useFlatLineEnds = false; this.enableLiveCoding = false; this.enableHyperOps = true; + this.disableClickToRun = false; + this.penColorModel = 'hsl'; // can also bei 'hsv' // for deserializing - do not persist this.spritesDict = {}; @@ -193,6 +195,8 @@ Scene.prototype.captureGlobalSettings = function () { this.enableLiveCoding = Process.prototype.enableLiveCoding; this.enableHyperOps = Process.prototype.enableHyperOps; this.customCategories = SpriteMorph.prototype.customCategories; + this.disableClickToRun = ThreadManager.prototype.disableClickToRun; + this.penColorModel = SpriteMorph.prototype.penColorModel; }; Scene.prototype.applyGlobalSettings = function () { @@ -208,6 +212,8 @@ Scene.prototype.applyGlobalSettings = function () { Process.prototype.enableLiveCoding = this.enableLiveCoding; Process.prototype.enableHyperOps = this.enableHyperOps; SpriteMorph.prototype.customCategories = this.customCategories; + ThreadManager.prototype.disableClickToRun = this.disableClickToRun; + SpriteMorph.prototype.penColorModel = this.penColorModel; }; Scene.prototype.updateTrash = function () { diff --git a/src/store.js b/src/store.js index 6a66d3af..b03fcb77 100644 --- a/src/store.js +++ b/src/store.js @@ -63,7 +63,7 @@ Project*/ // Global stuff //////////////////////////////////////////////////////// -modules.store = '2021-November-10'; +modules.store = '2021-November-11'; // XML_Serializer /////////////////////////////////////////////////////// /* @@ -380,6 +380,9 @@ SnapSerializer.prototype.loadScene = function (xmlNode, remixID) { } scene.unifiedPalette = model.scene.attributes.palette === 'single'; scene.showCategories = model.scene.attributes.categories !== 'false'; + scene.disableClickToRun = model.scene.attributes.clickrun === 'false'; + scene.penColorModel = model.scene.attributes.colormodel === 'hsv' ? + 'hsv' : 'hsl'; model.notes = model.scene.childNamed('notes'); if (model.notes) { scene.notes = model.notes.contents; @@ -1735,7 +1738,7 @@ Scene.prototype.toXML = function (serializer) { } xml = serializer.format( - '' + + '' + '$' + '%' + '$' + @@ -1749,6 +1752,8 @@ Scene.prototype.toXML = function (serializer) { this.unifiedPalette ? ' palette="single"' : '', this.unifiedPalette && !this.showCategories ? ' categories="false"' : '', + this.disableClickToRun ? ' clickrun="false"' : '', + this.penColorModel === 'hsv' ? ' colormodel="hsv"' : '', this.notes || '', serializer.paletteToXML(this.customCategories), Object.keys(this.hiddenPrimitives).reduce( diff --git a/sw.js b/sw.js index 462c03a1..713fea60 100644 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -var snapVersion = '7-dev211110' +var snapVersion = '7-dev211111' var cacheName = 'snap-pwa', filesToCache = [