限制裁剪框放大时超出画布范围
- 双指缩放裁剪框时添加边界检测 - 裁剪框超出边界时停止放大,保持在画布内
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user