From a12577a369d3557c022d401e33c6d7faebc096b2 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Tue, 28 Apr 2026 10:45:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E8=A3=81=E5=89=AA=E6=A1=86?= =?UTF-8?q?=E6=94=BE=E5=A4=A7=E6=97=B6=E8=B6=85=E5=87=BA=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 双指缩放裁剪框时添加边界检测 - 裁剪框超出边界时停止放大,保持在画布内 --- gallery/build.properties | 4 ++-- .../cc/winboll/studio/gallery/CropCanvasView.java | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gallery/build.properties b/gallery/build.properties index 2bc7272..580b8f9 100644 --- a/gallery/build.properties +++ b/gallery/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Tue Apr 28 10:21:42 CST 2026 +#Tue Apr 28 10:32:14 CST 2026 stageCount=7 libraryProject= baseVersion=15.0 publishVersion=15.0.6 -buildCount=37 +buildCount=39 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 f49723c..92285c9 100644 --- a/gallery/src/main/java/cc/winboll/studio/gallery/CropCanvasView.java +++ b/gallery/src/main/java/cc/winboll/studio/gallery/CropCanvasView.java @@ -414,8 +414,15 @@ public class CropCanvasView extends View { newWidth = Math.max(minSize, Math.min(newWidth, canvasBounds.width())); newHeight = newWidth / coverRatio; - cropRect.set(centerX - newWidth / 2, centerY - newHeight / 2, - centerX + newWidth / 2, centerY + newHeight / 2); + float newLeft = centerX - newWidth / 2; + float newTop = centerY - newHeight / 2; + float newRight = centerX + newWidth / 2; + float newBottom = centerY + newHeight / 2; + + if (newLeft >= canvasBounds.left && newRight <= canvasBounds.right && + newTop >= canvasBounds.top && newBottom <= canvasBounds.bottom) { + cropRect.set(newLeft, newTop, newRight, newBottom); + } initialSpan = span; invalidate();