[OpenLayers-Users] add a method to see if layer switcher is maxmized

huub fleuren huub.gis at gmail.com
Thu May 27 08:52:30 EDT 2010


Hi List,

If you  want to click something else than the Control to toggle the
layerswitcher you need  an extra function to check the state of the Control
by looking at the minimizedDiv or maximizedDiv propery. I never worried
about the logic of the terms.

If the maximizeDiv display =="none" the switchercontrol is in the maximized
state so it seems

so:

  OpenLayers.Control.LayerSwitcher.prototype.isShowControls  = function  ()
{

        return(this.maximizeDiv.style.display=="none") ;
  }

usage:
        if(layerSwitcher.isShowControls())
            layerSwitcher.minimizeControl()
        else
            layerSwitcher.maximizeControl();

this is compatible with the layer switcher control button (class:
olControlLayerSwitcher)


regards, Huub
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100527/b4e1f59c/attachment.html


More information about the Users mailing list