Let’s create a function called createMainWindow and create a BrowserWindow in it. Let zoomLevelSpan = document.getElementById("current-value") ĭocument.getElementById("zoom"). In Electron, the BrowserWindow API creates a browser window with the specified options and loads a desired URL to display. The following example shows how to change the zoom factor of the browser using a range input: If you need to shrink your window size based on screen size, then you could replace width and height like this: /// 460 and 640 is your window size, it is totally up to you width: parseInt (460 scaleFactor) height: parseInt (640 scaleFactor) Note that we should use parseInt, because width and height will not work for floating numbers. Let currentZoomFactor = webFrame.getZoomFactor() Example Access the module from electron using: const = require('electron') This task is executed only in the Renderer process (the view). set of CSS classes applied to document. To change the zoom level of a window in Electron, you will need to use the webFrame module of Electron that allows you to customize the rendering of the current web page. To specify a window's position, you can pass the coordinates as left and top (or screenX and screenY respectively) and pass the desired size as width and height (or innerWidth and innerHeight respectively). The Quasar Screen plugin allows you to have a dynamic and responsive UI when. Sometimes, using the zoom of the browser instead of changing the styles may work better, so you can take advantage of Electron if you remember that it is so to speak a browser for your own application. You can change the size of text, images, and videos for one webpage or for all webpages (windows in this case). minWidth Integer - Window's minimum width. center Boolean - Show window in the center of the screen. One of those tedious task, is to change the font-size of the application with JavaScript dinamically, as usually it will make your layout to display wrong and other problems. useContentSize Boolean - The width and height would be used as web page's size, which means the actual window's size will include window frame's size and be slightly larger. Process: Main, Renderer You cannot require or use this module until the ready event of the app module is emitted. As a developer sometimes, is pretty tedious to change styles dinamically. Retrieve information about screen size, displays, cursor position, etc.
0 Comments
Leave a Reply. |