mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Check that bubble bounds do not extend past stage boundaries
For when you can't flip the bubble, but need it to remain on-stage
This commit is contained in:
parent
ca6a7f9311
commit
25290e7f6a
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