Class: Fusuma::Plugin::Buffers::ThumbsenseBuffer
- Inherits:
-
Buffer
- Object
- Buffer
- Fusuma::Plugin::Buffers::ThumbsenseBuffer
- Defined in:
- lib/fusuma/plugin/buffers/thumbsense_buffer.rb
Overview
manage events and generate command
Constant Summary collapse
- DEFAULT_SOURCE =
"remap_touchpad_input"
- POINTING_STICK_SOURCE =
"pointing_stick_input"
Instance Method Summary collapse
- #begin?(event) ⇒ Boolean
- #buffer(event) ⇒ NilClass, ThumbsenseBuffer
-
#clear_expired ⇒ Object
clear old events.
- #config_param_types ⇒ Object
- #ended?(event) ⇒ Boolean
-
#finger ⇒ Object
return [Integer].
Instance Method Details
#begin?(event) ⇒ Boolean
46 47 48 |
# File 'lib/fusuma/plugin/buffers/thumbsense_buffer.rb', line 46 def begin?(event) event.record.status == "begin" end |
#buffer(event) ⇒ NilClass, ThumbsenseBuffer
29 30 31 32 33 34 35 |
# File 'lib/fusuma/plugin/buffers/thumbsense_buffer.rb', line 29 def buffer(event) case event.tag when source, POINTING_STICK_SOURCE @events.push(event) self end end |
#clear_expired ⇒ Object
clear old events
18 19 20 21 22 23 24 25 |
# File 'lib/fusuma/plugin/buffers/thumbsense_buffer.rb', line 18 def clear_expired(*) return if @events.empty? # skip palm/begin record return if !ended?(@events.last) clear end |
#config_param_types ⇒ Object
11 12 13 14 15 |
# File 'lib/fusuma/plugin/buffers/thumbsense_buffer.rb', line 11 def config_param_types { source: [String] } end |
#ended?(event) ⇒ Boolean
42 43 44 |
# File 'lib/fusuma/plugin/buffers/thumbsense_buffer.rb', line 42 def ended?(event) event.record.status == "end" end |
#finger ⇒ Object
return [Integer]
38 39 40 |
# File 'lib/fusuma/plugin/buffers/thumbsense_buffer.rb', line 38 def finger @events.map { |e| e.record.finger }.max end |