fix: Arrow update when cloned (#10747)

* fix: Arrow update when cloned

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* feat(editor): reduce binding gap (#10739)

* feat(editor): reduce binding gap to 7px

* feat(editor): reduce binding gap to 5px

* feat(editor): reduce binding gap to 3px

* go back to 5px

* update tests

* chore: Refactor

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

* fix: Align focus points

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>

---------

Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
Co-authored-by: David Luzar <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
Márk Tolmács
2026-02-09 13:03:05 +01:00
committed by GitHub
parent 3a5ef4020d
commit 1c8e8bb0f3
3 changed files with 14 additions and 3 deletions
+1
View File
@@ -43,6 +43,7 @@ export const alignElements = (
// update bound elements // update bound elements
updateBoundElements(element, scene, { updateBoundElements(element, scene, {
simultaneouslyUpdated: group, simultaneouslyUpdated: group,
indirectArrowUpdate: true,
}); });
return updatedEle; return updatedEle;
}); });
+10 -2
View File
@@ -1081,6 +1081,7 @@ export const updateBoundElements = (
options?: { options?: {
simultaneouslyUpdated?: readonly ExcalidrawElement[]; simultaneouslyUpdated?: readonly ExcalidrawElement[];
changedElements?: Map<string, ExcalidrawElement>; changedElements?: Map<string, ExcalidrawElement>;
indirectArrowUpdate?: boolean;
}, },
) => { ) => {
if (!isBindableElement(changedElement)) { if (!isBindableElement(changedElement)) {
@@ -1100,7 +1101,7 @@ export const updateBoundElements = (
}); });
} }
boundElementsVisitor(elementsMap, changedElement, (element) => { const visitor = (element: ExcalidrawElement | undefined) => {
if (!isArrowElement(element) || element.isDeleted) { if (!isArrowElement(element) || element.isDeleted) {
return; return;
} }
@@ -1172,7 +1173,14 @@ export const updateBoundElements = (
if (boundText && !boundText.isDeleted) { if (boundText && !boundText.isDeleted) {
handleBindTextResize(element, scene, false); handleBindTextResize(element, scene, false);
} }
}); };
boundElementsVisitor(elementsMap, changedElement, visitor);
if (options?.indirectArrowUpdate) {
boundElementsVisitor(elementsMap, changedElement, visitor);
boundElementsVisitor(elementsMap, changedElement, visitor);
}
}; };
const updateArrowBindings = ( const updateArrowBindings = (
+3 -1
View File
@@ -9595,7 +9595,9 @@ class App extends React.Component<AppProps, AppState> {
isBindableElement(element) && isBindableElement(element) &&
element.boundElements?.some((other) => other.type === "arrow") element.boundElements?.some((other) => other.type === "arrow")
) { ) {
updateBoundElements(element, this.scene); updateBoundElements(element, this.scene, {
indirectArrowUpdate: true,
});
} }
}); });