Merge branch 'dev' of https://gitee.com/MTrun/go-view into master-fetch-dev

This commit is contained in:
奔跑的面条
2022-10-15 17:20:05 +08:00
93 changed files with 2443 additions and 672 deletions
+20 -11
View File
@@ -3,8 +3,9 @@ import { useSync } from './useSync.hook'
import { WinKeyboard, MacKeyboard, MenuEnum } from '@/enums/editPageEnum'
import throttle from 'lodash/throttle'
import debounce from 'lodash/debounce'
import keymaster from 'keymaster'
import { setKeyboardDressShow } from '@/utils'
// Keymaster可以支持识别以下组合键: ⇧,shift,option,⌥,altctrlcontrolcommand,和⌘
const chartEditStore = useChartEditStore()
const useSyncIns = useSync()
@@ -29,7 +30,7 @@ export const winKeyboardValue = {
[MenuEnum.LOCK]: winCtrlMerge('l'),
[MenuEnum.UNLOCK]: winCtrlMerge(winShiftMerge('l')),
[MenuEnum.HIDE]: winCtrlMerge('h'),
[MenuEnum.SHOW]: winCtrlMerge(winShiftMerge('h')),
[MenuEnum.SHOW]: winCtrlMerge(winShiftMerge('h'))
}
// 这个 Ctrl 后面还是换成了 ⌘
@@ -55,7 +56,7 @@ export const macKeyboardValue = {
[MenuEnum.LOCK]: macCtrlMerge('l'),
[MenuEnum.UNLOCK]: macCtrlMerge(macShiftMerge('l')),
[MenuEnum.HIDE]: macCtrlMerge('h'),
[MenuEnum.SHOW]: macCtrlMerge(macShiftMerge('h')),
[MenuEnum.SHOW]: macCtrlMerge(macShiftMerge('h'))
}
// Win 快捷键列表
@@ -81,7 +82,7 @@ const winKeyList: Array<string> = [
winKeyboardValue.unLock,
winKeyboardValue.hide,
winKeyboardValue.show,
winKeyboardValue.show
]
// Mac 快捷键列表
@@ -107,21 +108,29 @@ const macKeyList: Array<string> = [
macKeyboardValue.unLock,
macKeyboardValue.hide,
macKeyboardValue.show,
macKeyboardValue.show
]
// 处理键盘记录
const keyRecordHandle = () => {
// 初始化清空
if(window.$KeyboardActive) window.$KeyboardActive = new Set([])
// 默认赋值
window.$KeyboardActive = {
ctrl: false
}
document.onkeydown = (e: KeyboardEvent) => {
if(window.$KeyboardActive) window.$KeyboardActive.add(e.key.toLocaleLowerCase())
else window.$KeyboardActive = new Set([e.key.toLocaleLowerCase()])
if(e.keyCode === 17 && window.$KeyboardActive) {
setKeyboardDressShow(e.keyCode)
window.$KeyboardActive.ctrl = true
}
}
document.onkeyup = (e: KeyboardEvent) => {
if(window.$KeyboardActive) window.$KeyboardActive.delete(e.key.toLocaleLowerCase())
if(e.keyCode === 17 && window.$KeyboardActive)
{
window.$KeyboardActive.ctrl = false
setKeyboardDressShow()
}
}
}