Issue
I m using Osmdroid to create an offline map
Now, i want to implement my own pinch to zoom functionality for offline maps
When user uses pinch, i would like to zoom in/ zoom out to only a particular zoom level and not increment/ decrement zoom level by 1
Is there a way to do it? how can i go about this ?
P.S : yes, there are zoom controls, but i would like to make zooming feature more intuitive
Thanks
Solution
I dealt with a similar question here, and provided the code for custom functionality on pinch. So basically, expanding on what I had in the answer, just basically do:
int currentZoomLevel = mOsmv.getController().getZoomLevel();
if (currentZoomLevel < (mOsmv.getControler().getMaxZoomLevel()) - 2)
mOsmv.getController().setZoomLevel(currentZoomLevel + 2);
That is just an example of increasing the zoom level by 2, instead of just 1. I also wrote the code above from memory, so I'm not 100% sure if you call getController()
to get the current and maximum zoom level, but I'm pretty sure that's it. mOsmv
, just in case you don't get it, is an instance of the osmdroid map.
Answered By - digerati32
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.