You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I am trying to use this nice component to allow users to edit a large SVG. However, I have various edit modes where certain ones are supposed to disable any changes to the current pan or zoom so that they can perform other actions. I figured changing the value of allowPan and allowZoom would be reflected. However, it seems that this doesn't cause any effect.
My hunch is that the useEffect needs to list allowPan and allowZoom (probably also most of the other props too) as dependencies and the event listener functions should be moved to be defined in the useEffect? However, I am fairly new to react, so I would appreciate any input you have or if I missed something obvious.
EDIT: I played around with the code and just adding the props to the useEffect dependencies seems to make this work, but react exhaustive dependencies recommends to define the handler functions in the useEffect as well.
The text was updated successfully, but these errors were encountered:
Hi Ryan. Indeed, these props were not correctly considered after recent changes and you correctly spotted the issue: event listeners were not updated on props changes.
This should be fixed on version 3.3.5 thanks to this MR: #73
Could you confirm it's working as intended on your side?
Hi, I am trying to use this nice component to allow users to edit a large SVG. However, I have various edit modes where certain ones are supposed to disable any changes to the current pan or zoom so that they can perform other actions. I figured changing the value of
allowPan
andallowZoom
would be reflected. However, it seems that this doesn't cause any effect.My hunch is that the
useEffect
needs to listallowPan
andallowZoom
(probably also most of the other props too) as dependencies and the event listener functions should be moved to be defined in theuseEffect
? However, I am fairly new to react, so I would appreciate any input you have or if I missed something obvious.See this codesandbox reproduction.
EDIT: I played around with the code and just adding the props to the
useEffect
dependencies seems to make this work, but react exhaustive dependencies recommends to define the handler functions in theuseEffect
as well.The text was updated successfully, but these errors were encountered: