Merge pull request #1280 from paulkaplan/fix-bubble-state

Fix a few say bubble issues
This commit is contained in:
Paul Kaplan 2018-07-05 08:55:39 -04:00 committed by GitHub
commit 06573f4624
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,6 +107,8 @@ class Scratch3LooksBlocks {
*/ */
_onResetBubbles () { _onResetBubbles () {
for (let n = 0; n < this.runtime.targets.length; n++) { 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]); this._onTargetWillExit(this.runtime.targets[n]);
} }
clearTimeout(this._bubbleTimeout); clearTimeout(this._bubbleTimeout);
@ -198,7 +200,13 @@ class Scratch3LooksBlocks {
// TODO is there a way to figure out before rendering whether to default left or right? // TODO is there a way to figure out before rendering whether to default left or right?
const targetBounds = target.getBounds(); 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) { if (targetBounds.right + 170 > stageBounds.right) {
bubbleState.onSpriteRight = false; bubbleState.onSpriteRight = false;
} }