OpenLayers OpenLayers

Changeset 5284

Show
Ignore:
Timestamp:
11/27/07 05:17:54 (1 year ago)
Author:
fredj
Message:

Correctly check if the alpha hack needs to be applied to the layer's div by testing
if the alpha option is set and by calling Util.alphaHack().
Thanks elemoine for the review (Closes #1130)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Tile/Image.js

    r5157 r5284  
    3737    frame: null,  
    3838 
     39     
     40    /** 
     41     * Property: layerAlphaHack 
     42     * {Boolean} True if the png alpha hack needs to be applied on the layer's div. 
     43     */ 
     44    layerAlphaHack: null, 
     45 
    3946    /** TBD 3.0 - reorder the parameters to the init function to remove  
    4047     *             URL. the getUrl() function on the layer gets called on  
     
    5966        this.frame.style.overflow = 'hidden';  
    6067        this.frame.style.position = 'absolute';  
     68 
     69        this.layerAlphaHack = this.layer.alpha && OpenLayers.Util.alphaHack(); 
    6170    }, 
    6271 
     
    116125 
    117126        var imageSize = this.layer.getImageSize();  
    118         if (this.layer.alpha) { 
     127        if (this.layerAlphaHack) { 
    119128            OpenLayers.Util.modifyAlphaImageDiv(this.imgDiv, 
    120129                    null, null, imageSize, this.url); 
     
    147156        var size = this.layer.getImageSize();  
    148157      
    149         if (this.layer.alpha) { 
     158        if (this.layerAlphaHack) { 
    150159            this.imgDiv = OpenLayers.Util.createAlphaImageDiv(null, 
    151160                                                           offset, 
     
    231240        // from the map, in which case this check is not needed.   
    232241        if (this.layer) { 
    233             var loaded = this.layer.alpha ? this.imgDiv.firstChild.src : this.imgDiv.src; 
     242            var loaded = this.layerAlphaHack ? this.imgDiv.firstChild.src : this.imgDiv.src; 
    234243            if (!OpenLayers.Util.isEquivalentUrl(loaded, this.url)) { 
    235244                this.imgDiv.style.display = "none";