Manage app.ts litegraph keybindings (#1151)

* Manage app.ts litegraph keybindings

* nit
This commit is contained in:
Chenlei Hu
2024-10-07 16:50:58 -04:00
committed by GitHub
parent ff1ca268a4
commit cc17bee945
6 changed files with 159 additions and 77 deletions

View File

@@ -8,16 +8,20 @@ import type { ComfyExtension } from '@/types/comfy'
export class KeybindingImpl implements Keybinding {
commandId: string
combo: KeyComboImpl
targetSelector?: string
constructor(obj: Keybinding) {
this.commandId = obj.commandId
this.combo = new KeyComboImpl(obj.combo)
this.targetSelector = obj.targetSelector
}
equals(other: any): boolean {
if (toRaw(other) instanceof KeybindingImpl) {
return (
this.commandId === other.commandId && this.combo.equals(other.combo)
this.commandId === other.commandId &&
this.combo.equals(other.combo) &&
this.targetSelector === other.targetSelector
)
}
return false