当前位置: 首页>>代码示例>>Java>>正文


Java ScaleGestureDetector.getCurrentSpan方法代码示例

本文整理汇总了Java中android.view.ScaleGestureDetector.getCurrentSpan方法的典型用法代码示例。如果您正苦于以下问题:Java ScaleGestureDetector.getCurrentSpan方法的具体用法?Java ScaleGestureDetector.getCurrentSpan怎么用?Java ScaleGestureDetector.getCurrentSpan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.ScaleGestureDetector的用法示例。


在下文中一共展示了ScaleGestureDetector.getCurrentSpan方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onScaleBegin

import android.view.ScaleGestureDetector; //导入方法依赖的package包/类
@Override
public boolean onScaleBegin(ScaleGestureDetector detector) {
    mScaleX = xViewToDraw(detector.getFocusX());
    mScaleY = yViewToDraw(detector.getFocusY());
    mScaleSpan = detector.getCurrentSpan();
    mScaleOldX = mBoundsView.centerX();
    mScaleOldY = mBoundsView.centerY();

    mPointerX = mScaleX;
    mPointerY = mScaleY;
    return true;
}
 
开发者ID:dftec-es,项目名称:planetcon,代码行数:13,代码来源:GalaxyView.java

示例6: zoomStart

import android.view.ScaleGestureDetector; //导入方法依赖的package包/类
public void zoomStart(ScaleGestureDetector scaleGestureDetector)
    {
        if (mDrawingState == DRAW_STATE_zooming) {
            return;
        }

        mDrawingState = DRAW_STATE_zooming;
        mMapDrawing.onDrawStart();

        mCurrentSpan = scaleGestureDetector.getCurrentSpan();
        mCurrentFocusLocation.set(
                scaleGestureDetector.getFocusX(), scaleGestureDetector.getFocusY());
//        mCurrentFocusOffset.set(0, 0);
        mScaleFactor = 1.0;
    }
 
开发者ID:nextgis,项目名称:android_nextgis_mobile,代码行数:16,代码来源:MapGlView.java

示例7: 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

示例8: getCurrentSpanX

import android.view.ScaleGestureDetector; //导入方法依赖的package包/类
/**
 * @see ScaleGestureDetector#getCurrentSpanX()
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static float getCurrentSpanX(ScaleGestureDetector scaleGestureDetector) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        return scaleGestureDetector.getCurrentSpanX();
    } else {
        return scaleGestureDetector.getCurrentSpan();
    }
}
 
开发者ID:donglua,项目名称:JZAndroidChart,代码行数:12,代码来源:ScaleGestureDetectorCompat.java

示例9: getCurrentSpanY

import android.view.ScaleGestureDetector; //导入方法依赖的package包/类
/**
 * @see ScaleGestureDetector#getCurrentSpanY()
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static float getCurrentSpanY(ScaleGestureDetector scaleGestureDetector) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        return scaleGestureDetector.getCurrentSpanY();
    } else {
        return scaleGestureDetector.getCurrentSpan();
    }
}
 
开发者ID:donglua,项目名称:JZAndroidChart,代码行数:12,代码来源:ScaleGestureDetectorCompat.java

示例10: 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.getCurrentSpan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。