OpenLayers OpenLayers

Ticket #674: ls.patch

File ls.patch, 1.7 kB (added by crschmidt, 1 year ago)
  • lib/OpenLayers/Control/LayerSwitcher.js

    old new  
    9999        this.loadContents(); 
    100100 
    101101        // set mode to minimize 
    102         this.minimizeControl(); 
    103          
     102        if(!this.outsideViewport) { 
     103            this.minimizeControl(); 
     104        } 
     105 
    104106        // populate div with current info 
    105107        this.redraw();     
    106108 
  • tests/Control/test_LayerSwitcher.html

    old new  
    2222        t.ok( control.div != null, "draw makes a div" ); 
    2323        t.ok( div != null, "draw returns its div" ); 
    2424    } 
     25    function test_Control_LayerSwitcher_outsideViewport (t) { 
     26        t.plan( 2 ); 
     27 
     28        map = new OpenLayers.Map('map'); 
     29        control = new OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('layerswitcher')}); 
     30        map.addControl(control); 
     31        console.log(control.outsideViewport); 
     32        t.eq(control.div.style.width, "250px", "Div is not minimized when added.");  
     33        control = new OpenLayers.Control.LayerSwitcher(); 
     34        map.addControl(control); 
     35        t.eq(control.div.style.width, "0px", "Div is minimized when added.");  
     36    } 
    2537  
    2638    function test_03_Control_LayerSwitcher_loadContents(t) { 
    2739 
     
    110122</head> 
    111123<body> 
    112124    <div id="map" style="width: 1024px; height: 512px;"/> 
     125    <div id="layerswitcher" style="width:250px; height:256px;" /> 
    113126</body> 
    114127</html>