include matching preset of selected object in preset selection list

see https://github.com/openstreetmap/iD/issues/9298#issuecomment-1250929094
This commit is contained in:
Martin Raifer
2022-09-23 15:12:22 +02:00
parent 4f34e28431
commit e9eb0a0b3a
3 changed files with 10 additions and 4 deletions
+2
View File
@@ -75,6 +75,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
* Add fallback values for access field for barrier presets
* Support incrementing cardinal directions with the up/down buttons ([#9141], thanks [@k-yle])
* Don't suggest (newly) hidden presets in preset selection list
* Always include the current matching preset of the selected object in the preset selection list ([#9298])
#### :hammer: Development
* Reduce uses of unsafe html injecting code
* Upgrade dependencies: maki to `v8.0`, `osm-community-index` to `v5.2`, `d3` to `v7.6`, `togeojson` to `v5.2`, `mocha` to `v10`
@@ -104,6 +105,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
[#9293]: https://github.com/openstreetmap/iD/issues/9293
[#9241]: https://github.com/openstreetmap/iD/pull/9241
[#9242]: https://github.com/openstreetmap/iD/pull/9242
[#9298]: https://github.com/openstreetmap/iD/issues/9298
[@furkanmutlu]: https://github.com/furkanmutlu
[@JackNUMBER]: https://github.com/JackNUMBER
[@aaditya0000]: https://github.com/aaditya0000
+2 -2
View File
@@ -386,7 +386,7 @@ export function presetIndex() {
_this.universal = () => _universal;
_this.defaults = (geometry, n, startWithRecents, loc) => {
_this.defaults = (geometry, n, startWithRecents, loc, extraPresets) => {
let recents = [];
if (startWithRecents) {
recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
@@ -404,7 +404,7 @@ export function presetIndex() {
}
let result = presetCollection(
utilArrayUniq(recents.concat(defaults)).slice(0, n - 1)
utilArrayUniq(recents.concat(defaults).concat(extraPresets)).slice(0, n - 1)
);
if (Array.isArray(loc)) {
+6 -2
View File
@@ -104,7 +104,9 @@ export function uiPresetList(context) {
search: value
});
} else {
results = presetManager.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc);
var entityPresets = _entityIDs.map(entityID =>
presetManager.match(context.graph().entity(entityID), context.graph()));
results = presetManager.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets);
messageText = t.html('inspector.choose');
}
list.call(drawList, results);
@@ -142,10 +144,12 @@ export function uiPresetList(context) {
.append('div')
.attr('class', 'inspector-body');
var entityPresets = _entityIDs.map(entityID =>
presetManager.match(context.graph().entity(entityID), context.graph()));
var list = listWrap
.append('div')
.attr('class', 'preset-list')
.call(drawList, presetManager.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc));
.call(drawList, presetManager.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
context.features().on('change.preset-list', updateForFeatureHiddenState);
}