Skip to content

3.0.0

Latest
Compare
Choose a tag to compare
@ianmackenzie ianmackenzie released this 27 Nov 20:01

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.