This is for JSXGraph 1.10.1.
I'm trying to set up a graph with both pan and zoom enabled. I also set a maxBoundingBox
because I want my users to stay within a certain area of the graph.
Here's a JSFiddle to illustrate this. The initial bounds of the graph is set to be equal to the maxBoundingBox
. When I zoom in, then try zooming back out all the way, the zoom-out stops before hitting the maxBoundingBox
. I would expect the zoom to stop at the maxBoundingBox
, not before.
I've tried setting zoom: { min: someParticularNumber }
in place of maxBoundingBox
to control & limit the zoom-out. I'd find the value of someParticularNumber
so that the minimum zoom matches the bounds I want to enforce. This almost works, except it doesn't limit panning maxBoundingBox
does; the user will be able to pan outside my desired bounded area.
I tried setting both zoom: { min: someParticularNumber }
and maxBoundingBox
. But the zoom-out still stops before hitting the maxBoundingBox
.
Is there a way set panning and zoom that meets these requirements?
- Panning is limited to some
maxBoundingBox
. - A user can zoom in, then zoom out until the bounds of the graph exactly matches the
maxBoundingBox
and not before.
This is for JSXGraph 1.10.1.
I'm trying to set up a graph with both pan and zoom enabled. I also set a maxBoundingBox
because I want my users to stay within a certain area of the graph.
Here's a JSFiddle to illustrate this. The initial bounds of the graph is set to be equal to the maxBoundingBox
. When I zoom in, then try zooming back out all the way, the zoom-out stops before hitting the maxBoundingBox
. I would expect the zoom to stop at the maxBoundingBox
, not before.
I've tried setting zoom: { min: someParticularNumber }
in place of maxBoundingBox
to control & limit the zoom-out. I'd find the value of someParticularNumber
so that the minimum zoom matches the bounds I want to enforce. This almost works, except it doesn't limit panning maxBoundingBox
does; the user will be able to pan outside my desired bounded area.
I tried setting both zoom: { min: someParticularNumber }
and maxBoundingBox
. But the zoom-out still stops before hitting the maxBoundingBox
.
Is there a way set panning and zoom that meets these requirements?
- Panning is limited to some
maxBoundingBox
. - A user can zoom in, then zoom out until the bounds of the graph exactly matches the
maxBoundingBox
and not before.
1 Answer
Reset to default 0This is a bug in all JSXGraph version including v1.10.1. Thank you very much for pointing it out. Branch develop
contains a bug fix that relaxes the bounds somewhat to meet the floating point precision.
maxBoundingBox
restricts panning and zooming to the given bounds. I'm not sure if this is sufficient for your needs.