Search code examples
mapbox-gl-jsthreebox

In Threebox, it is possible to disable dragging, only the altitude of a 3D object?


In Threebox, it is possible to disable dragging, only the altitude of a 3D object?

I know that we get the altitude position value on the third index of the coords (origin) array, when we are dragging the 3D object and have the enableSelectingFeatures: true, and enableDraggingObjects: true, features set to true.

const origin = [-122.47920912, 37.716351775, 0]; window.tb = new Threebox(m, gl, { defaultLights: true, enableSelectingFeatures: true, enableSelectingObjects: true, enableDraggingObjects: true, enableRotatingObjects: true });

We could set that value always to 0, but I'm looking to disable the option of changing the altitude position when dragging with ctrlKey and mouse move. Anyone knows if that is possible?

Thanks in advance, and thanks @jscastro for the library update.


Solution

  • Yes, you can. Just add only the following:

    tb.altitudeStep = 0;
    

    That will make the vertical dragging not working.