Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #70 from arthyn/fix/zoom-slightly-off
Browse files Browse the repository at this point in the history
Fix zoom
  • Loading branch information
arthyn authored May 6, 2021
2 parents 6f93f97 + 28dc5f0 commit e3c0b1f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "taisho",
"productName": "taisho",
"version": "0.5.2",
"version": "0.5.3",
"description": "A ship runner and manager for Urbit OS",
"repository": {
"type": "git",
Expand Down
14 changes: 5 additions & 9 deletions src/main/main-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ export function createMainWindow(

mainWindowState.manage(mainWindow);

const withFocusedView = (block: (contents: WebContents) => void): void => {
const withFocusedView = (block: (contents: WebContents) => void, onlyWindow = false): void => {
const focusedWindow = BrowserWindow.getFocusedWindow();
if (focusedWindow) {
const contents = getWindowOrViewContents(focusedWindow);
return block(contents);
return onlyWindow ? block(focusedWindow.webContents) : block(contents);
}
return undefined;
};
Expand All @@ -75,21 +75,17 @@ export function createMainWindow(
};

const onZoomIn = (): void => {
withFocusedView((contents: WebContents) =>
adjustZoom(contents, ZOOM_INTERVAL),
);
withFocusedView((contents: WebContents) => adjustZoom(contents, ZOOM_INTERVAL), true);
};

const onZoomOut = (): void => {
withFocusedView((contents: WebContents) =>
adjustZoom(contents, -ZOOM_INTERVAL),
);
withFocusedView((contents: WebContents) => adjustZoom(contents, -ZOOM_INTERVAL), true);
};

const onZoomReset = (): void => {
withFocusedView((contents: WebContents) => {
contents.zoomFactor = 1;
});
}, true);
};

const clearAppData = async (): Promise<void> => {
Expand Down

0 comments on commit e3c0b1f

Please sign in to comment.