From 6c83a735197589956a69fda786203b440f7daa12 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Sat, 20 May 2006 03:47:46 +0000 Subject: [PATCH] Controls each create their own div, which is then individually added to the viewPortDiv directly, rather than to a Controls Div. This may fix some issues with event handling of lower layers, and may be related to #36. It also prevents the need for the markers hack a couple commits back. git-svn-id: http://svn.openlayers.org/trunk/openlayers@206 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control.js | 2 ++ lib/OpenLayers/Map.js | 9 +-------- markers.html | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/OpenLayers/Control.js b/lib/OpenLayers/Control.js index 4548572b42..bb9bd58b35 100644 --- a/lib/OpenLayers/Control.js +++ b/lib/OpenLayers/Control.js @@ -25,6 +25,8 @@ OpenLayers.Control.prototype = { if (this.div == null) { this.div = OpenLayers.Util.createDiv(); } + this.div.style.zIndex = this.map.Z_INDEX_BASE['Control'] + + this.map.controls.length; return this.div; }, diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 9443b151d7..e81fc5d6f2 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -74,13 +74,6 @@ OpenLayers.Map.prototype = { this.viewPortDiv.style.position = "relative"; this.div.appendChild(this.viewPortDiv); - // the controlDiv is the div that all the controls sit on - this.controlDiv = OpenLayers.Util.createDiv( - div.id + "_OpenLayers_Control" ); - this.controlDiv.style.width="100%"; - this.controlDiv.style.height="100%"; - this.controlDiv.style.zIndex = this.Z_INDEX_BASE["Control"]; - this.viewPortDiv.appendChild(this.controlDiv); // the layerContainerDiv is the one that holds all the layers this.layerContainerDiv = OpenLayers.Util.createDiv( @@ -146,7 +139,7 @@ OpenLayers.Map.prototype = { this.controls.push(control); var div = control.draw(); if (div) { - this.controlDiv.appendChild( div ); + this.viewPortDiv.appendChild( div ); } }, diff --git a/markers.html b/markers.html index 9e1644b479..1d83b90359 100644 --- a/markers.html +++ b/markers.html @@ -21,9 +21,9 @@ map.addLayer(layer); var markers = new OpenLayers.Layer.Marker( "Markers" ); - map.addLayer(markers, 300); + map.addLayer(markers); var newl = new OpenLayers.Layer.Text( "text", "./textfile.txt" ); - map.addLayer(newl,301); + map.addLayer(newl); var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',new OpenLayers.Size(10,17)); markers.addMarker(new OpenLayers.Marker(icon, new OpenLayers.LonLat(0,0))); markers.addMarker(new OpenLayers.Marker(icon, new OpenLayers.LonLat(0,45)));