Created
March 25, 2020 15:29
-
-
Save rdnt/5aa63200e2b2c1f82ac53a9fcd16d4d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
handleMousewheel(event) { | |
this.holdingCtrl = event.ctrlKey; | |
if (event.deltaY == 0 && event.deltaX == 0) { | |
// inertial scroll has started | |
this.inertialScroll = true; | |
} | |
clearTimeout(this.timer); | |
this.timer = setTimeout(() => { | |
// inertial scroll has stopped | |
this.inertialScroll = false; | |
}, 150); | |
if ( | |
event.ctrlKey && !this.inertialScroll && | |
this.config.get('editor.zoomFontWhenCtrlScrolling') && | |
event.target.closest('atom-text-editor') != null | |
) { | |
if (event.wheelDeltaY > 0) { | |
this.model.increaseFontSize(); | |
} else if (event.wheelDeltaY < 0) { | |
this.model.decreaseFontSize(); | |
} | |
event.preventDefault(); | |
event.stopPropagation(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment