Class: Dommy::PointerEvent
- Inherits:
-
MouseEvent
- Object
- Event
- MouseEvent
- Dommy::PointerEvent
- 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.
Instance Attribute Summary
Attributes inherited from Event
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
-
#initialize(type, init = nil) ⇒ PointerEvent
constructor
A new instance of PointerEvent.
Methods inherited from Event
#__js_call__, #__js_set__, #__prepare_for_dispatch__, #__record_path__, #__set_current_target__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?
Constructor Details
#initialize(type, init = nil) ⇒ PointerEvent
Returns a new instance of PointerEvent.
477 478 479 480 481 482 483 484 485 486 487 488 489 |
# File 'lib/dommy/event.rb', line 477 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
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/dommy/event.rb', line 491 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 |