Skip to content

Commit

Permalink
Merge pull request #316 from Kyusung4698/develop
Browse files Browse the repository at this point in the history
0.6.3 (2020-03-15)
  • Loading branch information
Kyusung4698 authored Mar 15, 2020
2 parents 412ef2d + 1d395d0 commit 6bf2b3b
Show file tree
Hide file tree
Showing 12 changed files with 11,983 additions and 25 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.6.3 (2020-03-15)

- add 3.10 stats (#311)
- add support for windowed mode by moving the overlay on top of poe (#233)
- update default dialog spawns to center (#315)
- fix breaking on tab by settings window on top after tabbing back (#295)
- fix dialog spawns not centered if zoomed (#315)

## 0.6.2 (2020-03-13)

- add periodic version check
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PoE Overlay 0.6.2
# PoE Overlay 0.6.3

An Overlay for Path of Exile. The ***core aspect*** is to blend in with the game. Built with Electron and Angular.

Expand Down Expand Up @@ -81,11 +81,11 @@ These instructions will set you up to run and enjoy the overlay.
#### Installing

1. Head over to [Releases](https://github.com/Kyusung4698/PoE-Overlay/releases) and download one of the following files
1. `poe-overlay-Setup-0.6.2.exe` to install locally. This supports auto update/ auto launch.
2. `poe-overlay-0.6.2.exe` portable version. This does not support auto update/ auto launch.
1. `poe-overlay-Setup-0.6.3.exe` to install locally. This supports auto update/ auto launch.
2. `poe-overlay-0.6.3.exe` portable version. This does not support auto update/ auto launch.
2. Run either of your downloaded file
3. Start Path of Exile
4. Wait until you can see `PoE Overlay 0.6.2` in the bottom left corner
4. Wait until you can see `PoE Overlay 0.6.3` in the bottom left corner
5. Hit `f7` and set `Language` and `League` to meet your game settings

#### Shortcuts
Expand Down
20 changes: 16 additions & 4 deletions hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ interface WheelEvent {
ctrlKey: boolean;
}

interface Bounds {
x: number;
y: number;
width: number;
height: number;
}

let active = false;
let activeChangeFn: (active: boolean) => void;
let bounds: Bounds = null;
let activeChangeFn: (active: boolean, bounds: Bounds) => void;
let wheelChangeFn: (event: WheelEvent) => void;

const activeCheck$ = new Subject<void>();
Expand Down Expand Up @@ -54,11 +62,15 @@ function checkActive(): void {
active = test.endsWith('pathofexile_x64_kg.exe') || test.endsWith('pathofexile_kg.exe')
|| test.endsWith('pathofexile_x64steam.exe') || test.endsWith('pathofexilesteam.exe')
|| test.endsWith('pathofexile_x64.exe') || test.endsWith('pathofexile.exe');

if (active) {
bounds = win.bounds;
}
}

if (old !== active) {
if (activeChangeFn) {
activeChangeFn(active);
activeChangeFn(active, bounds);
}
}
}
Expand All @@ -67,14 +79,14 @@ export function getActive(): boolean {
return active;
}

export function on(event: 'change', callback: (active: boolean) => void): void;
export function on(event: 'change', callback: (active: boolean, bounds: Bounds) => void): void;
export function on(event: 'wheel', callback: (event: WheelEvent) => void): void;

export function on(event: string, callback: any) {
switch (event) {
case 'change':
activeChangeFn = callback;
activeChangeFn(active);
activeChangeFn(active, bounds);
break;
case 'wheel':
wheelChangeFn = callback;
Expand Down
38 changes: 32 additions & 6 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ let win: BrowserWindow = null;
let tray: Tray = null;
let menu: Menu = null;
let downloadItem: MenuItem = null;
let checkForUpdatesHandle;

const childs: {
[key: string]: BrowserWindow
Expand Down Expand Up @@ -69,8 +70,24 @@ ipcMain.on('set-keyboard-delay', (event, delay) => {
/* hook */

ipcMain.on('register-active-change', event => {
hook.on('change', active => {
hook.on('change', (active, bounds) => {
event.sender.send('active-change', serve ? true : active);

if (active) {
win.setAlwaysOnTop(false);
win.setVisibleOnAllWorkspaces(false);

win.setAlwaysOnTop(true, 'pop-up-menu', 1);
win.setVisibleOnAllWorkspaces(true);

if (bounds) {
win.setBounds({
...bounds
});
log.info('set bounds to: ', win.getBounds());
}
}

});
event.returnValue = true;
});
Expand Down Expand Up @@ -127,6 +144,10 @@ autoUpdater.on('update-available', () => {
});
menu?.insert(2, downloadItem);
}
if (checkForUpdatesHandle) {
clearInterval(checkForUpdatesHandle);
checkForUpdatesHandle = null;
}
});

autoUpdater.on('update-downloaded', () => {
Expand All @@ -141,7 +162,7 @@ autoUpdater.on('update-downloaded', () => {
ipcMain.on('app-download-init', (event, autoDownload) => {
autoUpdater.autoDownload = autoDownload;
autoUpdater.checkForUpdates();
setInterval(() => {
checkForUpdatesHandle = setInterval(() => {
autoUpdater.checkForUpdates();
}, 1000 * 60 * 5);
event.returnValue = true;
Expand All @@ -162,6 +183,12 @@ ipcMain.on('app-quit-and-install', event => {
event.returnValue = true;
});

ipcMain.on('app-version', event => {
const version = app.getVersion();
log.info('version: ', version)
event.returnValue = version;
});

/* auto-launch */

ipcMain.on('app-auto-launch-enabled', event => {
Expand All @@ -183,7 +210,7 @@ function createWindow(): BrowserWindow {

// Create the browser window.
win = new BrowserWindow({
fullscreen: true,
// fullscreen: true,
width: bounds.width,
height: bounds.height,
x: bounds.x,
Expand Down Expand Up @@ -219,10 +246,9 @@ function createWindow(): BrowserWindow {
ipcMain.on('open-route', (event, route) => {
try {
if (!childs[route]) {
const { bounds } = getDisplay();
// Create the child browser window.
const bounds = win.getBounds();
childs[route] = new BrowserWindow({
fullscreen: true,
// fullscreen: true,
width: bounds.width,
height: bounds.height,
x: bounds.x,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "poe-overlay",
"version": "0.6.2",
"version": "0.6.3",
"private": true,
"description": "A Overlay for Path of Exile. Built with Electron and Angular.",
"main": "main.js",
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/service/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class AppService {
}

public version(): string {
return this.electron.app.getVersion();
return this.ipcRenderer.sendSync('app-version');
}

public quit(): void {
Expand Down
5 changes: 3 additions & 2 deletions src/app/core/service/dialog/dialog.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ export class DialogService {
const local = point
? this.window.convertToLocal(point)
: { x: bounds.width * 0.5, y: bounds.height * 0.5 };
const scaled = this.window.convertToLocalScaled(local);

const left = Math.max(Math.min(local.x - width * 0.5, bounds.width - width), 0);
const top = Math.max(Math.min(local.y - height * 0.5, bounds.height - height), 0);
const left = Math.max(Math.min(scaled.x - width * 0.5, bounds.width - width), 0);
const top = Math.max(Math.min(scaled.y - height * 0.5, bounds.height - height), 0);

this.window.enableInput();
const dialogRef = this.dialog.open(componentOrTemplateRef, {
Expand Down
13 changes: 10 additions & 3 deletions src/app/core/service/window.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,17 @@ export class WindowService {
local.x = Math.min(Math.max(local.x, 0), bounds.width);
local.y -= bounds.y;
local.y = Math.min(Math.max(local.y, 0), bounds.height);
return local;
}

public convertToLocalScaled(local: Point): Point{
const point = {
...local
};

const { zoomFactor } = this.window.webContents;
local.x *= 1 / zoomFactor;
local.y *= 1 / zoomFactor;
return local;
point.x *= 1 / zoomFactor;
point.y *= 1 / zoomFactor;
return point;
}
}
2 changes: 1 addition & 1 deletion src/app/layout/page/overlay/overlay.component.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div class="version" *ngIf="displayVersion$ | async">PoE-Overlay: {{version}}</div>
<div class="version" *ngIf="displayVersion$ | async">PoE Overlay: {{version$ | async}}</div>
4 changes: 2 additions & 2 deletions src/app/layout/page/overlay/overlay.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { UserSettings } from '../../type';
export class OverlayComponent implements OnInit, OnDestroy {
private userSettingsOpen: Observable<void>;

public version: string;
public version$ = new BehaviorSubject<string>('');
public displayVersion$ = new BehaviorSubject(true);

constructor(
Expand All @@ -33,7 +33,6 @@ export class OverlayComponent implements OnInit, OnDestroy {
private readonly app: AppService,
private readonly snackBar: SnackBarService,
private readonly window: WindowService,
private readonly browser: BrowserService,
private readonly renderer: RendererService,
private readonly shortcut: ShortcutService,
private readonly dialogRef: DialogRefService,
Expand All @@ -47,6 +46,7 @@ export class OverlayComponent implements OnInit, OnDestroy {
}

public ngOnInit(): void {
this.version$.next(this.app.version());
this.initSettings();
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/layout/service/user-settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class UserSettingsService {
exitAppKeybinding: 'F8',
language: Language.English,
zoom: 100,
dialogSpawnPosition: DialogSpawnPosition.Cursor,
dialogSpawnPosition: DialogSpawnPosition.Center,
displayVersion: true,
autoDownload: true
};
Expand Down
Loading

0 comments on commit 6bf2b3b

Please sign in to comment.