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

Constructor Details

#initialize(local_position:, global_position:, scroll_delta:) ⇒ ScrollEvent

Returns a new instance of ScrollEvent.



524
525
526
527
528
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 524

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.



522
523
524
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 522

def global_position
  @global_position
end

#local_positionObject (readonly)

Returns the value of attribute local_position.



522
523
524
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 522

def local_position
  @local_position
end

#scroll_deltaObject (readonly)

Returns the value of attribute scroll_delta.



522
523
524
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 522

def scroll_delta
  @scroll_delta
end

Class Method Details

.from_data(data) ⇒ Object



530
531
532
533
534
535
536
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 530

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