Skip to content

Commit 66bf1a2

Browse files
committed
small doc phrasing changes
1 parent 1687e90 commit 66bf1a2

File tree

2 files changed

+28
-23
lines changed

2 files changed

+28
-23
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# One True Path
22

3-
A general-purpose library for working with paths.
3+
A general-purpose library for working with curves and paths.
44

5-
The primary aim at the moment is SVG paths, but the types and functions in this package can also be
5+
The primary aim is SVG paths, but the types and functions in this package can also be
66
used for animations or other graphics backends (webgl, canvas).
77

8+
Additionally, this package is meant to serve as an interchange format between packages.
9+
810
## Core Concepts
911

1012
* **Path:** A list of subpaths
@@ -105,8 +107,7 @@ Path.parse pathAsString
105107

106108
The `Segment` module breaks down a line into four basic segment types, and exposes some mathematical functions (and the constructors, if you want to define your own fancy stuff).
107109

108-
The `LowLevel` module has that name for a reason. Unless you are making your own primitives, there is probably a better way.
109-
If there isn't but you think there should be, please open an issue.
110+
The `LowLevel.Command` module contains individual instructions. These should only be used for building other primitives! Making and combining curves should happen on the SubPath level.
110111

111112
## What about styling
112113

src/LowLevel/Command.elm

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ module LowLevel.Command
2929
, merge
3030
)
3131

32-
{-| Low-level access to absolute svg drawing commands.
32+
{-| Low-level access to drawing instructions.
3333
34-
As the name implies, this is a low-level module that you probably shouldn't deal with.
34+
This is a low-level module that you probably shouldn't deal with.
35+
These instructions are meant to build up primitives (like in the `Curve` module); building of
36+
curves should happen at the `SubPath` level.
3537
3638
3739
## Threading State
@@ -121,10 +123,12 @@ type DrawTo
121123
{ start = ( 0, 42 )
122124
, end = ( 42, 0 )
123125
, radii = ( 1, 1 )
124-
, xAxisRotate = 0
126+
, xAxisRotate = 90
125127
, arcFlag = largestArc
126128
, direction = clockwise
127129
}
130+
131+
The xAxisRotate parameter is in degrees (note that in the `Segment` module, it is in radians).
128132
-}
129133
type alias EllipticalArcArgument =
130134
{ radii : ( Float, Float )
@@ -351,15 +355,15 @@ fromLowLevelDrawTo drawto ({ start, cursor } as state) =
351355
LowLevel.SmoothCurveTo mode coordinates ->
352356
-- (If there is no previous command or if the previous command was not an C, c, S or s,
353357
-- assume the first control point is coincident with the current point.)
354-
coordinates
355-
|> coordinatesToAbsolute mode (Vec2.map (Vec2.add cursor))
356-
|> Maybe.map (makeControlPointExplicitVec2 state << Tuple.second)
357-
|> Maybe.map
358-
(\( finalState, finalPoints ) ->
359-
( CurveTo finalPoints
360-
, finalState
361-
)
358+
let
359+
updateState ( finalState, finalPoints ) =
360+
( CurveTo finalPoints
361+
, finalState
362362
)
363+
in
364+
coordinates
365+
|> coordinatesToAbsolute mode (Vec2.map (Vec2.add cursor))
366+
|> Maybe.map (updateState << makeControlPointExplicitVec2 state << Tuple.second)
363367

364368
LowLevel.QuadraticBezierCurveTo mode coordinates ->
365369
let
@@ -373,15 +377,15 @@ fromLowLevelDrawTo drawto ({ start, cursor } as state) =
373377
|> Maybe.map updateState
374378

375379
LowLevel.SmoothQuadraticBezierCurveTo mode coordinates ->
376-
coordinates
377-
|> coordinatesToAbsolute mode (Vec2.add cursor)
378-
|> Maybe.map (makeControlPointExplicitVec1 state << Tuple.second)
379-
|> Maybe.map
380-
(\( finalState, finalPoints ) ->
381-
( QuadraticBezierCurveTo finalPoints
382-
, finalState
383-
)
380+
let
381+
updateState ( finalState, finalPoints ) =
382+
( QuadraticBezierCurveTo finalPoints
383+
, finalState
384384
)
385+
in
386+
coordinates
387+
|> coordinatesToAbsolute mode (Vec2.add cursor)
388+
|> Maybe.map (updateState << makeControlPointExplicitVec1 state << Tuple.second)
385389

386390
LowLevel.EllipticalArc mode arguments ->
387391
let

0 commit comments

Comments
 (0)