Class: Ruflet::Events::PointerEvent

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(kind:, local_position:, global_position:, timestamp:, device:, pressure:, pressure_min:, pressure_max:, distance:, distance_max:, size:, radius_major:, radius_minor:, radius_min:, radius_max:, orientation:, tilt:, local_delta:, global_delta:) ⇒ PointerEvent

Returns a new instance of PointerEvent.



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 372

def initialize(kind:, local_position:, global_position:, timestamp:, device:, pressure:, pressure_min:, pressure_max:, distance:, distance_max:, size:, radius_major:, radius_minor:, radius_min:, radius_max:, orientation:, tilt:, local_delta:, global_delta:)
  @kind = kind
  @local_position = local_position
  @global_position = global_position
  @timestamp = timestamp
  @device = device
  @pressure = pressure
  @pressure_min = pressure_min
  @pressure_max = pressure_max
  @distance = distance
  @distance_max = distance_max
  @size = size
  @radius_major = radius_major
  @radius_minor = radius_minor
  @radius_min = radius_min
  @radius_max = radius_max
  @orientation = orientation
  @tilt = tilt
  @local_delta = local_delta
  @global_delta = global_delta
end

Instance Attribute Details

#deviceObject (readonly)

Returns the value of attribute device.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def device
  @device
end

#distanceObject (readonly)

Returns the value of attribute distance.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def distance
  @distance
end

#distance_maxObject (readonly)

Returns the value of attribute distance_max.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def distance_max
  @distance_max
end

#global_deltaObject (readonly)

Returns the value of attribute global_delta.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def global_delta
  @global_delta
end

#global_positionObject (readonly)

Returns the value of attribute global_position.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def global_position
  @global_position
end

#kindObject (readonly)

Returns the value of attribute kind.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def kind
  @kind
end

#local_deltaObject (readonly)

Returns the value of attribute local_delta.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def local_delta
  @local_delta
end

#local_positionObject (readonly)

Returns the value of attribute local_position.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def local_position
  @local_position
end

#orientationObject (readonly)

Returns the value of attribute orientation.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def orientation
  @orientation
end

#pressureObject (readonly)

Returns the value of attribute pressure.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def pressure
  @pressure
end

#pressure_maxObject (readonly)

Returns the value of attribute pressure_max.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def pressure_max
  @pressure_max
end

#pressure_minObject (readonly)

Returns the value of attribute pressure_min.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def pressure_min
  @pressure_min
end

#radius_majorObject (readonly)

Returns the value of attribute radius_major.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def radius_major
  @radius_major
end

#radius_maxObject (readonly)

Returns the value of attribute radius_max.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def radius_max
  @radius_max
end

#radius_minObject (readonly)

Returns the value of attribute radius_min.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def radius_min
  @radius_min
end

#radius_minorObject (readonly)

Returns the value of attribute radius_minor.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def radius_minor
  @radius_minor
end

#sizeObject (readonly)

Returns the value of attribute size.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def size
  @size
end

#tiltObject (readonly)

Returns the value of attribute tilt.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def tilt
  @tilt
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



366
367
368
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 366

def timestamp
  @timestamp
end

Class Method Details

.from_data(data) ⇒ Object



394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/ruflet_ui/ruflet/events/gesture_events.rb', line 394

def self.from_data(data)
  new(
    kind: pick(data, "k", "kind"),
    local_position: offset(data, "l", "local_position"),
    global_position: offset(data, "g", "global_position"),
    timestamp: duration(data, "ts", "timestamp"),
    device: pick(data, "dev", "device"),
    pressure: pick(data, "ps", "pressure"),
    pressure_min: pick(data, "pMin", "pressure_min"),
    pressure_max: pick(data, "pMax", "pressure_max"),
    distance: pick(data, "dist", "distance"),
    distance_max: pick(data, "distMax", "distance_max"),
    size: pick(data, "size", "size"),
    radius_major: pick(data, "rMj", "radius_major"),
    radius_minor: pick(data, "rMn", "radius_minor"),
    radius_min: pick(data, "rMin", "radius_min"),
    radius_max: pick(data, "rMax", "radius_max"),
    orientation: pick(data, "or", "orientation"),
    tilt: pick(data, "tilt", "tilt"),
    local_delta: offset(data, "ld", "local_delta"),
    global_delta: offset(data, "gd", "global_delta")
  )
end