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.
1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 |
# File 'lib/dommy/event.rb', line 1141 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.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def client_x @client_x end |
#client_y ⇒ Object (readonly)
Returns the value of attribute client_y.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def client_y @client_y end |
#force ⇒ Object (readonly)
Returns the value of attribute force.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def force @force end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def identifier @identifier end |
#page_x ⇒ Object (readonly)
Returns the value of attribute page_x.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def page_x @page_x end |
#page_y ⇒ Object (readonly)
Returns the value of attribute page_y.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def page_y @page_y end |
#radius_x ⇒ Object (readonly)
Returns the value of attribute radius_x.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def radius_x @radius_x end |
#radius_y ⇒ Object (readonly)
Returns the value of attribute radius_y.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def radius_y @radius_y end |
#rotation_angle ⇒ Object (readonly)
Returns the value of attribute rotation_angle.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def rotation_angle @rotation_angle end |
#screen_x ⇒ Object (readonly)
Returns the value of attribute screen_x.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def screen_x @screen_x end |
#screen_y ⇒ Object (readonly)
Returns the value of attribute screen_y.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def screen_y @screen_y end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
1126 1127 1128 |
# File 'lib/dommy/event.rb', line 1126 def target @target end |
Instance Method Details
#__js_get__(key) ⇒ Object
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 |
# File 'lib/dommy/event.rb', line 1156 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 else Bridge::ABSENT end end |