mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Use renderer bounds instead of stage bounds for positioning bubbles.
Instead of using the rendered bounds of the stage (which can be larger than the actual rendering area of the stage due to large costumes), use the `nativeSize` which is the size in scratch coords of the rendering area. Note that `nativeSize` is not the size of the canvas element or anything like that, it is the "logical size", i.e. the [width, height] in scratch coords.
This commit is contained in:
parent
23e72525bf
commit
6c59ccbe1b
1 changed files with 7 additions and 1 deletions
|
@ -137,7 +137,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;
|
||||
|
|
Loading…
Reference in a new issue