14 phase updated
This commit is contained in:
parent
023714442d
commit
dd68fc9ccd
3 changed files with 1003 additions and 25 deletions
|
|
@ -476,28 +476,32 @@ class HotkeyService extends EventEmitter {
|
|||
// 핫키에 지정된 수정자가 모두 눌려 있어야 하고,
|
||||
// 지정되지 않은 수정자는 눌려 있으면 안 된다.
|
||||
//
|
||||
// 단, 핫키의 주 키 자체가 수정자 키인 경우(예: Right Alt)에는
|
||||
// 해당 수정자의 altKey 등이 true로 올 수 있으므로, 주 키가 수정자인 경우
|
||||
// 해당 수정자 검사를 건너뛴다.
|
||||
const isKeyModifier = this._isModifierKeyCode(config.keyCode)
|
||||
// 단, 핫키의 주 키 자체가 수정자 키인 경우(예: Right Alt 단독):
|
||||
// - 해당 수정자의 altKey 등이 true로 올 수 있으므로,
|
||||
// modifiers에 해당 modifier가 **없을 때만** 이벤트의 해당 플래그를 무시한다.
|
||||
// - modifiers에 해당 modifier가 **있으면** (예: Alt+Right Alt은 불가하므로)
|
||||
// 해당 플래그가 true여야 매칭 성공.
|
||||
//
|
||||
// 예: Right Alt 단독 (keyCode=AltRight, modifiers=[])
|
||||
// → e.altKey가 true여도 wantsAlt=false이므로 bypass → match
|
||||
// 예: Ctrl+Right Alt (keyCode=AltRight, modifiers=['ctrl'])
|
||||
// → e.altKey bypass, e.ctrlKey===true 체크 → match only with Ctrl held
|
||||
|
||||
const wantsCtrl = config.modifiers.includes('ctrl')
|
||||
const wantsAlt = config.modifiers.includes('alt')
|
||||
const wantsShift = config.modifiers.includes('shift')
|
||||
const wantsMeta = config.modifiers.includes('meta')
|
||||
|
||||
const ctrlMatch = isKeyModifier && this._isCtrlKeyCode(config.keyCode)
|
||||
? true
|
||||
: e.ctrlKey === wantsCtrl
|
||||
const altMatch = isKeyModifier && this._isAltKeyCode(config.keyCode)
|
||||
? true
|
||||
: e.altKey === wantsAlt
|
||||
const shiftMatch = isKeyModifier && this._isShiftKeyCode(config.keyCode)
|
||||
? true
|
||||
: e.shiftKey === wantsShift
|
||||
const metaMatch = isKeyModifier && this._isMetaKeyCode(config.keyCode)
|
||||
? true
|
||||
: e.metaKey === wantsMeta
|
||||
// 주 키 자체가 해당 modifier인 경우, 그 modifier의 이벤트 플래그는 무시
|
||||
const skipCtrl = this._isCtrlKeyCode(config.keyCode) && !wantsCtrl
|
||||
const skipAlt = this._isAltKeyCode(config.keyCode) && !wantsAlt
|
||||
const skipShift = this._isShiftKeyCode(config.keyCode) && !wantsShift
|
||||
const skipMeta = this._isMetaKeyCode(config.keyCode) && !wantsMeta
|
||||
|
||||
const ctrlMatch = skipCtrl || (e.ctrlKey === wantsCtrl)
|
||||
const altMatch = skipAlt || (e.altKey === wantsAlt)
|
||||
const shiftMatch = skipShift || (e.shiftKey === wantsShift)
|
||||
const metaMatch = skipMeta || (e.metaKey === wantsMeta)
|
||||
|
||||
if (ctrlMatch && altMatch && shiftMatch && metaMatch) {
|
||||
return config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue