OpenLayers OpenLayers

Changeset 6380

Show
Ignore:
Timestamp:
02/26/08 19:47:55 (9 months ago)
Author:
ahocevar
Message:

SVG renderer draws features in the upperleft corner of the map pane when coordinate outside range. r=tschaub (closes #1360)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Renderer/SVG.js

    r6200 r6380  
    193193        style = style  || node._style; 
    194194        options = options || node._options; 
    195         if (node._geometryClass == "OpenLayers.Geometry.Point") { 
     195        var x = node.getAttributeNS(null, "cx"); 
     196        // if x equals "", the node is outside the valid range 
     197        if (node._geometryClass == "OpenLayers.Geometry.Point" && x) { 
    196198            if (style.externalGraphic) { 
    197                 var x = parseFloat(node.getAttributeNS(null, "cx")); 
     199                x = parseFloat(x); 
    198200                var y = parseFloat(node.getAttributeNS(null, "cy")); 
    199201                 
     
    338340            node.setAttributeNS(null, "r", radius); 
    339341        } else { 
    340             if (node.parentNode == this.root) { 
    341                 this.root.removeChild(node); 
    342             } 
     342            node.setAttributeNS(null, "cx", ""); 
     343            node.setAttributeNS(null, "cy", ""); 
     344            node.setAttributeNS(null, "r", 0); 
    343345        }     
    344346             
  • trunk/openlayers/tests/Renderer/test_SVG.html

    r6131 r6380  
    156156        r.drawCircle(node, geometry, "blah_4000"); 
    157157         
    158         t.eq(node.getAttributeNS(null, 'cx'), '2', "cx is correct"); 
    159         t.eq(node.getAttributeNS(null, 'cy'), '-4', "cy is correct"); 
    160         t.eq(node.getAttributeNS(null, 'r'), '3', "r is correct"); 
     158        t.eq(node.getAttributeNS(null, 'cx'), '', "cx is correct"); 
     159        t.eq(node.getAttributeNS(null, 'cy'), '', "cy is correct"); 
     160        t.eq(node.getAttributeNS(null, 'r'), '0', "r is correct"); 
    161161    } 
    162162