同时支持触摸和鼠标事件翻页
This commit is contained in:
@@ -68,6 +68,19 @@ function createWindow() {
|
||||
},
|
||||
});
|
||||
|
||||
// 启用触摸事件支持(Windows 触摸屏)
|
||||
mainWindow.webContents.on("did-finish-load", () => {
|
||||
// 注入触摸事件支持脚本
|
||||
mainWindow.webContents.executeJavaScript(`
|
||||
// 确保触摸事件可用
|
||||
if (navigator.maxTouchPoints === 0) {
|
||||
console.log('[Electron] 未检测到触摸设备,将使用鼠标事件模拟');
|
||||
} else {
|
||||
console.log('[Electron] 检测到触摸设备,触摸点数:', navigator.maxTouchPoints);
|
||||
}
|
||||
`).catch(err => log.error("Failed to inject touch support:", err));
|
||||
});
|
||||
|
||||
const isDev = !app.isPackaged;
|
||||
|
||||
if (isDev) {
|
||||
|
||||
Reference in New Issue
Block a user