Don't trigger update for selection element mutations

This commit is contained in:
Marcel Mraz 2025-04-17 13:50:52 +02:00
parent 6668945282
commit 56fb7aec44
No known key found for this signature in database
GPG key ID: 4EBD6E62DC830CD2
10 changed files with 71 additions and 69 deletions

View file

@ -450,12 +450,13 @@ class Scene {
options,
);
// skip triggerUpdate if the element version hasn't changed
if (prevVersion === nextVersion) {
return element;
}
if (options.informMutation) {
if (
// skip if the element is not in the scene (i.e. selection)
this.elementsMap.has(element.id) &&
// skip if the element's version hasn't changed, as mutateElement returned the same element
prevVersion !== nextVersion &&
options.informMutation
) {
this.triggerUpdate();
}

View file

@ -423,6 +423,7 @@ export const maybeBindLinearElement = (
pointerCoords: { x: number; y: number },
scene: Scene,
): void => {
const elements = scene.getNonDeletedElements();
const elementsMap = scene.getNonDeletedElementsMap();
if (appState.startBoundElement != null) {
@ -436,7 +437,7 @@ export const maybeBindLinearElement = (
const hoveredElement = getHoveredElementForBinding(
pointerCoords,
scene.getNonDeletedElements(),
elements,
elementsMap,
appState.zoom,
isElbowArrow(linearElement),