diff --git a/package.json b/package.json index 29eef28c..c5123cd7 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "animate.css": "^4.1.1", "apexcharts": "^3.23.1", "dot-prop": "6.x.x", - "electron-overlay-window": "2.0.x", + "electron-overlay-window": "3.0.0-beta.1", "electron-store": "8.0.x", "electron-updater": "^4.2.0", "fast-deep-equal": "3.1.x", diff --git a/src/main/PoeWindow.ts b/src/main/PoeWindow.ts index 24daca2e..bd123ca3 100644 --- a/src/main/PoeWindow.ts +++ b/src/main/PoeWindow.ts @@ -1,19 +1,18 @@ -import type { Rectangle, BrowserWindow } from 'electron' +import type { BrowserWindow } from 'electron' import { EventEmitter } from 'events' import { logger } from './logger' import { config } from './config' -import { overlayWindow as OW, AttachEvent } from 'electron-overlay-window' +import { OverlayWindow as OW, AttachEvent } from 'electron-overlay-window' interface PoeWindowClass { on: (event: 'active-change', listener: (isActive: boolean) => void) => this } class PoeWindowClass extends EventEmitter { private _isActive: boolean = false - bounds: Rectangle | undefined - get isActive () { - return this._isActive - } + get bounds () { return OW.bounds } + + get isActive () { return this._isActive } set isActive (active: boolean) { if (this.isActive !== active) { @@ -30,25 +29,18 @@ class PoeWindowClass extends EventEmitter { get uiSidebarWidth () { // sidebar is 370px at 800x600 const ratio = 370 / 600 - return Math.round(this.bounds!.height * ratio) + return Math.round(this.bounds.height * ratio) } attach (window: BrowserWindow) { - OW.on('focus', () => { this.isActive = true }) - OW.on('blur', () => { this.isActive = false }) - - OW.on('moveresize', (e) => { - this.bounds = e - }) - OW.on('attach', (e) => { - this.bounds = e - }) + OW.events.on('focus', () => { this.isActive = true }) + OW.events.on('blur', () => { this.isActive = false }) OW.attachTo(window, config.get('windowTitle')) } onAttach (cb: (hasAccess: boolean | undefined) => void) { - OW.on('attach', (e: AttachEvent) => { + OW.events.on('attach', (e: AttachEvent) => { cb(e.hasAccess) }) } diff --git a/src/main/overlay-window.ts b/src/main/overlay-window.ts index 6e685aa1..cb79687a 100644 --- a/src/main/overlay-window.ts +++ b/src/main/overlay-window.ts @@ -3,7 +3,7 @@ import { BrowserWindow, ipcMain, dialog, Menu, systemPreferences } from 'electro import { PoeWindow } from './PoeWindow' import { logger } from './logger' import * as ipc from '@/ipc/ipc-event' -import { overlayWindow as OW } from 'electron-overlay-window' +import { OverlayWindow as OW } from 'electron-overlay-window' import { config } from './config' export let overlayWindow: BrowserWindow | undefined diff --git a/yarn.lock b/yarn.lock index 1287c257..c855aec3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3782,10 +3782,10 @@ electron-osx-sign@^0.5.0: minimist "^1.2.0" plist "^3.0.1" -electron-overlay-window@2.0.x: - version "2.0.1" - resolved "https://registry.yarnpkg.com/electron-overlay-window/-/electron-overlay-window-2.0.1.tgz#c549d5436c7a10ceb4884f5eabcf0901c1880aea" - integrity sha512-ULweUF7N4i6GFTO6sEA32U/iMJFAAcM33j8mScqDvRriWbW8CGKhYwu0AYOuZLhVmzg869KPnThJiI9e4FcdjA== +electron-overlay-window@3.0.0-beta.1: + version "3.0.0-beta.1" + resolved "https://registry.yarnpkg.com/electron-overlay-window/-/electron-overlay-window-3.0.0-beta.1.tgz#94072bb8527c45d7c15db555279044077d04ee0f" + integrity sha512-59+Zw3e8ou/9fuX22gEHCbItbp2HQBEjHi7vNO5fbYe/r7niU3wEAhqMvYrWPcw/T1bhqTWsmnBjMy7yjLlRmw== dependencies: node-gyp-build "4.x.x" throttle-debounce "3.x.x"