當前位置: 首頁>>代碼示例>>Java>>正文


Java ScaleGestureDetector.getPreviousSpan方法代碼示例

本文整理匯總了Java中android.view.ScaleGestureDetector.getPreviousSpan方法的典型用法代碼示例。如果您正苦於以下問題:Java ScaleGestureDetector.getPreviousSpan方法的具體用法?Java ScaleGestureDetector.getPreviousSpan怎麽用?Java ScaleGestureDetector.getPreviousSpan使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.ScaleGestureDetector的用法示例。


在下文中一共展示了ScaleGestureDetector.getPreviousSpan方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onScale

import android.view.ScaleGestureDetector; //導入方法依賴的package包/類
@Override
public boolean onScale(ScaleGestureDetector detector) {
	float span = detector.getCurrentSpan() - detector.getPreviousSpan();
	float targetScale = getScale() * detector.getScaleFactor();

	if (mScaleEnabled) {
		if (mScaled && span != 0) {
			mUserScaled = true;
			targetScale = Math.min(getMaxScale(), Math.max(targetScale, getMinScale() - 0.1f));
			zoomTo(targetScale, detector.getFocusX(), detector.getFocusY());
			mDoubleTapDirection = 1;
			invalidate();
			return true;
		}

		// This is to prevent a glitch the first time
		// image is scaled.
		if (!mScaled)
			mScaled = true;
	}
	return true;
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:23,代碼來源:ImageViewTouch.java

示例2: onScale

import android.view.ScaleGestureDetector; //導入方法依賴的package包/類
@Override
public boolean onScale(ScaleGestureDetector detector) {
    float span = detector.getCurrentSpan() - detector.getPreviousSpan();
    float targetScale = getScale() * detector.getScaleFactor();
    // System.out.println("span--->" + span);
    if (mScaleEnabled) {
        if (mScaled && span != 0) {
            mUserScaled = true;
            targetScale = Math.min(getMaxScale(),
                    Math.max(targetScale, getMinScale() - 0.1f));
            zoomTo(targetScale, detector.getFocusX(),
                    detector.getFocusY());
            mDoubleTapDirection = 1;
            invalidate();
            return true;
        }

        // This is to prevent a glitch the first time
        // image is scaled.
        if (!mScaled)
            mScaled = true;
    }
    return true;
}
 
開發者ID:viseator,項目名稱:MontageCam,代碼行數:25,代碼來源:ImageViewTouch.java

示例3: onScale

import android.view.ScaleGestureDetector; //導入方法依賴的package包/類
@Override
public boolean onScale(ScaleGestureDetector detector) {
    float span = detector.getCurrentSpan() - detector.getPreviousSpan();
    float targetScale = getScale() * detector.getScaleFactor();

    if (mScaleEnabled) {
        if (mScaled && span != 0) {
            mUserScaled = true;
            targetScale = Math.min(getMaxScale(), Math.max(targetScale, getMinScale() - MIN_SCALE_DIFF));
            zoomTo(targetScale, detector.getFocusX(), detector.getFocusY());
            mDoubleTapDirection = 1;
            invalidate();
            return true;
        }

        // This is to prevent a glitch the first time
        // image is scaled.
        if (!mScaled) {
            mScaled = true;
        }
    }
    return true;
}
 
開發者ID:StickyTolt,項目名稱:ForeverLibrary,代碼行數:24,代碼來源:ImageViewTouch.java

示例4: onScale

import android.view.ScaleGestureDetector; //導入方法依賴的package包/類
@Override
public boolean onScale(ScaleGestureDetector detector) {
    if (isZoomEnabled) {
        float scale = detector.getCurrentSpan() / detector.getPreviousSpan();
        if (Float.isInfinite(scale)) {
            scale = 1;
        }
        return chartZoomer.scale(computator, detector.getFocusX(), detector.getFocusY(), scale);
    }

    return false;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:13,代碼來源:PreviewChartTouchHandler.java

示例5: onScale

import android.view.ScaleGestureDetector; //導入方法依賴的package包/類
public boolean onScale(ScaleGestureDetector detector) {
    if (!PreviewChartTouchHandler.this.isZoomEnabled) {
        return false;
    }
    float scale = detector.getCurrentSpan() / detector.getPreviousSpan();
    if (Float.isInfinite(scale)) {
        scale = 1.0f;
    }
    return PreviewChartTouchHandler.this.chartZoomer.scale(PreviewChartTouchHandler.this.computator, detector.getFocusX(), detector.getFocusY(), scale);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:11,代碼來源:PreviewChartTouchHandler.java

示例6: onScale

import android.view.ScaleGestureDetector; //導入方法依賴的package包/類
@Override
public boolean onScale(ScaleGestureDetector detector) {
    if (mThresholdManager.getPassedThreshold() == PinchThresholdManager.THRESHOLD_THREE) {
        // We completed the pinch, so stop listening to further movement until user lets go.
        return true;
    }
    if (mLauncher.getDragController().isDragging()) {
        mLauncher.getDragController().cancelDrag();
    }

    float pinchDist = detector.getCurrentSpan() - detector.getPreviousSpan();
    if (pinchDist < 0 && mWorkspace.isInOverviewMode() ||
            pinchDist > 0 && !mWorkspace.isInOverviewMode()) {
        // Pinching the wrong way, so ignore.
        return false;
    }
    // Pinch distance must equal the workspace width before switching states.
    int pinchDistanceToCompleteTransition = mWorkspace.getWidth();
    float overviewScale = mWorkspace.getOverviewModeShrinkFactor();
    float initialWorkspaceScale = mWorkspace.isInOverviewMode() ? overviewScale : 1f;
    float pinchScale = initialWorkspaceScale + pinchDist / pinchDistanceToCompleteTransition;
    // Bound the scale between the overview scale and the normal workspace scale (1f).
    pinchScale = Math.max(overviewScale, Math.min(pinchScale, 1f));
    // Progress ranges from 0 to 1, where 0 corresponds to the overview scale and 1
    // corresponds to the normal workspace scale (1f).
    float progress = (pinchScale - overviewScale) / (1f - overviewScale);
    float interpolatedProgress = mInterpolator.getInterpolation(progress);

    mAnimationManager.setAnimationProgress(interpolatedProgress);
    float passedThreshold = mThresholdManager.updateAndAnimatePassedThreshold(
            interpolatedProgress, mAnimationManager);
    if (passedThreshold == PinchThresholdManager.THRESHOLD_THREE) {
        return true;
    }

    mProgressDelta = interpolatedProgress - mPreviousProgress;
    mPreviousProgress = interpolatedProgress;
    mTimeDelta = System.currentTimeMillis() - mPreviousTimeMillis;
    mPreviousTimeMillis = System.currentTimeMillis();
    return false;
}
 
開發者ID:enricocid,項目名稱:LaunchEnr,代碼行數:42,代碼來源:PinchToOverviewListener.java


注:本文中的android.view.ScaleGestureDetector.getPreviousSpan方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。