From 1940371250c254966ad21542f9f00688cb5bc5d0 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Thu, 18 Apr 2024 22:30:44 -0500 Subject: [PATCH] consolidate --- web/src/components/settings/PolygonCanvas.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/web/src/components/settings/PolygonCanvas.tsx b/web/src/components/settings/PolygonCanvas.tsx index af58dae47..22c23a226 100644 --- a/web/src/components/settings/PolygonCanvas.tsx +++ b/web/src/components/settings/PolygonCanvas.tsx @@ -178,21 +178,17 @@ export function PolygonCanvas({ ) { let updatedPoints; - // we've clicked near a line segment, so add a new point in the right position if (isPointNearLineSegment(activePolygon, mousePos)) { + // we've clicked near a line segment, so add a new point in the right position updatedPoints = addPointToPolygon(activePolygon, mousePos); - updatedPolygons[activePolygonIndex] = { - ...activePolygon, - points: updatedPoints, - }; } else { - updatedPoints = [...activePolygon.points, mousePos]; // Add a new point to the active polygon - updatedPolygons[activePolygonIndex] = { - ...activePolygon, - points: updatedPoints, - }; + updatedPoints = [...activePolygon.points, mousePos]; } + updatedPolygons[activePolygonIndex] = { + ...activePolygon, + points: updatedPoints, + }; setPolygons(updatedPolygons); } }