mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Merge pull request #1427 from paulkaplan/fix-bubble-positioning
Remove heuristic for bubble positioning that was not accurate.
This commit is contained in:
commit
d1761466fc
1 changed files with 0 additions and 15 deletions
|
@ -197,23 +197,8 @@ class Scratch3LooksBlocks {
|
||||||
this.runtime.renderer.updateTextSkin(bubbleState.skinId, type, text, onSpriteRight, [0, 0]);
|
this.runtime.renderer.updateTextSkin(bubbleState.skinId, type, text, onSpriteRight, [0, 0]);
|
||||||
} else {
|
} else {
|
||||||
target.addListener(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this._onTargetChanged);
|
target.addListener(RenderedTarget.EVENT_TARGET_VISUAL_CHANGE, this._onTargetChanged);
|
||||||
|
|
||||||
// TODO is there a way to figure out before rendering whether to default left or right?
|
|
||||||
const targetBounds = target.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) {
|
|
||||||
bubbleState.onSpriteRight = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bubbleState.drawableId = this.runtime.renderer.createDrawable(StageLayering.SPRITE_LAYER);
|
bubbleState.drawableId = this.runtime.renderer.createDrawable(StageLayering.SPRITE_LAYER);
|
||||||
bubbleState.skinId = this.runtime.renderer.createTextSkin(type, text, bubbleState.onSpriteRight, [0, 0]);
|
bubbleState.skinId = this.runtime.renderer.createTextSkin(type, text, bubbleState.onSpriteRight, [0, 0]);
|
||||||
|
|
||||||
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
|
this.runtime.renderer.updateDrawableProperties(bubbleState.drawableId, {
|
||||||
skinId: bubbleState.skinId
|
skinId: bubbleState.skinId
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue