Releases: ianmackenzie/elm-geometry-svg
3.0.0
This version brings elm-geometry-svg
up to date with elm-geometry
3.0, and relaxes the restriction that input geometry must be in Pixels
. It is often useful to create SVG elements using real-world units, and then later on apply a scaling factor to convert to pixels for final display (see #14 for some related discussion - thanks @MartinSStewart!).
Rendering with different units types is now possible with the elm-geometry-svg
API, although with the side effect that you now have to be a bit more careful to make sure the units work out correctly - since as soon as you convert from (for example) a Circle2d Meters WorldCoordinates
to a plain Svg Msg
value, you lose compile-time checking of units and coordinate systems.
Also note that regardless of whether you use meters, centimeters, feet or some other Length
unit to construct your geometry, the actual SVG coordinate values generated will always be in meters; for example, a Point2d.feet 1 2
might end up getting written out to SVG as the coordinates "0.3048,0.6096"
since 1 foot is 0.3048 meters. However, in most cases you should be able to use the new Svg.at
and Svg.at_
functions to explicitly apply a conversion factor from whatever units you want (centimeters, inches etc.) to pixels; see the API documentation for details.
2.0.0
elm-geometry-svg
2.0.0 is out! The breaking change is that elm-geometry-svg
is now based on elm-geometry
2.0 (with units and coordinate systems support). In addition, this release adds Svg.rectangle2d
for proper rectangle drawing.
1.0.0
elm-geometry-svg
1.0 is out! This replaces opensolid/svg
, although with a slightly narrower focus. The high-level point2d
, vector2d
, direction2d
, text2d
and render2d
functions have been removed, leaving only the functions where the translation to SVG elements is fairly direct, obvious and unambiguous:
- Geometry drawing functions such as
lineSegment2d
andcubicSpline2d
- Transformation functions such as
rotateAround
andmirrorAcross
If you do need to use the old text2d
, vector2d
, render2d
etc. functions, you can copy/adapt the opensolid/svg
implementations into your own code. Any questions, please send me (@ianmackenzie) a message in the Elm Slack!