Merge pull request #8373 from overleaf/td-review-panel-scroll

Scroll incrementally in response to mouse wheel in review panel

GitOrigin-RevId: 2c1f119ae8dfd09b378a3b265c3543f88e2d1f65
This commit is contained in:
Tim Down 2022-06-10 14:43:12 +01:00 committed by Copybot
parent 93f1339b87
commit ca5f438290

View file

@ -255,7 +255,7 @@ export default App.directive('reviewPanelSorted', $timeout => ({
const old_top = parseInt(list.css('top'))
const top = old_top - deltaY * 4
scrollAce(-top)
dispatchScrollEvent(-top)
dispatchScrollEvent(deltaY * 4)
return e.preventDefault()
})
@ -287,11 +287,11 @@ export default App.directive('reviewPanelSorted', $timeout => ({
scrollPanel(scrollTop - paddingTop, height)
})
// send the scroll position to the CodeMirror 6 track changes extension
const dispatchScrollEvent = value => {
// Send scroll delta to the CodeMirror 6 track changes extension
const dispatchScrollEvent = scrollTopDelta => {
window.dispatchEvent(
new CustomEvent('review-panel:event', {
detail: { type: 'scroll', payload: value },
detail: { type: 'scroll', payload: scrollTopDelta },
})
)
}