Added zoom

This commit is contained in:
Devine Lu Linvega
2019-07-14 20:21:12 +09:00
parent 391874841b
commit f8b2a4d652
2 changed files with 26 additions and 1 deletions

View File

@@ -56,6 +56,28 @@ function Ronin () {
this.load = function (content = this.default()) {
}
// Zoom
this.modZoom = function (mod = 0, set = false) {
try {
const { webFrame } = require('electron')
const currentZoomFactor = webFrame.getZoomFactor()
webFrame.setZoomFactor(set ? mod : currentZoomFactor + mod)
console.log(window.devicePixelRatio)
} catch (err) {
console.log('Cannot zoom')
}
}
this.setZoom = function (scale) {
try {
webFrame.setZoomFactor(scale)
} catch (err) {
console.log('Cannot zoom')
}
}
// Events
this.drag = (e) => {