diff --git a/data/shortcuts.json b/data/shortcuts.json index ac17243df..3fe790fbf 100644 --- a/data/shortcuts.json +++ b/data/shortcuts.json @@ -4,77 +4,47 @@ "desc": "shortcuts.display.desc", "shortcuts": [ { - "shortcut": [ - "↓", - "↑", - "←", - "→" - ], + "shortcut": ["↓", "↑", "←", "→"], "key": "shortcuts.display.pan_map" }, { - "shortcut": [ - "⇧↓", - "⇧↑", - "⇧←", - "⇧→" - ], + "shortcut": ["⇧↓", "⇧↑", "⇧←", "⇧→"], "key": "shortcuts.display.pan_map_screen" }, { - "shortcut": [ - "+", - "-" - ], + "shortcut": ["+", "-"], "key": "shortcuts.display.zoom" }, { - "shortcut": [ - "⌘+", - "⌘-" - ], + "shortcut": ["⌘+", "⌘-"], "key": "shortcuts.display.zoom_large" }, { - "shortcut": [ - "B" - ], + "shortcut": ["B"], "key": "shortcuts.display.bg_switcher" }, { - "shortcut": [ - "⌘B" - ], + "shortcut": ["⌘B"], "key": "shortcuts.display.bg" }, { - "shortcut": [ - "W" - ], + "shortcut": ["W"], "key": "shortcuts.display.wireframe" }, { - "shortcut": [ - "H" - ], + "shortcut": ["H"], "key": "shortcuts.display.help" }, { - "shortcut": [ - "/" - ], + "shortcut": ["/"], "key": "shortcuts.display.minimap" }, { - "shortcut": [ - "⌘I" - ], + "shortcut": ["⌘I"], "key": "shortcuts.display.infobox" }, { - "shortcut": [ - "Space" - ], + "shortcut": ["Space"], "key": "shortcuts.display.radial_menu" } ] @@ -84,54 +54,37 @@ "desc": "shortcuts.edit.desc", "shortcuts": [ { - "shortcut": [ - "1" - ], + "shortcut": ["1"], "key": "shortcuts.edit.add_point" }, { - "shortcut": [ - "2" - ], + "shortcut": ["2"], "key": "shortcuts.edit.add_line" }, { - "shortcut": [ - "3" - ], + "shortcut": ["3"], "key": "shortcuts.edit.add_area" }, { - "shortcut": [ - "A" - ], + "shortcut": ["A"], "key": "shortcuts.edit.continue_line" }, { - "shortcut": [ - "↵ Enter", - "Esc" - ], + "shortcut": ["↵ Enter", "Esc"], "key": "shortcuts.edit.stop_line" }, { - "shortcut": [ - "⌘Z" - ], + "shortcut": ["⌘Z"], "key": "shortcuts.edit.undo" }, { - "shortcut": [ - "⌘⇧Z" - ], + "shortcut": ["⌘⇧Z"], "key": "shortcuts.edit.redo" }, { - "shortcut": [ - "⌘S" - ], + "shortcut": ["⌘S"], "key": "shortcuts.edit.save" } ] } -]} \ No newline at end of file +]} diff --git a/modules/ui/shortcuts.js b/modules/ui/shortcuts.js index a0a2c69fa..3b20ecf33 100644 --- a/modules/ui/shortcuts.js +++ b/modules/ui/shortcuts.js @@ -5,6 +5,7 @@ import { d3keybinding } from '../lib/d3.keybinding.js'; import { t } from '../util/locale'; import { dataShortcuts } from '../../data'; + export function uiShortcuts() { var key = '⇧/'; var activeTab = 0; @@ -23,7 +24,8 @@ export function uiShortcuts() { d3.select(document) .call(keybinding); - + + function shortcutsModal(modalSelection) { modalSelection.select('.modal') .attr('class', 'modal modal-shortcuts fillL col6'); @@ -35,11 +37,12 @@ export function uiShortcuts() { .attr('class', 'modal-section') .append('h3') .text(t('shortcuts.modal.title')); - + shortcutsModal .call(renderTabs); } + function renderTabs(selection) { var wrapper = selection .selectAll('.wrapper') @@ -133,6 +136,7 @@ export function uiShortcuts() { }); } + return function(selection, show) { savedSelection = selection; if (show) {