ivanceras / svgbob

Convert your ascii diagram scribbles into happy little SVG
http://ivanceras.github.io/svgbob-editor/
Apache License 2.0
3.88k stars 109 forks source link

Arrowheads on dashed lines are rendered wrong by Safari #69

Closed dtolnay closed 3 years ago

dtolnay commented 3 years ago

As of current master:

$ cargo build
$ echo ' <~~~~~~~~~~~~~~>' | target/debug/svgbob > test.svg

It looks okay in Chrome and Firefox, but Safari does this:

Screen Shot 2020-12-06 at 12 27 40 PM

It would be good to avoid marker-start/marker-end and instead use a polygon class="filled" to position and draw the arrowheads.

ivanceras commented 3 years ago

Initially, I wanted the start-marker and end-marker since it creates a coherent drawing element in a sense that if you further enhance the resulting svg in an svg editor such as inkscape, the user can freely manipulate the lines, such as rotating the lines, dragging one of the endpoints. Rendering these arrow heads as polygon may simplify the algorithms in the code, but also losses the nice features of creating a more coherent output.

Might be a good alternative to do it, to keep a consistent look across browsers. This could also be implemented as a flag in the Settings.

ivanceras commented 3 years ago

This commit adds a parameter in the Settings to specify whether or not Arrow heads will merge with lines. The default value is false, hence the arrow heads will be rendered as polygons instead of a marker to a line. A published version 0.5.0 of the crate have this change.