vishalaksh
vishalaksh

Reputation: 2154

How to draw a marker in middle of path?

I have a path (which is essentially a line). I am able to draw an arrowhead with the help of marker-end attribute of path. But now I want to make a + sign in the middle of the path. I think for that purpose, marker-mid should be used.

Here is the code and output when I use marker-end. enter image description here

Here is the code and output when I use marker-mid. enter image description here

Upvotes: 2

Views: 731

Answers (1)

Paul LeBeau
Paul LeBeau

Reputation: 101868

marker-mid specifies the marker type that should be placed for the points in a path that are not the first or last point.

In other words, if you have a path that consists of four points (thus three lines), marker-mid markers will be placed on the middle two points.

There is currently no way to automatically place markers in the middle of a line segment as you wish. You would need to either place an appropriate shape at that point yourself, or split the line into two half-lines.

SVG 2, which is still in development, will likely have this feature, but you can't do it yet.

Upvotes: 1

Related Questions