From eb9e0453086980ed1ed6d5887b3e5fbda3946812 Mon Sep 17 00:00:00 2001 From: tophf Date: Sun, 26 Apr 2015 23:03:39 +0300 Subject: [PATCH] Editor: Shift-Ctrl-Wheel to scroll entire page --- edit.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/edit.js b/edit.js index 63488d60..af4efe9b 100644 --- a/edit.js +++ b/edit.js @@ -372,6 +372,15 @@ document.addEventListener("keydown", function(event) { } }); +// Shift-Ctrl-Wheel scrolls entire page even when mouse is over a code editor +document.addEventListener("wheel", function(event) { + if (event.shiftKey && event.ctrlKey && !event.altKey && !event.metaKey) { + // Chrome scrolls horizontally when Shift is pressed but on some PCs this might be different + window.scrollBy(0, event.deltaX || event.deltaY); + event.preventDefault(); + } +}); + chrome.tabs.query({currentWindow: true}, function(tabs) { isSeparateWindow = tabs.length == 1; }); @@ -851,6 +860,7 @@ function showKeyMapHelp() { var keyMap = mergeKeyMaps({}, prefs.getPref("editor.keyMap"), CodeMirror.defaults.extraKeys); var keyMapSorted = Object.keys(keyMap) .map(function(key) { return {key: key, cmd: keyMap[key]} }) + .concat([{key: "Shift-Ctrl-Wheel", cmd: "scrollWindow"}]) .sort(function(a, b) { return a.cmd < b.cmd || (a.cmd == b.cmd && a.key < b.key) ? -1 : 1 }); showHelp(t("cm_keyMap") + ": " + prefs.getPref("editor.keyMap"), '' +