mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-18 23:10:16 +02:00
Fix microjump on drag binding, no keyboard move if bound arrow
Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
invariant,
|
||||
isDevEnv,
|
||||
isTestEnv,
|
||||
toLocalPoint,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
@@ -523,8 +524,19 @@ export const bindLinearElement = (
|
||||
),
|
||||
};
|
||||
}
|
||||
const points = Array.from(linearElement.points);
|
||||
points[edgePointIndex] = toLocalPoint(
|
||||
bindPointToSnapToElementOutline(
|
||||
linearElement,
|
||||
hoveredElement,
|
||||
startOrEnd,
|
||||
elementsMap,
|
||||
),
|
||||
linearElement,
|
||||
);
|
||||
|
||||
mutateElement(linearElement, {
|
||||
points,
|
||||
[startOrEnd === "start" ? "startBinding" : "endBinding"]: binding,
|
||||
});
|
||||
|
||||
|
@@ -356,16 +356,17 @@ export class LinearElementEditor {
|
||||
elementsMap,
|
||||
true,
|
||||
);
|
||||
const newGlobalPointPosition = pointRotateRads(
|
||||
pointFrom<GlobalPoint>(
|
||||
element.x + newPointPosition[0],
|
||||
element.y + newPointPosition[1],
|
||||
),
|
||||
pointFrom<GlobalPoint>(cx, cy),
|
||||
element.angle,
|
||||
);
|
||||
const avoidancePoint = getOutlineAvoidingPoint(
|
||||
element,
|
||||
pointRotateRads(
|
||||
pointFrom<GlobalPoint>(
|
||||
element.x + newPointPosition[0],
|
||||
element.y + newPointPosition[1],
|
||||
),
|
||||
pointFrom<GlobalPoint>(cx, cy),
|
||||
element.angle,
|
||||
),
|
||||
newGlobalPointPosition,
|
||||
pointIndex,
|
||||
app.scene,
|
||||
app.state.zoom,
|
||||
@@ -373,8 +374,14 @@ export class LinearElementEditor {
|
||||
newPointPosition = LinearElementEditor.createPointAt(
|
||||
element,
|
||||
elementsMap,
|
||||
avoidancePoint[0] - linearElementEditor.pointerOffset.x,
|
||||
avoidancePoint[1] - linearElementEditor.pointerOffset.y,
|
||||
avoidancePoint[0] === newGlobalPointPosition[0]
|
||||
? newGlobalPointPosition[0] -
|
||||
linearElementEditor.pointerOffset.x
|
||||
: avoidancePoint[0],
|
||||
avoidancePoint[1] === newGlobalPointPosition[1]
|
||||
? newGlobalPointPosition[1] -
|
||||
linearElementEditor.pointerOffset.y
|
||||
: avoidancePoint[1],
|
||||
null,
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user