Only offer the ⌃⌘F shortcut for fullscreen if the user is on a mac

This commit is contained in:
Bryan Housel
2017-06-10 08:09:49 -04:00
parent 8c2775276e
commit addc3be4da
3 changed files with 11 additions and 15 deletions

View File

@@ -12,7 +12,6 @@ export var uiCmd = function (code) {
if (detected.os === 'win') {
if (code === '⌘⇧Z') return 'Ctrl+Y';
if (code === '⌃⌘F') return 'F11';
}
var result = '',

View File

@@ -1,6 +1,7 @@
import * as d3 from 'd3';
import { d3keybinding } from '../lib/d3.keybinding.js';
import { uiCmd } from './cmd';
import { utilDetect } from '../util/detect';
export function uiFullScreen(context) {
@@ -73,8 +74,9 @@ export function uiFullScreen(context) {
// button.append('span')
// .attr('class', 'icon full-screen');
keybinding
.on([uiCmd('⌃⌘F'), 'f11'], fullScreen);
var detected = utilDetect();
var keys = detected.os === 'mac' ? [uiCmd('⌃⌘F'), 'f11'] : ['f11'];
keybinding.on(keys, fullScreen);
d3.select(document)
.call(keybinding);

View File

@@ -151,8 +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 if (detected.os === 'mac' && d.text === 'shortcuts.browsing.display_options.fullscreen') {
return ["⌃", "⌘"];
} else {
return d.modifiers;
}
@@ -175,19 +175,14 @@ export function uiShortcuts() {
shortcutKeys
.selectAll('kbd.shortcut')
.data(function (d) {
var arr = d.shortcuts;
if (detected.os === 'win' && d.text === 'shortcuts.editing.commands.redo') {
return [{
shortcut: 'Y',
separator: d.separator
}];
} else if (detected.os === 'win' && d.text === 'shortcuts.browsing.display_options.fullscreen') {
return [{
shortcut: 'F11',
separator: d.separator
}];
arr = ['Y'];
} else if (detected.os === 'mac' && d.text === 'shortcuts.browsing.display_options.fullscreen') {
arr = ['F', 'F11'];
}
return d.shortcuts.map(function(s) {
return arr.map(function(s) {
return {
shortcut: s,
separator: d.separator