mirror of
https://github.com/jeffvli/feishin.git
synced 2026-08-07 21:03:27 +02:00
feat: support mouse navigation (#2298)
This commit is contained in:
@@ -765,6 +765,29 @@ async function createWindow(first = true): Promise<void> {
|
|||||||
log.error('Renderer process unresponsive');
|
log.error('Renderer process unresponsive');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Mouse navigation
|
||||||
|
mainWindow.on('app-command', (_event, command) => {
|
||||||
|
if (
|
||||||
|
command === 'browser-backward' &&
|
||||||
|
mainWindow?.webContents.navigationHistory.canGoBack()
|
||||||
|
) {
|
||||||
|
mainWindow.webContents.navigationHistory.goBack();
|
||||||
|
} else if (
|
||||||
|
command === 'browser-forward' &&
|
||||||
|
mainWindow?.webContents.navigationHistory.canGoForward()
|
||||||
|
) {
|
||||||
|
mainWindow.webContents.navigationHistory.goForward();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mainWindow.on('swipe', (_event, direction) => {
|
||||||
|
if (direction === 'right' && mainWindow?.webContents.navigationHistory.canGoForward()) {
|
||||||
|
mainWindow.webContents.navigationHistory.goForward();
|
||||||
|
} else if (direction === 'left' && mainWindow?.webContents.navigationHistory.canGoBack()) {
|
||||||
|
mainWindow.webContents.navigationHistory.goBack();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mainWindow.on('closed', () => {
|
mainWindow.on('closed', () => {
|
||||||
log.info('Main window closed');
|
log.info('Main window closed');
|
||||||
ipcMain.removeHandler('window-clear-cache');
|
ipcMain.removeHandler('window-clear-cache');
|
||||||
|
|||||||
Reference in New Issue
Block a user