mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 11:44:21 -05:00
Merge pull request #475 from sharelatex/ja-scroll-overflow-in-review-panel
Allow scrolling in the review panel to extend outside of top of text …
This commit is contained in:
commit
ce59307c91
1 changed files with 5 additions and 11 deletions
|
@ -127,15 +127,13 @@ define [
|
||||||
ace.require("ace/lib/event").addMouseWheelListener scroller[0], (e) ->
|
ace.require("ace/lib/event").addMouseWheelListener scroller[0], (e) ->
|
||||||
deltaY = e.wheelY
|
deltaY = e.wheelY
|
||||||
old_top = parseInt(list.css("top"))
|
old_top = parseInt(list.css("top"))
|
||||||
top = Math.min(0, old_top - deltaY * 4)
|
top = old_top - deltaY * 4
|
||||||
list.css(top: top)
|
|
||||||
scrollAce(-top)
|
scrollAce(-top)
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
# Use these to avoid unnecessary updates. Scrolling one
|
# We always scroll by telling Ace to scroll and then updating the
|
||||||
# panel causes us to scroll the other panel, but there's no
|
# review panel. This lets Ace manage the size of the scroller and
|
||||||
# need to trigger the event back to the original panel.
|
# when it overflows.
|
||||||
ignoreNextPanelEvent = false
|
|
||||||
ignoreNextAceEvent = false
|
ignoreNextAceEvent = false
|
||||||
|
|
||||||
scrollPanel = (scrollTop, height) ->
|
scrollPanel = (scrollTop, height) ->
|
||||||
|
@ -148,10 +146,6 @@ define [
|
||||||
list.css(top: - scrollTop)
|
list.css(top: - scrollTop)
|
||||||
|
|
||||||
scrollAce = (scrollTop) ->
|
scrollAce = (scrollTop) ->
|
||||||
if ignoreNextPanelEvent
|
|
||||||
ignoreNextPanelEvent = false
|
|
||||||
else
|
|
||||||
ignoreNextAceEvent = true
|
|
||||||
scope.reviewPanelEventsBridge.emit "externalScroll", scrollTop
|
scope.reviewPanelEventsBridge.emit "externalScroll", scrollTop
|
||||||
|
|
||||||
scope.reviewPanelEventsBridge.on "aceScroll", scrollPanel
|
scope.reviewPanelEventsBridge.on "aceScroll", scrollPanel
|
||||||
|
|
Loading…
Reference in a new issue