OpenLayers OpenLayers

Ticket #968: vml.patch

File vml.patch, 2.8 kB (added by crschmidt, 1 year ago)
  • VML.js

    old new  
    258258    setNodeDimension: function(node, geometry) { 
    259259 
    260260        var bbox = geometry.getBounds(); 
    261  
    262         var resolution = this.getResolution(); 
     261        if(bbox) { 
     262            var resolution = this.getResolution(); 
     263         
     264            var scaledBox =  
     265                new OpenLayers.Bounds((bbox.left/resolution).toFixed(), 
     266                                      (bbox.bottom/resolution).toFixed(), 
     267                                      (bbox.right/resolution).toFixed(), 
     268                                      (bbox.top/resolution).toFixed()); 
     269             
     270            // Set the internal coordinate system to draw the path 
     271            node.style.left = scaledBox.left; 
     272            node.style.top = scaledBox.top; 
     273            node.style.width = scaledBox.getWidth(); 
     274            node.style.height = scaledBox.getHeight(); 
    263275     
    264         var scaledBox =  
    265             new OpenLayers.Bounds((bbox.left/resolution).toFixed(), 
    266                                   (bbox.bottom/resolution).toFixed(), 
    267                                   (bbox.right/resolution).toFixed(), 
    268                                   (bbox.top/resolution).toFixed()); 
    269          
    270         // Set the internal coordinate system to draw the path 
    271         node.style.left = scaledBox.left; 
    272         node.style.top = scaledBox.top; 
    273         node.style.width = scaledBox.getWidth(); 
    274         node.style.height = scaledBox.getHeight(); 
    275  
    276         node.coordorigin = scaledBox.left + " " + scaledBox.top; 
    277         node.coordsize = scaledBox.getWidth()+ " " + scaledBox.getHeight(); 
     276            node.coordorigin = scaledBox.left + " " + scaledBox.top; 
     277            node.coordsize = scaledBox.getWidth()+ " " + scaledBox.getHeight(); 
     278        } 
    278279    }, 
    279280 
    280281    /** 
     
    381382     * radius - {float} 
    382383     */ 
    383384    drawCircle: function(node, geometry, radius) { 
    384  
    385         var resolution = this.getResolution(); 
     385        if(!isNaN(geometry.x)&& !isNaN(geometry.y)) { 
     386            var resolution = this.getResolution(); 
     387         
     388            node.style.left = (geometry.x /resolution).toFixed() - radius; 
     389            node.style.top = (geometry.y /resolution).toFixed() - radius; 
    386390     
    387         node.style.left = (geometry.x /resolution).toFixed() - radius; 
    388         node.style.top = (geometry.y /resolution).toFixed() - radius; 
    389  
    390         var diameter = radius * 2; 
    391          
    392         node.style.width = diameter; 
    393         node.style.height = diameter; 
     391            var diameter = radius * 2; 
     392             
     393            node.style.width = diameter; 
     394            node.style.height = diameter; 
     395        } 
    394396    }, 
    395397 
    396398