Class: Ruflet::Events::LongPressEndEvent

Inherits:
BasePayload show all
Defined in:
lib/ruflet_ui/ruflet/events/gesture_events.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BasePayload

duration, offset, pick, stringify_keys

Constructor Details

#initialize(local_position:, global_position:, velocity:) ⇒ LongPressEndEvent

Returns a new instance of LongPressEndEvent.



184
185
186
187
188
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 184

def initialize(local_position:, global_position:, velocity:)
  @local_position = local_position
  @global_position = global_position
  @velocity = velocity
end

Instance Attribute Details

#global_positionObject (readonly)

Returns the value of attribute global_position.



182
183
184
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 182

def global_position
  @global_position
end

#local_positionObject (readonly)

Returns the value of attribute local_position.



182
183
184
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 182

def local_position
  @local_position
end

#velocityObject (readonly)

Returns the value of attribute velocity.



182
183
184
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 182

def velocity
  @velocity
end

Class Method Details

.from_data(data) ⇒ Object



190
191
192
193
194
195
196
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 190

def self.from_data(data)
  new(
    local_position: offset(data, "l", "local_position"),
    global_position: offset(data, "g", "global_position"),
    velocity: offset(data, "v", "velocity")
  )
end