react-zoom-pan-pinch
react-zoom-pan-pinch copied to clipboard
Allow to use `'left' | 'center' | 'right'` and `'top' | 'center' | 'bottom'` for the position values
Is your feature request related to a problem? Please describe.
I want the initial position to be top-middle
. And the reset button to change the position to top-middle
instead of center
.
Describe the solution you'd like
Allow x
value of setTransform
and initialPositionX
to be 'left' | 'center' | 'right' | number
Allow y
value of setTransform
and initialPositionY
to be 'top' | 'center' | 'bottom' | number
Describe alternatives you've considered
Use useEffect
to update the initial position by calculating from instance.bounds
.
Additional context Add any other context or screenshots about the feature request here.
@vimutti77 great idea!
Hi there @prc5, is there any expected timeline for this? 🙇🏼
@a-fortunato probably not soon, I'm very busy working on the v4.0.0 and testing out the whole library as I built some internal tools for doing it. I discovered few issues with initialPositions and I will try to have it done with this release, but I can't really specify any date for it. However I'm accepting PRs so if you have a will to participate in solving this I would really appreciate it(and the whole community!).
@prc5 I thought this could fix an issue I am having but maybe it's more related to what you just said...
I discovered few issues with initialPositions
I have just created an issue (https://github.com/BetterTyped/react-zoom-pan-pinch/issues/483) to explain the problem I'm having, maybe there you can confirm if it's one of the problems you found and are working on (or if I'm missing something in the setup).
And about this:
I'm accepting PRs so if you have a will to participate in solving this I would really appreciate it
I've been actually taking a look at the code these past few days, trying to understand some of the features we need. I might dare and lend a hand if I see that I can bring some value. 😄
Thank you for both the library and your hard work!