Class: Hokusai::KeyPressEvent

Inherits:
KeyboardEvent show all
Defined in:
ui/src/hokusai/events/keyboard.rb

Instance Attribute Summary

Attributes inherited from KeyboardEvent

#input

Attributes inherited from Event

#bubbles, #captures, #stopped

Instance Method Summary collapse

Methods inherited from KeyboardEvent

#hovered, #initialize, #to_json

Methods inherited from Event

#bubble, #matches, name, #name, #stop, #to_json

Constructor Details

This class inherits a constructor from Hokusai::KeyboardEvent

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

#charObject



74
75
76
# File 'ui/src/hokusai/events/keyboard.rb', line 74

def char
  code.chr
end

#codeObject



70
71
72
# File 'ui/src/hokusai/events/keyboard.rb', line 70

def code
  keyboard_key[:char_code]
end

#keyObject



66
67
68
# File 'ui/src/hokusai/events/keyboard.rb', line 66

def key
  keyboard_key[:key][:key]
end

#keyboard_keyObject



62
63
64
# File 'ui/src/hokusai/events/keyboard.rb', line 62

def keyboard_key
  input.raw[:keyboard][:pressed]
end