Class: Ruflet::Events::DragUpdateEvent

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:, local_delta:, global_delta:, primary_delta:, timestamp:) ⇒ DragUpdateEvent

Returns a new instance of DragUpdateEvent.



337
338
339
340
341
342
343
344
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 337

def initialize(local_position:, global_position:, local_delta:, global_delta:, primary_delta:, timestamp:)
  @local_position = local_position
  @global_position = global_position
  @local_delta = local_delta
  @global_delta = global_delta
  @primary_delta = primary_delta
  @timestamp = timestamp
end

Instance Attribute Details

#global_deltaObject (readonly)

Returns the value of attribute global_delta.



335
336
337
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 335

def global_delta
  @global_delta
end

#global_positionObject (readonly)

Returns the value of attribute global_position.



335
336
337
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 335

def global_position
  @global_position
end

#local_deltaObject (readonly)

Returns the value of attribute local_delta.



335
336
337
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 335

def local_delta
  @local_delta
end

#local_positionObject (readonly)

Returns the value of attribute local_position.



335
336
337
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 335

def local_position
  @local_position
end

#primary_deltaObject (readonly)

Returns the value of attribute primary_delta.



335
336
337
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 335

def primary_delta
  @primary_delta
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



335
336
337
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 335

def timestamp
  @timestamp
end

Class Method Details

.from_data(data) ⇒ Object



346
347
348
349
350
351
352
353
354
355
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 346

def self.from_data(data)
  new(
    local_position: offset(data, "l", "local_position"),
    global_position: offset(data, "g", "global_position"),
    local_delta: offset(data, "ld", "local_delta"),
    global_delta: offset(data, "gd", "global_delta"),
    primary_delta: pick(data, "pd", "primary_delta"),
    timestamp: duration(data, "ts", "timestamp")
  )
end