Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: don't allow resizing in invalid conditions

httpjamesm133c21c0cf2f
diff --git a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
index ba8bfa9beb..439a6f0600 100644
--- a/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
+++ b/apps/photos/src/components/PhotoViewer/ImageEditorOverlay/index.tsx
@@ -367,6 +367,29 @@ const ImageEditorOverlay = (props: IProps) => {
// allow 10px tolerance
const tolerance = 10;
if (
+ x >
+ bottomRightCornerOfCanvas.x -
+ tolerance &&
+ x <
+ bottomRightCornerOfCanvas.x +
+ tolerance &&
+ y >
+ bottomRightCornerOfCanvas.y -
+ tolerance &&
+ y <
+ bottomRightCornerOfCanvas.y +
+ tolerance
+ ) {
+ setIsResizing(true);
+ setMouseDownX(event.clientX);
+ setMouseDownY(event.clientY);
+ setOriginalCanvasHeight(
+ canvas.height
+ );
+ setOriginalCanvasWidth(
+ canvas.width
+ );
+ } else if (
x <
bottomRightCornerOfCanvas.x -
tolerance ||
@@ -375,16 +398,10 @@ const ImageEditorOverlay = (props: IProps) => {
tolerance
) {
setIsDragging(true);
- } else {
- setIsResizing(true);
}
-
- setMouseDownX(event.clientX);
- setMouseDownY(event.clientY);
- setOriginalCanvasHeight(canvas.height);
- setOriginalCanvasWidth(canvas.width);
}}
onMouseUp={(event) => {
+ if (!isDragging && !isResizing) return;
setIsResizing(false);
setIsDragging(false);
const context =