diff --git a/css/80_app.css b/css/80_app.css index 25ab000fd..3d1b61f6b 100644 --- a/css/80_app.css +++ b/css/80_app.css @@ -3120,45 +3120,34 @@ img.tile-removing { flex-flow: row wrap; } -.modal-shortcuts .shortcut-group { - padding: 10px; - flex: 0 0 50%; - display: flex; - flex-direction: column; +.modal-shortcuts .shortcut-column { + flex: 1 1 50%; + width: 50%; } -.modal-shortcuts .shortcut-group h3 { - text-align: center; +.modal-shortcuts td { + padding-bottom: 5px; } -.modal-shortcuts .shortcut-row { - flex: 0 0 auto; - display: flex; - flex-direction: row; +.modal-shortcuts .shortcut-section { + padding: 15px 0 10px 0; } -.modal-shortcuts .kbd-row { +.modal-shortcuts .shortcut-keys { padding-right: 10px; color: #767676; text-align: right; - padding-bottom: 5px; - flex: 1 1 40%; - -} -.modal-shortcuts .shortcut-desc { - padding-bottom: 5px; - flex: 1 1 60%; } -.modal-shortcuts kbd { +.modal-shortcuts .shortcut-keys kbd { display: inline-block; - text-align: right; + text-align: center; padding: 3px 5px; font-size: 11px; - line-height: 10px; - letter-spacing: 1px; + line-height: 12px; + min-width: 12px; color: #555; - vertical-align: middle; + vertical-align: baseline; background-color: #fcfcfc; border: solid 1px #ccc; margin: 0 2px; diff --git a/data/shortcuts.json b/data/shortcuts.json index 78e26e407..d804aeb08 100644 --- a/data/shortcuts.json +++ b/data/shortcuts.json @@ -2,12 +2,13 @@ { "tab": "browsing", "text": "shortcuts.browsing.title", - "groups": [ + "columns": [ { - "group": "navigation", - "text": "shortcuts.browsing.navigation.title", - "shortcuts": [ + "rows": [ { + "section": "navigation", + "text": "shortcuts.browsing.navigation.title" + }, { "shortcut": ["↓", "↑", "←", "→"], "text": "shortcuts.browsing.navigation.pan_map" }, { @@ -19,13 +20,25 @@ }, { "shortcut": ["⌘+", "⌘-"], "text": "shortcuts.browsing.navigation.zoom_large" + }, + + { + "section": "help", + "text": "shortcuts.browsing.help.title" + }, { + "shortcut": ["H"], + "text": "shortcuts.browsing.help.help" + }, { + "shortcut": ["?"], + "text": "shortcuts.browsing.help.keyboard" } ] }, { - "group": "display", - "text": "shortcuts.browsing.display.title", - "shortcuts": [ + "rows": [ { + "section": "display", + "text": "shortcuts.browsing.display.title" + }, { "shortcut": ["B"], "text": "shortcuts.browsing.display.background" }, { @@ -40,25 +53,12 @@ }, { "shortcut": ["W"], "text": "shortcuts.browsing.display.wireframe" - } - ] - }, { - "group": "help", - "text": "shortcuts.browsing.help.title", - "shortcuts": [ + }, + { - "shortcut": ["H"], - "text": "shortcuts.browsing.help.help" + "section": "selected", + "text": "shortcuts.browsing.selected.title" }, { - "shortcut": ["?"], - "text": "shortcuts.browsing.help.keyboard" - } - ] - }, { - "group": "selected", - "text": "shortcuts.browsing.selected.title", - "shortcuts": [ - { "shortcut": ["⌘I"], "text": "shortcuts.browsing.selected.toggle_infobox" }, { @@ -68,16 +68,16 @@ ] } ] - }, - { + }, { "tab": "editing", "text": "shortcuts.editing.title", - "groups": [ + "columns" : [ { - "group": "drawing", - "text": "shortcuts.editing.drawing.title", - "shortcuts": [ + "rows": [ { + "section": "drawing", + "text": "shortcuts.editing.drawing.title" + }, { "shortcut": ["1"], "text": "shortcuts.editing.drawing.add_point" }, { @@ -92,13 +92,34 @@ }, { "shortcut": ["↵ Enter", "Esc"], "text": "shortcuts.editing.drawing.stop_line" + }, + + { + "section": "edit", + "text": "shortcuts.editing.edit.title" + }, { + "shortcut": ["⌘C"], + "text": "shortcuts.editing.edit.copy" + }, { + "shortcut": ["⌘V"], + "text": "shortcuts.editing.edit.paste" + }, { + "shortcut": ["⌘Z"], + "text": "shortcuts.editing.edit.undo" + }, { + "shortcut": ["⌘⇧Z"], + "text": "shortcuts.editing.edit.redo" + }, { + "shortcut": ["⌘S"], + "text": "shortcuts.editing.edit.save" } ] }, { - "group": "operations", - "text": "shortcuts.editing.operations.title", - "shortcuts": [ + "rows": [ { + "section": "operations", + "text": "shortcuts.editing.operations.title" + }, { "shortcut": ["operations.continue.key"], "text": "shortcuts.editing.operations.continue_line" }, { @@ -133,27 +154,6 @@ "text": "shortcuts.editing.operations.reflect_short" } ] - }, { - "group": "edit", - "text": "shortcuts.editing.edit.title", - "shortcuts": [ - { - "shortcut": ["⌘C"], - "text": "shortcuts.editing.edit.copy" - }, { - "shortcut": ["⌘V"], - "text": "shortcuts.editing.edit.paste" - }, { - "shortcut": ["⌘Z"], - "text": "shortcuts.editing.edit.undo" - }, { - "shortcut": ["⌘⇧Z"], - "text": "shortcuts.editing.edit.redo" - }, { - "shortcut": ["⌘S"], - "text": "shortcuts.editing.edit.save" - } - ] } ] } diff --git a/modules/ui/shortcuts.js b/modules/ui/shortcuts.js index 5ddbf8d38..95635b1e5 100644 --- a/modules/ui/shortcuts.js +++ b/modules/ui/shortcuts.js @@ -99,30 +99,38 @@ export function uiShortcuts() { .append('div') .attr('class', 'shortcut-tab'); - - var groupsEnter = shortcutsEnter - .selectAll('.shortcut-group') - .data(function (d) { return d.groups; }) + var columnsEnter = shortcutsEnter + .selectAll('.shortcut-column') + .data(function (d) { return d.columns; }) .enter() - .append('div') - .attr('class', 'shortcut-group'); + .append('table') + .attr('class', 'shortcut-column'); - groupsEnter - .append('h3') - .text(function(d) { return t(d.text); }); - - var row = groupsEnter + var rowsEnter = columnsEnter .selectAll('.shortcut-row') - .data(function (d) { return d.shortcuts; }) + .data(function (d) { return d.rows; }) .enter() - .append('div') + .append('tr') .attr('class', 'shortcut-row'); - var shortcutsRow = row - .append('div') - .attr('class', 'kbd-row'); + var sectionRows = rowsEnter + .filter(function (d) { return !d.shortcut; }); - shortcutsRow + sectionRows + .append('td'); + + sectionRows + .append('td') + .attr('class', 'shortcut-section') + .append('h3') + .text(function (d) { return t(d.text); }); + + var shortcutRows = rowsEnter + .filter(function (d) { return d.shortcut; }); + + shortcutRows + .append('td') + .attr('class', 'shortcut-keys') .selectAll('kbd') .data(function (d) { return d.shortcut; }) .enter() @@ -131,11 +139,12 @@ export function uiShortcuts() { return d.indexOf('.') !== -1 ? uiCmd(t(d)) : uiCmd(d); }); - row - .append('div') + shortcutRows + .append('td') .attr('class', 'shortcut-desc') .text(function (d) { return t(d.text); }); + shortcuts = shortcuts .merge(shortcutsEnter);