Question

What difences should i be aware of when tring to complement a working function that use mouse move in to also work on smartphones.

So far have i learned that on my android i get

  • touchmove insted of mousemove,
  • touchstart insted of mousedown,
  • touchend insted of mouseup
  • event.touches[0].pageX insted of event.clientX
  • event.touches[0].pageY insted of event.clientY

But it's not enough, the code still misbehave, what more should i learn before i can get it to work?

The exemple: http://paint.puggan.se/paint/paint_201305311921.html

When you drag from one point to another in the same group, its adds a yellow line between them. While still draging its paints a blue line to the closest, if you drag close or stop(mouse up) its adds the yellow line.

Above works fine with mouse in firefox for my computer.

Above dosn't work on my android, i can see blue lines, but never any yellow lines

Was it helpful?

Solution

Learned another diferences, and now it works.

When the touchend trigger, the list event.touches is empty, and therefor the event.touches[0] fails.

working version of exemple above http://paint.puggan.se/paint/paint_201306011919.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top