mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
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:
commit
418c3837c6
1 changed files with 9 additions and 2 deletions
|
@ -153,10 +153,17 @@ class Scratch3LooksBlocks {
|
||||||
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
|
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
|
||||||
position: [
|
position: [
|
||||||
bubbleState.onSpriteRight ? (
|
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, targetBounds.right)
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
|
Math.min(
|
||||||
|
stageBounds.right - bubbleWidth, // Bubble should not extend past right edge of stage
|
||||||
Math.max(stageBounds.left, targetBounds.left - bubbleWidth)
|
Math.max(stageBounds.left, targetBounds.left - bubbleWidth)
|
||||||
|
)
|
||||||
),
|
),
|
||||||
|
// Bubble should not extend past the top of the stage
|
||||||
Math.min(stageBounds.top, targetBounds.bottom + bubbleHeight)
|
Math.min(stageBounds.top, targetBounds.bottom + bubbleHeight)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue