I'm making very simple application. It needs to show one SVG containing generalised world map. By clicking on city's name (svg rectangle), I need to show another SVG that corresponds to that city. Also, all SVGs must support zooming and panning.
I managed to make SVGs support zooming and panning and that works perfect. For that purpose, I'm using svg-android library for rendering SVGs and customized TouchImageView for panning, zooming and capturing scale and touch events. But, it seems to be impossible to make clickable regions on SVGs in Android.
I tried brute force, to recalculate position of my interesting areas on every user interaction (on touch or on scale) and on every click on the SVG to check if my areas (List of rectangles) contain that point, and perform corresponding action.
That doesn't work because I can't understand rule for calculating MotionEvent#getX/Y
and similar methods. Maybe I could achieve this for fixed SVG but for zoomable, I really can't.
Any hints? Is this even possible in Android?
First of all, really sorry for late answer. Hope it is not too late for everyone :)
I made a GitHub repo with code sample (not with working app), so please, use it! :)
Use repo's readme for some details.
Core solution:
Votes are appreciated! :)