Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zoom with Ctrl+Scroll Wheel in Electron App?

Tags:

electron

Is it possible to emulate browser-like behavior in Electron to add zooming with ctrl+scroll wheel?

like image 676
Slbox Avatar asked Oct 26 '16 12:10

Slbox


1 Answers

Yes, it should be possible to emulate that behavior:

  • Catch the CTRL + mousewheel element as discussed in this question.
  • Use the Electron web-frame API to adapt the zoomFactor accordingly, use webFrame.getZoomFactor() to get the current zoom level and webFrame.setZoomFactor(level) to change it.
like image 143
Jens Habegger Avatar answered Feb 11 '23 01:02

Jens Habegger