/*----------------------setPositionAndScale--------------------------------------------------------------------*/ public boolean setPositionAndScale(KiwiGLSurfaceView obj, PositionAndScale pos, PointInfo info) { Log.d(TAG, "setPositionAndScale"); if (this.mLastTouchInfo == null) { this.mLastTouchInfo = new PointInfo(); this.mLastTouchInfo.set(info); return true; } this.mCurrentTouchInfo.set(info); boolean isMulti = mLastTouchInfo.isMultiTouch(); float dx = mCurrentTouchInfo.getX() - mLastTouchInfo.getX(); float dy = mCurrentTouchInfo.getY() - mLastTouchInfo.getY(); float x1 = mCurrentTouchInfo.getX(); float y1 = mCurrentTouchInfo.getY(); float x0 = x1 - dx; float y0 = y1 + dy; float scale = 1.0f; float angle = 0.0f; if (isMulti && mLastTouchInfo.getMultiTouchDiameter() != 0.0f) { scale = mCurrentTouchInfo.getMultiTouchDiameter() / mLastTouchInfo.getMultiTouchDiameter(); } if (isMulti) { angle = mCurrentTouchInfo.getMultiTouchAngle() - mLastTouchInfo.getMultiTouchAngle(); } MyRunnable myrun = new MyRunnable(); myrun.dx = dx; myrun.dy = dy; myrun.x0 = x0; myrun.y0 = y0; myrun.x1 = x1; myrun.y1 = y1; myrun.scale = scale; myrun.angle = angle; myrun.isMulti = isMulti; this.queueEvent(myrun); mLastTouchInfo.set(mCurrentTouchInfo); return true; }