@@ -34,6 +34,7 @@ class MinimapView extends View
3434 @ transform @miniWrapper [0 ], @minimapScale
3535 # dragging's status
3636 @isPressed = false
37+ @offsetLeft = 0
3738 @offsetTop = 0
3839 @indicator = new MinimapIndicator ()
3940
@@ -96,8 +97,9 @@ class MinimapView extends View
9697
9798 subscribeToEditor : ->
9899 @ subscribe @editor , ' screen-lines-changed.minimap' , @updateMinimapEditorView
99- @ subscribe @editor , ' scroll-top-changed.minimap' , @updateScroll
100- # @subscribe @editor, 'scroll-left-changed.minimap', @updateScroll
100+ @ subscribe @editor , ' scroll-top-changed.minimap' , @updateScrollY
101+ # Hacked scroll-left
102+ @ subscribe @scrollView , ' scroll.minimap' , @updateScrollX
101103
102104 # See /Applications/Atom.app/Contents/Resources/app/src/pane-view.js#349
103105 # pane-view's private api
@@ -160,7 +162,7 @@ class MinimapView extends View
160162
161163 setImmediate => @ updateScroll ()
162164
163- updateScroll : (top ) =>
165+ updateScrollY : (top ) =>
164166 # Need scroll-top value when in find pane or on Vim mode(`gg`, `shift+g`).
165167 # Or we can find a better solution.
166168 if top?
@@ -170,10 +172,18 @@ class MinimapView extends View
170172 overlayerOffset = @scrollView .find (' .overlayer' ).offset ().top
171173 overlayY = - overlayerOffset + scrollViewOffset
172174
173- @indicator .y = overlayY
174- @indicator .updateRatio ()
175- @indicator .updateScrollerPosition ()
175+ @indicator .setY (overlayY)
176+ @ updatePositions ()
176177
178+ updateScrollX : =>
179+ @indicator .setX (@scrollView [0 ].scrollLeft )
180+ @ updatePositions ()
181+
182+ updateScroll : =>
183+ @ updateScrollX ()
184+ @ updateScrollY ()
185+
186+ updatePositions : ->
177187 @ transform @miniVisibleArea [0 ], @ translate (@indicator .x , @indicator .y )
178188 @ transform @miniWrapper [0 ], @minimapScale + @ translate (@indicator .scroller .x , @indicator .scroller .y )
179189
0 commit comments