Class: Ruflet::Events::ScaleStartEvent

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:, pointer_count:, timestamp:) ⇒ ScaleStartEvent

Returns a new instance of ScaleStartEvent.



300
301
302
303
304
305
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 300

def initialize(local_focal_point:, global_focal_point:, pointer_count:, timestamp:)
  @local_focal_point = local_focal_point
  @global_focal_point = global_focal_point
  @pointer_count = pointer_count
  @timestamp = timestamp
end

Instance Attribute Details

#global_focal_pointObject (readonly)

Returns the value of attribute global_focal_point.



298
299
300
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 298

def global_focal_point
  @global_focal_point
end

#local_focal_pointObject (readonly)

Returns the value of attribute local_focal_point.



298
299
300
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 298

def local_focal_point
  @local_focal_point
end

#pointer_countObject (readonly)

Returns the value of attribute pointer_count.



298
299
300
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 298

def pointer_count
  @pointer_count
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



298
299
300
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 298

def timestamp
  @timestamp
end

Class Method Details

.from_data(data) ⇒ Object



307
308
309
310
311
312
313
314
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 307

def self.from_data(data)
  new(
    local_focal_point: offset(data, "lfp", "local_focal_point"),
    global_focal_point: offset(data, "gfp", "global_focal_point"),
    pointer_count: pick(data, "pc", "pointer_count"),
    timestamp: duration(data, "ts", "timestamp")
  )
end