Class: Dommy::Touch
- Inherits:
-
Object
- Object
- Dommy::Touch
- Defined in:
- lib/dommy/event.rb
Overview
‘Touch` — a single touch point on a touch-capable surface. Constructed by tests; tied to a target element and coordinate set.
Instance Attribute Summary collapse
-
#client_x ⇒ Object
readonly
Returns the value of attribute client_x.
-
#client_y ⇒ Object
readonly
Returns the value of attribute client_y.
-
#force ⇒ Object
readonly
Returns the value of attribute force.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#page_x ⇒ Object
readonly
Returns the value of attribute page_x.
-
#page_y ⇒ Object
readonly
Returns the value of attribute page_y.
-
#radius_x ⇒ Object
readonly
Returns the value of attribute radius_x.
-
#radius_y ⇒ Object
readonly
Returns the value of attribute radius_y.
-
#rotation_angle ⇒ Object
readonly
Returns the value of attribute rotation_angle.
-
#screen_x ⇒ Object
readonly
Returns the value of attribute screen_x.
-
#screen_y ⇒ Object
readonly
Returns the value of attribute screen_y.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #__js_get__(key) ⇒ Object
-
#initialize(init = {}) ⇒ Touch
constructor
A new instance of Touch.
Constructor Details
#initialize(init = {}) ⇒ Touch
Returns a new instance of Touch.
564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
# File 'lib/dommy/event.rb', line 564 def initialize(init = {}) @identifier = (init["identifier"] || init[:identifier] || 0).to_i @target = init["target"] || init[:target] @client_x = (init["clientX"] || init[:clientX] || 0).to_f @client_y = (init["clientY"] || init[:clientY] || 0).to_f @page_x = (init["pageX"] || init[:pageX] || @client_x).to_f @page_y = (init["pageY"] || init[:pageY] || @client_y).to_f @screen_x = (init["screenX"] || init[:screenX] || @client_x).to_f @screen_y = (init["screenY"] || init[:screenY] || @client_y).to_f @radius_x = (init["radiusX"] || init[:radiusX] || 0).to_f @radius_y = (init["radiusY"] || init[:radiusY] || 0).to_f @rotation_angle = (init["rotationAngle"] || init[:rotationAngle] || 0).to_f @force = (init["force"] || init[:force] || 0).to_f end |
Instance Attribute Details
#client_x ⇒ Object (readonly)
Returns the value of attribute client_x.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def client_x @client_x end |
#client_y ⇒ Object (readonly)
Returns the value of attribute client_y.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def client_y @client_y end |
#force ⇒ Object (readonly)
Returns the value of attribute force.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def force @force end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def identifier @identifier end |
#page_x ⇒ Object (readonly)
Returns the value of attribute page_x.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def page_x @page_x end |
#page_y ⇒ Object (readonly)
Returns the value of attribute page_y.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def page_y @page_y end |
#radius_x ⇒ Object (readonly)
Returns the value of attribute radius_x.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def radius_x @radius_x end |
#radius_y ⇒ Object (readonly)
Returns the value of attribute radius_y.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def radius_y @radius_y end |
#rotation_angle ⇒ Object (readonly)
Returns the value of attribute rotation_angle.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def rotation_angle @rotation_angle end |
#screen_x ⇒ Object (readonly)
Returns the value of attribute screen_x.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def screen_x @screen_x end |
#screen_y ⇒ Object (readonly)
Returns the value of attribute screen_y.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def screen_y @screen_y end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
549 550 551 |
# File 'lib/dommy/event.rb', line 549 def target @target end |
Instance Method Details
#__js_get__(key) ⇒ Object
579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 |
# File 'lib/dommy/event.rb', line 579 def __js_get__(key) case key when "identifier" @identifier when "target" @target when "clientX" @client_x when "clientY" @client_y when "pageX" @page_x when "pageY" @page_y when "screenX" @screen_x when "screenY" @screen_y when "radiusX" @radius_x when "radiusY" @radius_y when "rotationAngle" @rotation_angle when "force" @force end end |