Hello,
does any one know a better solution of Mouse/Touch event cross compatibility.
Basically what I want to do is to make Mouse events behave as single touch event. So I can test my app both on Desktop (with mouse) and on Device (with multi touch support).
For now all I do is adding something similar to every event handler:
if e.x and e.y then
e.touch = {}
e.touch.id = 1
e.touch.x = e.x
e.touch.y = e.y
end |
And I can use same event handlers for both functions and test on both platforms. But I need to modify every event handler with this code and need to add same handlers for both events. Which is bad, because on device both methods are called and of course it is a lot of work to do, especially when you have many different elements.
So maybe anyone knows a better way?
Or maybe event cross compatibility someday would be supported by Gideros?
Comments
One possibility can be redefining EventDispather:addEventListener on Windows and Mac OS. I just get your approach and move it one step forward:
Likes: ar2rsawseen, alexzheng
And we do not need to add mouse events any more?
https://sites.google.com/site/xraystudiogame