AnsweredAssumed Answered

Draw tool offset on mobile

Question asked by greenkarmic on Feb 17, 2015

I noticed an issue when testing the Circle draw tool of our application on mobile, specifically on a Samsung Galaxy Tab and an iPad2.


The tool is used to pinpoint the location of an emergency (e.g. flooding, explosion) and create a circle around the site to advise local establishments to prepare for the emergency. A specific radius is used according to the emergency.


In a desktop environment, using a mouse, the circle is fine. On the tablets, the circle center is offset in the direction of the pan when moving the finger to create the circle. At high scale this can mean an error of several kilometers.


The error is more obvious because we use separate code (Hammer library) to calculate the radius as the circle is created on mobile devices. Hammer properly registers the circle center where we first put the finger down, and starts calculating the radius (i.e. delta from center) as the finger is moved. But since the draw tool doesn't put the circle center there, but puts it offset in the direction of the pan, it doesn't match the radius returned by Hammer.


A last thing I noticed, but only on Android, is that if I do a long press before panning, then the circle center is ok. The same thing doesn't work on the iPad, but is a bit irrelevant because users won't do a long press when creating the circle.


I wonder if the pan threshold used in the API to start the circle is too high?


Any ideas or advice are welcome.

Thank You