[OpenLayers-Trac] Re: [OpenLayers] #2985: Ctrl-Click or Shift-Click on a SVG-feature with named graphic opens new window because of <use>/<def> and the href-attribute

OpenLayers trac-20090302 at openlayers.org
Tue Dec 21 18:30:07 EST 2010


#2985: Ctrl-Click or Shift-Click on a SVG-feature with named graphic opens new
window because of <use>/<def> and the href-attribute
--------------------------+-------------------------------------------------
 Reporter:  marcjansen    |       Owner:  ahocevar       
     Type:  bug           |      Status:  new            
 Priority:  minor         |   Milestone:  2.11 Release   
Component:  Renderer.SVG  |     Version:  2.10           
 Keywords:                |       State:  Needs More Work
--------------------------+-------------------------------------------------
Changes (by ahocevar):

  * state:  Review => Needs More Work


Comment:

 marcjansen: the notice you are seeing in firebug comes from a typo in
 SVG.js (style.rotation instead of rotation), and there is another block in
 there that can be removed. See this diff which fixes both:
 {{{
 Index: lib/OpenLayers/Renderer/SVG.js
 ===================================================================
 --- lib/OpenLayers/Renderer/SVG.js      (revision 10975)
 +++ lib/OpenLayers/Renderer/SVG.js      (working copy)
 @@ -337,16 +331,10 @@
              if ((rotation !== undefined || node._rotation !== undefined)
 && pos) {
                  node._rotation = rotation;
                  rotation |= 0;
 -                if(node.nodeName !== "svg") {
 -                    node.setAttributeNS(null, "transform",
 -                        "rotate(" + rotation + " " + pos.x + " " +
 -                        pos.y + ")");
 -                } else {
 -                     var metrics = this.symbolMetrics[id];
 -                     node.firstChild.setAttributeNS(null, "transform",
 -                     "rotate(" + style.rotation + " " + metrics[1] +
 -                         " " +  metrics[2] + ")");
 -                }
 +                var metrics = this.symbolMetrics[id];
 +                node.firstChild.setAttributeNS(null, "transform",
 +                "rotate(" + rotation + " " + metrics[1] +
 +                    " " +  metrics[2] + ")");
              }
          }

 }}}

 Regarding the examples: you added anchor and mining symbols, but commented
 them out with a note about incompatibility with Chrome 8. What is the
 issue here? And after fixing the above typo, it won't be necessary to add
 a rotation property to the default style.

 For the tests: we don't really require unit tests here, but what you could
 do if you want to add tests is find the dom element that represents a
 graphicName point and compare its coordinates and position with your
 expected ones. The best test for this part of the rendering engine is an
 acceptance test using the graphic-name.html example.

 Another minor remark: you can remove the no longer needed tests from the
 test case entirely, instead of commenting them out. And instead of the
 comment around line 300 ("workaround for webkit..."), you could just state
 that the more appropriate way to implement this would be use/defs, but due
 to various issues in several browsers, it is safer to copy the symbols
 instead of referencing them.

 If you can fix the rotation part and my remarks, and explain what the
 issue with the anchor symbol is, then this patch is good to be committed.
 Again, thanks for your efforts!

-- 
Ticket URL: <http://trac.openlayers.org/ticket/2985#comment:2>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list