[OpenLayers-Dev] Graticule control can't be deactivated

Fabian Patzke (OL) listensammler at patzi.de
Tue Apr 6 05:15:08 EDT 2010

bartvde wrote:
> I don't think control activate and deactivate are meant to control the
> visibility of the actual control. Compare this for instance to the
> MousePosition control, it also does not disappear on deactivate. Normally
> active means it will respond to mouse events etc.
I find it a bit strange that a none active control still draws the graticule
on the map if it is moved, but that could just be me finding it strange ;)

My solution is now that I put events on the control that hides the layer
every time it is deactivated and turn them on again when activated. Also the
Control is added to the map without being activated:

  var gratControl = new OpenLayers.Control.Graticule({
    autoActivate: false
    ,visible: false
    ,eventListeners: {
        "activate": function(event) {
          this.visible = true;
      ,"deactivate": function(event) {
          this.visible = false;
View this message in context: http://n2.nabble.com/Graticule-control-can-t-be-deactivated-tp4836670p4857917.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.

More information about the Dev mailing list