mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -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, {
|
||||
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)
|
||||
]
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue