mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Fix issue where the favorite preset button could be stale
Use first in, first out favoriting order
This commit is contained in:
@@ -325,12 +325,13 @@ export function coreContext() {
|
||||
return !(d.id === preset.id && d.geom === geom);
|
||||
});
|
||||
} else {
|
||||
//only allow 3 favorites
|
||||
//replace the last one
|
||||
// only allow 3 favorites
|
||||
if (favs.length === 3) {
|
||||
favs = favs.slice(0,2);
|
||||
// remove the last favorite (first in, first out)
|
||||
favs.pop();
|
||||
}
|
||||
favs.push({id: preset.id, geom: geom});
|
||||
// prepend array
|
||||
favs.unshift({id: preset.id, geom: geom});
|
||||
}
|
||||
|
||||
context.storage('favorite_presets', JSON.stringify(favs));
|
||||
|
||||
@@ -340,8 +340,8 @@ export function uiEntityEditor(context) {
|
||||
_activePreset = val;
|
||||
_tagReference = uiTagReference(_activePreset.reference(context.geometry(_entityID)), context)
|
||||
.showing(false);
|
||||
_presetFavorite = uiPresetFavorite(_activePreset, context.geometry(_entityID), context);
|
||||
}
|
||||
_presetFavorite = uiPresetFavorite(_activePreset, context.geometry(_entityID), context);
|
||||
return entityEditor;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user