Skip to content

Commit

Permalink
fix: set fishing zone at wrong dims if game is windowed
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbots committed Dec 22, 2023
1 parent 482798f commit af8a742
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
15 changes: 9 additions & 6 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,15 @@ const setFishingZone = async ({workwindow}, relZone, type, config, settings) =>

const result = await createFishingZone({pos, screenSize, type, config, settings, scale});
if(!result) return;
return {
x: (result.x - screenSize.x) * scale / screenSize.width,
y: (result.y - screenSize.y) * scale / screenSize.height,
width: result.width * scale / screenSize.width,
height: result.height * scale / screenSize.height
}

const convertedResult = {
x: (result.x * scale - screenSize.x) / screenSize.width,
y: (result.y * scale - screenSize.y) / screenSize.height,
width: (result.width * scale) / screenSize.width,
height: (result.height * scale) / screenSize.height
};

return convertedResult
}

let win;
Expand Down
8 changes: 4 additions & 4 deletions app/wins/fishingzone/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ const getDataFrom = async (zone) => {
const createFishingZone = ({pos, screenSize, type, config, settings, scale}, finished) => {
let win = new BrowserWindow({
title: `Fishing Zone`,
x: Math.floor(pos.x),
y: Math.floor(pos.y),
width: Math.floor(pos.width),
height: Math.floor(pos.height),
x: Math.round(pos.x),
y: Math.round(pos.y),
width: Math.round(pos.width),
height: Math.round(pos.height),
show: true,
resizable: true,
opacity: 0.3,
Expand Down

0 comments on commit af8a742

Please sign in to comment.