[OpenLayers-Users] Single untiled map with maxextent

jonz jonathan.zaid at mediolanum.it
Thu Sep 13 03:54:00 EDT 2007


I've modified a version of WMS/Untiled, which I've configured with a ratio of
2. After the map is loaded I don't want the user to be able to drag the map
outside of the original map extent. 
I've done the following.
1) After the map is loaded, I do a map.setOptions setting maxExtent to
getExtent().
2) modified moveTo in the Untiled.js so that if the map is out of bounds, it
is not reloaded

That still leaves the fact that when the user drags the map, once it goes
out of the originally loaded extent, the area out of the extent but in the
viewport is white.

So, I registered priority event handlers for mouseup, mousedown and
mousemove. 
On mousemove, if dragging and  trying to move the mouse out of the extent,
i.e. !this.tile.bounds.containsBounds(this.map.getExtent(), the event is
cancelled and  map doesn't move. 
The problem here is the mouseup event. In the case that the mouse is
actually moved out of the extent, even if we haven't moved the map, the
event clientX and clientY are now out of bounds and once we let the mouse
go, if we don't block the event, the map will be moved into the non-loaded
area outside of the extent. If I don't let the event continue, openlayers
still thinks the mouse is down.
Questions: 
a) there must be a better way to achieve what I would like via OpenLayers in
a much simpler manner, just setting some simple parameter.
"displayOutsideMaxExtent" seemed promising but don't think that will do it.
b) otherwise, any ideas on how to deal with the mouseup event?

TIA
Jon

-- 
View this message in context: http://www.nabble.com/Single-untiled-map-with-maxextent-tf4430441.html#a12639038
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list