From 4a9ce557931ddd7d16d7cf7d5cdb1551e65e41c5 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 4 Mar 2013 11:29:03 -0500 Subject: [PATCH] let delete shortcut work on empty preset search --- js/id/ui/inspector.js | 3 +++ js/id/ui/preset_grid.js | 12 +++++++++++- locale/da.js | 2 +- locale/de.js | 2 +- locale/en.js | 2 +- locale/es.js | 2 +- locale/fr.js | 2 +- locale/it.js | 2 +- locale/ja.js | 2 +- locale/lv.js | 2 +- locale/nl.js | 2 +- locale/pl.js | 2 +- locale/ru.js | 2 +- locale/tr.js | 2 +- locale/uk.js | 2 +- locale/vi.js | 2 +- 16 files changed, 28 insertions(+), 15 deletions(-) diff --git a/js/id/ui/inspector.js b/js/id/ui/inspector.js index 3909c4788..7a00f970e 100644 --- a/js/id/ui/inspector.js +++ b/js/id/ui/inspector.js @@ -11,6 +11,9 @@ iD.ui.Inspector = function(context) { var presetGrid = iD.ui.PresetGrid(context) .entity(entity) + .on('close', function() { + event.close(); + }) .on('choose', function(preset) { inspectorbody.call(tagEditor, preset); }); diff --git a/js/id/ui/preset_grid.js b/js/id/ui/preset_grid.js index e3eb76236..37f77861b 100644 --- a/js/id/ui/preset_grid.js +++ b/js/id/ui/preset_grid.js @@ -1,5 +1,5 @@ iD.ui.PresetGrid = function(context) { - var event = d3.dispatch('choose'), + var event = d3.dispatch('choose', 'close'), entity, presets = context.presets(), taginfo = iD.taginfo(); @@ -26,6 +26,16 @@ iD.ui.PresetGrid = function(context) { var search = searchwrap.append('input') .attr('class', 'preset-grid-search') .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) { + annotation = t('operations.delete.annotation.' + context.geometry(entity.id)); + context.perform( + iD.actions.DeleteMultiple([entity.id]), + annotation); + event.close(); + } + }) .on('keyup', function() { // enter var value = search.property('value'); diff --git a/locale/da.js b/locale/da.js index dfcb28daf..2c3853bfb 100644 --- a/locale/da.js +++ b/locale/da.js @@ -73,7 +73,7 @@ locale.da = { 'delete': { title: "Slet", description: "Fjern dette fra kortet.", - key: "⌫", + key: "⌦", annotation: { point: "Slettede et punkt.", vertex: "Slettede en node fra en vej.", diff --git a/locale/de.js b/locale/de.js index 7667de056..2bd98f50d 100644 --- a/locale/de.js +++ b/locale/de.js @@ -73,7 +73,7 @@ locale.de = { 'delete': { title: "Löschen", description: "Lösche dies aus der Karte.", - key: "⌫", + 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 cf6bdfd2b..7ff6bfff8 100644 --- a/locale/en.js +++ b/locale/en.js @@ -73,7 +73,7 @@ locale.en = { 'delete': { title: "Delete", description: "Remove this from the map.", - key: "⌫", + key: "⌦", annotation: { point: "Deleted a point.", vertex: "Deleted a node from a way.", diff --git a/locale/es.js b/locale/es.js index b3b3f2c65..8d69b0824 100644 --- a/locale/es.js +++ b/locale/es.js @@ -73,7 +73,7 @@ locale.es = { 'delete': { title: "Eliminar", //"Delete", description: "Eliminar del mapa.", //"Remove this from the map.", - key: "⌫", + 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 8150725b0..3dcab57cc 100644 --- a/locale/fr.js +++ b/locale/fr.js @@ -73,7 +73,7 @@ locale.fr = { 'delete': { title: "Supprimer", description: "Supprime l'élément de la carte.", - key: "⌫", + key: "⌦", annotation: { point: "Supprime un point.", vertex: "Supprime le noeud d'une ligne.", diff --git a/locale/it.js b/locale/it.js index dd7960a9a..a9dd04d69 100644 --- a/locale/it.js +++ b/locale/it.js @@ -73,7 +73,7 @@ locale.it = { 'delete': { title: "Cancella", description: "Cancella questo dalla mappa.", - key: "⌫", + key: "⌦", annotation: { point: "Cancellato un punto.", vertex: "Cancellato un punto da una linea.", diff --git a/locale/ja.js b/locale/ja.js index 13261ecb3..e03df290d 100644 --- a/locale/ja.js +++ b/locale/ja.js @@ -73,7 +73,7 @@ locale.ja = { 'delete': { title: "削除", description: "この地物をマップから削除", - key: "⌫", + key: "⌦", annotation: { point: "ポイントを削除", vertex: "ウェイ上のノードを削除", diff --git a/locale/lv.js b/locale/lv.js index e4e635079..cddb729db 100644 --- a/locale/lv.js +++ b/locale/lv.js @@ -73,7 +73,7 @@ locale.lv = { 'delete': { title: "Dzēst", description: "Izdzēst no kartes.", - key: "⌫", + key: "⌦", annotation: { point: "Punkts dzēsts.", vertex: "Mezgls dzests.", diff --git a/locale/nl.js b/locale/nl.js index c7c888895..188aec4c8 100644 --- a/locale/nl.js +++ b/locale/nl.js @@ -73,7 +73,7 @@ locale.nl = { 'delete': { title: "Verwijderen", description: "Verwijder dit van de kaart.", - key: "⌫", + key: "⌦", annotation: { point: "Punt verwijderd.", vertex: "Knoop uit een weg verwijderd.", diff --git a/locale/pl.js b/locale/pl.js index 9b1c55268..340f1de2e 100644 --- a/locale/pl.js +++ b/locale/pl.js @@ -73,7 +73,7 @@ locale.pl = { 'delete': { title: "Usuń", description: "Usuń to z mapy.", - key: "⌫", + key: "⌦", annotation: { point: "Usunięto punkt.", vertex: "Usunięto węzeł z drogi.", diff --git a/locale/ru.js b/locale/ru.js index f4c0b7fd2..a07a05d9a 100644 --- a/locale/ru.js +++ b/locale/ru.js @@ -73,7 +73,7 @@ locale.ru = { 'delete': { title: "Удалить", description: "Убрать объект с карты.", - key: "⌫", + key: "⌦", annotation: { point: "Удалена точка.", vertex: "Удалёна точка из линии.", diff --git a/locale/tr.js b/locale/tr.js index 7e2ff3bcb..bcb5d6eed 100644 --- a/locale/tr.js +++ b/locale/tr.js @@ -73,7 +73,7 @@ locale.tr = { 'delete': { title: "Sil", description: "Haritan bunu sil.", - key: "⌫", + key: "⌦", annotation: { point: "Bir nokta silindi.", vertex: "Yoldan bir nod silindi.", diff --git a/locale/uk.js b/locale/uk.js index dabf4d808..2dfbd5619 100644 --- a/locale/uk.js +++ b/locale/uk.js @@ -73,7 +73,7 @@ locale.uk = { 'delete': { title: "Вилучити", description: "Вилучити об’єкт з мапи.", - key: "⌫", + key: "⌦", annotation: { point: "Вилучено точку.", vertex: "Вилучено точку з лінії.", diff --git a/locale/vi.js b/locale/vi.js index 7ccb44b03..8b5afad93 100644 --- a/locale/vi.js +++ b/locale/vi.js @@ -73,7 +73,7 @@ locale.vi = { 'delete': { title: "Xóa", description: "Xóa đối tượng này khỏi bản đồ.", - key: "⌫", + key: "⌦", annotation: { point: "Xóa địa điểm.", vertex: "Xóa nốt khỏi lối.",