This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 973
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix zoom support with preload script
- Loading branch information
Showing
2 changed files
with
6 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,25 @@ | ||
var electron = require('electron') | ||
var ipc = electron.ipcRenderer | ||
var webFrame = electron.webFrame | ||
var webFrame = require('electron').webFrame | ||
var ipc = require('electron').ipcRenderer | ||
|
||
var browserZoomLevel = 0 | ||
var browserMaxZoom = 9 | ||
var browserMinZoom = -8 | ||
|
||
ipc.on('zoomIn', function () { | ||
ipc.on('zoom-in', function () { | ||
if (browserMaxZoom > browserZoomLevel) { | ||
browserZoomLevel += 1 | ||
} | ||
webFrame.setZoomLevel(browserZoomLevel) | ||
}) | ||
|
||
ipc.on('zoomOut', function () { | ||
ipc.on('zoom-out', function () { | ||
if (browserMinZoom < browserZoomLevel) { | ||
browserZoomLevel -= 1 | ||
} | ||
webFrame.setZoomLevel(browserZoomLevel) | ||
}) | ||
|
||
ipc.on('zoomReset', function () { | ||
ipc.on('zoom-reset', function () { | ||
browserZoomLevel = 0 | ||
webFrame.setZoomLevel(browserZoomLevel) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66829d0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aekeus please audit just this request. Merging.
66829d0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ tested in the browser