Example usage for android.view ScaleGestureDetector getFocusY

List of usage examples for android.view ScaleGestureDetector getFocusY

Introduction

In this page you can find the example usage for android.view ScaleGestureDetector getFocusY.

Prototype

public float getFocusY() 

Source Link

Document

Get the Y coordinate of the current gesture's focal point.

Usage

From source file:com.hippo.largeimageview.GestureRecognizer.java

@Override
public boolean onScale(ScaleGestureDetector detector) {
    mScale = true;// ww w.j a v  a 2  s.  c om
    mListener.onScale(detector.getFocusX(), detector.getFocusY(), detector.getScaleFactor());
    return true;
}

From source file:cn.goodjobs.common.view.photodraweeview.ScaleDragDetector.java

@Override
public boolean onScale(ScaleGestureDetector detector) {
    float scaleFactor = detector.getScaleFactor();

    if (Float.isNaN(scaleFactor) || Float.isInfinite(scaleFactor)) {
        return false;
    }/* w  w w.  ja  v a 2  s.  co m*/

    mScaleDragGestureListener.onScale(scaleFactor, detector.getFocusX(), detector.getFocusY());
    return true;
}

From source file:org.ros.android.view.visualization.layer.CameraControlLayer.java

@Override
public void onStart(final VisualizationView view, ConnectedNode connectedNode) {
    view.post(new Runnable() {
        @Override/*w ww  . j  a  va  2 s. com*/
        public void run() {
            translateGestureDetector = new GestureDetectorCompat(view.getContext(),
                    new GestureDetector.SimpleOnGestureListener() {
                        @Override
                        public boolean onDown(MotionEvent e) {
                            // This must return true in order for onScroll() to trigger.
                            return true;
                        }

                        @Override
                        public boolean onScroll(MotionEvent event1, MotionEvent event2, final float distanceX,
                                final float distanceY) {
                            view.getCamera().translate(-distanceX, distanceY);
                            listeners.signal(new SignalRunnable<CameraControlListener>() {
                                @Override
                                public void run(CameraControlListener listener) {
                                    listener.onTranslate(-distanceX, distanceY);
                                }
                            });
                            return true;
                        }

                        @Override
                        public boolean onDoubleTap(final MotionEvent e) {
                            listeners.signal(new SignalRunnable<CameraControlListener>() {
                                @Override
                                public void run(CameraControlListener listener) {
                                    listener.onDoubleTap(e.getX(), e.getY());
                                }
                            });
                            return true;
                        }
                    });
            rotateGestureDetector = new RotateGestureDetector(
                    new RotateGestureDetector.OnRotateGestureListener() {
                        @Override
                        public boolean onRotate(MotionEvent event1, MotionEvent event2,
                                final double deltaAngle) {
                            final float focusX = (event1.getX(0) + event1.getX(1)) / 2;
                            final float focusY = (event1.getY(0) + event1.getY(1)) / 2;
                            view.getCamera().rotate(focusX, focusY, deltaAngle);
                            listeners.signal(new SignalRunnable<CameraControlListener>() {
                                @Override
                                public void run(CameraControlListener listener) {
                                    listener.onRotate(focusX, focusY, deltaAngle);
                                }
                            });
                            return true;
                        }
                    });
            zoomGestureDetector = new ScaleGestureDetector(view.getContext(),
                    new ScaleGestureDetector.SimpleOnScaleGestureListener() {
                        @Override
                        public boolean onScale(ScaleGestureDetector detector) {
                            if (!detector.isInProgress()) {
                                return false;
                            }
                            final float focusX = detector.getFocusX();
                            final float focusY = detector.getFocusY();
                            final float factor = detector.getScaleFactor();
                            view.getCamera().zoom(focusX, focusY, factor);
                            listeners.signal(new SignalRunnable<CameraControlListener>() {
                                @Override
                                public void run(CameraControlListener listener) {
                                    listener.onZoom(focusX, focusY, factor);
                                }
                            });
                            return true;
                        }
                    });
        }
    });
}

From source file:am.widget.scalerecyclerview.ScaleRecyclerView.java

/**
 * ??/*from  w w w  . ja va 2  s  .co m*/
 *
 * @param detector 
 */
protected void dispatchScaleEnd(ScaleGestureDetector detector) {
    onScaleEnd(mScale, detector.getFocusX(), detector.getFocusY());
}

From source file:am.widget.scalerecyclerview.ScaleRecyclerView.java

/**
 * ?/*  ww  w  .  j  a va2 s.c  o  m*/
 *
 * @param detector 
 * @return ??
 */
protected boolean dispatchScaleBegin(ScaleGestureDetector detector) {
    onScaleBegin(mScale, detector.getFocusX(), detector.getFocusY());
    return true;
}

From source file:am.widget.scalerecyclerview.ScaleRecyclerView.java

/**
 * ?//from www  .jav  a2 s. c om
 *
 * @param detector 
 * @return ??
 */
protected boolean dispatchScale(ScaleGestureDetector detector) {
    onScale(mScale * detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY());
    return true;
}

From source file:org.mozilla.gecko.ui.PanZoomController.java

@Override
public void onScaleEnd(ScaleGestureDetector detector) {
    mState = PanZoomState.PANNING_HOLD;//from   ww w  .j a  v  a2s.  c om
    mLastTimestamp = System.currentTimeMillis();
    mX.touchPos = detector.getFocusX();
    mY.touchPos = detector.getFocusY();
}

From source file:com.mediatek.galleryfeature.stereo.segment.ImageShow.java

@Override
public boolean onScaleBegin(ScaleGestureDetector detector) {
    if (!mIsZoomPanSupported) {
        return false;
    }/*from   w ww  .  ja  v  a  2s.  c o  m*/
    Point pos = mMasterImage.getTranslation();
    mOriginalTranslation.x = pos.x;
    mOriginalTranslation.y = pos.y;
    mMasterImage.getScaleFactor();
    mStartFocusX = detector.getFocusX();
    mStartFocusY = detector.getFocusY();
    mInteractionMode = InteractionMode.SCALE;
    return true;
}

From source file:org.mozilla.gecko.ui.PanZoomController.java

@Override
public boolean onScale(ScaleGestureDetector detector) {
    mState = PanZoomState.PINCHING;//  w w w .j a v  a2s.com
    float newZoom = detector.getCurrentSpan() / mInitialZoomSpan;

    IntSize screenSize = mController.getScreenSize();
    float x = mInitialZoomFocus.x - (detector.getFocusX() / newZoom);
    float y = mInitialZoomFocus.y - (detector.getFocusY() / newZoom);
    float width = screenSize.width / newZoom;
    float height = screenSize.height / newZoom;
    mController.setVisibleRect(x, y, width, height);
    mController.notifyLayerClientOfGeometryChange();
    populatePositionAndLength();
    return true;
}

From source file:org.mozilla.gecko.ui.PanZoomController.java

@Override
public boolean onScaleBegin(ScaleGestureDetector detector) {
    mState = PanZoomState.PINCHING;/*from w w w.  jav  a 2  s  .co m*/
    FloatRect initialZoomRect = mController.getVisibleRect();
    float initialZoom = mController.getZoomFactor();

    mInitialZoomFocus = new FloatPoint(initialZoomRect.x + (detector.getFocusX() / initialZoom),
            initialZoomRect.y + (detector.getFocusY() / initialZoom));
    mInitialZoomSpan = detector.getCurrentSpan() / initialZoom;
    return true;
}