Don't flip SVG Y values anymore, since we're working in pixel space these days,

and the Y transforms just make working with the SVG directly -- for example,
with people modifying it to support text -- more difficult than it should be.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@5430 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-12-15 16:24:31 +00:00
parent fb3c02354f
commit 45c420782c
2 changed files with 7 additions and 14 deletions

View File

@@ -215,11 +215,10 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
var opacity = style.graphicOpacity || style.fillOpacity;
node.setAttributeNS(null, "x", (x + xOffset).toFixed());
node.setAttributeNS(null, "y", (-y + yOffset).toFixed());
node.setAttributeNS(null, "y", (y + yOffset).toFixed());
node.setAttributeNS(null, "width", width);
node.setAttributeNS(null, "height", height);
node.setAttributeNS("http://www.w3.org/1999/xlink", "href", style.externalGraphic);
node.setAttributeNS(null, "transform", "scale(1,-1)");
node.setAttributeNS(null, "style", "opacity: "+opacity);
} else {
node.setAttributeNS(null, "r", style.pointRadius);
@@ -304,13 +303,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
*/
createRoot: function() {
var id = this.container.id + "_root";
var root = this.nodeFactory(id, "g");
// flip the SVG display Y axis upside down so it
// matches the display Y axis of the map
root.setAttributeNS(null, "transform", "scale(1, -1)");
return root;
},
@@ -344,7 +337,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
drawCircle: function(node, geometry, radius) {
var resolution = this.getResolution();
var x = (geometry.x / resolution + this.left);
var y = (geometry.y / resolution - this.top);
var y = (this.top - geometry.y / resolution);
if (this.inValidRange(x, y)) {
node.setAttributeNS(null, "cx", x);
@@ -423,7 +416,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
drawRectangle: function(node, geometry) {
var resolution = this.getResolution();
var x = (geometry.x / resolution + this.left);
var y = (geometry.y / resolution - this.top);
var y = (this.top - geometry.y / resolution);
if (this.inValidRange(x, y)) {
node.setAttributeNS(null, "x", x);
@@ -504,7 +497,7 @@ OpenLayers.Renderer.SVG = OpenLayers.Class(OpenLayers.Renderer.Elements, {
getShortString: function(point) {
var resolution = this.getResolution();
var x = (point.x / resolution + this.left);
var y = (point.y / resolution - this.top);
var y = (this.top - point.y / resolution);
if (this.inValidRange(x, y)) {
return x + "," + y;