Fix to display only one unit on scaleline in IE. Previously, this worked in
most browsers, but not IE. Includes a test, tested on IE6 and IE7. Patch by zspitzer, r=me, (Closes #1478) git-svn-id: http://svn.openlayers.org/trunk/openlayers@8950 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -189,12 +189,18 @@ OpenLayers.Control.ScaleLine = OpenLayers.Class(OpenLayers.Control, {
|
||||
var bottomPx = bottomMax / res;
|
||||
|
||||
// now set the pixel widths
|
||||
this.eTop.style.width = Math.round(topPx) + "px";
|
||||
this.eBottom.style.width = Math.round(bottomPx) + "px";
|
||||
|
||||
// and the values inside them
|
||||
this.eTop.innerHTML = topRounded + " " + topUnits;
|
||||
this.eBottom.innerHTML = bottomRounded + " " + bottomUnits ;
|
||||
|
||||
if (this.eBottom.style.visibility == "visible"){
|
||||
this.eBottom.style.width = Math.round(bottomPx) + "px";
|
||||
this.eBottom.innerHTML = bottomRounded + " " + bottomUnits ;
|
||||
}
|
||||
|
||||
if (this.eTop.style.visibility == "visible"){
|
||||
this.eTop.style.width = Math.round(topPx) + "px";
|
||||
this.eTop.innerHTML = topRounded + " " + topUnits;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
CLASS_NAME: "OpenLayers.Control.ScaleLine"
|
||||
|
||||
@@ -168,6 +168,18 @@
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
function test_ie_oneunit(t) {
|
||||
t.plan(2);
|
||||
var control = new OpenLayers.Control.ScaleLine({bottomOutUnits:'',bottomInUnits:'',maxWidth:150});
|
||||
t.ok(control instanceof OpenLayers.Control.ScaleLine, "new OpenLayers.Control returns object" );
|
||||
var map = new OpenLayers.Map('map');
|
||||
var layer = new OpenLayers.Layer.WMS('Test Layer', "bogus", {});
|
||||
map.addLayer(layer);
|
||||
map.zoomTo(0);
|
||||
map.addControl(control);
|
||||
t.ok(true, "invisible bottom scale doesn't cause scaleline failure (IE only)");
|
||||
map.destroy();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user