最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - JSXGraph: Can't zoom out all the way when maxBoundingBox is set - Stack Overflow

programmeradmin3浏览0评论

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.
Share Improve this question edited Feb 18 at 22:58 PixelPipeline asked Feb 15 at 2:40 PixelPipelinePixelPipeline 32 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

This 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.

发布评论

评论列表(0)

  1. 暂无评论