Rolling back patch from #751: this broke IE when used (destroy tries to
destroy slider even though it was never created). Thanks to the tests we caught it, but this patch needs reworking. git-svn-id: http://svn.openlayers.org/trunk/openlayers@6516 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -48,20 +48,6 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
* {<OpenLayers.Events>}
|
* {<OpenLayers.Events>}
|
||||||
*/
|
*/
|
||||||
divEvents: null,
|
divEvents: null,
|
||||||
|
|
||||||
/** Whether or not Pan icons will be displayed
|
|
||||||
* Default is true
|
|
||||||
*
|
|
||||||
* @type Boolean
|
|
||||||
*/
|
|
||||||
showPan: true,
|
|
||||||
|
|
||||||
/** Whether or not ZoomBar will be displayed
|
|
||||||
* Default is true
|
|
||||||
*
|
|
||||||
* @type Boolean
|
|
||||||
*/
|
|
||||||
showZoomBar: true,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: zoomWorldIcon
|
* Property: zoomWorldIcon
|
||||||
@@ -146,24 +132,19 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
centered = new OpenLayers.Pixel(px.x+sz.w, px.y);
|
centered = new OpenLayers.Pixel(px.x+sz.w, px.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.showPan) {
|
this._addButton("panup", "north-mini.png", centered, sz);
|
||||||
|
px.y = centered.y+sz.h;
|
||||||
this._addButton("panup", "north-mini.png", centered, sz);
|
this._addButton("panleft", "west-mini.png", px, sz);
|
||||||
px.y = centered.y+sz.h;
|
if (this.zoomWorldIcon) {
|
||||||
this._addButton("panleft", "west-mini.png", px, sz);
|
this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz);
|
||||||
if (this.zoomWorldIcon) {
|
|
||||||
this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz);
|
wposition *= 2;
|
||||||
|
|
||||||
wposition *= 2;
|
|
||||||
}
|
|
||||||
this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz);
|
|
||||||
this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz);
|
|
||||||
}
|
|
||||||
if (this.showZoomBar) {
|
|
||||||
this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz);
|
|
||||||
centered = this._addZoomBar(centered.add(0, sz.h*4 + 5));
|
|
||||||
this._addButton("zoomout", "zoom-minus-mini.png", centered, sz);
|
|
||||||
}
|
}
|
||||||
|
this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz);
|
||||||
|
this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz);
|
||||||
|
this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz);
|
||||||
|
centered = this._addZoomBar(centered.add(0, sz.h*4 + 5));
|
||||||
|
this._addButton("zoomout", "zoom-minus-mini.png", centered, sz);
|
||||||
return this.div;
|
return this.div;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -4,27 +4,22 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var map;
|
var map;
|
||||||
function test_01_Control_PanZoomBar_constructor (t) {
|
function test_01_Control_PanZoomBar_constructor (t) {
|
||||||
|
t.plan( 4 );
|
||||||
t.plan( 6 );
|
|
||||||
|
|
||||||
|
|
||||||
control = new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(100,100), showPan: false, showZoomBar: false});
|
control = new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(100,100)});
|
||||||
t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" );
|
t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" );
|
||||||
t.eq( control.displayClass, "olControlPanZoomBar", "displayClass is correct" );
|
t.eq( control.displayClass, "olControlPanZoomBar", "displayClass is correct" );
|
||||||
t.eq( control.position.x, 100, "PanZoom X Set correctly.");
|
t.eq( control.position.x, 100, "PanZoom X Set correctly.");
|
||||||
t.eq( control.position.y, 100, "PanZoom y Set correctly.");
|
t.eq( control.position.y, 100, "PanZoom y Set correctly.");
|
||||||
t.eq( control.showPan, false, "showPan Set correctly.");
|
|
||||||
t.eq( control.showZoomBar, false, "showZoomBar Set correctly.");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
function test_02_Control_PanZoomBar_addControl (t) {
|
function test_02_Control_PanZoomBar_addControl (t) {
|
||||||
t.plan( 10 );
|
t.plan( 8 );
|
||||||
map = new OpenLayers.Map('map', {controls:[]});
|
map = new OpenLayers.Map('map', {controls:[]});
|
||||||
var layer = new OpenLayers.Layer.WMS("Test Layer",
|
var layer = new OpenLayers.Layer.WMS("Test Layer",
|
||||||
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
||||||
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
control = new OpenLayers.Control.PanZoomBar({showPan: false, showZoomBar: false});
|
control = new OpenLayers.Control.PanZoomBar();
|
||||||
t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" );
|
t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" );
|
||||||
t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map creates map" );
|
t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map creates map" );
|
||||||
map.addControl(control);
|
map.addControl(control);
|
||||||
@@ -33,12 +28,10 @@
|
|||||||
t.eq( parseInt(control.div.style.zIndex), 1001, "Control div zIndexed properly" );
|
t.eq( parseInt(control.div.style.zIndex), 1001, "Control div zIndexed properly" );
|
||||||
t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), 1001, "Viewport div contains control div" );
|
t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), 1001, "Viewport div contains control div" );
|
||||||
t.eq( control.div.style.top, "4px", "Control div top located correctly by default");
|
t.eq( control.div.style.top, "4px", "Control div top located correctly by default");
|
||||||
t.eq( control.div.childNodes.length, 0, "showPan/showZoomBar work correctly");
|
|
||||||
|
|
||||||
var control2 = new OpenLayers.Control.PanZoomBar();
|
var control2 = new OpenLayers.Control.PanZoomBar();
|
||||||
map.addControl(control2, new OpenLayers.Pixel(100,100));
|
map.addControl(control2, new OpenLayers.Pixel(100,100));
|
||||||
t.eq( control2.div.style.top, "100px", "2nd control div is located correctly");
|
t.eq( control2.div.style.top, "100px", "2nd control div is located correctly");
|
||||||
t.eq( control2.div.childNodes.length, 8, "showPan/showZoomBar work correctly on 2nd control div");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user