Merge pull request #1098 from paulkaplan/fix-say-bounds

Use renderer bounds instead of stage bounds for positioning bubbles.
This commit is contained in:
Paul Kaplan 2018-04-30 15:14:08 -04:00 committed by GitHub
commit 8a9818d0d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -133,7 +133,13 @@ class Scratch3LooksBlocks {
bottom: target.y
};
}
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 (bubbleState.onSpriteRight && bubbleWidth + targetBounds.right > stageBounds.right &&
(targetBounds.left - bubbleWidth > stageBounds.left)) { // Only flip if it would fit
bubbleState.onSpriteRight = false;