mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04: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:
parent
c3924a8f8c
commit
06b3750a2f
8 changed files with 80 additions and 69 deletions
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue