Skip to content

Commit e5777aa

Browse files
committed
Bump version to 0.5.0
Conflicts: History.md package.json
2 parents 29b91e4 + 725a5d5 commit e5777aa

File tree

7 files changed

+54
-11
lines changed

7 files changed

+54
-11
lines changed

History.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
0.5.0 / 2014-04-03
2+
==================
3+
4+
* drag-to-scroll
5+
* using `ctrl-k ctrl-m` toggle the minimap without the logs
6+
* using `ctrl-k ctrl-d` toggle the minimap with the logs
7+
18
0.4.0 / 2014-04-02
29
==================
310

Readme.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ apm install minimap
1515
* [Redacted Font][]
1616
* Multiple Panes
1717
* Responsive
18-
* Mouse wheel and simple click-to-scroll _(no animation)_ support
18+
* Mouse wheel and click-to-scroll _(no animation)_
19+
* drag-to-scroll
20+
21+
### Shortcuts
22+
23+
* `ctrl-k ctrl-m` toggle the minimap without the logs
24+
* `ctrl-k ctrl-d` toggle the minimap with the logs
1925

2026
### Contributors
2127

keymaps/minimap.cson

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
# For more detailed documentation see
99
# https://atom.io/docs/latest/advanced/keymaps
1010
'.workspace':
11-
'ctrl-alt-o': 'minimap:toggle'
11+
'ctrl-k ctrl-m': 'minimap:toggle'
12+
'ctrl-k ctrl-d': 'minimap:toggle-debug'

lib/minimap-view.coffee

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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: ->

lib/minimap.coffee

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ class Minimap
1111
# minimapViews object will never be set to null.
1212
active: false
1313

14+
# Does the minimap debug features are activated on toggle
15+
allowDebug: false
16+
1417
activate: ->
1518
atom.workspaceView.command 'minimap:toggle', => @toggle()
19+
atom.workspaceView.command 'minimap:toggle-debug', => @toggleDebug()
1620

1721
deactivate: ->
1822
view.destroy() for id, view of @minimapViews
1923
@eachPaneViewSubscription.off()
2024
@minimapViews = {}
2125
@emit('deactivated')
2226

23-
toggle: ->
27+
toggle: (debugMode=false) ->
28+
@allowDebug = debugMode
2429
if @active
2530
@deactivate()
2631
else
@@ -29,14 +34,16 @@ class Minimap
2934

3035
@active = not @active
3136

37+
toggleDebug: ->
38+
@toggle(true)
39+
3240
updateAllViews: ->
3341
view.onScrollViewResized() for id,view of @minimapViews
3442

3543
minimapForEditorView: (editorView) ->
3644
@minimapForPaneView(editorView.getPane())
3745

3846
minimapForPaneView: (paneView) -> @minimapForPane(paneView.model)
39-
4047
minimapForPane: (pane) -> @minimapViews[pane.id]
4148

4249
open: ->
@@ -46,7 +53,7 @@ class Minimap
4653
# the callback.
4754
@eachPaneViewSubscription = atom.workspaceView.eachPaneView (paneView) =>
4855
paneId = paneView.model.id
49-
view = new MinimapView(paneView)
56+
view = new MinimapView(paneView, @allowDebug)
5057
view.onActiveItemChanged(paneView.getActiveItem())
5158
@updateAllViews()
5259

lib/mixins/debug.coffee

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ Mixin = require 'mixto'
22

33
module.exports =
44
class Debug extends Mixin
5+
allowDebug: false
6+
57
log: (args...) ->
68
console.log.apply(console, args) if @inDevMode()
79

@@ -35,4 +37,4 @@ class Debug extends Mixin
3537
time = @logIntermediateTime(label)
3638
@benchmarkTimes.push(time)
3739

38-
inDevMode: -> atom.inDevMode()
40+
inDevMode: -> @allowDebug and atom.inDevMode()

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "minimap",
33
"main": "./lib/minimap",
4-
"version": "0.4.0",
4+
"version": "0.5.0",
55
"private": true,
66
"description": "A preview of the full source code.",
77
"author": "Fangdun Cai <[email protected]>",
@@ -16,7 +16,8 @@
1616
}
1717
],
1818
"activationEvents": [
19-
"minimap:toggle"
19+
"minimap:toggle",
20+
"minimap:toggle-debug"
2021
],
2122
"repository": "https://github.com/fundon/atom-minimap",
2223
"license": "MIT",

0 commit comments

Comments
 (0)