@@ -32,23 +32,17 @@ class MinimapView extends View
3232 @minimapScale = @ scale (@scaleX , @scaleY )
3333 @miniScrollView = @miniEditorView .scrollView
3434 @minimapScroll = 0
35-
3635 @ transform @miniWrapper [0 ], @minimapScale
36+ # dragging's status
37+ @isPressed = false
3738
3839 initialize : ->
3940
40- isPressed = false
41- @ on ' mousedown' , ' .minimap-visible-area' , (e ) =>
42- isPressed = true
43- @ on ' mousemove.visible-area' , (e ) =>
44- @ onMouseDown e if isPressed
45- @ on ' mouseup.visible-area' , (e ) =>
46- isPressed = false
47- @ off ' .visible-area'
48-
4941 @ on ' mousewheel' , @onMouseWheel
5042 @ on ' mousedown' , @onMouseDown
5143
44+ @ on ' mousedown' , ' .minimap-visible-area' , @onDragStart
45+
5246 @ subscribe @paneView .model .$activeItem , @onActiveItemChanged
5347 @ subscribe @miniEditorView , ' minimap:updated' , @updateMinimapView
5448
@@ -203,6 +197,20 @@ class MinimapView extends View
203197 onScrollViewResized : =>
204198 @ updateMinimapView ()
205199
200+ onDragStart : (e ) =>
201+ # only supports for left-click
202+ return unless e .which is 1
203+ @isPressed = true
204+ @ on ' mousemove.visible-area' , @onMove
205+ @ on ' mouseup.visible-area' , @onDragEnd
206+
207+ onMove : (e ) =>
208+ @ onMouseDown e if @isPressed
209+
210+ onDragEnd : (e ) =>
211+ @isPressed = false
212+ @ off ' .visible-area'
213+
206214 # OTHER PRIVATE METHODS
207215
208216 activeTabSupportMinimap : ->
0 commit comments