private void performDragOrPinch(){
  if (selectedObject == null)   return;
  float currScale=!mCurrXform.updateScale ? 1.0f : mCurrXform.scale == 0.0f ? 1.0f : mCurrXform.scale;
  extractCurrPtInfo();
  float newPosX=mCurrPtX - startPosX * currScale;
  float newPosY=mCurrPtY - startPosY * currScale;
  float deltaX=mCurrPt.getX() - mPrevPt.getX();
  float deltaY=mCurrPt.getY() - mPrevPt.getY();
  float newScale=mCurrXform.scale;
  if (mMode == MODE_ST_GRAB) {
    if (deltaX < 0.0f || deltaY < 0.0f) {
      newScale=mCurrXform.scale - 0.04f;
    }
 else {
      newScale=mCurrXform.scale + 0.04f;
    }
    if (newScale < 0.35f)     return;
  }
 else {
    newScale=startScaleOverPinchDiam * mCurrPtDiam;
  }
  if (!mDragOccurred) {
    if (!pastThreshold(Math.abs(deltaX),Math.abs(deltaY),newScale)) {
      if (DEBUG) {
        Log.i("MultiTouch","Change received by performDragOrPinch " + "was below the threshold");
      }
      return;
    }
  }
  float newScaleX=startScaleXOverPinchWidth * mCurrPtWidth;
  float newScaleY=startScaleYOverPinchHeight * mCurrPtHeight;
  float newAngle=startAngleMinusPinchAngle + mCurrPtAng;
  mCurrXform.set(newPosX,newPosY,newScale,newScaleX,newScaleY,newAngle);
  boolean success=objectCanvas.setPositionAndScale(selectedObject,mCurrXform,mCurrPt);
  if (!success)   ;
  mDragOccurred=true;
}

private void performDragOrPinch ( ) { if ( selectedObject == null ) return ; float currScale = ! mCurrXform . updateScale ? 1.0f : mCurrXform . scale == 0.0f ? 1.0f : mCurrXform . scale ; extractCurrPtInfo ( ) ; float newPosX = mCurrPtX - startPosX * currScale ; float newPosY = mCurrPtY - startPosY * currScale ; float deltaX = mCurrPt . getX ( ) - mPrevPt . getX ( ) ; float deltaY = mCurrPt . getY ( ) - mPrevPt . getY ( ) ; float newScale = mCurrXform . scale ; if ( mMode == MODE_ST_GRAB ) { if ( deltaX < 0.0f || deltaY < 0.0f ) { newScale = mCurrXform . scale - 0.04f ; } else { newScale = mCurrXform . scale + 0.04f ; } if ( newScale < 0.35f ) return ; } else { newScale = startScaleOverPinchDiam * mCurrPtDiam ; } if ( ! mDragOccurred ) { if ( ! pastThreshold ( Math . abs ( deltaX ) , Math . abs ( deltaY ) , newScale ) ) { if ( DEBUG ) { Log . i ( "MultiTouch" , "Change received by performDragOrPinch " + "was below the threshold" ) ; } return ; } } float newScaleX = startScaleXOverPinchWidth * mCurrPtWidth ; float newScaleY = startScaleYOverPinchHeight * mCurrPtHeight ; float newAngle = startAngleMinusPinchAngle + mCurrPtAng ; mCurrXform . set ( newPosX , newPosY , newScale , newScaleX , newScaleY , newAngle ) ; boolean success = objectCanvas . setPositionAndScale ( selectedObject , mCurrXform , mCurrPt ) ; if ( ! success ) ; mDragOccurred = true ; }
drag / stretch / rotate the selected object using the current touch position ( s ) relative to the anchor position ( s ) .
