mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix index
This commit is contained in:
parent
330b3a0530
commit
0b0846bd8e
1 changed files with 5 additions and 4 deletions
|
@ -791,19 +791,20 @@ export class LinearElementEditor {
|
||||||
|
|
||||||
const pointHandles =
|
const pointHandles =
|
||||||
LinearElementEditor.getPointsGlobalCoordinates(element);
|
LinearElementEditor.getPointsGlobalCoordinates(element);
|
||||||
let idx = linearElementEditor.visiblePointIndexes.length;
|
let counter = linearElementEditor.visiblePointIndexes.length;
|
||||||
|
|
||||||
// loop from right to left because points on the right are rendered over
|
// loop from right to left because points on the right are rendered over
|
||||||
// points on the left, thus should take precedence when clicking, if they
|
// points on the left, thus should take precedence when clicking, if they
|
||||||
// overlap
|
// overlap
|
||||||
while (--idx > 0) {
|
while (--counter >= 0) {
|
||||||
const point = pointHandles[linearElementEditor.visiblePointIndexes[idx]];
|
const index = linearElementEditor.visiblePointIndexes[counter];
|
||||||
|
const point = pointHandles[index];
|
||||||
if (
|
if (
|
||||||
distance2d(x, y, point[0], point[1]) * zoom.value <
|
distance2d(x, y, point[0], point[1]) * zoom.value <
|
||||||
// +1px to account for outline stroke
|
// +1px to account for outline stroke
|
||||||
LinearElementEditor.POINT_HANDLE_SIZE + 1
|
LinearElementEditor.POINT_HANDLE_SIZE + 1
|
||||||
) {
|
) {
|
||||||
return idx;
|
return index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue