We need to create a seat map representation of the interior of an
airplane that both pans and zooms.

I have successfully extended FrameLayout to create a view that both
pans(fling) and scales(pinch and zoom). This layout contains 1 child
which is a RelativeLayout. This RelativeLayout in turn contains
several LinearLayouts(vertical orientation) which contain the
clickable ImageViews(seats).

I am utilizing the ScaleGestureDetector class to accomplish the
scaling of the view. However, when the view is zoomed IN the clickable
hit areas of the ImageViews are no longer at the same x and y position
on the screen. If the view is zoomed back OUT then the hit areas are
in the appropriate place.

Here is my onScale method that assigns the scale factor to a member
variable.
public boolean onScale(ScaleGestureDetector detector) {

                        mScaleFactor *= detector.getScaleFactor();

                        mScaleFactor = Math.max(1.0f, Math.min(mScaleFactor, 
2.25f));

                        seatMapView.invalidate();
                        return true;
                }

I have tried to override the getHitRect() method on the ImageView
using this scale factor:

public void getHitRect(Rect outRect) {


           outRect.set((int)(this.getLeft()*mScaleFactor), (int)
(this.getTop()*mScaleFactor), (int)(this.getRight()*mScaleFactor),
(int)(this.getBottom()*mScaleFactor));

        }

This does not move the hit areas properly.
Has anyone has encountered this problem before? Or am I even on the
right track to accomplish this?

Thx

Dennis

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to