mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: Incorrect point offsetting in LinearElementEditor.movePoints() (#8145)
The LinearElementEditor.movePoints() function incorrectly calculates the offset for local linear element points when multiple targetPoints are provided, one of those target points is index === 0 AND the other points are moved in the negative direction, and ending up with negative local coordinates. Signed-off-by: Mark Tolmacs <mark@lazycat.hu>
This commit is contained in:
parent
744b3e5d09
commit
ba8c09d529
2 changed files with 37 additions and 10 deletions
|
@ -1165,7 +1165,7 @@ export class LinearElementEditor {
|
|||
const nextPoints = points.map((point, idx) => {
|
||||
const selectedPointData = targetPoints.find((p) => p.index === idx);
|
||||
if (selectedPointData) {
|
||||
if (selectedOriginPoint) {
|
||||
if (selectedPointData.index === 0) {
|
||||
return point;
|
||||
}
|
||||
|
||||
|
@ -1174,7 +1174,10 @@ export class LinearElementEditor {
|
|||
const deltaY =
|
||||
selectedPointData.point[1] - points[selectedPointData.index][1];
|
||||
|
||||
return [point[0] + deltaX, point[1] + deltaY] as const;
|
||||
return [
|
||||
point[0] + deltaX - offsetX,
|
||||
point[1] + deltaY - offsetY,
|
||||
] as const;
|
||||
}
|
||||
return offsetX || offsetY
|
||||
? ([point[0] - offsetX, point[1] - offsetY] as const)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue