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
Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, Event::NONE
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_clear_propagation_flags__, #__internal_mark_trusted__, #__internal_prepare_for_dispatch__, #__internal_record_path__, #__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
Constructor Details
#initialize(type, init = nil) ⇒ PointerEvent
Returns a new instance of PointerEvent.
646 647 648 649 650 651 652 653 654 655 656 657 658 |
# File 'lib/dommy/event.rb', line 646 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
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 |
# File 'lib/dommy/event.rb', line 660 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 |