From a6a29a5437a61ab34c9680e3d23aef6fa7e7fee2 Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Thu, 28 Jun 2018 16:44:33 -0400
Subject: [PATCH 1/2] Fix hidden bubbles not resetting on stop

---
 src/blocks/scratch3_looks.js | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js
index 14e7a5b53..5280d31b4 100644
--- a/src/blocks/scratch3_looks.js
+++ b/src/blocks/scratch3_looks.js
@@ -107,6 +107,8 @@ class Scratch3LooksBlocks {
      */
     _onResetBubbles () {
         for (let n = 0; n < this.runtime.targets.length; n++) {
+            const bubbleState = this._getBubbleState(this.runtime.targets[n]);
+            bubbleState.text = '';
             this._onTargetWillExit(this.runtime.targets[n]);
         }
         clearTimeout(this._bubbleTimeout);

From 63e96634bffd686cdb3364b657cd0931b6ad80cf Mon Sep 17 00:00:00 2001
From: Paul Kaplan <pkaplan@media.mit.edu>
Date: Thu, 28 Jun 2018 16:45:07 -0400
Subject: [PATCH 2/2] Use bounds of the renderer instead of stage target for
 positioning.

Fixes the regression where bubbles almost always point left instead of right.
---
 src/blocks/scratch3_looks.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/blocks/scratch3_looks.js b/src/blocks/scratch3_looks.js
index 5280d31b4..cc2f2ac4c 100644
--- a/src/blocks/scratch3_looks.js
+++ b/src/blocks/scratch3_looks.js
@@ -200,7 +200,13 @@ class Scratch3LooksBlocks {
 
             // TODO is there a way to figure out before rendering whether to default left or right?
             const targetBounds = target.getBounds();
-            const stageBounds = this.runtime.getTargetForStage().getBounds();
+            const stageSize = this.runtime.renderer.getNativeSize();
+            const stageBounds = {
+                left: -stageSize[0] / 2,
+                right: stageSize[0] / 2,
+                top: stageSize[1] / 2,
+                bottom: -stageSize[1] / 2
+            };
             if (targetBounds.right + 170 > stageBounds.right) {
                 bubbleState.onSpriteRight = false;
             }