Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Electron's BrowserWindow zoomFactor can be changed after construction? and how to choose nearest neighbor instead of smoothing?

In node electron's BrowserWindow constructor, you can specify webPreferences: { zoomFactor: x } to zoom the web contents of the window.

Is there a way to modify this when the BrowserWindow has already been created?

And is there a way to specify that the content is not smoothed when zoomed but rather magnified with nearest neighbor?

like image 414
Petruza Avatar asked Jan 20 '16 16:01

Petruza


1 Answers

You can use webContents.setZoomFactor(factor)

The zoom factor is zoom percent divided by 100, so 300% = 3.0.

Ref.

like image 133
Joshua Avatar answered Dec 25 '22 16:12

Joshua