Fix linear editor bug when both midpoint and endpoint is moved
This commit is contained in:
parent
8c2de8c3c4
commit
4980631cb1
@ -1475,7 +1475,8 @@ export class LinearElementEditor {
|
|||||||
if (
|
if (
|
||||||
otherUpdates?.moveMidPointsWithElement &&
|
otherUpdates?.moveMidPointsWithElement &&
|
||||||
idx !== 0 &&
|
idx !== 0 &&
|
||||||
idx !== points.length - 1
|
idx !== points.length - 1 &&
|
||||||
|
!pointUpdates.has(idx)
|
||||||
) {
|
) {
|
||||||
return pointFrom<LocalPoint>(current[0], current[1]);
|
return pointFrom<LocalPoint>(current[0], current[1]);
|
||||||
}
|
}
|
||||||
@ -2023,6 +2024,11 @@ const pointDraggingUpdates = (
|
|||||||
elements: readonly Ordered<NonDeletedExcalidrawElement>[],
|
elements: readonly Ordered<NonDeletedExcalidrawElement>[],
|
||||||
zoom: AppState["zoom"],
|
zoom: AppState["zoom"],
|
||||||
): PointsPositionUpdates => {
|
): PointsPositionUpdates => {
|
||||||
|
const hasMidPoints =
|
||||||
|
selectedPointsIndices.filter(
|
||||||
|
(_, idx) => idx > 0 && idx < element.points.length - 1,
|
||||||
|
).length > 0;
|
||||||
|
|
||||||
return new Map(
|
return new Map(
|
||||||
selectedPointsIndices.map((pointIndex) => {
|
selectedPointsIndices.map((pointIndex) => {
|
||||||
let newPointPosition: LocalPoint =
|
let newPointPosition: LocalPoint =
|
||||||
@ -2039,7 +2045,10 @@ const pointDraggingUpdates = (
|
|||||||
element.points[pointIndex][1] + deltaY,
|
element.points[pointIndex][1] + deltaY,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (pointIndex === 0 || pointIndex === element.points.length - 1) {
|
if (
|
||||||
|
!hasMidPoints &&
|
||||||
|
(pointIndex === 0 || pointIndex === element.points.length - 1)
|
||||||
|
) {
|
||||||
const [, , , , cx, cy] = getElementAbsoluteCoords(
|
const [, , , , cx, cy] = getElementAbsoluteCoords(
|
||||||
element,
|
element,
|
||||||
elementsMap,
|
elementsMap,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user