Class: Dommy::TouchEvent
Overview
‘TouchEvent` — fires for touchstart / touchmove / touchend / touchcancel. Carries three TouchLists plus modifier keys.
Constant Summary
Constants inherited from Event
Event::AT_TARGET, Event::BUBBLING_PHASE, Event::CAPTURING_PHASE, Event::NONE
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
#__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) ⇒ TouchEvent
Returns a new instance of TouchEvent.
827 828 829 830 831 832 833 834 835 836 |
# File 'lib/dommy/event.rb', line 827 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.
838 839 840 |
# File 'lib/dommy/event.rb', line 838 def changed_touches @changed_touches end |
#target_touches ⇒ Object (readonly)
Returns the value of attribute target_touches.
838 839 840 |
# File 'lib/dommy/event.rb', line 838 def target_touches @target_touches end |
#touches ⇒ Object (readonly)
Returns the value of attribute touches.
838 839 840 |
# File 'lib/dommy/event.rb', line 838 def touches @touches end |
Instance Method Details
#__js_get__(key) ⇒ Object
840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 |
# File 'lib/dommy/event.rb', line 840 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 |