Resizable

This commit is contained in:
Devine Lu Linvega
2019-02-21 15:13:29 +09:00
parent e4984a9df1
commit b506939ea8
5 changed files with 24 additions and 10 deletions

View File

@@ -126,7 +126,7 @@ function Dotgrid () {
}
}
this.setSize = function (size = { width: 600, height: 300 }, ui = true, scale = 1) {
this.setSize = function (size = { width: 600, height: 300 }, ui = true, scale = window.devicePixelRatio) {
size = { width: clamp(step(size.width, 15), 105, 1080), height: clamp(step(size.height, 15), 120, 1080) }
this.tool.settings.size.width = size.width
@@ -161,6 +161,17 @@ function Dotgrid () {
document.title = `Dotgrid — ${size.width}x${size.height}`
}
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)