在ScaleGesture中,android如何计算detector.getScaleFactor();
中的比例因子以及在哪个范围内?
private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
@Override
public boolean onScale(ScaleGestureDetector detector) {
mScaleFactor *= detector.getScaleFactor();
// Don't let the object get too small or too large.
mScaleFactor = Math.max(0.1f, Math.min(mScaleFactor, 15.0f));
_renderer.z=-mScaleFactor;
invalidate();
return true;
}
}
答案 0 :(得分:2)
如果您搜索捏,基本上会根据源代码找到相同的公式:
mScaleFactor = getCurrentSpan() / getPreviousSpan();
当前夹点的距离除以第一个/旧夹点。