Remove use-zoom
It's only needed for electron
This commit is contained in:
parent
1426dd5b83
commit
b9a5dc3c70
4 changed files with 0 additions and 95 deletions
|
@ -1,5 +1,4 @@
|
||||||
import { app, Menu, shell } from 'electron';
|
import { app, Menu, shell } from 'electron';
|
||||||
import { ZOOM } from 'util/zoomWindow';
|
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const template = [
|
const template = [
|
||||||
|
@ -23,38 +22,6 @@ export default () => {
|
||||||
label: 'View',
|
label: 'View',
|
||||||
submenu: [
|
submenu: [
|
||||||
{ role: 'reload' },
|
{ role: 'reload' },
|
||||||
{
|
|
||||||
label: 'Zoom',
|
|
||||||
submenu: [
|
|
||||||
{
|
|
||||||
label: 'Zoom In',
|
|
||||||
accelerator: 'CmdOrCtrl+=',
|
|
||||||
click: (menuItem, browserWindow) => {
|
|
||||||
if (browserWindow) {
|
|
||||||
browserWindow.webContents.send('zoom-window', ZOOM.INCREMENT);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Zoom Out',
|
|
||||||
accelerator: 'CmdOrCtrl+-',
|
|
||||||
click: (menuItem, browserWindow) => {
|
|
||||||
if (browserWindow) {
|
|
||||||
browserWindow.webContents.send('zoom-window', ZOOM.DECREMENT);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Reset Zoom',
|
|
||||||
accelerator: 'CmdOrCtrl+0',
|
|
||||||
click: (menuItem, browserWindow) => {
|
|
||||||
if (browserWindow) {
|
|
||||||
browserWindow.webContents.send('zoom-window', ZOOM.RESET);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
label: 'Developer',
|
label: 'Developer',
|
||||||
submenu: [{ role: 'forcereload' }, { role: 'toggledevtools' }],
|
submenu: [{ role: 'forcereload' }, { role: 'toggledevtools' }],
|
||||||
|
|
|
@ -22,7 +22,6 @@ import Spinner from 'component/spinner';
|
||||||
import LANGUAGES from 'constants/languages';
|
import LANGUAGES from 'constants/languages';
|
||||||
|
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
import useZoom from 'effects/use-zoom';
|
|
||||||
import useHistoryNav from 'effects/use-history-nav';
|
import useHistoryNav from 'effects/use-history-nav';
|
||||||
// @endif
|
// @endif
|
||||||
// @if TARGET='web'
|
// @if TARGET='web'
|
||||||
|
@ -236,11 +235,6 @@ function App(props: Props) {
|
||||||
return () => window.removeEventListener('keydown', handleKeyPress);
|
return () => window.removeEventListener('keydown', handleKeyPress);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Enable ctrl +/- zooming on Desktop.
|
|
||||||
// @if TARGET='app'
|
|
||||||
useZoom();
|
|
||||||
// @endif
|
|
||||||
|
|
||||||
// Enable 'Alt + Left/Right' for history navigation on Desktop.
|
// Enable 'Alt + Left/Right' for history navigation on Desktop.
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
useHistoryNav(history);
|
useHistoryNav(history);
|
||||||
|
|
|
@ -1,51 +0,0 @@
|
||||||
import { useEffect } from 'react';
|
|
||||||
import { changeZoomFactor, ZOOM } from 'util/zoomWindow';
|
|
||||||
|
|
||||||
export default function useHover(ref) {
|
|
||||||
useEffect(() => {
|
|
||||||
const handleKeyPress = e => {
|
|
||||||
if (e.ctrlKey && !e.shiftKey) {
|
|
||||||
switch (e.code) {
|
|
||||||
case 'NumpadAdd':
|
|
||||||
case 'Equal':
|
|
||||||
e.preventDefault();
|
|
||||||
changeZoomFactor(ZOOM.INCREMENT);
|
|
||||||
break;
|
|
||||||
case 'NumpadSubtract':
|
|
||||||
case 'Minus':
|
|
||||||
e.preventDefault();
|
|
||||||
changeZoomFactor(ZOOM.DECREMENT);
|
|
||||||
break;
|
|
||||||
case 'Numpad0':
|
|
||||||
case 'Digit0':
|
|
||||||
e.preventDefault();
|
|
||||||
changeZoomFactor(ZOOM.RESET);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// Do nothing
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
window.addEventListener('keydown', handleKeyPress);
|
|
||||||
return () => window.removeEventListener('keydown', handleKeyPress);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const handleWheel = e => {
|
|
||||||
if (e.ctrlKey && !e.shiftKey) {
|
|
||||||
if (e.deltaY < 0) {
|
|
||||||
changeZoomFactor(ZOOM.INCREMENT);
|
|
||||||
} else {
|
|
||||||
changeZoomFactor(ZOOM.DECREMENT);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
window.addEventListener('wheel', handleWheel);
|
|
||||||
return () => window.removeEventListener('wheel', handleWheel);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
changeZoomFactor(ZOOM.LOAD_FROM_LOCAL_STORAGE);
|
|
||||||
}, []);
|
|
||||||
}
|
|
|
@ -6,7 +6,6 @@ import SnackBar from 'component/snackBar';
|
||||||
// @if TARGET='app'
|
// @if TARGET='app'
|
||||||
import SplashScreen from 'component/splash';
|
import SplashScreen from 'component/splash';
|
||||||
import * as ACTIONS from 'constants/action_types';
|
import * as ACTIONS from 'constants/action_types';
|
||||||
import { changeZoomFactor } from 'util/zoomWindow';
|
|
||||||
// @endif
|
// @endif
|
||||||
import { ipcRenderer, remote, shell } from 'electron';
|
import { ipcRenderer, remote, shell } from 'electron';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
@ -179,10 +178,6 @@ ipcRenderer.on('open-menu', (event, uri) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcRenderer.on('zoom-window', (event, action) => {
|
|
||||||
changeZoomFactor(action);
|
|
||||||
});
|
|
||||||
|
|
||||||
const { dock } = remote.app;
|
const { dock } = remote.app;
|
||||||
|
|
||||||
ipcRenderer.on('window-is-focused', () => {
|
ipcRenderer.on('window-is-focused', () => {
|
||||||
|
|
Loading…
Reference in a new issue