moagrius / TileView

TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.
MIT License
1.46k stars 337 forks source link

Callout doesn't appear in center of marker #464

Closed Errichamonda closed 6 years ago

Errichamonda commented 6 years ago

I'm trying to add Callout to my TileView markers but when I scale the TileView the callout doesn't appear in center of the marker.

Here it is before i zoom out: https://imgur.com/aDc010d And here and after: https://imgur.com/Mc93Qrg

My MarkerTapListener; mMarkerTapListener = (View v, int x, int y) -> { tileView.slideToAndCenter(x, y); SampleCallout callout = new SampleCallout(v.getContext()); tileView.addCallout(callout, x, y, -0.5f, -1.0f); callout.transitionIn(); callout.setTitle("Guida " + v.getTag()); callout.setSubtitle("Altre info?"); };

For positioning i use placeMarker(R.drawable.marker, 1106, 606, 0);

and private void placeMarker(int resId, double x, double y, int tag) { ImageView imageView = new ImageView(getContext()); imageView.setImageResource(resId); imageView.setTag(tag); tileView.setMarkerTapListener(mMarkerTapListener); tileView.addMarker(imageView, x, y, -1f, -1.0f); }

What's wrong with it?

p.s. I have some problem formatting the code in GitHub

Errichamonda commented 6 years ago

Fixed it was my mistake. I didn't use getCoordinateTranslater().translateAndScaleAbsoluteToRelativeX and Y

moagrius commented 6 years ago

glad you got it working