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
When setting minDistance and maxDistance on the GraphCanvas element, these settings have only an impact when zooming in/out with the mouse wheel gesture. Now, if you're using manual controls and call ref.current?.zoomIn() or ref.current?.zoomOut(), these settings are ignored and you can zoom in/out beyond these limits.
Steps to Reproduce the Bug or Issue
Set min/maxDistance on the GraphCanvas like:
maxDistance={10000}
minDistance={1000}
Add buttons to control the zoom of the graph which call graphRef.current?.zoomIn() or graphRef.current?.zoomOut()
The view now goes beyond the provided bounds
Expected behavior
When setting min/maxDistance values, these should also apply to programmatically zooming in/out for consistency reasons.
Platform
Reagraph Version: 4.15.26
OS: macOS
Browser: Chrome
Additional context
Looks like that these manual zoom functions are looking for the minZoom and maxZoom values of the graphRef.current.getControls() object. I can manually overwrite these settings to limit the possible zoom but I guess it would be beneficial that the zoom limitations (e.g. setting min/maxDistance) are shared between gesture and 'manual' control. Alternatively, it would be nice to set min/maxZoom on the GraphCanvas as well instead of min/maxDistance to control both zoom limitations.
The text was updated successfully, but these errors were encountered:
Describe the bug
When setting
minDistance
andmaxDistance
on theGraphCanvas
element, these settings have only an impact when zooming in/out with the mouse wheel gesture. Now, if you're using manual controls and callref.current?.zoomIn()
orref.current?.zoomOut()
, these settings are ignored and you can zoom in/out beyond these limits.Steps to Reproduce the Bug or Issue
graphRef.current?.zoomIn()
orgraphRef.current?.zoomOut()
Expected behavior
When setting min/maxDistance values, these should also apply to programmatically zooming in/out for consistency reasons.
Platform
Additional context
Looks like that these manual zoom functions are looking for the
minZoom
andmaxZoom
values of thegraphRef.current.getControls()
object. I can manually overwrite these settings to limit the possible zoom but I guess it would be beneficial that the zoom limitations (e.g. setting min/maxDistance) are shared between gesture and 'manual' control. Alternatively, it would be nice to set min/maxZoom on the GraphCanvas as well instead of min/maxDistance to control both zoom limitations.The text was updated successfully, but these errors were encountered: