解決atom使用ELAN觸控板時編輯器滾動異常問題
阿新 • • 發佈:2018-11-23
解決atom使用ELAN觸控板時編輯器滾動異常問題
atom 滾動異常是因為atom把觸控板的滾動事件識別為游標鍵按鍵事件了
通過配置編輯器快捷鍵可以實現通過同時按下
alt-cmd
時使用觸控板正常滾動編輯器的功能
keymap.cson
'atom-workspace':
'alt-cmd-up': 'core:cmd-move-up'
'alt-cmd-down': 'core:cmd-move-down'
'alt-cmd-left': 'core:cmd-move-left'
'alt-cmd-right': 'core:cmd-move-right'
init.coffee
atom.commands.add 'atom-workspace',
'core:cmd-move-down': () ->
editor = atom.workspace.getActiveTextEditor()
editor?.element.setScrollTop editor.element.getScrollTop() + editor.scrollSensitivity
'core:cmd-move-up': () ->
editor = atom.workspace.getActiveTextEditor()
editor ?.element.setScrollTop editor.element.getScrollTop() - editor.scrollSensitivity
'core:cmd-move-right': () ->
editor = atom.workspace.getActiveTextEditor()
editor?.element.setScrollLeft editor.element.getScrollLeft() + editor.scrollSensitivity
'core:cmd-move-left': () ->
editor = atom.workspace .getActiveTextEditor()
editor?.element.setScrollLeft editor.element.getScrollLeft() - editor.scrollSensitivity