We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MultiTouchController.java:
public class MultiTouchController<T> { ... float mStartAbsoluteAng; // <---------- ... private void anchorAtThisPositionAndScale() { ... /* add at the end of the function */ mStartAbsoluteAng = mCurrXform.angle; // <---------- } ... private void performDragOrPinch() { /* Don't do anything if we're not dragging anything*/ if (selectedObject == null) return; /* Calc new position of dragged object*/ 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 newScale = startScaleOverPinchDiam * mCurrPtDiam; float newScaleX = startScaleXOverPinchWidth * mCurrPtWidth; float newScaleY = startScaleYOverPinchHeight * mCurrPtHeight; float newAngle = startAngleMinusPinchAngle + mCurrPtAng; /* * Fix: Rotation relative to the midpoint start */ float[] deltaPosition = new float[2]; deltaPosition[0] = newPosX - mCurrPtX; deltaPosition[1] = newPosY - mCurrPtY; float deltaAngle = newAngle - mStartAbsoluteAng; float[] deltaRotate = new float[2]; deltaRotate[0] = (float)( deltaPosition[0] * Math.cos(deltaAngle)) - (float) ( deltaPosition[1] * Math.sin(deltaAngle)); deltaRotate[1] = (float)( deltaPosition[0] * Math.sin(deltaAngle)) + (float) ( deltaPosition[1] * Math.cos(deltaAngle)); newPosX = mCurrPtX + deltaRotate[0]; newPosY = mCurrPtY + deltaRotate[1]; /* * Fix: Rotation relative to the midpoint end */ // Set the new obj coords, scale, and angle as appropriate (notifying the subclass of the change). mCurrXform.set(newPosX, newPosY, newScale, newScaleX, newScaleY, newAngle); boolean success = objectCanvas.setPositionAndScale(selectedObject, mCurrXform, mCurrPt); if (!success) ; // If we could't set those params, do nothing currently } ... }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
MultiTouchController.java:
The text was updated successfully, but these errors were encountered: