Skip to content

Commit 97517a6

Browse files
committed
backport fixes as v2.35.2
* restore transitionable actions like circularize and reflect * fix glich when dragging the map while inside a move operation * show midpoints of selected ways when mouse is nearby
1 parent e100783 commit 97517a6

File tree

13 files changed

+98
-61
lines changed

13 files changed

+98
-61
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ _Breaking developer changes, which may affect downstream projects or sites that
3636
-->
3737

3838

39+
# v2.35.2
40+
##### 2025-07-18
41+
42+
#### :bug: Bugfixes
43+
* Restore behavior of _reflect_ and _circularize_ operations, as well as fixing minor glitches in some other actions with transitions ([#11213])
44+
* Fix glitch while dragging the map during a _move_ operation ([#11217])
45+
* Show midpoints of selected ways when mouse is nearby ([#11220])
46+
47+
[#11213]: https://github.com/openstreetmap/iD/issues/11213
48+
[#11217]: https://github.com/openstreetmap/iD/issues/11217
49+
[#11220]: https://github.com/openstreetmap/iD/issues/11220
50+
51+
3952
# v2.35.1
4053
##### 2025-07-14
4154

dist/iD.js

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15361,7 +15361,7 @@
1536115361
"package.json"() {
1536215362
package_default = {
1536315363
name: "iD",
15364-
version: "2.35.0",
15364+
version: "2.35.2",
1536515365
description: "A friendly editor for OpenStreetMap",
1536615366
main: "dist/iD.min.js",
1536715367
repository: "github:openstreetmap/iD",
@@ -31708,12 +31708,12 @@
3170831708
}
3170931709
function _overwrite(args, t2) {
3171031710
var previous = _stack[_index].graph;
31711-
var actionResult = _act(args, t2);
3171231711
if (_index > 0) {
3171331712
_index--;
3171431713
_stack.pop();
3171531714
}
3171631715
_stack = _stack.slice(0, _index + 1);
31716+
var actionResult = _act(args, t2);
3171731717
_stack.push(actionResult);
3171831718
_index++;
3171931719
return change(previous);
@@ -58266,19 +58266,26 @@ Please report this to https://github.com/markedjs/marked.`, e3) {
5826658266
var drawLayer = selection2.selectAll(".layer-osm.labels");
5826758267
var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
5826858268
layers.selectAll(".nolabel").classed("nolabel", false);
58269-
var mouse = context.map().mouse();
58270-
var ids = [];
58271-
var pad3, bbox2;
58272-
if (mouse && context.mode().id !== "browse" && context.mode().id !== "select") {
58273-
pad3 = 20;
58269+
const graph = context.graph();
58270+
const mouse = context.map().mouse();
58271+
let bbox2;
58272+
let hideIds = [];
58273+
if (mouse && context.mode().id !== "browse") {
58274+
const pad3 = 20;
5827458275
bbox2 = { minX: mouse[0] - pad3, minY: mouse[1] - pad3, maxX: mouse[0] + pad3, maxY: mouse[1] + pad3 };
58275-
var nearMouse = _rdrawn.search(bbox2).map(function(entity) {
58276-
return entity.id;
58277-
});
58278-
ids.push.apply(ids, nearMouse);
58279-
}
58280-
ids = utilArrayDifference(ids, ((_b2 = (_a4 = context.mode()) == null ? void 0 : _a4.selectedIDs) == null ? void 0 : _b2.call(_a4)) || []);
58281-
layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
58276+
const nearMouse = _rdrawn.search(bbox2).map((entity) => entity.id).filter((id2) => context.mode().id !== "select" || // in select mode: hide labels of currently selected line(s)
58277+
// to still allow accessing midpoints
58278+
// https://github.com/openstreetmap/iD/issues/11220
58279+
context.mode().selectedIDs().includes(id2) && graph.hasEntity(id2).geometry(graph) === "line");
58280+
hideIds.push.apply(hideIds, nearMouse);
58281+
hideIds = utilArrayUniq(hideIds);
58282+
}
58283+
const selected = (((_b2 = (_a4 = context.mode()) == null ? void 0 : _a4.selectedIDs) == null ? void 0 : _b2.call(_a4)) || []).filter((id2) => {
58284+
var _a5;
58285+
return ((_a5 = graph.hasEntity(id2)) == null ? void 0 : _a5.geometry(graph)) !== "line";
58286+
});
58287+
hideIds = utilArrayDifference(hideIds, selected);
58288+
layers.selectAll(utilEntitySelector(hideIds)).classed("nolabel", true);
5828258289
var debug2 = selection2.selectAll(".labels-group.debug");
5828358290
var gj = [];
5828458291
if (context.getDebug("collision")) {
@@ -74692,7 +74699,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tif
7469274699
};
7469374700
var annotation = _t("operations.change_tags.annotation");
7469474701
if (_coalesceChanges) {
74695-
context.overwrite(combinedAction, annotation);
74702+
context.replace(combinedAction, annotation);
7469674703
} else {
7469774704
context.perform(combinedAction, annotation);
7469874705
}
@@ -74735,7 +74742,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tif
7473574742
};
7473674743
var annotation = _t("operations.change_tags.annotation");
7473774744
if (_coalesceChanges) {
74738-
context.overwrite(combinedAction, annotation);
74745+
context.replace(combinedAction, annotation);
7473974746
} else {
7474074747
context.perform(combinedAction, annotation);
7474174748
}
@@ -82265,7 +82272,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tif
8226582272
return actionChangeTags(entityID, currTags);
8226682273
}).filter(Boolean);
8226782274
if (!actions.length) return;
82268-
context.overwrite(
82275+
context.replace(
8226982276
function actionUpdateWikipediaTags(graph) {
8227082277
actions.forEach(function(action) {
8227182278
graph = action(graph);
@@ -82495,7 +82502,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tif
8249582502
return null;
8249682503
}).filter(Boolean);
8249782504
if (!actions.length) return;
82498-
context.overwrite(
82505+
context.replace(
8249982506
function actionUpdateWikidataTags(graph) {
8250082507
actions.forEach(function(action) {
8250182508
graph = action(graph);
@@ -84427,22 +84434,24 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tif
8442784434
var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
8442884435
var _prevGraph;
8442984436
var _cache5;
84430-
var _prevMouse;
84437+
var _prevMouseCoords;
8443184438
var _nudgeInterval;
8443284439
var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
8443384440
function doMove(nudge) {
8443484441
nudge = nudge || [0, 0];
8443584442
let fn;
8443684443
if (_prevGraph !== context.graph()) {
8443784444
_cache5 = {};
84438-
_prevMouse = context.map().mouse();
84445+
_prevMouseCoords = context.map().mouseCoordinates();
8443984446
fn = context.perform;
8444084447
} else {
84441-
fn = context.overwrite;
84448+
fn = context.replace;
8444284449
}
84443-
const currMouse = context.map().mouse();
84444-
const delta = geoVecSubtract(geoVecSubtract(currMouse, _prevMouse), nudge);
84445-
_prevMouse = currMouse;
84450+
const currMouseCoords = context.map().mouseCoordinates();
84451+
const currMouse = context.projection(currMouseCoords);
84452+
const prevMouse = context.projection(_prevMouseCoords);
84453+
const delta = geoVecSubtract(geoVecSubtract(currMouse, prevMouse), nudge);
84454+
_prevMouseCoords = currMouseCoords;
8444684455
fn(actionMove(entityIDs, delta, context.projection, _cache5));
8444784456
_prevGraph = context.graph();
8444884457
}
@@ -84488,7 +84497,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e3.byteLength}`), e3.tif
8448884497
context.enter(modeBrowse(context));
8448984498
}
8449084499
mode.enter = function() {
84491-
_prevMouse = context.map().mouse();
84500+
_prevMouseCoords = context.map().mouseCoordinates();
8449284501
_prevGraph = null;
8449384502
_cache5 = {};
8449484503
context.features().forceVisible(entityIDs);

dist/iD.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iD.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/iD.min.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/core/history.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ export function coreHistory(context) {
8080
// internal _overwrite with eased time
8181
function _overwrite(args, t) {
8282
var previous = _stack[_index].graph;
83-
var actionResult = _act(args, t);
8483
if (_index > 0) {
8584
_index--;
8685
_stack.pop();
8786
}
8887
_stack = _stack.slice(0, _index + 1);
88+
var actionResult = _act(args, t);
8989
_stack.push(actionResult);
9090
_index++;
9191
return change(previous);

modules/modes/move.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function modeMove(context, entityIDs, baseGraph) {
4747

4848
var _prevGraph;
4949
var _cache;
50-
var _prevMouse;
50+
var _prevMouseCoords;
5151
var _nudgeInterval;
5252

5353
// use pointer events on supported platforms; fallback to mouse events
@@ -60,15 +60,17 @@ export function modeMove(context, entityIDs, baseGraph) {
6060
let fn;
6161
if (_prevGraph !== context.graph()) {
6262
_cache = {};
63-
_prevMouse = context.map().mouse();
63+
_prevMouseCoords = context.map().mouseCoordinates();
6464
fn = context.perform;
6565
} else {
66-
fn = context.overwrite;
66+
fn = context.replace;
6767
}
6868

69-
const currMouse = context.map().mouse();
70-
const delta = geoVecSubtract(geoVecSubtract(currMouse, _prevMouse), nudge);
71-
_prevMouse = currMouse;
69+
const currMouseCoords = context.map().mouseCoordinates();
70+
const currMouse = context.projection(currMouseCoords);
71+
const prevMouse = context.projection(_prevMouseCoords);
72+
const delta = geoVecSubtract(geoVecSubtract(currMouse, prevMouse), nudge);
73+
_prevMouseCoords = currMouseCoords;
7274

7375
fn(actionMove(entityIDs, delta, context.projection, _cache));
7476
_prevGraph = context.graph();
@@ -129,7 +131,7 @@ export function modeMove(context, entityIDs, baseGraph) {
129131

130132

131133
mode.enter = function() {
132-
_prevMouse = context.map().mouse();
134+
_prevMouseCoords = context.map().mouseCoordinates();
133135
_prevGraph = null;
134136
_cache = {};
135137

modules/svg/labels.js

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import { presetManager } from '../presets';
1212
import { osmEntity, osmIsInterestingTag } from '../osm';
1313
import { utilDetect } from '../util/detect';
14-
import { utilArrayDifference, utilDisplayName, utilDisplayNameForPath, utilEntitySelector } from '../util';
14+
import { utilArrayDifference, utilArrayUniq, utilDisplayName, utilDisplayNameForPath, utilEntitySelector } from '../util';
1515

1616

1717

@@ -692,20 +692,33 @@ export function svgLabels(projection, context) {
692692
layers.selectAll('.nolabel')
693693
.classed('nolabel', false);
694694

695-
var mouse = context.map().mouse();
696-
var ids = [];
697-
var pad, bbox;
695+
const graph = context.graph();
696+
const mouse = context.map().mouse();
697+
let bbox;
698+
let hideIds = [];
698699

699700
// hide labels near the mouse
700-
if (mouse && context.mode().id !== 'browse' && context.mode().id !== 'select') {
701-
pad = 20;
701+
if (mouse && context.mode().id !== 'browse') {
702+
const pad = 20;
702703
bbox = { minX: mouse[0] - pad, minY: mouse[1] - pad, maxX: mouse[0] + pad, maxY: mouse[1] + pad };
703-
var nearMouse = _rdrawn.search(bbox).map(function(entity) { return entity.id; });
704-
ids.push.apply(ids, nearMouse);
704+
const nearMouse = _rdrawn.search(bbox)
705+
.map(entity => entity.id)
706+
.filter(id =>
707+
context.mode().id !== 'select' ||
708+
// in select mode: hide labels of currently selected line(s)
709+
// to still allow accessing midpoints
710+
// https://github.com/openstreetmap/iD/issues/11220
711+
context.mode().selectedIDs().includes(id) && graph.hasEntity(id).geometry(graph) === 'line');
712+
hideIds.push.apply(hideIds, nearMouse);
713+
hideIds = utilArrayUniq(hideIds);
705714
}
706-
ids = utilArrayDifference(ids, context.mode()?.selectedIDs?.() || []);
707715

708-
layers.selectAll(utilEntitySelector(ids))
716+
// don't hide label of currently selected entity while in e.g. drag mode
717+
const selected = (context.mode()?.selectedIDs?.() || [])
718+
.filter(id => graph.hasEntity(id)?.geometry(graph) !== 'line');
719+
hideIds = utilArrayDifference(hideIds, selected);
720+
721+
layers.selectAll(utilEntitySelector(hideIds))
709722
.classed('nolabel', true);
710723

711724

modules/ui/entity_editor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export function uiEntityEditor(context) {
199199
var annotation = t('operations.change_tags.annotation');
200200

201201
if (_coalesceChanges) {
202-
context.overwrite(combinedAction, annotation);
202+
context.replace(combinedAction, annotation);
203203
} else {
204204
context.perform(combinedAction, annotation);
205205
}
@@ -256,7 +256,7 @@ export function uiEntityEditor(context) {
256256
var annotation = t('operations.change_tags.annotation');
257257

258258
if (_coalesceChanges) {
259-
context.overwrite(combinedAction, annotation);
259+
context.replace(combinedAction, annotation);
260260
} else {
261261
context.perform(combinedAction, annotation);
262262
}

modules/ui/fields/wikidata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export function uiFieldWikidata(field, context) {
259259
if (!actions.length) return;
260260

261261
// Coalesce the update of wikidata tag into the previous tag change
262-
context.overwrite(
262+
context.replace(
263263
function actionUpdateWikipediaTags(graph) {
264264
actions.forEach(function(action) {
265265
graph = action(graph);

0 commit comments

Comments
 (0)