I have a web page with map that is using OpenLayers 4.6.4 and I want to prevent the user from panning or zooming beyond the edge of the map, like this:
There are plenty of answers for this for OL3, but that is very different than OL4. Items likes "restrictedExtent" that existed in OL3 are no longer there in OL4.
The only customizations I have added to the map are the fullscreen and scale controls and an onclick handler as I am still new to OL & GIS (though not to web development).
OL is getting the data from a GeoServer instance via WMS if that makes any difference.
extent
within theView
config. This will set the extent that constrains the center, in other words, center cannot be set outside this extent. openlayers.org/en/latest/apidoc/ol.View.html