OpenLayers OpenLayers

Changeset 3087

Show
Ignore:
Timestamp:
04/19/07 16:00:15 (2 years ago)
Author:
crschmidt
Message:

Fix ka-Map's clone method, to fix bug with Overview Map reported by Stephen
Woodbridge. (Thx Stephen.)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Layer/KaMap.js

    r2240 r3087  
    146146 
    147147    }, 
     148     
     149    /** 
     150     * @param {Object} obj 
     151     *  
     152     * @returns An exact clone of this OpenLayers.Layer.Grid 
     153     * @type OpenLayers.Layer.Grid 
     154     */ 
     155    clone: function (obj) { 
     156         
     157        if (obj == null) { 
     158            obj = new OpenLayers.Layer.KaMap(this.name, 
     159                                            this.url, 
     160                                            this.params, 
     161                                            this.options); 
     162        } 
     163 
     164        //get all additions from superclasses 
     165        obj = OpenLayers.Layer.Grid.prototype.clone.apply(this, [obj]); 
     166 
     167        // copy/set any non-init, non-simple values here 
     168        if (this.tileSize != null) { 
     169            obj.tileSize = this.tileSize.clone(); 
     170        } 
     171         
     172        // we do not want to copy reference to grid, so we make a new array 
     173        obj.grid = new Array(); 
     174 
     175        return obj; 
     176    },     
     177 
    148178 
    149179    /** @final @type String */ 
  • trunk/openlayers/tests/Layer/test_KaMap.html

    r2803 r3087  
    148148 
    149149    function test_10_Layer_KaMap_clone(t) { 
    150         t.plan(4); 
     150        t.plan(5); 
    151151         
    152152        var options = {tileSize: new OpenLayers.Size(500,50)}; 
     
    169169 
    170170        t.eq( clone.alpha, layer.alpha, "alpha copied correctly"); 
     171         
     172        t.eq( clone.CLASS_NAME, "OpenLayers.Layer.KaMap", "Clone is a ka-map layer"); 
    171173 
    172174        layer.grid = null;