缩放后如何获得正确的坐标?
我使用手指绘画教程,
class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
@Override
public boolean onScale(ScaleGestureDetector detector) {
mScaleFactor = detector.getScaleFactor();
mScaleFactor = Math.max(1f, Math.min(mScaleFactor, 5.0f));
return true;
}
}
但在缩放画布后,我的线条没有绘制在画布上的正确位置?
im using finger paint turtorial with
class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
@Override
public boolean onScale(ScaleGestureDetector detector) {
mScaleFactor = detector.getScaleFactor();
mScaleFactor = Math.max(1f, Math.min(mScaleFactor, 5.0f));
return true;
}
}
but after zooming canvas,my lines are not drawing at correct position on canvas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你已经创建了逻辑,就像缩放时一样,然后也增加画布大小
就像canvasHeight=(canvasHeight*mScaleFactor);
you have create logic like when you zooming then increase your canvas size also
like
canvasHeight=(canvasHeight*mScaleFactor);