mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 05:30:35 +02:00
Fix address field overwriting existing data when switching features
fixes #12060 This bug can occur occasionally under the following circumstances: * map feature 1 is selected * the cursor is in an address (sub) field * map feature 2 gets selected directly * now, in some cases, the contents of the address fields of feature 2 are written into feature 1's tags
This commit is contained in:
@@ -52,6 +52,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
* Fix icons with inline css styles not properly being displayed on osm.org
|
||||
* Properly sort map features with lifecycle prefixes in the _Past/Futures_ features ([#7582])
|
||||
* Only consider features with either `landuse`, `natural`, `amentiy` or `leisure` tag to be classified as _Landuse_ areas
|
||||
* Fix address field overwriting existing data when switching selected map features under certain circumstances ([#10260])
|
||||
#### :earth_asia: Localization
|
||||
#### :hourglass: Performance
|
||||
#### :mortar_board: Walkthrough / Help
|
||||
@@ -68,6 +69,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
[#10181]: https://github.com/openstreetmap/iD/pull/10181
|
||||
[#10255]: https://github.com/openstreetmap/iD/pull/10255
|
||||
[#10257]: https://github.com/openstreetmap/iD/pull/10257
|
||||
[#10260]: https://github.com/openstreetmap/iD/issues/10260
|
||||
[@zbycz]: https://github.com/zbycz
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { presetManager } from '../../presets';
|
||||
import { fileFetcher } from '../../core/file_fetcher';
|
||||
import { geoExtent, geoChooseEdge, geoSphericalDistance } from '../../geo';
|
||||
import { uiCombobox } from '../combobox';
|
||||
import { utilArrayUniqBy, utilGetSetValue, utilNoAuto, utilRebind, utilTotalExtent } from '../../util';
|
||||
import { utilArrayUniqBy, utilGetSetValue, utilNoAuto, utilRebind, utilTotalExtent, utilTriggerEvent } from '../../util';
|
||||
import { t } from '../../core/localizer';
|
||||
|
||||
|
||||
@@ -235,6 +235,7 @@ export function uiFieldAddress(field, context) {
|
||||
if (d.isAutoStreetPlace) {
|
||||
// set subtag depending on selected entry
|
||||
d.id = selected ? selected.type : 'street';
|
||||
utilTriggerEvent(d3_select(this), 'change');
|
||||
}
|
||||
})
|
||||
);
|
||||
@@ -283,35 +284,33 @@ export function uiFieldAddress(field, context) {
|
||||
|
||||
function change(onInput) {
|
||||
return function() {
|
||||
setTimeout(() => {
|
||||
var tags = {};
|
||||
var tags = {};
|
||||
|
||||
_wrap.selectAll('input')
|
||||
.each(function (subfield) {
|
||||
var key = field.key + ':' + subfield.id;
|
||||
_wrap.selectAll('input')
|
||||
.each(function (subfield) {
|
||||
var key = field.key + ':' + subfield.id;
|
||||
|
||||
var value = this.value;
|
||||
if (!onInput) value = context.cleanTagValue(value);
|
||||
var value = this.value;
|
||||
if (!onInput) value = context.cleanTagValue(value);
|
||||
|
||||
// don't override multiple values with blank string
|
||||
if (Array.isArray(_tags[key]) && !value) return;
|
||||
// don't override multiple values with blank string
|
||||
if (Array.isArray(_tags[key]) && !value) return;
|
||||
|
||||
if (subfield.isAutoStreetPlace) {
|
||||
if (subfield.id === 'street') {
|
||||
tags[`${field.key}:place`] = undefined;
|
||||
} else if (subfield.id === 'place') {
|
||||
tags[`${field.key}:street`] = undefined;
|
||||
}
|
||||
if (subfield.isAutoStreetPlace) {
|
||||
if (subfield.id === 'street') {
|
||||
tags[`${field.key}:place`] = undefined;
|
||||
} else if (subfield.id === 'place') {
|
||||
tags[`${field.key}:street`] = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
tags[key] = value || undefined;
|
||||
});
|
||||
tags[key] = value || undefined;
|
||||
});
|
||||
|
||||
Object.keys(tags)
|
||||
.filter(k => tags[k])
|
||||
.forEach(k => _tags[k] = tags[k]);
|
||||
dispatch.call('change', this, tags, onInput);
|
||||
}, 0);
|
||||
Object.keys(tags)
|
||||
.filter(k => tags[k])
|
||||
.forEach(k => _tags[k] = tags[k]);
|
||||
dispatch.call('change', this, tags, onInput);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user