Class: Ruflet::Events::ScaleUpdateEvent

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_focal_point:, global_focal_point:, focal_point_delta:, pointer_count:, horizontal_scale:, vertical_scale:, scale:, rotation:, timestamp:) ⇒ ScaleUpdateEvent

Returns a new instance of ScaleUpdateEvent.



322
323
324
325
326
327
328
329
330
331
332
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 322

def initialize(local_focal_point:, global_focal_point:, focal_point_delta:, pointer_count:, horizontal_scale:, vertical_scale:, scale:, rotation:, timestamp:)
  @local_focal_point = local_focal_point
  @global_focal_point = global_focal_point
  @focal_point_delta = focal_point_delta
  @pointer_count = pointer_count
  @horizontal_scale = horizontal_scale
  @vertical_scale = vertical_scale
  @scale = scale
  @rotation = rotation
  @timestamp = timestamp
end

Instance Attribute Details

#focal_point_deltaObject (readonly)

Returns the value of attribute focal_point_delta.



318
319
320
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 318

def focal_point_delta
  @focal_point_delta
end

#global_focal_pointObject (readonly)

Returns the value of attribute global_focal_point.



318
319
320
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 318

def global_focal_point
  @global_focal_point
end

#horizontal_scaleObject (readonly)

Returns the value of attribute horizontal_scale.



318
319
320
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 318

def horizontal_scale
  @horizontal_scale
end

#local_focal_pointObject (readonly)

Returns the value of attribute local_focal_point.



318
319
320
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 318

def local_focal_point
  @local_focal_point
end

#pointer_countObject (readonly)

Returns the value of attribute pointer_count.



318
319
320
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 318

def pointer_count
  @pointer_count
end

#rotationObject (readonly)

Returns the value of attribute rotation.



318
319
320
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 318

def rotation
  @rotation
end

#scaleObject (readonly)

Returns the value of attribute scale.



318
319
320
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 318

def scale
  @scale
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



318
319
320
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 318

def timestamp
  @timestamp
end

#vertical_scaleObject (readonly)

Returns the value of attribute vertical_scale.



318
319
320
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 318

def vertical_scale
  @vertical_scale
end

Class Method Details

.from_data(data) ⇒ Object



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

def self.from_data(data)
  new(
    local_focal_point: offset(data, "lfp", "local_focal_point"),
    global_focal_point: offset(data, "gfp", "global_focal_point"),
    focal_point_delta: offset(data, "fpd", "focal_point_delta"),
    pointer_count: pick(data, "pc", "pointer_count"),
    horizontal_scale: pick(data, "hs", "horizontal_scale"),
    vertical_scale: pick(data, "vs", "vertical_scale"),
    scale: pick(data, "s", "scale"),
    rotation: pick(data, "rot", "rotation"),
    timestamp: duration(data, "ts", "timestamp")
  )
end