mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-26 15:33:50 +00:00
Allow up to 10 favorite presets
Show favorite preset keyboard shortcut in tooltip
This commit is contained in:
@@ -325,8 +325,8 @@ export function coreContext() {
|
||||
return !(d.id === preset.id && d.geom === geom);
|
||||
});
|
||||
} else {
|
||||
// only allow 3 favorites
|
||||
if (favs.length === 3) {
|
||||
// only allow 10 favorites
|
||||
if (favs.length === 10) {
|
||||
// remove the last favorite (first in, first out)
|
||||
favs.pop();
|
||||
}
|
||||
|
||||
@@ -86,6 +86,13 @@ export function uiModes(context) {
|
||||
preset: preset,
|
||||
geometry: d.geom
|
||||
};
|
||||
var keyCode = index + 1;
|
||||
if (keyCode <= 10) {
|
||||
if (keyCode === 10) {
|
||||
keyCode = 0;
|
||||
}
|
||||
favoriteMode.key = keyCode.toString();
|
||||
}
|
||||
var mode;
|
||||
switch (d.geom) {
|
||||
case 'point':
|
||||
@@ -98,12 +105,9 @@ export function uiModes(context) {
|
||||
case 'area':
|
||||
mode = modeAddArea(context, favoriteMode);
|
||||
}
|
||||
var keyCode = index + 1;
|
||||
if (keyCode <= 10) {
|
||||
if (keyCode === 10) {
|
||||
keyCode = 0;
|
||||
}
|
||||
context.keybinding().on(keyCode.toString(), function() {
|
||||
|
||||
if (mode.key) {
|
||||
context.keybinding().on(mode.key, function() {
|
||||
if (!enabled(mode)) return;
|
||||
|
||||
if (mode.button === context.mode().button) {
|
||||
|
||||
Reference in New Issue
Block a user