2

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

Puggan Se
  • 5,738
  • 2
  • 22
  • 48
  • I am not much into Javascript, but could that be because you have zoom level hard coded? – ozbek May 31 '13 at 18:28
  • where is the zoom level hard coded? if you refering to my javascript var zoom, it was just the name chosen for the variable that scaling the canvas, the android can still zoom as usal – Puggan Se May 31 '13 at 18:45

1 Answers1

1

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

Puggan Se
  • 5,738
  • 2
  • 22
  • 48
  • Hi, I am having the same trouble. I have already replaced all the touchmove insted to mousemove, touchstart insted to mousedown, and touchend insted to mouseup. But it still doesn't work in my android webview, I couldn't find anything to help. so I hope you could tell how I can solve it please. –  Feb 23 '17 at 19:19