[android-developers] Re: ItemizedOverlay.hitTest incorrect
I did change the getBounds to copyBounds since it is offsetting the
bounds...
On Jun 16, 12:47 pm, tfriest <tfri...@kc.rr.com> wrote:
> It appears that the hitTest method is not working right when I iterate
> through the items in myItemizedOverlayand call hittest on them in
> theonTap(GeoPoint, MapView) method.
>
> I am doing this because I want to handle taps both when they are on an
> item and not (where I create a new item). If I override bothonTap
> methods theonTap(int) never gets called...
>
> Anyway, the problem I have with hitTest is that it only returns a hit
> if you tap the upper left corner of the display (where there is no
> item).
>
> I wrote the following in theonTapmethod
>
> for (OverlayItem item : items) {
> android.graphics.Point itemPoint =
> mapView.getProjection().toPixels(item.getPoint(), null);
> android.graphics.Rect bounds = item.getMarker(0).getBounds();
> bounds.offset(itemPoint.x, itemPoint.y);
> if (bounds.contains(screenPoint.x, screenPoint.y)) {
> .<handle item tapped>
> .return true;
> }
>
> } // for
>
> I suspect that the hitTest method is not offsetting the marker to the
> location of the item...
> Since the arguments of the hitTest don't take the MapView or
> Projection, I don';t see how it can work right...
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home