@@ -44,111 +44,114 @@ class MinimapQuickSettingsElement {
4444 this . plugins = { }
4545 this . itemsActions = new WeakMap ( )
4646
47- const subs = this . subscriptions
48-
49- subs . add ( Main . onDidAddPlugin ( ( { name, plugin } ) => {
50- return this . addItemFor ( name , plugin )
51- } ) )
52- subs . add ( Main . onDidRemovePlugin ( ( { name, plugin } ) => {
53- return this . removeItemFor ( name , plugin )
54- } ) )
55- subs . add ( Main . onDidActivatePlugin ( ( { name, plugin } ) => {
56- return this . activateItem ( name , plugin )
57- } ) )
58- subs . add ( Main . onDidDeactivatePlugin ( ( { name, plugin } ) => {
59- return this . deactivateItem ( name , plugin )
60- } ) )
61-
62- subs . add ( atom . commands . add ( 'minimap-quick-settings' , {
63- 'core:move-up' : ( ) => {
64- this . selectPreviousItem ( )
65- } ,
66- 'core:move-down' : ( ) => {
67- this . selectNextItem ( )
68- } ,
69- 'core:move-left' : ( ) => {
70- atom . config . set ( 'minimap.displayMinimapOnLeft' , true )
71- } ,
72- 'core:move-right' : ( ) => {
73- atom . config . set ( 'minimap.displayMinimapOnLeft' , false )
74- } ,
75- 'core:cancel' : ( ) => {
76- this . destroy ( )
77- } ,
78- 'core:confirm' : ( ) => {
79- this . toggleSelectedItem ( )
80- }
81- } ) )
82-
8347 this . codeHighlights . classList . toggle ( 'active' , this . minimap . displayCodeHighlights )
8448
85- subs . add ( this . subscribeTo ( this . codeHighlights , {
86- mousedown : ( e ) => {
87- e . preventDefault ( )
88- atom . config . set ( 'minimap.displayCodeHighlights' , ! this . minimap . displayCodeHighlights )
89- }
90- } ) )
91-
9249 this . itemsActions . set ( this . codeHighlights , ( ) => {
9350 atom . config . set ( 'minimap.displayCodeHighlights' , ! this . minimap . displayCodeHighlights )
9451 } )
9552
96- subs . add ( this . subscribeTo ( this . absoluteMode , {
97- mousedown : ( e ) => {
98- e . preventDefault ( )
99- atom . config . set ( 'minimap.absoluteMode' , ! atom . config . get ( 'minimap.absoluteMode' ) )
100- }
101- } ) )
102-
10353 this . itemsActions . set ( this . absoluteMode , ( ) => {
10454 atom . config . set ( 'minimap.absoluteMode' , ! atom . config . get ( 'minimap.absoluteMode' ) )
10555 } )
10656
107- subs . add ( this . subscribeTo ( this . adjustAbsoluteModeHeight , {
108- mousedown : ( e ) => {
109- e . preventDefault ( )
110- atom . config . set ( 'minimap.adjustAbsoluteModeHeight' , ! atom . config . get ( 'minimap.adjustAbsoluteModeHeight' ) )
111- }
112- } ) )
113-
11457 this . itemsActions . set ( this . adjustAbsoluteModeHeight , ( ) => {
11558 atom . config . set ( 'minimap.adjustAbsoluteModeHeight' , ! atom . config . get ( 'minimap.adjustAbsoluteModeHeight' ) )
11659 } )
11760
118- subs . add ( this . subscribeTo ( this . hiddenInput , {
119- focusout : ( e ) => { this . destroy ( ) }
120- } , { passive : true } ) )
121-
122- subs . add ( this . subscribeTo ( this . onLeftButton , {
123- mousedown : ( e ) => {
124- e . preventDefault ( )
125- atom . config . set ( 'minimap.displayMinimapOnLeft' , true )
126- }
127- } ) )
128-
129- subs . add ( this . subscribeTo ( this . onRightButton , {
130- mousedown : ( e ) => {
131- e . preventDefault ( )
132- atom . config . set ( 'minimap.displayMinimapOnLeft' , false )
133- }
134- } ) )
135-
136- subs . add ( atom . config . observe ( 'minimap.displayCodeHighlights' , ( bool ) => {
137- this . codeHighlights . classList . toggle ( 'active' , bool )
138- } ) )
139-
140- subs . add ( atom . config . observe ( 'minimap.absoluteMode' , ( bool ) => {
141- this . absoluteMode . classList . toggle ( 'active' , bool )
142- } ) )
143-
144- subs . add ( atom . config . observe ( 'minimap.adjustAbsoluteModeHeight' , ( bool ) => {
145- this . adjustAbsoluteModeHeight . classList . toggle ( 'active' , bool )
146- } ) )
147-
148- subs . add ( atom . config . observe ( 'minimap.displayMinimapOnLeft' , ( bool ) => {
149- this . onLeftButton . classList . toggle ( 'selected' , bool )
150- this . onRightButton . classList . toggle ( 'selected' , ! bool )
151- } ) )
61+ this . subscriptions . add (
62+
63+ Main . onDidAddPlugin ( ( { name, plugin } ) => {
64+ return this . addItemFor ( name , plugin )
65+ } ) ,
66+ Main . onDidRemovePlugin ( ( { name, plugin } ) => {
67+ return this . removeItemFor ( name , plugin )
68+ } ) ,
69+ Main . onDidActivatePlugin ( ( { name, plugin } ) => {
70+ return this . activateItem ( name , plugin )
71+ } ) ,
72+ Main . onDidDeactivatePlugin ( ( { name, plugin } ) => {
73+ return this . deactivateItem ( name , plugin )
74+ } ) ,
75+
76+ atom . commands . add ( 'minimap-quick-settings' , {
77+ 'core:move-up' : ( ) => {
78+ this . selectPreviousItem ( )
79+ } ,
80+ 'core:move-down' : ( ) => {
81+ this . selectNextItem ( )
82+ } ,
83+ 'core:move-left' : ( ) => {
84+ atom . config . set ( 'minimap.displayMinimapOnLeft' , true )
85+ } ,
86+ 'core:move-right' : ( ) => {
87+ atom . config . set ( 'minimap.displayMinimapOnLeft' , false )
88+ } ,
89+ 'core:cancel' : ( ) => {
90+ this . destroy ( )
91+ } ,
92+ 'core:confirm' : ( ) => {
93+ this . toggleSelectedItem ( )
94+ }
95+ } ) ,
96+
97+ this . subscribeTo ( this . codeHighlights , {
98+ mousedown : ( e ) => {
99+ e . preventDefault ( )
100+ atom . config . set ( 'minimap.displayCodeHighlights' , ! this . minimap . displayCodeHighlights )
101+ }
102+ } ) ,
103+
104+ this . subscribeTo ( this . absoluteMode , {
105+ mousedown : ( e ) => {
106+ e . preventDefault ( )
107+ atom . config . set ( 'minimap.absoluteMode' , ! atom . config . get ( 'minimap.absoluteMode' ) )
108+ }
109+ } ) ,
110+
111+ this . subscribeTo ( this . adjustAbsoluteModeHeight , {
112+ mousedown : ( e ) => {
113+ e . preventDefault ( )
114+ atom . config . set ( 'minimap.adjustAbsoluteModeHeight' , ! atom . config . get ( 'minimap.adjustAbsoluteModeHeight' ) )
115+ }
116+ } ) ,
117+
118+ this . subscribeTo ( this . hiddenInput , {
119+ focusout : ( e ) => { this . destroy ( ) }
120+ } ,
121+ { passive : true }
122+ ) ,
123+
124+ this . subscribeTo ( this . onLeftButton , {
125+ mousedown : ( e ) => {
126+ e . preventDefault ( )
127+ atom . config . set ( 'minimap.displayMinimapOnLeft' , true )
128+ }
129+ } ) ,
130+
131+ this . subscribeTo ( this . onRightButton , {
132+ mousedown : ( e ) => {
133+ e . preventDefault ( )
134+ atom . config . set ( 'minimap.displayMinimapOnLeft' , false )
135+ }
136+ } ) ,
137+
138+ atom . config . observe ( 'minimap.displayCodeHighlights' , ( bool ) => {
139+ this . codeHighlights . classList . toggle ( 'active' , bool )
140+ } ) ,
141+
142+ atom . config . observe ( 'minimap.absoluteMode' , ( bool ) => {
143+ this . absoluteMode . classList . toggle ( 'active' , bool )
144+ } ) ,
145+
146+ atom . config . observe ( 'minimap.adjustAbsoluteModeHeight' , ( bool ) => {
147+ this . adjustAbsoluteModeHeight . classList . toggle ( 'active' , bool )
148+ } ) ,
149+
150+ atom . config . observe ( 'minimap.displayMinimapOnLeft' , ( bool ) => {
151+ this . onLeftButton . classList . toggle ( 'selected' , bool )
152+ this . onRightButton . classList . toggle ( 'selected' , ! bool )
153+ } )
154+ )
152155
153156 this . initList ( )
154157 }
0 commit comments