修复裁剪框在画布缩放后的触摸操作
- onTouchEvent()中将触摸坐标除以containerScale进行转换 - 边界检测使用转换后的坐标buckets - 确保单指移动裁剪框在缩放后正常工作
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue Apr 28 10:15:27 CST 2026
|
#Tue Apr 28 10:21:42 CST 2026
|
||||||
stageCount=7
|
stageCount=7
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.0
|
baseVersion=15.0
|
||||||
publishVersion=15.0.6
|
publishVersion=15.0.6
|
||||||
buildCount=36
|
buildCount=37
|
||||||
baseBetaVersion=15.0.7
|
baseBetaVersion=15.0.7
|
||||||
|
|||||||
@@ -427,6 +427,18 @@ public class CropCanvasView extends View {
|
|||||||
float x = event.getX();
|
float x = event.getX();
|
||||||
float y = event.getY();
|
float y = event.getY();
|
||||||
|
|
||||||
|
RectF bounds = canvasBounds;
|
||||||
|
if (containerScale != 1.0f) {
|
||||||
|
x = x / containerScale;
|
||||||
|
y = y / containerScale;
|
||||||
|
bounds = new RectF(
|
||||||
|
canvasBounds.left,
|
||||||
|
canvasBounds.top,
|
||||||
|
canvasBounds.right,
|
||||||
|
canvasBounds.bottom
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (colorPickMode) {
|
if (colorPickMode) {
|
||||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||||
pickX = x;
|
pickX = x;
|
||||||
@@ -455,11 +467,11 @@ public class CropCanvasView extends View {
|
|||||||
float newRight = cropRect.right + dx;
|
float newRight = cropRect.right + dx;
|
||||||
float newBottom = cropRect.bottom + dy;
|
float newBottom = cropRect.bottom + dy;
|
||||||
|
|
||||||
if (newLeft >= canvasBounds.left && newRight <= canvasBounds.right) {
|
if (newLeft >= bounds.left && newRight <= bounds.right) {
|
||||||
cropRect.left = newLeft;
|
cropRect.left = newLeft;
|
||||||
cropRect.right = newRight;
|
cropRect.right = newRight;
|
||||||
}
|
}
|
||||||
if (newTop >= canvasBounds.top && newBottom <= canvasBounds.bottom) {
|
if (newTop >= bounds.top && newBottom <= bounds.bottom) {
|
||||||
cropRect.top = newTop;
|
cropRect.top = newTop;
|
||||||
cropRect.bottom = newBottom;
|
cropRect.bottom = newBottom;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user