Skip to content

Commit

Permalink
🐛 Fix broken scroll when clicking the minimap
Browse files Browse the repository at this point in the history
Fixes #171
  • Loading branch information
abe33 committed Dec 10, 2014
1 parent 17c22f8 commit e9c501c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/minimap-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,13 @@ class MinimapView extends View
@isClicked = true
e.preventDefault()
e.stopPropagation()
# VisibleArea's center-y

y = e.pageY - @offsetTop
top = @indicator.computeFromCenterY(y) / @scaleY
# @note: currently, no animation.
@editor.scrollToScreenPosition({top, left: 0})
top = (y + @renderView.scrollTop()) / @scaleY

position = @editor.displayBuffer.screenPositionForPixelPosition({top, left: 0})
@editor.scrollToScreenPosition(position, center: true)

# Fix trigger `mousewheel` event.
setTimeout =>
@isClicked = false
Expand Down

0 comments on commit e9c501c

Please sign in to comment.