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
stickerview getX() and getY() always return 0
The text was updated successfully, but these errors were encountered:
Hey pateljc, You can get center x and y position using below code. Please write this code snippet inside the StickerView class
private float positionX, positionY; private void getCenterPoint(PointF centerPoint) { float[] arrayOfFloat = new float[9]; this.matrix.getValues(arrayOfFloat); float f1 = 0.0F * arrayOfFloat[0] + 0.0F * arrayOfFloat[1] + arrayOfFloat[2]; float f2 = 0.0F * arrayOfFloat[3] + 0.0F * arrayOfFloat[4] + arrayOfFloat[5]; float f3 = arrayOfFloat[0] * this.mBitmap.getWidth() + arrayOfFloat[1] * this.mBitmap.getHeight() + arrayOfFloat[2]; float f4 = arrayOfFloat[3] * this.mBitmap.getWidth() + arrayOfFloat[4] * this.mBitmap.getHeight() + arrayOfFloat[5]; float f5 = f1 + f3; float f6 = f2 + f4; centerPoint.set(f5 / 2.0F, f6 / 2.0F); } private float getCenterX(){ return positionX; } private float getCenterY(){ return positionY; }
And inside overrided onTouchEvent method of StickerView class
case MotionEvent.ACTION_UP: PointF centerPoint = new PointF(); midDiagonalPoint(centerPoint); positionX = centerPoint.x; positionY = centerPoint.y;
Hope you can resolve your problem via this.
Sorry, something went wrong.
No branches or pull requests
stickerview getX() and getY() always return 0
The text was updated successfully, but these errors were encountered: