diff --git a/apps/web/src/components/ImageItem.tsx b/apps/web/src/components/ImageItem.tsx index 003982a..76fb5e5 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); + } + }} + /> +
);