KeyBinding

Entity → ceramic.KeyBinding (Class)

Represents a keyboard shortcut binding that triggers when a specific key combination is pressed.

KeyBinding monitors keyboard input and triggers an event when its assigned key combination is activated. It supports modifier keys (Shift, Cmd/Ctrl) combined with regular keys, and handles platform-specific differences (e.g., Cmd on macOS vs Ctrl on Windows/Linux).

Note: KeyBinding instances are typically created and managed by KeyBindings, not instantiated directly.

Instance Members

accelerator: ReadOnlyArray<Anonymous>

The key combination that triggers this binding. Read-only array of KeyAcceleratorItem elements that must all be pressed together.


bindings: KeyBindings

The parent KeyBindings instance that manages this binding. Null if this binding is not part of a KeyBindings collection.

Events

@event trigger()

Triggered when the key combination is pressed. The event fires once when all keys in the combination are pressed together.

onTrigger(owner, handler) onceTrigger(owner, handler) offTrigger(?handler) listensTrigger()

Private Members

pressedItems: Array<Int>

matches: Bool

leftShiftPressed: Bool

rightShiftPressed: Bool

disableIfShiftPressed: Bool

emitTrigger(): Void

Triggered when the key combination is pressed. The event fires once when all keys in the combination are pressed together. @event trigger


bindKeyboardEvents(): Void

bindScanCode(scanCode: ScanCode, itemIndex: Int): Void
Name Type
scanCode ScanCode
itemIndex Int

bindKeyCode(keyCode: KeyCode, itemIndex: Int): Void
Name Type
keyCode KeyCode
itemIndex Int

bindShift(): Void

checkStatus(): Void

new(accelerator: Array<Anonymous>, ?bindings: KeyBindings): Void
Name Type Default
accelerator Array
bindings KeyBindings (optional)

Metadata

Name Parameters
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()
:allow ceramic.KeyBindings