mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Use bounds of the renderer instead of stage target for positioning.
Fixes the regression where bubbles almost always point left instead of right.
This commit is contained in:
parent
a6a29a5437
commit
63e96634bf
1 changed files with 7 additions and 1 deletions
|
@ -200,7 +200,13 @@ class Scratch3LooksBlocks {
|
||||||
|
|
||||||
// TODO is there a way to figure out before rendering whether to default left or right?
|
// TODO is there a way to figure out before rendering whether to default left or right?
|
||||||
const targetBounds = target.getBounds();
|
const targetBounds = target.getBounds();
|
||||||
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 (targetBounds.right + 170 > stageBounds.right) {
|
if (targetBounds.right + 170 > stageBounds.right) {
|
||||||
bubbleState.onSpriteRight = false;
|
bubbleState.onSpriteRight = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue