naming
This commit is contained in:
parent
7ce0615411
commit
d3ee66b7cc
@ -477,4 +477,9 @@ export enum UserIdleState {
|
||||
IDLE = "idle",
|
||||
}
|
||||
|
||||
export const MIN_LOOP_LOCK_DISTANCE = 20;
|
||||
/**
|
||||
* distance at which we merge points instead of adding a new merge-point
|
||||
* when converting a line to a polygon (merge currently means overlaping
|
||||
* the start and end points)
|
||||
*/
|
||||
export const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
|
||||
|
@ -1390,7 +1390,7 @@ export class LinearElementEditor {
|
||||
) {
|
||||
const { points } = element;
|
||||
|
||||
// Handle loop lock behavior
|
||||
// if polygon, move start and end points together
|
||||
if (isLineElement(element) && element.polygon) {
|
||||
const firstPointUpdate = pointUpdates.get(0);
|
||||
const lastPointUpdate = pointUpdates.get(points.length - 1);
|
||||
|
@ -5,7 +5,7 @@ import {
|
||||
ROUNDNESS,
|
||||
invariant,
|
||||
elementCenterPoint,
|
||||
MIN_LOOP_LOCK_DISTANCE,
|
||||
LINE_POLYGON_POINT_MERGE_DISTANCE,
|
||||
} from "@excalidraw/common";
|
||||
import {
|
||||
isPoint,
|
||||
@ -414,7 +414,7 @@ export const toggleLinePolygonState = (
|
||||
firstPoint[1] - lastPoint[1],
|
||||
);
|
||||
|
||||
if (distance > MIN_LOOP_LOCK_DISTANCE) {
|
||||
if (distance > LINE_POLYGON_POINT_MERGE_DISTANCE) {
|
||||
updatedPoints.push(pointFrom(firstPoint[0], firstPoint[1]));
|
||||
} else {
|
||||
updatedPoints[updatedPoints.length - 1] = pointFrom(
|
||||
|
@ -104,14 +104,11 @@ export const actionTogglePolygon = register({
|
||||
selectedElementIds: appState.selectedElementIds,
|
||||
});
|
||||
|
||||
// Check if all selected elements are locked
|
||||
const allLocked =
|
||||
selectedElements.length > 0 &&
|
||||
selectedElements.every(
|
||||
(element) => isLineElement(element) && element.polygon,
|
||||
const allPolygons = !selectedElements.some(
|
||||
(element) => !isLineElement(element) || !element.polygon,
|
||||
);
|
||||
|
||||
return allLocked
|
||||
return allPolygons
|
||||
? "labels.polygon.breakPolygon"
|
||||
: "labels.polygon.convertToPolygon";
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user