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

Constructor Details

#initialize(local_position:, global_position:, local_delta:, global_delta:, primary_delta:, timestamp:) ⇒ DragUpdateEvent

Returns a new instance of DragUpdateEvent.



238
239
240
241
242
243
244
245
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 238

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.



236
237
238
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 236

def global_delta
  @global_delta
end

#global_positionObject (readonly)

Returns the value of attribute global_position.



236
237
238
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 236

def global_position
  @global_position
end

#local_deltaObject (readonly)

Returns the value of attribute local_delta.



236
237
238
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 236

def local_delta
  @local_delta
end

#local_positionObject (readonly)

Returns the value of attribute local_position.



236
237
238
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 236

def local_position
  @local_position
end

#primary_deltaObject (readonly)

Returns the value of attribute primary_delta.



236
237
238
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 236

def primary_delta
  @primary_delta
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



236
237
238
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 236

def timestamp
  @timestamp
end

Class Method Details

.from_data(data) ⇒ Object



247
248
249
250
251
252
253
254
255
256
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 247

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