Merge pull request #1209 from technoboy10/bugfix/gh-1135-bubble-edge

Check that bubble bounds do not extend past stage boundaries
This commit is contained in:
Paul Kaplan 2018-06-11 12:14:53 -04:00 committed by GitHub
commit 418c3837c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -153,10 +153,17 @@ class Scratch3LooksBlocks {
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
position: [
bubbleState.onSpriteRight ? (
Math.max(
stageBounds.left, // Bubble should not extend past left edge of stage
Math.min(stageBounds.right - bubbleWidth, targetBounds.right)
)
) : (
Math.min(
stageBounds.right - bubbleWidth, // Bubble should not extend past right edge of stage
Math.max(stageBounds.left, targetBounds.left - bubbleWidth)
)
),
// Bubble should not extend past the top of the stage
Math.min(stageBounds.top, targetBounds.bottom + bubbleHeight)
]
});