-
27 Jul 2011 7:17 AM #1
Kind of pinch to zoom that sort of works on Android.
Kind of pinch to zoom that sort of works on Android.
Hi EveryOne.
I want to introduce you a little hack i did to zoom on pinch. It's not fully working but let's say that it works for 80% of the cases (and more if you know how to pinch correctly
). I only catched pinches on the X axis, that are enough for me.
It is based on something that is certainly a bug:
When you drag with only one finger, many drag events are firing. But when you drag with two fingers (when you pinch for exemple!), only one drag event is firing, and one can catch the dragend to have usefull informations.
It is also based on the fact you pinch somewhere near the middle of the screen... !
After some tests, i realized that :
- if the startX of the dragend is before the pageX (the end)
--- if the middle point of your drag is before the middle of the screen you are pinching IN
--- else you are pinching out
- else it's the exact opposite !
Edit: Try it here:
http://webeleves.emse.fr/~cpichery/test
Well it has to be improved somehow, but yet it works quite fine!
Best regardsLast edited by karudo; 2 Aug 2011 at 11:49 PM. Reason: Example
-
3 Aug 2011 12:10 AM #2
And a link to show how it works with an Esri map (needs a browser compatible with Dojo)
http://webeleves.emse.fr/~cpichery/map


Reply With Quote