ajstarks / svgo

Go Language Library for SVG generation
Other
2.14k stars 169 forks source link

Defining marker orientation #51

Closed DavidGamba closed 4 years ago

DavidGamba commented 4 years ago

Is there a way to define marker orientation? The Marker method only takes in style.

ajstarks commented 4 years ago

you can:

1) apply the needed transformations on the elements that make up the marker

        canvas.Marker("arrow", 2, 6, 13, 13)
    canvas.Path("M2,2 L2,11 L10,6 L2,2", `fill="blue"`,  `transform="rotate(-30)"`)
    canvas.MarkerEnd()
    canvas.DefEnd()

2) or apply the transformation when defining the marker:

        canvas.Marker("arrow", 2, 6, 13, 13)
    canvas.Rotate(-20)
    canvas.Path("M2,2 L2,11 L10,6 L2,2", `fill="blue"`)
    canvas.MarkerEnd()
    canvas.Gend()
    canvas.DefEnd()
DavidGamba commented 4 years ago

So orient=auto is not supported. Is that correct? By the way I love your library (was going to give you a shout out on twitter), it is amazing how complete and well done it is.

ajstarks commented 4 years ago

Ah I see. Note that you can add this:

canvas.Marker(..... , `orient="auto"`)

This "escape hatch" is common to most methods.
Many thanks for the kind words (A twitter shout out would be nice).

DavidGamba commented 4 years ago

That did it, thanks so much!