How to draw non-scalable circle in SVG with Javascript

后端 未结 4 1811
星月不相逢
星月不相逢 2020-12-16 20:51

I\'m developing a map, in Javascript using SVG to draw the lines.

I would like to add a feature where you can search for a road, and if the road is found, a circle a

4条回答
  •  天涯浪人
    2020-12-16 20:57

    If you are looking for a fully static way of doing this, you might be able to combine non-scaling-stroke with markers to get this, since the markers can be relative to the stroke-width.

    In other words, you could wrap the circles in a element and then use those markers where you need them.

    
        
          
        
            
            
    
    

    The same can also be viewed and tweaked here. The svg spec isn't fully explicit about what should happen in this case (since markers are not in SVG Tiny 1.2, and vector-effect isn't in SVG 1.1). My current line of thinking was that it should probably affect the size of the marker, but it seems no viewers do that at the moment (try in a viewer that supports vector-effect, e.g Opera or Chrome).

提交回复
热议问题