完善剪裁窗口颜色拾取功能,工具栏图标同步更新

This commit is contained in:
2026-04-28 18:31:16 +08:00
parent 1b62ff288f
commit dad179c15f
3 changed files with 15 additions and 5 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Tue Apr 28 17:21:55 HKT 2026 #Tue Apr 28 18:27:43 CST 2026
stageCount=10 stageCount=10
libraryProject= libraryProject=
baseVersion=15.0 baseVersion=15.0
publishVersion=15.0.9 publishVersion=15.0.9
buildCount=0 buildCount=3
baseBetaVersion=15.0.10 baseBetaVersion=15.0.10

View File

@@ -127,6 +127,7 @@ public class CropActivity extends AppCompatActivity {
public void onColorPicked(int color) { public void onColorPicked(int color) {
int pickX = cropCanvasView.getLastPickImageX(); int pickX = cropCanvasView.getLastPickImageX();
int pickY = cropCanvasView.getLastPickImageY(); int pickY = cropCanvasView.getLastPickImageY();
colorView.setBackgroundColor(color);
Toast.makeText(CropActivity.this, Toast.makeText(CropActivity.this,
"颜色已拾取: #" + String.format("%06X", color & 0xFFFFFF) + "颜色已拾取: #" + String.format("%06X", color & 0xFFFFFF) +
" (" + pickX + "," + pickY + ")", " (" + pickX + "," + pickY + ")",

View File

@@ -528,10 +528,19 @@ public class CropCanvasView extends View {
return true; return true;
} }
if (event.getAction() == MotionEvent.ACTION_UP) { if (event.getAction() == MotionEvent.ACTION_UP) {
if (previewColor != 0 && previewColor != Color.TRANSPARENT) { if (canvasBounds.contains(x, y)) {
backgroundColor = previewColor; int pickedColor;
float imgX = screenToImageX(x);
float imgY = screenToImageY(y);
if (imageBounds.contains(imgX, imgY)) {
int colorAtPoint = getImageColorAt(x, y);
pickedColor = colorAtPoint;
backgroundColor = colorAtPoint;
} else {
pickedColor = backgroundColor;
}
if (colorPickedListener != null) { if (colorPickedListener != null) {
colorPickedListener.onColorPicked(backgroundColor); colorPickedListener.onColorPicked(pickedColor);
} }
} }
if (colorPickEndListener != null) { if (colorPickEndListener != null) {