OpenLayers OpenLayers

Ticket #1042: renderer.patch

File renderer.patch, 4.5 kB (added by tschaub, 1 year ago)

stop flashing black and filling white

  • lib/OpenLayers/Renderer/Elements.js

    old new  
    127127        node._featureId = featureId; 
    128128        node._geometryClass = geometry.CLASS_NAME; 
    129129        node._style = style; 
    130         this.root.appendChild(node); 
    131130         
    132131        //now actually draw the node, and style it 
    133         this.drawGeometryNode(node, geometry); 
     132        node = this.drawGeometryNode(node, geometry); 
     133        this.root.appendChild(node); 
    134134    }, 
    135135 
    136136    /** 
     
    180180 
    181181        //set style 
    182182        //TBD simplify this 
    183         this.setStyle(node, style, options, geometry); 
     183        return this.setStyle(node, style, options, geometry); 
    184184    }, 
    185185     
    186186    /** 
  • lib/OpenLayers/Renderer/VML.js

    old new  
    157157                var _featureId = node._featureId; 
    158158                var _geometryClass = node._geometryClass; 
    159159                var _style = node._style; 
    160                 this.root.removeChild(node); 
    161160                 
    162161                // create new image node 
    163                 var node = this.createNode("v:rect", id); 
     162                node = this.createNode("v:rect", id); 
    164163                var fill = this.createNode("v:fill", id+"_image"); 
    165164                node.appendChild(fill); 
    166165                node._featureId = _featureId; 
    167166                node._geometryClass = _geometryClass; 
    168167                node._style = _style; 
    169                 this.root.appendChild(node); 
    170168                 
    171169                fill.src = style.externalGraphic; 
    172170                fill.type = "frame"; 
     
    202200            } 
    203201        } 
    204202 
    205       //fill 
    206         var fillColor = (options.isFilled) ? style.fillColor : "none"; 
    207         node.setAttribute("fillcolor", fillColor); 
     203        // fill  
     204        if (options.isFilled) {  
     205            node.setAttribute("fillcolor", style.fillColor);  
     206        } else {  
     207            node.setAttribute("filled", "false");  
     208        } 
    208209        var fills = node.getElementsByTagName("fill"); 
    209210        var fill = (fills.length == 0) ? null : fills[0]; 
    210211        if (!options.isFilled) { 
     
    227228        } 
    228229 
    229230 
    230       //stroke 
    231         var strokeColor = (options.isStroked) ? style.strokeColor : "none"; 
    232         node.setAttribute("strokecolor", strokeColor); 
    233         node.setAttribute("strokeweight", style.strokeWidth); 
     231        // stroke  
     232        if (options.isStroked) {  
     233            node.setAttribute("strokecolor", style.strokeColor);  
     234            node.setAttribute("strokeweight", style.strokeWidth);  
     235        } else {  
     236            node.setAttribute("stroked", "false");  
     237        } 
    234238        var strokes = node.getElementsByTagName("stroke"); 
    235239        var stroke = (strokes.length == 0) ? null : strokes[0]; 
    236240        if (!options.isStroked) { 
     
    249253        if (style.cursor) { 
    250254            node.style.cursor = style.cursor; 
    251255        } 
     256        return node; 
    252257    }, 
    253258 
    254259 
  • lib/OpenLayers/Renderer/SVG.js

    old new  
    179179    setStyle: function(node, style, options) { 
    180180        style = style  || node._style; 
    181181        options = options || node._options; 
    182  
    183182        if (node._geometryClass == "OpenLayers.Geometry.Point") { 
    184183            if (style.externalGraphic) { 
    185184                // remove old node 
     
    189188                var _featureId = node._featureId; 
    190189                var _geometryClass = node._geometryClass; 
    191190                var _style = node._style; 
    192                 this.root.removeChild(node); 
    193191                 
    194192                // create new image node 
    195                 var node = this.createNode("image", id); 
     193                node = this.createNode("image", id); 
    196194                node._featureId = _featureId; 
    197195                node._geometryClass = _geometryClass; 
    198196                node._style = _style; 
    199                 this.root.appendChild(node); 
    200197 
    201198                // now style the new node 
    202199                if (style.graphicWidth && style.graphicHeight) { 
     
    247244        if (style.cursor) { 
    248245            node.setAttributeNS(null, "cursor", style.cursor); 
    249246        } 
     247        return node; 
    250248    }, 
    251249 
    252250    /**