From 26e9e689a5e084244cf89e40f6fb25f73e11dab2 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Mon, 16 Mar 2020 16:59:38 +0100 Subject: [PATCH] more watcher and result bubble migrations --- src/blocks.js | 33 +++++++++++++++++++-------------- src/objects.js | 31 ++++++++++++++++++------------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/blocks.js b/src/blocks.js index 849dee8e..a8a37004 100644 --- a/src/blocks.js +++ b/src/blocks.js @@ -148,7 +148,7 @@ CustomCommandBlockMorph, SymbolMorph, ToggleButtonMorph, DialMorph*/ // Global stuff //////////////////////////////////////////////////////// -modules.blocks = '2020-March-10'; +modules.blocks = '2020-March-16'; var SyntaxElementMorph; var BlockMorph; @@ -2138,14 +2138,15 @@ SyntaxElementMorph.prototype.showBubble = function (value, exportPic, target) { if (isSnapObject(value)) { img = value.thumbnail(new Point(40, 40)); morphToShow = new Morph(); - morphToShow.silentSetWidth(img.width); - morphToShow.silentSetHeight(img.height); - morphToShow.image = img; + morphToShow.isCachingImage = true; + morphToShow.bounds.setWidth(img.width); + morphToShow.bounds.setHeight(img.height); + morphToShow.cachedImage = img; morphToShow.version = value.version; morphToShow.step = function () { if (this.version !== value.version) { img = value.thumbnail(new Point(40, 40)); - this.image = img; + this.cachedImage = img; this.version = value.version; this.changed(); } @@ -2153,24 +2154,28 @@ SyntaxElementMorph.prototype.showBubble = function (value, exportPic, target) { } else { img = value.fullImage(); morphToShow = new Morph(); - morphToShow.silentSetWidth(img.width); - morphToShow.silentSetHeight(img.height); - morphToShow.image = img; + morphToShow.isCachingImage = true; + morphToShow.bounds.setWidth(img.width); + morphToShow.bounds.setHeight(img.height); + morphToShow.cachedImage = img; } } else if (value instanceof Costume) { img = value.thumbnail(new Point(40, 40)); morphToShow = new Morph(); - morphToShow.silentSetWidth(img.width); - morphToShow.silentSetHeight(img.height); - morphToShow.image = img; + morphToShow = new Morph(); + morphToShow.isCachingImage = true; + morphToShow.bounds.setWidth(img.width); + morphToShow.bounds.setHeight(img.height); + morphToShow.cachedImage = img; } else if (value instanceof Sound) { morphToShow = new SymbolMorph('notes', 30); } else if (value instanceof Context) { img = value.image(); morphToShow = new Morph(); - morphToShow.silentSetWidth(img.width); - morphToShow.silentSetHeight(img.height); - morphToShow.image = img; + morphToShow.isCachingImage = true; + morphToShow.bounds.setWidth(img.width); + morphToShow.bounds.setHeight(img.height); + morphToShow.cachedImage = img; } else if (typeof value === 'boolean') { morphToShow = SpriteMorph.prototype.booleanMorph.call( null, diff --git a/src/objects.js b/src/objects.js index cc4b9282..6feea2b9 100644 --- a/src/objects.js +++ b/src/objects.js @@ -7068,7 +7068,7 @@ SpriteMorph.prototype.fullThumbnail = function (extentPoint) { SpriteMorph.prototype.booleanMorph = function (bool) { var sym = new BooleanSlotMorph(bool); sym.isStatic = true; - sym.drawNew(); + sym.fixLayout(); return sym; }; @@ -10906,26 +10906,31 @@ CellMorph.prototype.createContents = function () { this.contents ).fullImage(); this.contentsMorph = new Morph(); - this.contentsMorph.silentSetWidth(img.width); - this.contentsMorph.silentSetHeight(img.height); - this.contentsMorph.image = img; + this.contentsMorph.isCachingImage = true; + this.contentsMorph.bounds.setWidth(img.width); + this.contentsMorph.bounds.setHeight(img.height); + this.contentsMorph.cachedImage = img; } else if (this.contents instanceof HTMLCanvasElement) { + img = this.contents; this.contentsMorph = new Morph(); - this.contentsMorph.silentSetWidth(this.contents.width); - this.contentsMorph.silentSetHeight(this.contents.height); - this.contentsMorph.image = this.contents; + this.contentsMorph.isCachingImage = true; + this.contentsMorph.bounds.setWidth(img.width); + this.contentsMorph.bounds.setHeight(img.height); + this.contentsMorph.cachedImage = img; } else if (this.contents instanceof Context) { img = this.contents.image(); this.contentsMorph = new Morph(); - this.contentsMorph.silentSetWidth(img.width); - this.contentsMorph.silentSetHeight(img.height); - this.contentsMorph.image = img; + this.contentsMorph.isCachingImage = true; + this.contentsMorph.bounds.setWidth(img.width); + this.contentsMorph.bounds.setHeight(img.height); + this.contentsMorph.cachedImage = img; } else if (this.contents instanceof Costume) { img = this.contents.thumbnail(new Point(40, 40)); this.contentsMorph = new Morph(); - this.contentsMorph.silentSetWidth(img.width); - this.contentsMorph.silentSetHeight(img.height); - this.contentsMorph.image = img; + this.contentsMorph.isCachingImage = true; + this.contentsMorph.bounds.setWidth(img.width); + this.contentsMorph.bounds.setHeight(img.height); + this.contentsMorph.cachedImage = img; } else if (this.contents instanceof Sound) { this.contentsMorph = new SymbolMorph('notes', 30); } else if (this.contents instanceof List) {