OpenLayers OpenLayers

Ticket #878: layer_visibility.patch

File layer_visibility.patch, 1.5 kB (added by crschmidt, 1 year ago)
  • tests/test_Layer.html

    old new  
    118118 
    119119    function test_05_Layer_visibility(t) { 
    120120 
    121         t.plan(5
     121        t.plan(7
    122122 
    123123        var layer = new OpenLayers.Layer('Test Layer'); 
     124        t.visibilitychanged = 0;  
     125        layer.events.register("visibilitychanged", t, function() { 
     126            this.visibilitychanged++  
     127            this.ok(true, "Visibility changed called: time " + this.visibilitychanged + " of 2"); 
     128        });     
    124129     
    125130        t.eq(layer.getVisibility(), true, "default for layer creation is visible"); 
    126131         
  • lib/OpenLayers/Layer.js

    old new  
    3232     * Constant: EVENT_TYPES 
    3333     * {Array(String)} Supported application event types 
    3434     */ 
    35     EVENT_TYPES: [ "loadstart", "loadend", "loadcancel"], 
     35    EVENT_TYPES: [ "loadstart", "loadend", "loadcancel", "visibilitychanged"], 
    3636         
    3737    /** 
    3838     * APIProperty: events`` 
     
    504504            this.visibility = visibility; 
    505505            this.display(visibility); 
    506506            this.redraw(); 
     507            this.events.triggerEvent("visibilitychanged"); 
    507508            if ((this.map != null) &&  
    508509                ((noEvent == null) || (noEvent == false))) { 
    509510                this.map.events.triggerEvent("changelayer");