@@ -24,19 +24,25 @@ class MinimapView extends View
2424
2525 # VIEW CREATION/DESTRUCTION
2626
27- constructor : (@paneView ) ->
27+ constructor : (@paneView , @allowDebug ) ->
2828 super
2929
3030 @scaleX = 0.2
3131 @scaleY = @scaleX * 0.8
3232 @minimapScale = @ scale (@scaleX , @scaleY )
3333 @miniScrollView = @miniEditorView .scrollView
3434 @minimapScroll = 0
35+ @ transform @miniWrapper [0 ], @minimapScale
36+ # dragging's status
37+ @isPressed = false
38+ @miniEditorView .allowDebug = @allowDebug
3539
3640 initialize : ->
3741 @ on ' mousewheel' , @onMouseWheel
3842 @ on ' mousedown' , @onMouseDown
3943
44+ @ on ' mousedown' , ' .minimap-visible-area' , @onDragStart
45+
4046 @ subscribe @paneView .model .$activeItem , @onActiveItemChanged
4147 @ subscribe @miniEditorView , ' minimap:updated' , @updateMinimapView
4248
@@ -47,6 +53,7 @@ class MinimapView extends View
4753 @configs .theme = atom .config .get (themeProp) ? CONFIGS .theme
4854 @ updateTheme ()
4955
56+
5057 destroy : ->
5158 @ off ()
5259 @ unsubscribe ()
@@ -68,8 +75,6 @@ class MinimapView extends View
6875 @paneView .removeClass (' with-minimap' )
6976 @ detachFromPaneView ()
7077
71- resetMinimapTransform : -> @ transform @miniWrapper [0 ], @ scale ()
72-
7378 minimapIsAttached : -> @paneView .find (' .minimap' ).length is 1
7479
7580 # EDITOR VIEW MANAGEMENT
@@ -193,6 +198,20 @@ class MinimapView extends View
193198 onScrollViewResized : =>
194199 @ updateMinimapView ()
195200
201+ onDragStart : (e ) =>
202+ # only supports for left-click
203+ return unless e .which is 1
204+ @isPressed = true
205+ @ on ' mousemove.visible-area' , @onMove
206+ @ on ' mouseup.visible-area' , @onDragEnd
207+
208+ onMove : (e ) =>
209+ @ onMouseDown e if @isPressed
210+
211+ onDragEnd : (e ) =>
212+ @isPressed = false
213+ @ off ' .visible-area'
214+
196215 # OTHER PRIVATE METHODS
197216
198217 activeTabSupportMinimap : ->
0 commit comments