Class: Ruflet::Events::ScrollEvent

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:, scroll_delta:) ⇒ ScrollEvent

Returns a new instance of ScrollEvent.



424
425
426
427
428
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 424

def initialize(local_position:, global_position:, scroll_delta:)
  @local_position = local_position
  @global_position = global_position
  @scroll_delta = scroll_delta
end

Instance Attribute Details

#global_positionObject (readonly)

Returns the value of attribute global_position.



422
423
424
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 422

def global_position
  @global_position
end

#local_positionObject (readonly)

Returns the value of attribute local_position.



422
423
424
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 422

def local_position
  @local_position
end

#scroll_deltaObject (readonly)

Returns the value of attribute scroll_delta.



422
423
424
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 422

def scroll_delta
  @scroll_delta
end

Class Method Details

.from_data(data) ⇒ Object



430
431
432
433
434
435
436
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 430

def self.from_data(data)
  new(
    local_position: offset(data, "l", "local_position"),
    global_position: offset(data, "g", "global_position"),
    scroll_delta: offset(data, "sd", "scroll_delta")
  )
end