示例#1
0
    @Override
    public boolean onScale(ScaleGestureDetector detector) {
      if (mActiveIndex >= 0) {
        mScaleFactor *= detector.getScaleFactor();
        mScaleFactor = Math.max(0.1f, Math.min(mScaleFactor, 5.0f));

        Figure f = mFigures.get(mActiveIndex);
        f.width = (int) (origWidth * mScaleFactor);
        f.height = (int) (origHeight * mScaleFactor);
        f.x = origX - (f.width - origWidth) / 2;
        f.y = origY - (f.height - origHeight) / 2;
        invalidate();
        return true;
      }
      return false;
    }