Class: Ruflet::Events::DragEndEvent

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, offset_pair, pick, stringify_keys

Constructor Details

#initialize(local_position:, global_position:, velocity:, primary_velocity:) ⇒ DragEndEvent

Returns a new instance of DragEndEvent.



361
362
363
364
365
366
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 361

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

Instance Attribute Details

#global_positionObject (readonly)

Returns the value of attribute global_position.



359
360
361
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 359

def global_position
  @global_position
end

#local_positionObject (readonly)

Returns the value of attribute local_position.



359
360
361
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 359

def local_position
  @local_position
end

#primary_velocityObject (readonly)

Returns the value of attribute primary_velocity.



359
360
361
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 359

def primary_velocity
  @primary_velocity
end

#velocityObject (readonly)

Returns the value of attribute velocity.



359
360
361
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 359

def velocity
  @velocity
end

Class Method Details

.from_data(data) ⇒ Object



368
369
370
371
372
373
374
375
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 368

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"),
    primary_velocity: pick(data, "pv", "primary_velocity")
  )
end