Skip to content

Commit

Permalink
Keybind all of _uniq([t(sidebar.key), '`', '²']) to toggle sidebar
Browse files Browse the repository at this point in the history
(closes #5663)
  • Loading branch information
bhousel committed Jan 6, 2019
1 parent 5567b2b commit 55d2ddd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/ui/init.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _uniq from 'lodash-es/uniq';

import {
event as d3_event,
select as d3_select
Expand Down Expand Up @@ -298,9 +300,10 @@ export function uiInit(context) {


var panPixels = 80;
var sidebarKeys = _uniq([t('sidebar.key'), '`', '²']); // #5663
context.keybinding()
.on('⌫', function() { d3_event.preventDefault(); })
.on(t('sidebar.key'), ui.sidebar.toggle)
.on(sidebarKeys, ui.sidebar.toggle)
.on('←', pan([panPixels, 0]))
.on('↑', pan([0, panPixels]))
.on('→', pan([-panPixels, 0]))
Expand Down
4 changes: 4 additions & 0 deletions modules/ui/shortcuts.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import _uniq from 'lodash-es/uniq';

import {
select as d3_select,
selectAll as d3_selectAll
Expand Down Expand Up @@ -177,6 +179,8 @@ export function uiShortcuts(context) {
arr = ['Y'];
} else if (detected.os !== 'mac' && d.text === 'shortcuts.browsing.display_options.fullscreen') {
arr = ['F11'];
} else if (d.text === 'shortcuts.browsing.display_options.sidebar') {
arr = _uniq([t('sidebar.key'), '`', '²']); // #5663
}

return arr.map(function(s) {
Expand Down

0 comments on commit 55d2ddd

Please sign in to comment.