Class: Dommy::TouchEvent
Overview
‘TouchEvent` — fires for touchstart / touchmove / touchend / touchcancel. Carries three TouchLists plus modifier keys.
Instance Attribute Summary collapse
-
#changed_touches ⇒ Object
readonly
Returns the value of attribute changed_touches.
-
#target_touches ⇒ Object
readonly
Returns the value of attribute target_touches.
-
#touches ⇒ Object
readonly
Returns the value of attribute touches.
Attributes inherited from Event
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
-
#initialize(type, init = nil) ⇒ TouchEvent
constructor
A new instance of TouchEvent.
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) ⇒ TouchEvent
Returns a new instance of TouchEvent.
656 657 658 659 660 661 662 663 664 665 |
# File 'lib/dommy/event.rb', line 656 def initialize(type, init = nil) super @touches = TouchList.new(Array(read_init(init, "touches") || [])) @target_touches = TouchList.new(Array(read_init(init, "targetTouches") || [])) @changed_touches = TouchList.new(Array(read_init(init, "changedTouches") || [])) @alt_key = !!read_init(init, "altKey") @ctrl_key = !!read_init(init, "ctrlKey") @shift_key = !!read_init(init, "shiftKey") @meta_key = !!read_init(init, "metaKey") end |
Instance Attribute Details
#changed_touches ⇒ Object (readonly)
Returns the value of attribute changed_touches.
667 668 669 |
# File 'lib/dommy/event.rb', line 667 def changed_touches @changed_touches end |
#target_touches ⇒ Object (readonly)
Returns the value of attribute target_touches.
667 668 669 |
# File 'lib/dommy/event.rb', line 667 def target_touches @target_touches end |
#touches ⇒ Object (readonly)
Returns the value of attribute touches.
667 668 669 |
# File 'lib/dommy/event.rb', line 667 def touches @touches end |
Instance Method Details
#__js_get__(key) ⇒ Object
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 |
# File 'lib/dommy/event.rb', line 669 def __js_get__(key) case key when "touches" @touches when "targetTouches" @target_touches when "changedTouches" @changed_touches when "altKey" @alt_key when "ctrlKey" @ctrl_key when "shiftKey" @shift_key when "metaKey" @meta_key else super end end |