Class: Hokusai::KeyPressEvent
Instance Attribute Summary
#input
Attributes inherited from Event
#bubbles, #captures, #stopped
Instance Method Summary
collapse
#hovered, #initialize, #to_json
Methods inherited from Event
#bubble, #matches, name, #name, #stop, #to_json
Instance Method Details
#capture(block, _) ⇒ Object
78
79
80
81
82
|
# File 'ui/src/hokusai/events/keyboard.rb', line 78
def capture(block, _)
return unless matches(block) && pressed_len > 0
captures << block
end
|
#char ⇒ Object
74
75
76
|
# File 'ui/src/hokusai/events/keyboard.rb', line 74
def char
code.chr
end
|
#code ⇒ Object
70
71
72
|
# File 'ui/src/hokusai/events/keyboard.rb', line 70
def code
keyboard_key[:char_code]
end
|
#key ⇒ Object
66
67
68
|
# File 'ui/src/hokusai/events/keyboard.rb', line 66
def key
keyboard_key[:key][:key]
end
|
#keyboard_key ⇒ Object
62
63
64
|
# File 'ui/src/hokusai/events/keyboard.rb', line 62
def keyboard_key
input.raw[:keyboard][:pressed]
end
|