From 5e8ad595b0d9f3f01f22fda226caaceae094ff93 Mon Sep 17 00:00:00 2001 From: Kushan Joshi <0o3ko0@gmail.com> Date: Wed, 8 Feb 2017 17:28:16 +0530 Subject: [PATCH] interim --- data/core.yaml | 26 +++++ data/shortcuts.json | 232 ++++++++++++++++++++++++---------------- modules/ui/shortcuts.js | 8 +- 3 files changed, 167 insertions(+), 99 deletions(-) diff --git a/data/core.yaml b/data/core.yaml index 0d9695e18..d84d076dc 100644 --- a/data/core.yaml +++ b/data/core.yaml @@ -1016,3 +1016,29 @@ en: help: "You're now ready to edit OpenStreetMap!{br}You can replay this walkthrough anytime or view more documentation by clicking the {button} Help button." save: "Don't forget to regularly save your changes!" start: "Start mapping!" +shortcuts: + display: + desc: "Changing the display" + shortcuts: + pan_map: "Pan map" + pan_map_screen: "Pan map by one screenful" + zoom: "Zoom in / Zoom out" + zoom_large: "Zoom in / Zoom out by a lot" + bg_switcher: "Display background layer switcher" + bg: "Switch between previous and current backgrounds" + wireframe: "Toggle wireframe mode" + help: "Show in-editor help/documentation" + minimap: "Toggle minimap" + infobox: "Toggle info/measurements box" + radial_menu: "Toggle radial menu for currently selected object" + edit: + desc: "Editing mode" + shortcuts: + add_point: "Switch to 'add point' mode" + add_line: "Switch to 'add line' mode" + add_area: "Switch to 'add area' mode" + continue_line: "Continue drawing a line at the selected node" + stop_line: "Stop drawing of a line or area" + undo: "Undo last action" + redo: "Redo last action" + save: "Save changes" \ No newline at end of file diff --git a/data/shortcuts.json b/data/shortcuts.json index ce0206929..ca0b68e24 100644 --- a/data/shortcuts.json +++ b/data/shortcuts.json @@ -1,95 +1,137 @@ -{ - "dataShortcuts": [ - { - "desc": "Changing the display", - "shortcuts": [ - { - "keys": ["↓", "↑", "←", "→"], - "desc": "Pan map" - }, - { - "keys": ["⇧↓", "⇧↑", "⇧←", "⇧→"], - "desc": "Pan map by one screenful" - }, - { - "keys": ["+", "-"], - "desc": "Zoom in / Zoom out" - }, - { - "keys": ["⌘+", "⌘-"], - "desc": "Zoom in / Zoom out by a lot" - }, - { - "keys": ["B"], - "desc": "Display background layer switcher" - }, - { - "keys": ["⌘B"], - "desc": "Switch between previous and current backgrounds" - }, - { - "keys": ["W"], - "desc": "Toggle wireframe mode" - }, - { - "keys": ["H"], - "desc": "Show in-editor help/documentation" - }, - { - "keys": ["/"], - "desc": "Toggle minimap" - }, - { - "keys": ["⌘I"], - "desc": "Toggle info/measurements box" - }, - { - "keys": ["Spacebar"], - "desc": "Toggle radial menu for currently selected object" - } - ] - }, - { - "desc": "Editing mode", - "shortcuts": [ - { - "keys": ["1"], - "desc": "Switch to 'add point' mode" - }, - { - "keys": ["2"], - "desc": "Switch to 'add line' mode" - }, - { - "keys": ["3"], - "desc": "Switch to 'add area' mode" - }, - { - "keys": ["A"], - "desc": "Continue drawing a line at the selected node" - }, - { - "keys": ["↵ Enter", "Esc"], - "desc": "Stop drawing of a line or area" - } - ] - }, - { - "desc": "Undoing or saving changes", - "shortcuts": [ - { - "keys": ["⌘Z"], - "desc": "Undo last action" - }, - { - "keys": ["⌘⇧Z"], - "desc": "Redo last action" - }, - { - "keys": ["⌘S"], - "desc": "Save changes" - } - ] - } - ] -} +[ + { + "key": "display", + "desc": "Changing the display", + "shortcuts": [ + { + "shortcut": [ + "↓", + "↑", + "←", + "→" + ], + "key": "pan_map" + }, + { + "shortcut": [ + "⇧↓", + "⇧↑", + "⇧←", + "⇧→" + ], + "key": "pan_map_screen" + }, + { + "shortcut": [ + "+", + "-" + ], + "key": "zoom" + }, + { + "shortcut": [ + "⌘+", + "⌘-" + ], + "key": "zoom_large" + }, + { + "shortcut": [ + "B" + ], + "key": "bg_switcher" + }, + { + "shortcut": [ + "⌘B" + ], + "key": "bg" + }, + { + "shortcut": [ + "W" + ], + "key": "wireframe" + }, + { + "shortcut": [ + "H" + ], + "key": "help" + }, + { + "shortcut": [ + "/" + ], + "key": "minimap" + }, + { + "shortcut": [ + "⌘I" + ], + "key": "infobox" + }, + { + "shortcut": [ + "Spacebar" + ], + "key": "radial_menu" + } + ] + }, + { + "key": "edit", + "desc": "Editing mode", + "shortcuts": [ + { + "shortcut": [ + "1" + ], + "key": "add_point" + }, + { + "shortcut": [ + "2" + ], + "desc": "add_line" + }, + { + "shortcut": [ + "3" + ], + "key": "add_area" + }, + { + "shortcut": [ + "A" + ], + "key": "continue_line" + }, + { + "shortcut": [ + "↵ Enter", + "Esc" + ], + "key": "stop_line" + }, + { + "shortcut": [ + "⌘Z" + ], + "key": "undo" + }, + { + "shortcut": [ + "⌘⇧Z" + ], + "key": "redo" + }, + { + "shortcut": [ + "⌘S" + ], + "save": "save" + } + ] + } +] \ No newline at end of file diff --git a/modules/ui/shortcuts.js b/modules/ui/shortcuts.js index 2f9dad149..b2e73e353 100644 --- a/modules/ui/shortcuts.js +++ b/modules/ui/shortcuts.js @@ -2,7 +2,7 @@ import * as d3 from 'd3'; import { uiCmd } from './cmd'; import { uiModal } from './modal'; import { d3keybinding } from '../lib/d3.keybinding.js'; -import { dataShortcuts } from '../../data/shortcuts.json'; +import shortcuts from '../../data/shortcuts.json'; export function uiShortcuts(context) { var key = uiCmd('⇧/'); @@ -29,7 +29,7 @@ export function uiShortcuts(context) { var section = shortcutsModal .selectAll('section') - .data(dataShortcuts) + .data(shortcuts) .enter().append('section') .attr('class', 'modal-section modal-shortcuts cf'); @@ -48,14 +48,14 @@ export function uiShortcuts(context) { shortcuts .selectAll('kbd') - .data(function(d) { return d.keys; }) + .data(function(d) { return d.shortcut; }) .enter().append('kbd') .text(function(d) { return uiCmd(d); }); var description = p .append('span') .attr('class', 'col8') - .text(function(d) { return d.desc; }); + .text(function(d) { return t('shortcuts.' }); } var keybinding = d3keybinding('shortcuts')