mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-14 17:52:55 +00:00
add/make visible weakly matched presets
This commit is contained in:
@@ -503,8 +503,8 @@ export function coreContext() {
|
||||
features.init();
|
||||
if (utilStringQs(window.location.hash).presets) {
|
||||
var external = utilStringQs(window.location.hash).presets;
|
||||
presets.fromExternal(external, function(externalPresets){
|
||||
presets = externalPresets; // default + external presets...
|
||||
presets.fromExternal(external, function(externalPresets) {
|
||||
context.presets = function() { return externalPresets; }; // default + external presets...
|
||||
areaKeys = presets.areaKeys();
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -73,7 +73,6 @@ export function presetIndex() {
|
||||
if (address && (!match || match.isFallback())) {
|
||||
match = address;
|
||||
}
|
||||
|
||||
return match || all.item(geometry);
|
||||
});
|
||||
};
|
||||
@@ -139,13 +138,23 @@ export function presetIndex() {
|
||||
|
||||
if (d.presets) {
|
||||
_forEach(d.presets, function(d, id) {
|
||||
all.collection.push(presetPreset(id, d, _fields, visible));
|
||||
var existing = all.collection.findIndex(function(p) { return p.id === id; });
|
||||
if (existing !== -1) {
|
||||
all.collection[existing] = presetPreset(id, d, _fields, visible);
|
||||
} else {
|
||||
all.collection.push(presetPreset(id, d, _fields, visible));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (d.categories) {
|
||||
_forEach(d.categories, function(d, id) {
|
||||
all.collection.push(presetCategory(id, d, all));
|
||||
var existing = all.collection.findIndex(function(p) { return p.id === id; });
|
||||
if (existing !== -1) {
|
||||
all.collection[existing] = presetCategory(id, d, all);
|
||||
} else {
|
||||
all.collection.push(presetCategory(id, d, all));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -165,7 +174,7 @@ export function presetIndex() {
|
||||
var geometry = preset.geometry;
|
||||
|
||||
for (var j = 0; j < geometry.length; j++) {
|
||||
var g = _index[geometry[j]];
|
||||
var g = _index[geometry[j]];
|
||||
for (var k in preset.tags) {
|
||||
(g[k] = g[k] || []).push(preset);
|
||||
}
|
||||
|
||||
@@ -218,6 +218,8 @@ export function uiEntityEditor(context) {
|
||||
// A "weak" preset doesn't set any tags. (e.g. "Address")
|
||||
// Don't replace a weak preset with a fallback preset (e.g. "Point")
|
||||
if (!(weakPreset && match.isFallback())) {
|
||||
match.visible(true);
|
||||
context.presets().choose(match);
|
||||
entityEditor.preset(match);
|
||||
}
|
||||
entityEditor.modified(_base !== graph);
|
||||
@@ -250,6 +252,7 @@ export function uiEntityEditor(context) {
|
||||
context.overwrite(actionChangeTags(_entityID, tags), annotation);
|
||||
} else {
|
||||
context.perform(actionChangeTags(_entityID, tags), annotation);
|
||||
// context.presets().choose(context.presets().match(context.graph))
|
||||
_coalesceChanges = !!onInput;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user