From 36e995c083b5627c438cc7e8220526f4bb6c0472 Mon Sep 17 00:00:00 2001 From: Alexander Drozdov Date: Wed, 3 Mar 2021 22:16:22 +0200 Subject: [PATCH] changed scrolling area in 3.13 --- src/main/shortcuts.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/shortcuts.ts b/src/main/shortcuts.ts index e2b8a8a9..aa2832cc 100644 --- a/src/main/shortcuts.ts +++ b/src/main/shortcuts.ts @@ -1,6 +1,6 @@ import { screen, Point, clipboard, globalShortcut, Notification, ipcMain } from 'electron' import robotjs from 'robotjs' -import { uIOhook, UiohookKey } from 'uiohook-napi' +import { uIOhook, UiohookKey, UiohookWheelEvent } from 'uiohook-napi' import { pollClipboard } from './poll-clipboard' import { showWidget as showPriceCheck } from './price-check' import { KeyToElectron } from '@/ipc/KeyToCode' @@ -187,9 +187,7 @@ export function setupShortcuts () { uIOhook.on('wheel', (e) => { if (!e.ctrlKey || !PoeWindow.bounds || !PoeWindow.isActive || !config.get('stashScroll')) return - const stashCheckX = PoeWindow.bounds.x + PoeWindow.uiSidebarWidth - const mouseX = e.x - if (mouseX > stashCheckX) { + if (!isGameScrolling(e)) { if (e.rotation > 0) { robotjs.keyTap('ArrowRight') } else if (e.rotation < 0) { @@ -201,6 +199,14 @@ export function setupShortcuts () { uIOhook.start() } +function isGameScrolling (mouse: UiohookWheelEvent): boolean { + if (!PoeWindow.bounds || + mouse.x > (PoeWindow.bounds.x + PoeWindow.uiSidebarWidth)) return false + + return (mouse.y > (PoeWindow.bounds.y + PoeWindow.bounds.height * 154 / 1600) && + mouse.y < (PoeWindow.bounds.y + PoeWindow.bounds.height * 1192 / 1600)) +} + function stashSearch (text: string) { const saved = clipboard.readText()