fix squaring operation on vertices, closes #10401

* only calculate `motion` for the selected vertex
* don't treat vertex as "closed way" when checking disabled/enabled state of operation
This commit is contained in:
Martin Raifer
2025-03-18 12:00:35 +01:00
parent 79362ea7a8
commit f4230785e1
2 changed files with 5 additions and 3 deletions
+2
View File
@@ -40,6 +40,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
#### :sparkles: Usability & Accessibility
* Allow searching for coordinates in localized number format in search box ([#10805])
#### :scissors: Operations
* Fix unexpected behavior of squaring operation on individual vertices ([#10401])
#### :camera: Street-Level
* Add prev/next button to viewer for local georeferenced photos ([#10852], thanks [@0xatulpatil])
#### :white_check_mark: Validation
@@ -58,6 +59,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
[#10805]: https://github.com/openstreetmap/iD/pull/10805
[#10299]: https://github.com/openstreetmap/iD/issues/10299
[#10401]: https://github.com/openstreetmap/iD/issues/10401
[#10843]: https://github.com/openstreetmap/iD/pull/10843
[#10852]: https://github.com/openstreetmap/iD/issues/10852
[#10885]: https://github.com/openstreetmap/iD/issues/10885
+3 -3
View File
@@ -56,9 +56,9 @@ export function actionOrthogonalize(wayID, projection, vertexID, degThresh, ep)
if (points.length === 3) { // move only one vertex for right triangle
for (i = 0; i < 1000; i++) {
motions = points.map(calcMotion);
const motion = calcMotion(points[1], 1, points);
points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
points[corner.i].coord = geoVecAdd(points[corner.i].coord, motion);
score = corner.dotp;
if (score < epsilon) {
break;
@@ -217,7 +217,7 @@ export function actionOrthogonalize(wayID, projection, vertexID, degThresh, ep)
way = way.removeNode(''); // sanity check - remove any consecutive duplicates
graph = graph.replace(way);
var isClosed = way.isClosed();
const isClosed = way.isClosed() && vertexID === undefined;
var nodes = graph.childNodes(way).slice(); // shallow copy
if (isClosed) nodes.pop();