'Create custom interaction handlers with mapbox-gl-js

I would like to create interaction handlers in Mapbox GL JS similar to those provided with the lib : BoxZoomHandler, DoubleClickZoomHandler, .... (https://docs.mapbox.com/mapbox-gl-js/api/handlers/).

Nothing is documented, but it seems to be implemented as it was in leafletJS, where custom handlers were available.

If any body as any idea. I guess we could reuse the code from existing handlers, like : https://github.com/mapbox/mapbox-gl-js/blob/7afee477ba26ccf539a1d35e3ca781691c548536/src/ui/handler/keyboard.js

but how to register and activate them ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source