Class: Ruflet::Events::ForcePressEvent
- Inherits:
-
BasePayload
- Object
- BasePayload
- Ruflet::Events::ForcePressEvent
- Defined in:
- lib/ruflet_ui/ruflet/events/gesture_events.rb
Instance Attribute Summary collapse
-
#global_position ⇒ Object
readonly
Returns the value of attribute global_position.
-
#local_position ⇒ Object
readonly
Returns the value of attribute local_position.
-
#pressure ⇒ Object
readonly
Returns the value of attribute pressure.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(local_position:, global_position:, pressure:) ⇒ ForcePressEvent
constructor
A new instance of ForcePressEvent.
Methods inherited from BasePayload
duration, offset, pick, stringify_keys
Constructor Details
#initialize(local_position:, global_position:, pressure:) ⇒ ForcePressEvent
Returns a new instance of ForcePressEvent.
282 283 284 285 286 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 282 def initialize(local_position:, global_position:, pressure:) @local_position = local_position @global_position = global_position @pressure = pressure end |
Instance Attribute Details
#global_position ⇒ Object (readonly)
Returns the value of attribute global_position.
280 281 282 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 280 def global_position @global_position end |
#local_position ⇒ Object (readonly)
Returns the value of attribute local_position.
280 281 282 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 280 def local_position @local_position end |
#pressure ⇒ Object (readonly)
Returns the value of attribute pressure.
280 281 282 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 280 def pressure @pressure end |
Class Method Details
.from_data(data) ⇒ Object
288 289 290 291 292 293 294 |
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 288 def self.from_data(data) new( local_position: offset(data, "l", "local_position"), global_position: offset(data, "g", "global_position"), pressure: pick(data, "p", "pressure") ) end |