Reputation: 11
everyone. I hope to load an indoor map (a PNG file) for my web page. however, I found that if you move the image map with your mouse, the map will out of range, or even disappear (difficult to find again).
An example can found from: http://openlayers.org/en/v3.7.0/examples/static-image.html?q=static You can move the image to the corner and it will then disappear.
My question is: how to constrain the map in the current view?
Thanks.
Upvotes: 1
Views: 919
Reputation: 3142
Use the extent
option on the view, see the notes on constraints in http://openlayers.org/en/v3.7.0/apidoc/ol.View.html
Note that the extent option constrains the center of the view, so that the center is within the extent. Parts of the viewport might still show areas outside of the extent.
Upvotes: 1