Skip to content

Commit 19ebc63

Browse files
authored
Refactor Tldraw shape change handler to temporarily disable relation movement prevention logic. (#379)
1 parent 9d38651 commit 19ebc63

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

apps/roam/src/components/canvas/Tldraw.tsx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -851,23 +851,25 @@ const InsideEditorAndUiContext = ({
851851
editor.sideEffects.registerBeforeChangeHandler(
852852
"shape",
853853
(prevShape, nextShape) => {
854-
// prevent accidental arrow reposition
855-
if (isCustomArrowShape(prevShape)) {
856-
const bindings = editor.getBindingsFromShape(
857-
prevShape,
858-
prevShape.type,
859-
);
860-
const isTranslating = editor.isIn("select.translating");
861-
if (bindings.length && isTranslating) {
862-
editor.setSelectedShapes([]);
863-
toasts.addToast({
864-
id: "tldraw-toast-cannot-move-relation",
865-
title: "Cannot move relation.",
866-
severity: "warning",
867-
});
868-
return prevShape;
869-
}
870-
}
854+
// TODO: Re-enable relation movement prevention with a different mechanism
855+
// This was disabled because it was firing when it shouldn't
856+
// The original logic prevented moving relations with bindings
857+
// if (isCustomArrowShape(prevShape)) {
858+
// const bindings = editor.getBindingsFromShape(
859+
// prevShape,
860+
// prevShape.type,
861+
// );
862+
// const isTranslating = editor.isIn("select.translating");
863+
// if (bindings.length && isTranslating) {
864+
// editor.setSelectedShapes([]);
865+
// toasts.addToast({
866+
// id: "tldraw-toast-cannot-move-relation",
867+
// title: "Cannot move relation.",
868+
// severity: "warning",
869+
// });
870+
// return prevShape;
871+
// }
872+
// }
871873
return nextShape;
872874
},
873875
);

0 commit comments

Comments
 (0)