relay scrolling over #header to usercss code section
This commit is contained in:
parent
d4ffa04bb6
commit
9c8e835a80
|
@ -129,6 +129,8 @@ function createSourceEditor(style) {
|
||||||
style.enabled = value;
|
style.enabled = value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$('#header').addEventListener('wheel', headerOnScroll, {passive: true});
|
||||||
|
|
||||||
cm.on('changes', () => {
|
cm.on('changes', () => {
|
||||||
dirty.modify('sourceGeneration', savedGeneration, cm.changeGeneration());
|
dirty.modify('sourceGeneration', savedGeneration, cm.changeGeneration());
|
||||||
updateLintReportIfEnabled(cm);
|
updateLintReportIfEnabled(cm);
|
||||||
|
@ -333,6 +335,20 @@ function createSourceEditor(style) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function headerOnScroll({deltaY, deltaMode, shiftKey}) {
|
||||||
|
if (deltaY < 0 && this.scrollTop ||
|
||||||
|
deltaY > 0 && this.scrollTop + this.clientHeight < this.scrollHeight) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cm.display.scroller.scrollTop +=
|
||||||
|
// WheelEvent.DOM_DELTA_LINE
|
||||||
|
deltaMode === 1 ? deltaY * cm.display.cachedTextHeight :
|
||||||
|
// WheelEvent.DOM_DELTA_PAGE
|
||||||
|
deltaMode === 2 || shiftKey ? Math.sign(deltaY) * cm.display.scroller.clientHeight :
|
||||||
|
// WheelEvent.DOM_DELTA_PIXEL
|
||||||
|
deltaY;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
replaceStyle,
|
replaceStyle,
|
||||||
save,
|
save,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user