How to disable pinch zoom?

319 views
Skip to first unread message

Ferenc Beleznay

unread,
Jun 28, 2017, 12:28:31 PM6/28/17
to JSXGraph
I am trying to control the placement of elements on the board so that users cannot move them (apart from the ones I ask them to move).
When creating the board, I set "showNavigation: false", "zoom: false" and "pan: false" and for the elements I set "fixed: true".
However, when I try the applet on tablets with multitouch capability and use two fingers to "zoom", the size of the board itself does not change, but the content is zoomed.
Is there any way to prevent this?
Thanks,
Ferenc 

Alfred Wassermann

unread,
Jul 6, 2017, 9:41:38 AM7/6/17
to JSXGraph
In the next version of JSXGraph these options regarding pinch and zoom have been reworked.
You can test them by using a nightly-build.


var board = JXG.JSXGraph.initBoard('box',{
                boundingbox
: [-5, 20, 10, -20],
                showCopyright
: true,
                showNavigation
: true,
                keepaspectratio
: false,
                zoom
:
               
{
                    wheel
: true,
                    enabled
: true
               
},
                pan
:
               
{
                    needTwoFingers
: false,
                    enabled
: true
               
}
           
});


Overall, the following options (together with default values) can be used:
 
           /**
             * zoom: {
             *   factorX: 1.25,  // horizontal zoom factor (multiplied to {@link JXG.Board#zoomX})
             *   factorY: 1.25,  // vertical zoom factor (multiplied to {@link JXG.Board#zoomY})
             *   wheel: false,     // allow zooming by mouse wheel or
             *                                     // by pinch-to-toom gesture on touch devices
             *   needShift: false, // mouse wheel zooming needs pressing of the shift key
             *   min: 0.001        // minimal values of {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}, limits zoomOut
             *   max: 1000.0       // maximal values of {@link JXG.Board#zoomX} and {@link JXG.Board#zoomY}, limits zoomIn
             *
             *   pinchHorizontal: true // Allow pinch-to-zoom to zoom only horizontal axis
             *   pinchVertical: true   // Allow pinch-to-zoom to zoom only vertical axis
             *   pinchSensitivity: 7   // Sensitivity (in degree) for recognizing horizontal or vertical pinch-to-zoom gestures.
             *
             * pan: {
             *   enabled: true   // Allow panning
             *   needTwoFingers: true, // panning is done with two fingers on touch devices
             *   needShift: true, // mouse panning needs pressing of the shift key
             * }
             */


Best wishes,
Alfred

Reply all
Reply to author
Forward
0 new messages