From 9782c137bb281e69a51152d724917824cbeb60f0 Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Fri, 20 Apr 2018 10:44:55 -0400 Subject: [PATCH] Use the new general target visual change for updating bubbles. --- src/blocks/scratch3_looks.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js index e04c5cc1..b1684c38 100644 --- a/src/blocks/scratch3_looks.js +++ b/src/blocks/scratch3_looks.js @@ -20,7 +20,7 @@ class Scratch3LooksBlocks { */ this.runtime = runtime; - this._onTargetMoved = this._onTargetMoved.bind(this); + this._onTargetChanged = this._onTargetChanged.bind(this); this._onResetBubbles = this._onResetBubbles.bind(this); this._onTargetWillExit = this._onTargetWillExit.bind(this); this._updateBubble = this._updateBubble.bind(this); @@ -75,7 +75,7 @@ class Scratch3LooksBlocks { * @param {RenderedTarget} target - the target which has moved. * @private */ - _onTargetMoved (target) { + _onTargetChanged (target) { const bubbleState = this._getBubbleState(target); if (bubbleState.drawableId) { this._positionBubble(target); @@ -97,7 +97,7 @@ class Scratch3LooksBlocks { bubbleState.drawableVisible = true; // Reset back to default value this.runtime.requestRedraw(); } - target.removeListener(RenderedTarget.EVENT_TARGET_MOVED, this._onTargetMoved); + target.removeListener(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this._onTargetChanged); } /** @@ -178,7 +178,7 @@ class Scratch3LooksBlocks { this.runtime.renderer.updateTextSkin(bubbleState.skinId, type, text, onSpriteRight, [0, 0]); } } else { - target.addListener(RenderedTarget.EVENT_TARGET_MOVED, this._onTargetMoved); + target.addListener(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this._onTargetChanged); // TODO is there a way to figure out before rendering whether to default left or right? const targetBounds = target.getBounds();