Only add the data layer to the main map, and use the visibility changed
event to handle turning the data layer on and off.
This commit is contained in:
parent
5620d7263a
commit
4d8ea0eed0
3 changed files with 14 additions and 20 deletions
|
@ -86,6 +86,10 @@ by the OpenStreetMap project and its contributors.
|
|||
function mapInit(){
|
||||
map = createMap("map");
|
||||
|
||||
map.dataLayer = new OpenLayers.Layer("Data", { "visibility": false });
|
||||
map.dataLayer.events.register("visibilitychanged", map.dataLayer, toggleData);
|
||||
map.addLayer(map.dataLayer);
|
||||
|
||||
<% if bbox %>
|
||||
var bbox = new OpenLayers.Bounds(<%= minlon %>, <%= minlat %>, <%= maxlon %>, <%= maxlat %>);
|
||||
|
||||
|
@ -118,6 +122,14 @@ by the OpenStreetMap project and its contributors.
|
|||
handleResize();
|
||||
}
|
||||
|
||||
function toggleData() {
|
||||
if (map.dataLayer.visibility) {
|
||||
<%= remote_function :url => { :controller => 'browse', :action => 'start' } %>
|
||||
} else {
|
||||
closeSidebar();
|
||||
}
|
||||
}
|
||||
|
||||
function getPosition() {
|
||||
return getMapCenter();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue