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.
Constant Summary
Constants inherited from Event
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
#__internal_prepare_for_dispatch__, #__internal_record_path__, #__internal_set_current_target__, #__js_call__, #__js_method_names__, #__js_set__, #bubbles?, #default_prevented?, #immediate_propagation_stopped?, #init_event, #propagation_stopped?
Constructor Details
#initialize(type, init = nil) ⇒ PointerEvent
Returns a new instance of PointerEvent.
495 496 497 498 499 500 501 502 503 504 505 506 507 |
# File 'lib/dommy/event.rb', line 495 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
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 |
# File 'lib/dommy/event.rb', line 509 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 |