Skip to content
Snippets Groups Projects
Commit c98bd220 authored by Adrian Heine's avatar Adrian Heine
Browse files

Fix wheel scrolling and set forceScroll from op

I broke this in 0ad53e0a. Closes #4713.
parent b93ab2d8
No related branches found
No related tags found
No related merge requests found
...@@ -140,7 +140,7 @@ function endOperation_finish(op) { ...@@ -140,7 +140,7 @@ function endOperation_finish(op) {
display.wheelStartX = display.wheelStartY = null display.wheelStartX = display.wheelStartY = null
// Propagate the scroll position to the actual DOM scroller // Propagate the scroll position to the actual DOM scroller
if (op.scrollTop != null) setScrollTop(cm, op.scrollTop, true) if (op.scrollTop != null) setScrollTop(cm, op.scrollTop, op.forceScroll)
if (op.scrollLeft != null) setScrollLeft(cm, op.scrollLeft, true, true) if (op.scrollLeft != null) setScrollLeft(cm, op.scrollLeft, true, true)
// If we need to scroll a specific position into view, do so. // If we need to scroll a specific position into view, do so.
......
...@@ -156,16 +156,17 @@ export function scrollToCoordsRange(cm, from, to, margin) { ...@@ -156,16 +156,17 @@ export function scrollToCoordsRange(cm, from, to, margin) {
export function updateScrollTop(cm, val) { export function updateScrollTop(cm, val) {
if (Math.abs(cm.doc.scrollTop - val) < 2) return if (Math.abs(cm.doc.scrollTop - val) < 2) return
if (!gecko) updateDisplaySimple(cm, {top: val}) if (!gecko) updateDisplaySimple(cm, {top: val})
setScrollTop(cm, val) setScrollTop(cm, val, true)
if (gecko) updateDisplaySimple(cm) if (gecko) updateDisplaySimple(cm)
startWorker(cm, 100) startWorker(cm, 100)
} }
export function setScrollTop(cm, val, forceScroll) { export function setScrollTop(cm, val, forceScroll) {
val = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val) val = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val)
if (cm.display.scroller.scrollTop == val && !forceScroll) return if (cm.display.scroller.scrollTop == val && !forceScroll) return
cm.doc.scrollTop = val cm.doc.scrollTop = val
cm.display.scrollbars.setScrollTop(val) cm.display.scrollbars.setScrollTop(val)
cm.display.scroller.scrollTop = val if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val
} }
// Sync scroller and scrollbar, ensure the gutter elements are // Sync scroller and scrollbar, ensure the gutter elements are
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment