Search code examples
zoomingcoordinate-systemsjsxgraph

JSXGraph: Board without ability to zoom and pan


I don't have much experience with JSXGraph and I have a basic question. How can I create a coordinate system that cannot be zoomed or panned?

I tried: "var board=JXG.JSXGraph.initBoard(divid, { boundingbox:[-5,5,5,-5], axis:true, showNavigation:false, zoom:{wheel:false, pinchHorizontal: false, pinchVertical:false}, pan:{enabled:false}});"

But I can still zoom in this board. What went wrong?


Solution

  • Indeed, as of version v1.6.2 the API doc and the program logic are not longer in sync. What is missing in the API doc is that by setting the board attribute

      zoom: {
        enabled: false
      }
    

    zooming should be disabled for all input devices (mouse or multi-touch). However - by purpose - this does not turn off zooming by pressing zoom buttons. Use the board attribute showZoom:false to turn off this possibility.

    Further, the API doc is (meanwhile) wrong about zoom: { wheel: false} having an effect on pinch-to-zoom. This feature has disappeared some versions ago. Instead, for v1.6.3+ we just introduced the attribute

      zoom: {
        pinch: true
      }
    

    which controls if zooming by two fingers is allowed.

    In short: Add zoom:{enabled: false} as board attribute.