mirror of
https://github.com/rubickCenter/rubick
synced 2025-08-09 05:09:34 +08:00
bugfix: 修复 iohook 卡顿问题
This commit is contained in:
parent
f9b0177c00
commit
eca119a8a9
@ -155,13 +155,29 @@ export default function init(mainWindow) {
|
||||
// 拾色器
|
||||
ipcMain.on('start-picker', () => {
|
||||
// 开启输入侦测
|
||||
ioHook.start(false)
|
||||
ioHook.start(false);
|
||||
ioHook.load();
|
||||
picker.init();
|
||||
|
||||
picker.getWindow().on('close', () => {
|
||||
ioHook.stop();
|
||||
ioHook.unload();
|
||||
});
|
||||
|
||||
let pos = robot.getMousePos();
|
||||
picker
|
||||
.getWindow()
|
||||
.setPosition(parseInt(pos.x) - 50, parseInt(pos.y) - 50);
|
||||
|
||||
picker
|
||||
.getWindow()
|
||||
.webContents.send(
|
||||
"updatePicker",
|
||||
robot.getPixelColor(pos.x, pos.y)
|
||||
);
|
||||
|
||||
ipcMain.on("closePicker", closePicker);
|
||||
});
|
||||
|
||||
ioHook.on('mousemove', e => {
|
||||
let x = e.x
|
||||
@ -183,25 +199,11 @@ export default function init(mainWindow) {
|
||||
}
|
||||
});
|
||||
|
||||
let pos = robot.getMousePos();
|
||||
picker
|
||||
.getWindow()
|
||||
.setPosition(parseInt(pos.x) - 50, parseInt(pos.y) - 50);
|
||||
|
||||
picker
|
||||
.getWindow()
|
||||
.webContents.send(
|
||||
"updatePicker",
|
||||
robot.getPixelColor(pos.x, pos.y)
|
||||
);
|
||||
|
||||
ipcMain.on("closePicker", closePicker);
|
||||
ioHook.on('mouseup', e => {
|
||||
if (e.button === 3) {
|
||||
closePicker()
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user