Ticket #1398: squarepoint-r6376.patch
| File squarepoint-r6376.patch, 1.7 kB (added by achipa, 6 months ago) |
|---|
-
lib/OpenLayers/Renderer/SVG.js
old new 154 154 switch (geometry.CLASS_NAME) { 155 155 case "OpenLayers.Geometry.Point": 156 156 nodeType = style.externalGraphic ? "image" : "circle"; 157 if (nodeType == "circle" && style.pointStyle == "square") nodeType = "rect"; 157 158 break; 158 159 case "OpenLayers.Geometry.Rectangle": 159 160 nodeType = "rect"; … … 219 220 node.setAttributeNS(null, "style", "opacity: "+opacity); 220 221 } else { 221 222 node.setAttributeNS(null, "r", style.pointRadius); 223 if (style.pointStyle == "square"){ 224 node.setAttributeNS(null, "pointStyle", "square"); 225 } 222 226 } 223 227 } 224 228 … … 315 319 * geometry - {<OpenLayers.Geometry>} 316 320 */ 317 321 drawPoint: function(node, geometry) { 318 this.drawCircle(node, geometry, 1); 322 if (node._style.pointStyle == "square") { 323 var size = node._style.pointRadius * this.getResolution(); 324 this.drawRectangle(node, {x: (geometry.x - size/2), y: (geometry.y + size/2), width: size, height: size}) 325 } else { 326 this.drawCircle(node, geometry, 1); 327 } 319 328 }, 320 329 321 330 /** … … 414 423 var resolution = this.getResolution(); 415 424 var x = (geometry.x / resolution + this.left); 416 425 var y = (this.top - geometry.y / resolution); 417 418 426 if (this.inValidRange(x, y)) { 419 427 node.setAttributeNS(null, "x", x); 420 428 node.setAttributeNS(null, "y", y);
