fix Allow to have PanZoomBar without pan icons, r=erilem (closes #3167)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@11746 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -59,6 +59,14 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
*/
|
||||
zoomWorldIcon: false,
|
||||
|
||||
/**
|
||||
* APIProperty: panIcons
|
||||
* {Boolean} Set this property to false not to display the pan icons. If
|
||||
* false the zoom world icon is placed under the zoom bar. Defaults to
|
||||
* true.
|
||||
*/
|
||||
panIcons: true,
|
||||
|
||||
/**
|
||||
* APIProperty: forceFixedZoomLevel
|
||||
* {Boolean} Force a fixed zoom level even though the map has
|
||||
@@ -144,26 +152,37 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
||||
this.buttons = [];
|
||||
|
||||
var sz = new OpenLayers.Size(18,18);
|
||||
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
|
||||
var wposition = sz.w;
|
||||
if (this.panIcons) {
|
||||
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
|
||||
var wposition = sz.w;
|
||||
|
||||
if (this.zoomWorldIcon) {
|
||||
centered = new OpenLayers.Pixel(px.x+sz.w, px.y);
|
||||
}
|
||||
if (this.zoomWorldIcon) {
|
||||
centered = new OpenLayers.Pixel(px.x+sz.w, px.y);
|
||||
}
|
||||
|
||||
this._addButton("panup", "north-mini.png", centered, sz);
|
||||
px.y = centered.y+sz.h;
|
||||
this._addButton("panleft", "west-mini.png", px, sz);
|
||||
if (this.zoomWorldIcon) {
|
||||
this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz);
|
||||
|
||||
wposition *= 2;
|
||||
this._addButton("panup", "north-mini.png", centered, sz);
|
||||
px.y = centered.y+sz.h;
|
||||
this._addButton("panleft", "west-mini.png", px, sz);
|
||||
if (this.zoomWorldIcon) {
|
||||
this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz);
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
else {
|
||||
this._addButton("zoomin", "zoom-plus-mini.png", px, sz);
|
||||
centered = this._addZoomBar(px.add(0, sz.h));
|
||||
this._addButton("zoomout", "zoom-minus-mini.png", centered, sz);
|
||||
if (this.zoomWorldIcon) {
|
||||
centered = centered.add(0, sz.h+3);
|
||||
this._addButton("zoomworld", "zoom-world-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;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user