"Sometimes, it is handy to have "zoomWorld" icon in
OpenLayers.Control.PanZoomBar. This patch enables it." Patch from jachym. (Closes #1131) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5159 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
function init(){
|
function init(){
|
||||||
map = new OpenLayers.Map('map', { controls: [] });
|
map = new OpenLayers.Map('map', { controls: [] });
|
||||||
|
|
||||||
map.addControl(new OpenLayers.Control.PanZoomBar());
|
map.addControl(new OpenLayers.Control.PanZoomBar({zoomWorldIcon:true}));
|
||||||
map.addControl(new OpenLayers.Control.MouseToolbar());
|
map.addControl(new OpenLayers.Control.MouseToolbar());
|
||||||
map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
|
map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
|
||||||
map.addControl(new OpenLayers.Control.Permalink());
|
map.addControl(new OpenLayers.Control.Permalink());
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
*/
|
*/
|
||||||
divEvents: null,
|
divEvents: null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Property: zoomWorldIcon
|
||||||
|
* {Boolean}
|
||||||
|
*/
|
||||||
|
zoomWorldIcon: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor: <OpenLayers.Control.PanZoomBar>
|
* Constructor: <OpenLayers.Control.PanZoomBar>
|
||||||
*/
|
*/
|
||||||
@@ -115,11 +121,21 @@ OpenLayers.Control.PanZoomBar = OpenLayers.Class(OpenLayers.Control.PanZoom, {
|
|||||||
|
|
||||||
var sz = new OpenLayers.Size(18,18);
|
var sz = new OpenLayers.Size(18,18);
|
||||||
var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
this._addButton("panup", "north-mini.png", centered, sz);
|
this._addButton("panup", "north-mini.png", centered, sz);
|
||||||
px.y = centered.y+sz.h;
|
px.y = centered.y+sz.h;
|
||||||
this._addButton("panleft", "west-mini.png", px, sz);
|
this._addButton("panleft", "west-mini.png", px, sz);
|
||||||
this._addButton("panright", "east-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;
|
||||||
|
}
|
||||||
|
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("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);
|
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));
|
centered = this._addZoomBar(centered.add(0, sz.h*4 + 5));
|
||||||
|
|||||||
Reference in New Issue
Block a user