OpenLayers OpenLayers

Changeset 5159

Show
Ignore:
Timestamp:
11/09/07 12:57:27 (1 year ago)
Author:
crschmidt
Message:

"Sometimes, it is handy to have "zoomWorld" icon in
OpenLayers.Control.PanZoomBar. This patch enables it." Patch from jachym.
(Closes #1131)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/examples/controls.html

    r5117 r5159  
    1414            map = new OpenLayers.Map('map', { controls: [] }); 
    1515 
    16             map.addControl(new OpenLayers.Control.PanZoomBar()); 
     16            map.addControl(new OpenLayers.Control.PanZoomBar({zoomWorldIcon:true})); 
    1717            map.addControl(new OpenLayers.Control.MouseToolbar()); 
    1818            map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false})); 
  • trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js

    r5028 r5159  
    4848    divEvents: null, 
    4949 
     50    /**  
     51     * Property: zoomWorldIcon 
     52     * {Boolean} 
     53     */ 
     54    zoomWorldIcon: false, 
     55 
    5056    /** 
    5157     * Constructor: <OpenLayers.Control.PanZoomBar> 
     
    116122        var sz = new OpenLayers.Size(18,18); 
    117123        var centered = new OpenLayers.Pixel(px.x+sz.w/2, px.y); 
     124        var wposition = sz.w; 
     125 
     126        if (this.zoomWorldIcon) { 
     127            centered = new OpenLayers.Pixel(px.x+sz.w, px.y); 
     128        } 
    118129 
    119130        this._addButton("panup", "north-mini.png", centered, sz); 
    120131        px.y = centered.y+sz.h; 
    121132        this._addButton("panleft", "west-mini.png", px, sz); 
    122         this._addButton("panright", "east-mini.png", px.add(sz.w, 0), sz); 
     133        if (this.zoomWorldIcon) { 
     134            this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz); 
     135             
     136            wposition *= 2; 
     137        } 
     138        this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz); 
    123139        this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz); 
    124140        this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz);