electron开发中遇到的分辨率问题

设置分辨率

// var devInnerHeight = 630.0 // 开发时的InnerHeight
// var devDevicePixelRatio = 1.0// 开发时的devicepixelratio
// var devScaleFactor = 1.33 // 开发时的ScaleFactor
// var scaleFactor = require(‘electron’).screen.getPrimaryDisplay().scaleFactor
// var zoomFactor = (window.innerHeight / devInnerHeight) * (window.devicePixelRatio / devDevicePixelRatio) * (devScaleFactor / scaleFactor)
// require(‘electron’).webFrame.setZoomFactor(zoomFactor)

获取分辨率

// var electron = require(‘electron’)
// // eslint-disable-next-line no-unused-vars
// var winW = electron.screen.getPrimaryDisplay().workAreaSize.width
// console.log(‘winW===’ + winW)
// // eslint-disable-next-line no-unused-vars
// var winH = electron.screen.getPrimaryDisplay().workAreaSize.height
// console.log(‘winH===’ + winH)

你可能感兴趣的:(electron开发中遇到的分辨率问题)