OpenLayers OpenLayers

Changeset 6516

Show
Ignore:
Timestamp:
03/13/08 09:44:09 (6 months ago)
Author:
crschmidt
Message:

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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Control/PanZoomBar.js

    r6514 r6516  
    4949     */ 
    5050    divEvents: null, 
    51      
    52     /** Whether or not Pan icons will be displayed  
    53      *   Default is true 
    54      *  
    55      * @type Boolean 
    56      */ 
    57     showPan: true, 
    58      
    59     /** Whether or not ZoomBar will be displayed  
    60      *   Default is true 
    61      *  
    62      * @type Boolean 
    63      */ 
    64     showZoomBar: true, 
    6551 
    6652    /**  
     
    147133        } 
    148134 
    149         if (this.showPan) { 
    150  
    151             this._addButton("panup", "north-mini.png", centered, sz); 
    152             px.y = centered.y+sz.h; 
    153             this._addButton("panleft", "west-mini.png", px, sz); 
    154             if (this.zoomWorldIcon) { 
    155                 this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz); 
    156                  
    157                 wposition *= 2; 
    158             } 
    159             this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz); 
    160             this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz); 
    161         }  
    162         if (this.showZoomBar) { 
    163             this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz); 
    164             centered = this._addZoomBar(centered.add(0, sz.h*4 + 5)); 
    165             this._addButton("zoomout", "zoom-minus-mini.png", centered, sz); 
    166         } 
     135        this._addButton("panup", "north-mini.png", centered, sz); 
     136        px.y = centered.y+sz.h; 
     137        this._addButton("panleft", "west-mini.png", px, sz); 
     138        if (this.zoomWorldIcon) { 
     139            this._addButton("zoomworld", "zoom-world-mini.png", px.add(sz.w, 0), sz); 
     140             
     141            wposition *= 2; 
     142        } 
     143        this._addButton("panright", "east-mini.png", px.add(wposition, 0), sz); 
     144        this._addButton("pandown", "south-mini.png", centered.add(0, sz.h*2), sz); 
     145        this._addButton("zoomin", "zoom-plus-mini.png", centered.add(0, sz.h*3+5), sz); 
     146        centered = this._addZoomBar(centered.add(0, sz.h*4 + 5)); 
     147        this._addButton("zoomout", "zoom-minus-mini.png", centered, sz); 
    167148        return this.div; 
    168149    }, 
  • trunk/openlayers/tests/Control/test_PanZoomBar.html

    r6514 r6516  
    55    var map;  
    66    function test_01_Control_PanZoomBar_constructor (t) { 
    7          
    8         t.plan( 6 ); 
    9          
     7        t.plan( 4 ); 
    108     
    11         control = new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(100,100), showPan: false, showZoomBar: false}); 
     9        control = new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(100,100)}); 
    1210        t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" ); 
    1311        t.eq( control.displayClass,  "olControlPanZoomBar", "displayClass is correct" ); 
    1412        t.eq( control.position.x, 100, "PanZoom X Set correctly.");  
    1513        t.eq( control.position.y, 100, "PanZoom y Set correctly.");  
    16         t.eq( control.showPan, false, "showPan Set correctly.");  
    17         t.eq( control.showZoomBar, false, "showZoomBar Set correctly.");  
    18          
    1914    } 
    2015    function test_02_Control_PanZoomBar_addControl (t) { 
    21         t.plan( 10 ); 
     16        t.plan( 8 ); 
    2217        map = new OpenLayers.Map('map', {controls:[]}); 
    2318        var layer = new OpenLayers.Layer.WMS("Test Layer",  
     
    2520            {map: "/mapdata/vmap_wms.map", layers: "basic"}); 
    2621        map.addLayer(layer); 
    27         control = new OpenLayers.Control.PanZoomBar({showPan: false, showZoomBar: false}); 
     22        control = new OpenLayers.Control.PanZoomBar(); 
    2823        t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" ); 
    2924        t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map creates map" ); 
     
    3429        t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), 1001, "Viewport div contains control div" ); 
    3530        t.eq( control.div.style.top, "4px", "Control div top located correctly by default"); 
    36         t.eq( control.div.childNodes.length, 0, "showPan/showZoomBar work correctly"); 
    3731 
    3832        var control2 = new OpenLayers.Control.PanZoomBar(); 
    3933        map.addControl(control2, new OpenLayers.Pixel(100,100)); 
    4034        t.eq( control2.div.style.top, "100px", "2nd control div is located correctly"); 
    41         t.eq( control2.div.childNodes.length, 8, "showPan/showZoomBar work correctly on 2nd control div"); 
    4235    } 
    4336