Skip to content

Commit

Permalink
Fix fullscreen shortcut on Mac, add F11 to the shortcuts screen
Browse files Browse the repository at this point in the history
  • Loading branch information
bhousel committed Jun 10, 2017
1 parent d20e053 commit 8c27752
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions data/shortcuts.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
"shortcuts": ["F"],
"text": "shortcuts.browsing.display_options.map_data"
}, {
"modifiers": ["", ""],
"shortcuts": ["F"],
"modifiers": ["", ""],
"shortcuts": ["F", "F11"],
"text": "shortcuts.browsing.display_options.fullscreen"
}, {
"shortcuts": ["W"],
Expand Down
2 changes: 2 additions & 0 deletions modules/ui/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export var uiCmd = function (code) {

if (detected.os === 'win') {
if (code === '⌘⇧Z') return 'Ctrl+Y';
if (code === '⌃⌘F') return 'F11';
}

var result = '',
Expand Down Expand Up @@ -45,6 +46,7 @@ uiCmd.display = function(code) {
'⌘': mac ? '⌘ ' + t('shortcuts.key.cmd') : t('shortcuts.key.ctrl'),
'⇧': mac ? '⇧ ' + t('shortcuts.key.shift') : t('shortcuts.key.shift'),
'⌥': mac ? '⌥ ' + t('shortcuts.key.option') : t('shortcuts.key.alt'),
'⌃': mac ? '⌃ ' + t('shortcuts.key.ctrl') : t('shortcuts.key.ctrl'),
'⌫': mac ? '⌫ ' + t('shortcuts.key.delete') : t('shortcuts.key.backspace'),
'⌦': mac ? '⌦ ' + t('shortcuts.key.del') : t('shortcuts.key.del'),
'↖': mac ? '↖ ' + t('shortcuts.key.pgup') : t('shortcuts.key.pgup'),
Expand Down
3 changes: 1 addition & 2 deletions modules/ui/full_screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ export function uiFullScreen(context) {
// .attr('class', 'icon full-screen');

keybinding
.on('f11', fullScreen)
.on(uiCmd('⌘⇧F'), fullScreen);
.on([uiCmd('⌃⌘F'), 'f11'], fullScreen);

d3.select(document)
.call(keybinding);
Expand Down
7 changes: 7 additions & 0 deletions modules/ui/shortcuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ export function uiShortcuts() {
.data(function (d) {
if (detected.os === 'win' && d.text === 'shortcuts.editing.commands.redo') {
return ['⌘'];
} else if (detected.os === 'win' && d.text === 'shortcuts.browsing.display_options.fullscreen') {
return [];
} else {
return d.modifiers;
}
Expand Down Expand Up @@ -178,6 +180,11 @@ export function uiShortcuts() {
shortcut: 'Y',
separator: d.separator
}];
} else if (detected.os === 'win' && d.text === 'shortcuts.browsing.display_options.fullscreen') {
return [{
shortcut: 'F11',
separator: d.separator
}];
}

return d.shortcuts.map(function(s) {
Expand Down

0 comments on commit 8c27752

Please sign in to comment.