Browse Source

fix: Other binding converted from fixed to orbit unconditionally (#10748)

* fix: Other binding converted from fixed to orbit unconditionally

Signed-off-by: Mark Tolmacs <[email protected]>

* fix: New arrow creation

Signed-off-by: Mark Tolmacs <[email protected]>

* fix: Alt point setting on inside binding

Signed-off-by: Mark Tolmacs <[email protected]>

* fix: Initial arrow creation with Alt

Signed-off-by: Mark Tolmacs <[email protected]>

---------

Signed-off-by: Mark Tolmacs <[email protected]>
Márk Tolmács 2 weeks ago
parent
commit
b43260d97b
2 changed files with 10 additions and 5 deletions
  1. 9 5
      packages/element/src/binding.ts
  2. 1 0
      packages/excalidraw/components/App.tsx

+ 9 - 5
packages/element/src/binding.ts

@@ -810,10 +810,13 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
     elementsMap,
   );
 
-  const other: BindingStrategy =
-    otherBindableElement &&
-    !otherFocusPointIsInElement &&
-    appState.selectedLinearElement?.initialState.altFocusPoint
+  const otherNeverOverride = opts?.newArrow
+    ? appState.selectedLinearElement?.initialState.arrowStartIsInside
+    : otherBinding?.mode === "inside";
+  const other: BindingStrategy = !otherNeverOverride
+    ? otherBindableElement &&
+      !otherFocusPointIsInElement &&
+      appState.selectedLinearElement?.initialState.altFocusPoint
       ? {
           mode: "orbit",
           element: otherBindableElement,
@@ -832,7 +835,8 @@ const getBindingStrategyForDraggingBindingElementEndpoints_simple = (
               elementsMap,
             ) || otherEndpoint,
         }
-      : { mode: undefined };
+      : { mode: undefined }
+    : { mode: undefined };
 
   return {
     start: startDragged ? current : other,

+ 1 - 0
packages/excalidraw/components/App.tsx

@@ -8743,6 +8743,7 @@ class App extends React.Component<AppProps, AppState> {
               selectedPointsIndices: [endIdx],
               initialState: {
                 ...linearElementEditor.initialState,
+                arrowStartIsInside: event.altKey,
                 lastClickedPoint: endIdx,
                 origin: pointFrom<GlobalPoint>(
                   pointerDownState.origin.x,