diff --git a/CHANGELOG.md b/CHANGELOG.md index 432c76107..399842910 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/modules/presets/index.js b/modules/presets/index.js index c0b4c9358..67c0be810 100644 --- a/modules/presets/index.js +++ b/modules/presets/index.js @@ -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)) { diff --git a/modules/ui/preset_list.js b/modules/ui/preset_list.js index c06275dd5..faf46313b 100644 --- a/modules/ui/preset_list.js +++ b/modules/ui/preset_list.js @@ -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); }