diff --git a/js/id/modes/select.js b/js/id/modes/select.js index cd47ac3a2..9a4ead7ba 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -72,10 +72,12 @@ iD.modes.Select = function(context, selection, initial) { }); operations.forEach(function(operation) { - keybinding.on(operation.key, function() { - if (operation.enabled()) { - operation(); - } + operation.keys.forEach(function(key) { + keybinding.on(key, function() { + if (operation.enabled()) { + operation(); + } + }); }); }); diff --git a/js/id/operations/circularize.js b/js/id/operations/circularize.js index 2680da4ec..b0b923420 100644 --- a/js/id/operations/circularize.js +++ b/js/id/operations/circularize.js @@ -17,7 +17,7 @@ iD.operations.Circularize = function(selection, context) { }; operation.id = "circularize"; - operation.key = t('operations.circularize.key'); + operation.keys = [t('operations.circularize.key')]; operation.title = t('operations.circularize.title'); operation.description = t('operations.circularize.description'); diff --git a/js/id/operations/delete.js b/js/id/operations/delete.js index 45d349c07..d74c7980b 100644 --- a/js/id/operations/delete.js +++ b/js/id/operations/delete.js @@ -24,7 +24,7 @@ iD.operations.Delete = function(selection, context) { }; operation.id = "delete"; - operation.key = t('operations.delete.key'); + operation.keys = [iD.ui.cmd('⌫'), iD.ui.cmd('⌦')]; operation.title = t('operations.delete.title'); operation.description = t('operations.delete.description'); diff --git a/js/id/operations/disconnect.js b/js/id/operations/disconnect.js index c8cc0d014..e64653626 100644 --- a/js/id/operations/disconnect.js +++ b/js/id/operations/disconnect.js @@ -16,7 +16,7 @@ iD.operations.Disconnect = function(selection, context) { }; operation.id = "disconnect"; - operation.key = t('operations.disconnect.key'); + operation.keys = [t('operations.disconnect.key')]; operation.title = t('operations.disconnect.title'); operation.description = t('operations.disconnect.description'); diff --git a/js/id/operations/merge.js b/js/id/operations/merge.js index 6202f1b3f..5120e7d53 100644 --- a/js/id/operations/merge.js +++ b/js/id/operations/merge.js @@ -26,7 +26,7 @@ iD.operations.Merge = function(selection, context) { }; operation.id = "merge"; - operation.key = t('operations.merge.key'); + operation.keys = [t('operations.merge.key')]; operation.title = t('operations.merge.title'); operation.description = t('operations.merge.description'); diff --git a/js/id/operations/move.js b/js/id/operations/move.js index 22d913ce0..23e9bdcc6 100644 --- a/js/id/operations/move.js +++ b/js/id/operations/move.js @@ -14,7 +14,7 @@ iD.operations.Move = function(selection, context) { }; operation.id = "move"; - operation.key = t('operations.move.key'); + operation.keys = [t('operations.move.key')]; operation.title = t('operations.move.title'); operation.description = t('operations.move.description'); diff --git a/js/id/operations/orthogonalize.js b/js/id/operations/orthogonalize.js index c59ed13e4..0426f936c 100644 --- a/js/id/operations/orthogonalize.js +++ b/js/id/operations/orthogonalize.js @@ -17,7 +17,7 @@ iD.operations.Orthogonalize = function(selection, context) { }; operation.id = "orthogonalize"; - operation.key = t('operations.orthogonalize.key'); + operation.keys = [t('operations.orthogonalize.key')]; operation.title = t('operations.orthogonalize.title'); operation.description = t('operations.orthogonalize.description'); diff --git a/js/id/operations/reverse.js b/js/id/operations/reverse.js index f750c134d..cc341b1f9 100644 --- a/js/id/operations/reverse.js +++ b/js/id/operations/reverse.js @@ -17,7 +17,7 @@ iD.operations.Reverse = function(selection, context) { }; operation.id = "reverse"; - operation.key = t('operations.reverse.key'); + operation.keys = [t('operations.reverse.key')]; operation.title = t('operations.reverse.title'); operation.description = t('operations.reverse.description'); diff --git a/js/id/operations/rotate.js b/js/id/operations/rotate.js index 1c9804aaa..8946a8707 100644 --- a/js/id/operations/rotate.js +++ b/js/id/operations/rotate.js @@ -16,7 +16,7 @@ iD.operations.Rotate = function(selection, context) { }; operation.id = "rotate"; - operation.key = t('operations.rotate.key'); + operation.keys = [t('operations.rotate.key')]; operation.title = t('operations.rotate.title'); operation.description = t('operations.rotate.description'); diff --git a/js/id/operations/split.js b/js/id/operations/split.js index f49f4b9ed..08a10d8d3 100644 --- a/js/id/operations/split.js +++ b/js/id/operations/split.js @@ -18,7 +18,7 @@ iD.operations.Split = function(selection, context) { }; operation.id = "split"; - operation.key = t('operations.split.key'); + operation.keys = [t('operations.split.key')]; operation.title = t('operations.split.title'); operation.description = t('operations.split.description'); diff --git a/js/id/ui/cmd.js b/js/id/ui/cmd.js index 9876da236..7c16e90ee 100644 --- a/js/id/ui/cmd.js +++ b/js/id/ui/cmd.js @@ -4,15 +4,17 @@ iD.ui.cmd = function(code) { if (iD.detect().os === 'mac') return code; - var modifiers = { + var replacements = { '⌘': 'Ctrl', '⇧': 'Shift', - '⌥': 'Alt' + '⌥': 'Alt', + '⌫': 'Backspace', + '⌦': 'Delete' }, keys = []; for (var i = 0; i < code.length; i++) { - if (code[i] in modifiers) { - keys.push(modifiers[code[i]]); + if (code[i] in replacements) { + keys.push(replacements[code[i]]); } else { keys.push(code[i]); } diff --git a/js/id/ui/preset_grid.js b/js/id/ui/preset_grid.js index ee5759c68..cc52b5eed 100644 --- a/js/id/ui/preset_grid.js +++ b/js/id/ui/preset_grid.js @@ -28,7 +28,9 @@ iD.ui.PresetGrid = function(context) { .attr('type', 'search') .on('keydown', function() { // hack to let delete shortcut work when search is autofocused - if (d3.event.keyCode === 46 && search.property('value').length === 0) { + if (search.property('value').length === 0 && + (d3.event.keyCode === d3.keybinding.keyCodes['⌫'] || + d3.event.keyCode === d3.keybinding.keyCodes['⌦'])) { annotation = t('operations.delete.annotation.' + context.geometry(entity.id)); context.perform( iD.actions.DeleteMultiple([entity.id]), diff --git a/js/id/ui/radial_menu.js b/js/id/ui/radial_menu.js index 17826d620..20c1f44f3 100644 --- a/js/id/ui/radial_menu.js +++ b/js/id/ui/radial_menu.js @@ -84,7 +84,7 @@ iD.ui.RadialMenu = function(operations) { .append('span') .style('position', 'static') .attr('class', 'keyhint') - .text(d.key.replace('⌫', 'Esc')); + .text(d.keys[0]); } function mouseout() { diff --git a/locale/da.js b/locale/da.js index 1c2b19eba..9b290492d 100644 --- a/locale/da.js +++ b/locale/da.js @@ -73,7 +73,6 @@ locale.da = { 'delete': { title: "Slet", description: "Fjern dette fra kortet.", - key: "⌦", annotation: { point: "Slettede et punkt.", vertex: "Slettede en node fra en vej.", diff --git a/locale/de.js b/locale/de.js index 111077a6c..bd9978900 100644 --- a/locale/de.js +++ b/locale/de.js @@ -73,7 +73,6 @@ locale.de = { 'delete': { title: "Löschen", description: "Lösche dies aus der Karte.", - key: "⌦", annotation: { point: "Punkt gelöscht.", vertex: "Stützpunkt aus einem Weg gelöscht.", diff --git a/locale/en.js b/locale/en.js index 7ff6bfff8..55ef464ad 100644 --- a/locale/en.js +++ b/locale/en.js @@ -73,7 +73,6 @@ locale.en = { 'delete': { title: "Delete", description: "Remove this from the map.", - key: "⌦", annotation: { point: "Deleted a point.", vertex: "Deleted a node from a way.", diff --git a/locale/es.js b/locale/es.js index 1cca7e7f6..b336946d4 100644 --- a/locale/es.js +++ b/locale/es.js @@ -73,7 +73,6 @@ locale.es = { 'delete': { title: "Eliminar", //"Delete", description: "Eliminar del mapa.", //"Remove this from the map.", - key: "⌦", annotation: { point: "Punto eliminado.", //"Deleted a point.", vertex: "Vértice elimnado de la ruta.", //"Deleted a node from a way.", diff --git a/locale/fr.js b/locale/fr.js index e1c6a67f0..b4e568fd2 100644 --- a/locale/fr.js +++ b/locale/fr.js @@ -73,7 +73,6 @@ locale.fr = { 'delete': { title: "Supprimer", description: "Supprime l'élément de la carte.", - key: "⌦", annotation: { point: "Supprime un point.", vertex: "Supprime le noeud d'une ligne.", diff --git a/locale/it.js b/locale/it.js index 29393c3f6..fe144f233 100644 --- a/locale/it.js +++ b/locale/it.js @@ -73,7 +73,6 @@ locale.it = { 'delete': { title: "Cancella", description: "Cancella questo dalla mappa.", - key: "⌦", annotation: { point: "Cancellato un punto.", vertex: "Cancellato un punto da una linea.", diff --git a/locale/ja.js b/locale/ja.js index 13b43d5d0..cf9475bfa 100644 --- a/locale/ja.js +++ b/locale/ja.js @@ -73,7 +73,6 @@ locale.ja = { 'delete': { title: "削除", description: "この地物をマップから削除", - key: "⌦", annotation: { point: "ポイントを削除", vertex: "ウェイ上のノードを削除", diff --git a/locale/lv.js b/locale/lv.js index fca92b82b..0878e3bff 100644 --- a/locale/lv.js +++ b/locale/lv.js @@ -73,7 +73,6 @@ locale.lv = { 'delete': { title: "Dzēst", description: "Izdzēst no kartes.", - key: "⌦", annotation: { point: "Punkts dzēsts.", vertex: "Mezgls dzests.", diff --git a/locale/nl.js b/locale/nl.js index 04bb5a9ec..ea61e7781 100644 --- a/locale/nl.js +++ b/locale/nl.js @@ -73,7 +73,6 @@ locale.nl = { 'delete': { title: "Verwijderen", description: "Verwijder dit van de kaart.", - key: "⌦", annotation: { point: "Punt verwijderd.", vertex: "Knoop uit een weg verwijderd.", diff --git a/locale/pl.js b/locale/pl.js index 3acc10a3a..80dcfcd82 100644 --- a/locale/pl.js +++ b/locale/pl.js @@ -73,7 +73,6 @@ locale.pl = { 'delete': { title: "Usuń", description: "Usuń to z mapy.", - key: "⌦", annotation: { point: "Usunięto punkt.", vertex: "Usunięto węzeł z drogi.", diff --git a/locale/ru.js b/locale/ru.js index 9edb658dd..4b10adfdd 100644 --- a/locale/ru.js +++ b/locale/ru.js @@ -73,7 +73,6 @@ locale.ru = { 'delete': { title: "Удалить", description: "Убрать объект с карты.", - key: "⌦", annotation: { point: "Удалена точка.", vertex: "Удалёна точка из линии.", diff --git a/locale/tr.js b/locale/tr.js index 847030963..fcd0beef4 100644 --- a/locale/tr.js +++ b/locale/tr.js @@ -73,7 +73,6 @@ locale.tr = { 'delete': { title: "Sil", description: "Haritan bunu sil.", - key: "⌦", annotation: { point: "Bir nokta silindi.", vertex: "Yoldan bir nod silindi.", diff --git a/locale/uk.js b/locale/uk.js index b73d312db..0b70fc811 100644 --- a/locale/uk.js +++ b/locale/uk.js @@ -73,7 +73,6 @@ locale.uk = { 'delete': { title: "Вилучити", description: "Вилучити об’єкт з мапи.", - key: "⌦", annotation: { point: "Вилучено точку.", vertex: "Вилучено точку з лінії.", diff --git a/locale/vi.js b/locale/vi.js index 9bdabda1c..3aef32938 100644 --- a/locale/vi.js +++ b/locale/vi.js @@ -73,7 +73,6 @@ locale.vi = { 'delete': { title: "Xóa", description: "Xóa đối tượng này khỏi bản đồ.", - key: "⌦", annotation: { point: "Xóa địa điểm.", vertex: "Xóa nốt khỏi lối.",