From 990ca8e27cd3f2261e374bb6784b17df050cba62 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 28 Apr 2026 10:26:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A3=81=E5=89=AA=E6=A1=86?= =?UTF-8?q?=E5=9C=A8=E7=94=BB=E5=B8=83=E7=BC=A9=E6=94=BE=E5=90=8E=E7=9A=84?= =?UTF-8?q?=E8=A7=A6=E6=91=B8=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - onTouchEvent()中将触摸坐标除以containerScale进行转换 - 边界检测使用转换后的坐标buckets - 确保单指移动裁剪框在缩放后正常工作 --- gallery/build.properties | 4 ++-- .../winboll/studio/gallery/CropCanvasView.java | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gallery/build.properties b/gallery/build.properties index 05ddb87..2bc7272 100644 --- a/gallery/build.properties +++ b/gallery/build.properties @@ -1,8 +1,8 @@ #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 libraryProject= baseVersion=15.0 publishVersion=15.0.6 -buildCount=36 +buildCount=37 baseBetaVersion=15.0.7 diff --git a/gallery/src/main/java/cc/winboll/studio/gallery/CropCanvasView.java b/gallery/src/main/java/cc/winboll/studio/gallery/CropCanvasView.java index 4aa8614..f49723c 100644 --- a/gallery/src/main/java/cc/winboll/studio/gallery/CropCanvasView.java +++ b/gallery/src/main/java/cc/winboll/studio/gallery/CropCanvasView.java @@ -427,6 +427,18 @@ public class CropCanvasView extends View { float x = event.getX(); 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 (event.getAction() == MotionEvent.ACTION_DOWN) { pickX = x; @@ -455,11 +467,11 @@ public class CropCanvasView extends View { float newRight = cropRect.right + dx; float newBottom = cropRect.bottom + dy; - if (newLeft >= canvasBounds.left && newRight <= canvasBounds.right) { + if (newLeft >= bounds.left && newRight <= bounds.right) { cropRect.left = newLeft; cropRect.right = newRight; } - if (newTop >= canvasBounds.top && newBottom <= canvasBounds.bottom) { + if (newTop >= bounds.top && newBottom <= bounds.bottom) { cropRect.top = newTop; cropRect.bottom = newBottom; }