Changeset 5430
- Timestamp:
- 12/15/07 11:24:31 (1 year ago)
- Files:
-
- trunk/openlayers/lib/OpenLayers/Renderer/SVG.js (modified) (5 diffs)
- trunk/openlayers/tests/Renderer/test_SVG.html (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/lib/OpenLayers/Renderer/SVG.js
r5373 r5430 216 216 217 217 node.setAttributeNS(null, "x", (x + xOffset).toFixed()); 218 node.setAttributeNS(null, "y", ( -y + yOffset).toFixed());218 node.setAttributeNS(null, "y", (y + yOffset).toFixed()); 219 219 node.setAttributeNS(null, "width", width); 220 220 node.setAttributeNS(null, "height", height); 221 221 node.setAttributeNS("http://www.w3.org/1999/xlink", "href", style.externalGraphic); 222 node.setAttributeNS(null, "transform", "scale(1,-1)");223 222 node.setAttributeNS(null, "style", "opacity: "+opacity); 224 223 } else { … … 305 304 createRoot: function() { 306 305 var id = this.container.id + "_root"; 307 308 306 var root = this.nodeFactory(id, "g"); 309 310 // flip the SVG display Y axis upside down so it311 // matches the display Y axis of the map312 root.setAttributeNS(null, "transform", "scale(1, -1)");313 314 307 return root; 315 308 }, … … 345 338 var resolution = this.getResolution(); 346 339 var x = (geometry.x / resolution + this.left); 347 var y = ( geometry.y / resolution - this.top);340 var y = (this.top - geometry.y / resolution); 348 341 349 342 if (this.inValidRange(x, y)) { … … 424 417 var resolution = this.getResolution(); 425 418 var x = (geometry.x / resolution + this.left); 426 var y = ( geometry.y / resolution - this.top);419 var y = (this.top - geometry.y / resolution); 427 420 428 421 if (this.inValidRange(x, y)) { … … 505 498 var resolution = this.getResolution(); 506 499 var x = (point.x / resolution + this.left); 507 var y = ( point.y / resolution - this.top);500 var y = (this.top - point.y / resolution); 508 501 509 502 if (this.inValidRange(x, y)) { trunk/openlayers/tests/Renderer/test_SVG.html
r5340 r5430 145 145 146 146 t.eq(node.getAttributeNS(null, 'cx'), '2', "cx is correct"); 147 t.eq(node.getAttributeNS(null, 'cy'), ' 4', "cy is correct");147 t.eq(node.getAttributeNS(null, 'cy'), '-4', "cy is correct"); 148 148 t.eq(node.getAttributeNS(null, 'r'), '3', "r is correct"); 149 149 } … … 272 272 273 273 t.eq(node.getAttributeNS(null, "x"), "2", "x attribute is correctly set"); 274 t.eq(node.getAttributeNS(null, "y"), " 4", "y attribute is correctly set");274 t.eq(node.getAttributeNS(null, "y"), "-4", "y attribute is correctly set"); 275 275 t.eq(node.getAttributeNS(null, "width"), "6", "width attribute is correctly set"); 276 276 t.eq(node.getAttributeNS(null, "height"), "8", "height attribute is correctly set"); … … 356 356 357 357 var string = r.getShortString(point); 358 t.eq(string, "2, 4", "returned string is correct");358 t.eq(string, "2,-4", "returned string is correct"); 359 359 } 360 360
