mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1250398 - Disable APZ for source editors. r=gl
MozReview-Commit-ID: JmUuoobDr7y
This commit is contained in:
parent
8b000f55a3
commit
a78f3444fe
@ -302,6 +302,30 @@ Editor.prototype = {
|
||||
// context menus won't work).
|
||||
|
||||
cm = win.CodeMirror(win.document.body, this.config);
|
||||
|
||||
// Disable APZ for source editors. It currently causes the line numbers to
|
||||
// "tear off" and swim around on top of the content. Bug 1160601 tracks
|
||||
// finding a solution that allows APZ to work with CodeMirror.
|
||||
cm.getScrollerElement().addEventListener("wheel", ev => {
|
||||
// By handling the wheel events ourselves, we force the platform to
|
||||
// scroll synchronously, like it did before APZ. However, we lose smooth
|
||||
// scrolling for users with mouse wheels. This seems acceptible vs.
|
||||
// doing nothing and letting the gutter slide around.
|
||||
ev.preventDefault();
|
||||
|
||||
let { deltaX, deltaY } = ev;
|
||||
|
||||
if (ev.deltaMode == ev.DOM_DELTA_LINE) {
|
||||
deltaX *= cm.defaultCharWidth();
|
||||
deltaY *= cm.defaultTextHeight();
|
||||
} else if (ev.deltaMode == ev.DOM_DELTA_PAGE) {
|
||||
deltaX *= cm.getWrapperElement().clientWidth;
|
||||
deltaY *= cm.getWrapperElement().clientHeight;
|
||||
}
|
||||
|
||||
cm.getScrollerElement().scrollBy(deltaX, deltaY);
|
||||
});
|
||||
|
||||
cm.getWrapperElement().addEventListener("contextmenu", ev => {
|
||||
ev.preventDefault();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user