From 1b916b5caebba7e067458cf4f31d8ae5308bb629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E5=81=B6?= <2424880409@qq.com> Date: Wed, 7 Jul 2021 16:51:03 +0800 Subject: [PATCH 1/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c916a2d..361aecb 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ 之所以做这个工具箱一方面是 utools 本身并未开源,但是公司内部的工具库又无法发布到 utools 插件中,所以为了既要享受 utools 生态又要有定制化需求,我们自己参考 utools 设计,做了 Rubick ## 安装包 -* [Rubick Mac OS V0.0.1](https://github.com/clouDr-f2e/rubick/releases/download/v0.0.1-beta/rubick2-0.0.1.pkg) +* [Rubick Mac OS V0.0.1](https://github.com/clouDr-f2e/rubick/releases/tag/v0.0.1-beta.2) ## 支持能力 From eca119a8a98d940f96e9baee15972bc9938390c1 Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Wed, 7 Jul 2021 20:08:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?bugfix:=20=E4=BF=AE=E5=A4=8D=20iohook=20?= =?UTF-8?q?=E5=8D=A1=E9=A1=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/common/common.js | 56 ++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/src/main/common/common.js b/src/main/common/common.js index 702a209..c1e246f 100644 --- a/src/main/common/common.js +++ b/src/main/common/common.js @@ -155,32 +155,13 @@ 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.on('mousemove', e => { - let x = e.x - let y = e.y - if (!picker.getWindow()) return; - let color = "#" + robot.getPixelColor(parseInt(x), parseInt(y)); - picker.getWindow().setPosition(parseInt(x) - 50, parseInt(y) - 50); - picker.getWindow().webContents.send("updatePicker", color); - }) - - ioHook.on('mouseup', e => { - if (e.button === 1) { - let x = e.x - let y = e.y - const color = "#" + robot.getPixelColor(parseInt(x), parseInt(y)); - clipboard.writeText("#" + robot.getPixelColor(parseInt(x), parseInt(y))); - new Notification({ title: 'Rubick 通知', body: `${color} 已保存到剪切板` }).show(); - closePicker(); - } + ioHook.unload(); }); let pos = robot.getMousePos(); @@ -196,12 +177,33 @@ export default function init(mainWindow) { ); ipcMain.on("closePicker", closePicker); - ioHook.on('mouseup', e => { - if (e.button === 3) { - closePicker() - } - }); + }); + + ioHook.on('mousemove', e => { + let x = e.x + let y = e.y + if (!picker.getWindow()) return; + let color = "#" + robot.getPixelColor(parseInt(x), parseInt(y)); + picker.getWindow().setPosition(parseInt(x) - 50, parseInt(y) - 50); + picker.getWindow().webContents.send("updatePicker", color); }) + + ioHook.on('mouseup', e => { + if (e.button === 1) { + let x = e.x + let y = e.y + const color = "#" + robot.getPixelColor(parseInt(x), parseInt(y)); + clipboard.writeText("#" + robot.getPixelColor(parseInt(x), parseInt(y))); + new Notification({ title: 'Rubick 通知', body: `${color} 已保存到剪切板` }).show(); + closePicker(); + } + }); + + ioHook.on('mouseup', e => { + if (e.button === 3) { + closePicker() + } + }); }