Commit 1c52cfcf601897aad8909bfa4a03a47a9c6da3f2
Merge pull request #82 from pietgeursen/ctrl-zoom
Adds ctrl+scroll zooming in electron.mix irving authored on 2/3/2017, 3:01:31 AM
GitHub committed on 2/3/2017, 3:01:31 AM
Parent: 2a6a22b5b33a8c6903dd250baa5b8d2b85f4a615
Parent: 868a6b6fd80c1defa4ab9681d5a893fdc04765e6
Files changed
modules_core/tabs.js | changed |
modules_core/tabs.js | ||
---|---|---|
@@ -190,8 +190,19 @@ | ||
190 | 190 … | errorsContent.appendChild(el) |
191 | 191 … | }) |
192 | 192 … | |
193 | 193 … | if (process.versions.electron) { |
194 … | + var {webFrame} = require('electron') | |
195 … | + | |
196 … | + window.addEventListener('mousewheel', function (ev) { | |
197 … | + var {ctrlKey, deltaY} = ev | |
198 … | + if(ctrlKey){ | |
199 … | + var direction = (deltaY / Math.abs(deltaY)) | |
200 … | + var currentZoom = webFrame.getZoomLevel() | |
201 … | + webFrame.setZoomLevel(currentZoom - direction) | |
202 … | + } | |
203 … | + }) | |
204 … | + | |
194 | 205 … | window.addEventListener('contextmenu', function (ev) { |
195 | 206 … | ev.preventDefault() |
196 | 207 … | var remote = require('electron').remote |
197 | 208 … | var Menu = remote.Menu |
Built with git-ssb-web