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.



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

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.



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

def global_position
  @global_position
end

#local_positionObject (readonly)

Returns the value of attribute local_position.



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

def local_position
  @local_position
end

#scroll_deltaObject (readonly)

Returns the value of attribute scroll_delta.



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

def scroll_delta
  @scroll_delta
end

Class Method Details

.from_data(data) ⇒ Object



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

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