From 10cb24a06164a931bf673022da7c437395bb695e Mon Sep 17 00:00:00 2001 From: Timothy Cho <104095972+timothycho01@users.noreply.github.com> Date: Sun, 18 May 2025 00:19:28 -0400 Subject: [PATCH 1/2] Update ImageItem.tsx - add crop rotation adjustment --- apps/web/src/components/ImageItem.tsx | 59 +++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/apps/web/src/components/ImageItem.tsx b/apps/web/src/components/ImageItem.tsx index 003982a..69c326d 100644 --- a/apps/web/src/components/ImageItem.tsx +++ b/apps/web/src/components/ImageItem.tsx @@ -51,6 +51,26 @@ export function TbZoomIn(props: SVGProps) { ); } +export function TbRotate(props: SVGProps) { + return ( + + + + + ); +} + const ImageItem = ( { file, @@ -73,11 +93,16 @@ const ImageItem = ( const [scale, setScaleImpl] = useState(1); const [minScalePerc, setMinScalePerc] = useState(1); const [maxScalePerc, setMaxScalePerc] = useState(1); + const [rotation, setRotationImpl] = useState(0); const setScale = useCallback((value: number) => { setScaleImpl(parseFloat(value.toFixed(2))); }, []); + const setRotation = useCallback((value: number) => { + setRotationImpl(parseFloat(value.toFixed(1))); + }, []); + return (
{ setMinScalePerc( Math.ceil((Math.min(image.width, image.height) / Math.max(image.width, image.height)) * 100), @@ -185,6 +211,39 @@ const ImageItem = ( }} />
+
+
+ +
+ { + const rot = parseFloat(e.target.value); + if (isNaN(rot)) { + setRotation(0); + } else { + setRotation(rot); + } + }} + /> + { + const rot = parseFloat(e.target.value.replace('°', '')); + if (isNaN(rot)) { + setRotation(0); + } else { + setRotation(rot); + } + }} + /> +
); From 790978c00a92ffb1db4cfff577737cb9c5c5f7e7 Mon Sep 17 00:00:00 2001 From: Timothy Cho <104095972+timothycho01@users.noreply.github.com> Date: Sun, 18 May 2025 00:34:41 -0400 Subject: [PATCH 2/2] Update ImageItem.tsx - fix icon size --- apps/web/src/components/ImageItem.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/src/components/ImageItem.tsx b/apps/web/src/components/ImageItem.tsx index 69c326d..76fb5e5 100644 --- a/apps/web/src/components/ImageItem.tsx +++ b/apps/web/src/components/ImageItem.tsx @@ -55,8 +55,8 @@ export function TbRotate(props: SVGProps) { return (