Skip to content

Commit

Permalink
🐛 Fix error raised when clicking on minimap
Browse files Browse the repository at this point in the history
Fixes #198
  • Loading branch information
abe33 committed Jan 7, 2015
1 parent 4f1f204 commit a77a94a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/minimap-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,15 @@ class MinimapView extends View
e.preventDefault()
e.stopPropagation()

y = e.pageY - @offsetTop
top = (y + @renderView.scrollTop()) / @scaleY
{pageY, target} = e

y = pageY - target.getBoundingClientRect().top
row = Math.floor(y / @getLineHeight()) + @getFirstVisibleScreenRow()

scrollTop = row * @getTextEditor().getLineHeightInPixels() - @getTextEditor().getHeight() / 2

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

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

0 comments on commit a77a94a

Please sign in to comment.