OpenLayers OpenLayers

Changeset 5826

Show
Ignore:
Timestamp:
01/20/08 15:11:38 (1 year ago)
Author:
crschmidt
Message:

Don't let the SVG renderer bail if the node we are trying to add is out of
bounds *and* not yet added to the map. r=pagameba (Closes #1274)

Files:

Legend:

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

    r5614 r5826  
    337337            node.setAttributeNS(null, "r", radius); 
    338338        } else { 
    339             this.root.removeChild(node); 
     339            if (node.parentNode == this.root) { 
     340                this.root.removeChild(node); 
     341            } 
    340342        }     
    341343             
  • trunk/openlayers/tests/Renderer/test_SVG.html

    r5430 r5826  
    128128        } 
    129129         
    130         t.plan(3); 
     130        t.plan(6); 
    131131         
    132132        var r = new OpenLayers.Renderer.SVG(document.body); 
     
    143143         
    144144        r.drawCircle(node, geometry, 3); 
     145         
     146        t.eq(node.getAttributeNS(null, 'cx'), '2', "cx is correct"); 
     147        t.eq(node.getAttributeNS(null, 'cy'), '-4', "cy is correct"); 
     148        t.eq(node.getAttributeNS(null, 'r'), '3', "r is correct"); 
     149        
     150        // #1274: out of bound node fails when first added 
     151        var geometry = { 
     152            x: 10000000, 
     153            y: 200000000 
     154        } 
     155         
     156        r.drawCircle(node, geometry, "blah_4000"); 
    145157         
    146158        t.eq(node.getAttributeNS(null, 'cx'), '2', "cx is correct");