fix: bounds cached prematurely resulting in incorrectly rendered labels (#7339)
This commit is contained in:
parent
fda5c6fdf7
commit
dd8a7d41e2
@ -22,6 +22,7 @@ import { getBoundTextElement, getContainerElement } from "./textElement";
|
|||||||
import { LinearElementEditor } from "./linearElementEditor";
|
import { LinearElementEditor } from "./linearElementEditor";
|
||||||
import { Mutable } from "../utility-types";
|
import { Mutable } from "../utility-types";
|
||||||
import { ShapeCache } from "../scene/ShapeCache";
|
import { ShapeCache } from "../scene/ShapeCache";
|
||||||
|
import Scene from "../scene/Scene";
|
||||||
|
|
||||||
export type RectangleBox = {
|
export type RectangleBox = {
|
||||||
x: number;
|
x: number;
|
||||||
@ -59,10 +60,17 @@ export class ElementBounds {
|
|||||||
|
|
||||||
const bounds = ElementBounds.calculateBounds(element);
|
const bounds = ElementBounds.calculateBounds(element);
|
||||||
|
|
||||||
|
// hack to ensure that downstream checks could retrieve element Scene
|
||||||
|
// so as to have correctly calculated bounds
|
||||||
|
// FIXME remove when we get rid of all the id:Scene / element:Scene mapping
|
||||||
|
const shouldCache = Scene.getScene(element);
|
||||||
|
|
||||||
|
if (shouldCache) {
|
||||||
ElementBounds.boundsCache.set(element, {
|
ElementBounds.boundsCache.set(element, {
|
||||||
version: element.version,
|
version: element.version,
|
||||||
bounds,
|
bounds,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return bounds;
|
return bounds;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user