scale calculation is not fixed 3.3.0
cheolhow opened this issue · 5 comments
Describe the bug
#367
3.0.7 works fine, but 3.3.0 doesn't work again.
To Reproduce
When initialScale is 1, it does not increase by 0.5 when the zoomIn(0.5) is executed.
I got the same issue
do you have any idea?
I don't know how to fix this bug. So I downgraded to version 3.0.7, which is the version that works.
A lord trick for this, I manual set scale for my component using ref. I hope it help you.
const setScale = (newScale: number) => { if (transformComponentRef.current) { const { setTransform, instance } = transformComponentRef.current; setTransform( instance?.transformState?.positionX || 0, instance?.transformState?.positionY || 0, newScale, 200, "easeOut" ); } };
I encountered the same issue and I found out you just need to set smooth
attribute to false
to have constant step. Hope this helps.
<TransformWrapper smooth={false} />