File tree Expand file tree Collapse file tree 4 files changed +18
-21
lines changed Expand file tree Collapse file tree 4 files changed +18
-21
lines changed Original file line number Diff line number Diff line change @@ -13,21 +13,13 @@ interface EditorScrollCommandsSettings {
1313}
1414
1515const DEFAULT_SETTINGS : EditorScrollCommandsSettings = {
16- offset : 2 ,
17- interval : 5 ,
16+ offset : 4 ,
17+ interval : 6 ,
1818 accelerate : true ,
19- accelRate : 0.024 ,
20- maxAccel : 4 ,
19+ accelRate : 0.02 ,
20+ maxAccel : 8 ,
2121}
2222
23- const MODIFIER_TO_EVENT_PROP = {
24- 'Alt' : 'altKey' ,
25- 'Shift' : 'shiftKey' ,
26- 'Ctrl' : 'ctrlKey' ,
27- 'Meta' : 'metaKey' ,
28- 'Mod' : Platform . isMacOS ? 'metaKey' : 'ctrlKey' ,
29- } ;
30-
3123export default class EditorScrollCommandsPlugin extends Plugin {
3224 settings : EditorScrollCommandsSettings ;
3325 intervalId : number ;
@@ -76,14 +68,18 @@ export default class EditorScrollCommandsPlugin extends Plugin {
7668 ( hotkey . key == event . code ) ||
7769 ( 'Key' + hotkey . key == event . code ) ;
7870
79- let allModsMatched = hotkey . modifiers . every ( m => {
80- let modifierPressed = MODIFIER_TO_EVENT_PROP [ m ] ;
71+ if ( ! keyMatched ) { return false ; }
8172
82- // @ts -expect-error
83- return event [ modifierPressed ] ;
84- } ) ;
73+ let mods = hotkey . modifiers ;
74+ let modKeyState = Platform . isMacOS ? event . metaKey : event . ctrlKey ;
75+
76+ if ( event . altKey != mods . contains ( 'Alt' ) ) { return false ; }
77+ if ( event . ctrlKey != mods . contains ( 'Ctrl' ) ) { return false ; }
78+ if ( event . shiftKey != mods . contains ( 'Shift' ) ) { return false ; }
79+ if ( event . metaKey != mods . contains ( 'Meta' ) ) { return false ; }
80+ if ( modKeyState != mods . contains ( 'Mod' ) ) { return false ; }
8581
86- return keyMatched && allModsMatched ;
82+ return true ;
8783 } ) ;
8884 }
8985
Original file line number Diff line number Diff line change 11{
22 "id" : " editor-scroll-commands" ,
33 "name" : " Editor Scroll Commands" ,
4- "version" : " 1.1.1 " ,
4+ "version" : " 1.1.2 " ,
55 "minAppVersion" : " 0.15.0" ,
66 "description" : " Add scroll commands for editor, so you can assign hotkeys." ,
77 "author" :
" Andrey Sorokin <[email protected] >" ,
Original file line number Diff line number Diff line change 11{
22 "name" : " editor-scroll-commands" ,
3- "version" : " 1.1.1 " ,
3+ "version" : " 1.1.2 " ,
44 "description" : " Add scroll commands for editor, so you can assign hotkeys." ,
55 "main" : " main.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change 22 "1.0.0" : " 0.15.0" ,
33 "1.0.3" : " 0.15.0" ,
44 "1.1.0" : " 0.15.0" ,
5- "1.1.1" : " 0.15.0"
5+ "1.1.1" : " 0.15.0" ,
6+ "1.1.2" : " 0.15.0"
67}
You can’t perform that action at this time.
0 commit comments