Class: Dommy::PointerEvent

Inherits:
MouseEvent show all
Defined in:
lib/dommy/event.rb

Overview

PointerEvent — pointer (mouse / touch / pen) unified events. Inherits from MouseEvent for coords / modifier keys; adds pointerId, pointerType, pressure, width, height, etc.

Constant Summary

Constants inherited from Event

Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, Event::NONE

Instance Attribute Summary

Attributes inherited from Event

#type

Instance Method Summary collapse

Methods inherited from MouseEvent

#__js_call__

Methods inherited from UIEvent

#__js_call__

Methods inherited from Event

#__internal_clear_propagation_flags__, #__internal_mark_trusted__, #__internal_prepare_for_dispatch__, #__internal_record_path__, #__internal_run_passive__, #__internal_set_current_target__, #__internal_set_dispatch_flag__, #__internal_set_event_phase__, #__js_call__, #__js_set__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?

Methods included from Bridge::Methods

included

Constructor Details

#initialize(type, init = nil) ⇒ PointerEvent

Returns a new instance of PointerEvent.



1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
# File 'lib/dommy/event.rb', line 1054

def initialize(type, init = nil)
  super
  @pointer_id = (read_init(init, "pointerId") || 0).to_i
  @pointer_type = (read_init(init, "pointerType") || "mouse").to_s
  @pressure = (read_init(init, "pressure") || 0).to_f
  @tangential_pressure = (read_init(init, "tangentialPressure") || 0).to_f
  @width = (read_init(init, "width") || 1).to_f
  @height = (read_init(init, "height") || 1).to_f
  @tilt_x = (read_init(init, "tiltX") || 0).to_i
  @tilt_y = (read_init(init, "tiltY") || 0).to_i
  @twist = (read_init(init, "twist") || 0).to_i
  @is_primary = !!read_init(init, "isPrimary")
end

Instance Method Details

#__js_get__(key) ⇒ Object



1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
# File 'lib/dommy/event.rb', line 1068

def __js_get__(key)
  case key
  when "pointerId"
    @pointer_id
  when "pointerType"
    @pointer_type
  when "pressure"
    @pressure
  when "tangentialPressure"
    @tangential_pressure
  when "width"
    @width
  when "height"
    @height
  when "tiltX"
    @tilt_x
  when "tiltY"
    @tilt_y
  when "twist"
    @twist
  when "isPrimary"
    @is_primary
  else
    super
  end
end