From 3dad1b403e7ccf121e9cdeb1764593560ce86491 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Wed, 15 Jul 2020 16:35:44 +0200 Subject: [PATCH] refactored transparency handling for syntax elements --- HISTORY.md | 1 + snap.html | 2 +- src/blocks.js | 11 +++++------ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index bc0d28fc..cd59cf24 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -6,6 +6,7 @@ * morphic: made keyboard handler (more) invisible, thanks, Bernat! * gui: made remaining synchronous http requests asynch (url: #open, #run) * morphic, gui: switch to scripts tab when dragging a block into the editor pane +* blocks: refactored transparency handling for syntax elements ### 2020-07-13 * paint, symbols: new iconic buttons for grow, shrink and flip actions, thanks, Jadga! diff --git a/snap.html b/snap.html index 4053f881..7bbf1ee0 100755 --- a/snap.html +++ b/snap.html @@ -7,7 +7,7 @@ - + diff --git a/src/blocks.js b/src/blocks.js index 5c8c2d0b..e9b23692 100644 --- a/src/blocks.js +++ b/src/blocks.js @@ -148,7 +148,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2020-July-02'; +modules.blocks = '2020-July-15'; var SyntaxElementMorph; var BlockMorph; @@ -284,6 +284,7 @@ SyntaxElementMorph.prototype.setScale = function (num) { SyntaxElementMorph.prototype.setScale(1); SyntaxElementMorph.prototype.isCachingInputs = false; +SyntaxElementMorph.prototype.alpha = 1; // SyntaxElementMorph instance creation: @@ -302,6 +303,7 @@ SyntaxElementMorph.prototype.init = function () { this.defaults = []; this.cachedInputs = null; + delete this.alpha; }; // SyntaxElementMorph accessing: @@ -4421,7 +4423,7 @@ BlockMorph.prototype.prepareToBeGrabbed = function (hand) { }; BlockMorph.prototype.justDropped = function () { - this.alpha = 1; + delete this.alpha; this.allComments().forEach(comment => comment.stopFollowing() ); @@ -5595,7 +5597,7 @@ ReporterBlockMorph.prototype.prepareToBeGrabbed = function (handMorph) { this.setPosition(oldPos); } ReporterBlockMorph.uber.prepareToBeGrabbed.call(this, handMorph); - this.alpha = 0.85; + this.alpha = Math.min(this.alpha, 0.85); this.cachedSlotSpec = null; }; @@ -6188,7 +6190,6 @@ function RingMorph() { RingMorph.prototype.init = function () { RingMorph.uber.init.call(this); this.category = 'other'; - this.alpha = RingMorph.prototype.alpha; this.contrast = RingMorph.prototype.contrast; this.setExtent(new Point(200, 80)); }; @@ -7968,7 +7969,6 @@ function RingCommandSlotMorph() { RingCommandSlotMorph.prototype.init = function () { RingCommandSlotMorph.uber.init.call(this); this.color = new Color(0, 17, 173); - this.alpha = RingMorph.prototype.alpha; this.contrast = RingMorph.prototype.contrast; }; @@ -11933,7 +11933,6 @@ function RingReporterSlotMorph(isPredicate) { RingReporterSlotMorph.prototype.init = function (isPredicate) { RingReporterSlotMorph.uber.init.call(this, isPredicate, true); - this.alpha = RingMorph.prototype.alpha; this.contrast = RingMorph.prototype.contrast; };