In openlayers.js (current version 5.3.0) how to restrict the map during the mouse drag? The range of lat shall be [-90,90].
Compared with those two examples hereunder,
https://openlayers.org/en/latest/examples/drag-rotate-and-zoom.html?q=drag
https://docs.mapbox.com/mapbox-gl-js/example/add-image-animated/
If the map is dragged over the lat[-90,90], the map in mapbox restricts the range automatically and the map in OpenLayers will show the blank area.
Here is the same problem, but no prefect answers. https://gis.stackexchange.com/questions/222698/openlayers3-how-to-limits-the-drag-range-of-the-map
The dirty solution I tried is 1. add the map.on('moveend'...) listener 2. detect the map center with zoom 3. if out of range, do map.getView().animate({ center:[...],duration:100})
But the process of animation is, you know, the transition from some blank area to the nominated center.
Are there any options in the Map constructor? Or any position of source code in OpenLayers where some hack code could be done?