lib/opal/jquery/event.rb in opal-jquery-0.4.6 vs lib/opal/jquery/event.rb in opal-jquery-0.5.0
- old
+ new
@@ -161,15 +161,23 @@
def page_y
`#@native.pageY`
end
- def touch_x
- `#@native.originalEvent.touches[0].pageX`
+ def touch_count
+ `#@native.originalEvent.touches.length`
end
- def touch_y
- `#@native.originalEvent.touches[0].pageY`
+ def touch_x(index = 0)
+ `#@native.originalEvent.touches[#{index}].pageX` if index < touch_count
+ end
+
+ def touch_y(index = 0)
+ `#@native.originalEvent.touches[#{index}].pageY` if index < touch_count
+ end
+
+ def location
+ `#@native.originalEvent.location`
end
def ctrl_key
`#@native.ctrlKey`
end