We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It will be good if the viewer have ability to rotate, isn't it?
The text was updated successfully, but these errors were encountered:
It is also necessary for me
Sorry, something went wrong.
I implemented rotation outside of the lib by doing something like this:
given the ref to an image:
const imageRef = useRef<HTMLImageElement>(null)
I implemented and exposed the following API (through a custom context):
const rotateClockwise = useCallback(() => { if (!imageRef?.current) return setRotation((rotation) => { const newRotation = (rotation + 90) % 360 imageRef.current!.style.transform = `rotate(${newRotation}deg)` return newRotation }) }, [setRotation, imageRef]); const rotateCounterClockwise = useCallback(() => { if (!imageRef?.current) return setRotation((rotation) => { const newRotation = (rotation - 90) % 360 imageRef.current!.style.transform = `rotate(${newRotation}deg)` return newRotation }) }, [setRotation, imageRef]);
Then I implemented it on the image itself:
return ( <TransformWrapper> <ImageControls /> <TransformComponent> <img ref={imageRef} id="img" src={uri} /> </TransformComponent> </TransformWrapper> )
then the ImageControls is just a custom version of the default Controls that implements both useControls() for the lib and my own context.
useControls()
TBH, if I got little time, I believe it can be easy to add to the API
HTH
No branches or pull requests
It will be good if the viewer have ability to rotate, isn't it?
The text was updated successfully, but these errors were encountered: