| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Reflex.Dom.Widget.SVG.Types.SVG_Path
Description
Types and functions for constructing type-safe SVG <path> properties.
Synopsis
- data PathCommandType
- data PathCommand = PathComm PathCommandType PathCommandRelativity
- data PathCommandRelativity
- newtype SVG_Path = D (NonEmpty PathCommand)
- newtype P = P (Pos X, Pos Y)
- _SmthQuadBez :: Prism' PathCommandType P
- _QuadBez :: Prism' PathCommandType (P, P)
- _SmthCubicBez :: Prism' PathCommandType (P, P)
- _CubicBez :: Prism' PathCommandType (P, P, P)
- _MoveTo :: Prism' PathCommandType P
- _LineTo :: Prism' PathCommandType P
- _Horizontal :: Prism' PathCommandType (Pos X)
- _Vertical :: Prism' PathCommandType (Pos Y)
- _ClosePath :: Prism' PathCommandType ()
- _PathComm :: Prism' PathCommand (PathCommandType, PathCommandRelativity)
- _m :: Pos X -> Pos Y -> PathCommand
- _M :: Pos X -> Pos Y -> PathCommand
- _l :: Pos X -> Pos Y -> PathCommand
- _L :: Pos X -> Pos Y -> PathCommand
- _h :: Pos X -> PathCommand
- _H :: Pos X -> PathCommand
- _v :: Pos Y -> PathCommand
- _V :: Pos Y -> PathCommand
- _z :: PathCommand
- _Z :: PathCommand
- makePathProps :: SVG_Path -> Map Text Text
- pathCommandToText :: PathCommand -> Text
Documentation
data PathCommandType Source #
These are the commands to be used when building the d attribute for an SVG path element.
Constructors
| MoveTo P | Pick up and move the drawing instrument to another position |
| LineTo P | Draw a straight line |
| Horizontal (Pos X) | Straight horizontal line |
| Vertical (Pos Y) | Straight vertical line |
| SmthQuadBez P | Smooth Quadratic Bezier Curve |
| QuadBez P P | Quadratic Bezier Curve using the given control points |
| SmthCubicBez P P | Smooth Cubic Bezier Curve with control points at the end |
| CubicBez P P P | Cubic Bezier Curve with beginning and end control points |
| ClosePath | Draw a straight line from the current position to the first point in the path. |
Instances
| Eq PathCommandType Source # | |
Defined in Reflex.Dom.Widget.SVG.Types.SVG_Path Methods (==) :: PathCommandType -> PathCommandType -> Bool # (/=) :: PathCommandType -> PathCommandType -> Bool # | |
| Show PathCommandType Source # | |
Defined in Reflex.Dom.Widget.SVG.Types.SVG_Path Methods showsPrec :: Int -> PathCommandType -> ShowS # show :: PathCommandType -> String # showList :: [PathCommandType] -> ShowS # | |
data PathCommand Source #
To be able to describe a path command, we need to know the command you would like to use (and its inputs). As well as whether or not you're issuing a relative command, or an absolute one.
Constructors
| PathComm PathCommandType PathCommandRelativity |
Instances
| Eq PathCommand Source # | |
Defined in Reflex.Dom.Widget.SVG.Types.SVG_Path | |
| Show PathCommand Source # | |
Defined in Reflex.Dom.Widget.SVG.Types.SVG_Path Methods showsPrec :: Int -> PathCommand -> ShowS # show :: PathCommand -> String # showList :: [PathCommand] -> ShowS # | |
data PathCommandRelativity Source #
Indicates if a given command is expected to distances from the current position or be set coordinates. See the documentation for more.
Constructors
| Relative | Input are considered distances relative to the current position |
| Absolute | Input is considered to be an absolute position |
Instances
| Eq PathCommandRelativity Source # | |
Defined in Reflex.Dom.Widget.SVG.Types.SVG_Path Methods (==) :: PathCommandRelativity -> PathCommandRelativity -> Bool # (/=) :: PathCommandRelativity -> PathCommandRelativity -> Bool # | |
| Show PathCommandRelativity Source # | |
Defined in Reflex.Dom.Widget.SVG.Types.SVG_Path Methods showsPrec :: Int -> PathCommandRelativity -> ShowS # show :: PathCommandRelativity -> String # showList :: [PathCommandRelativity] -> ShowS # | |
A wrapper for a list of commands to describe a SVG path. An empty list of
commands doesn't make sense, so you have to construct a NonEmpty list.
Constructors
| D (NonEmpty PathCommand) |
For a bit of brevity we wrap a combined X,Y position in a tuple tucked in a newtype.
_SmthQuadBez :: Prism' PathCommandType P Source #
Prism for a Smooth Quadradic Bezier Curve [MDN]
_SmthCubicBez :: Prism' PathCommandType (P, P) Source #
Prism for a Smooth Cubic Bezier Curve [MDN]
_Horizontal :: Prism' PathCommandType (Pos X) Source #
Prism for the 'H/h' command [MDN]
_ClosePath :: Prism' PathCommandType () Source #
Prism for the 'Z/z' command [MDN]
_PathComm :: Prism' PathCommand (PathCommandType, PathCommandRelativity) Source #
Prism for the PathCommand that encompasses the command and it's relativity.
_m :: Pos X -> Pos Y -> PathCommand Source #
These are some short-hand functions to help in the construction of a
PathCommand. Named to match their respective SVG equivalent.
_M :: Pos X -> Pos Y -> PathCommand Source #
These are some short-hand functions to help in the construction of a
PathCommand. Named to match their respective SVG equivalent.
_l :: Pos X -> Pos Y -> PathCommand Source #
These are some short-hand functions to help in the construction of a
PathCommand. Named to match their respective SVG equivalent.
_L :: Pos X -> Pos Y -> PathCommand Source #
These are some short-hand functions to help in the construction of a
PathCommand. Named to match their respective SVG equivalent.
_h :: Pos X -> PathCommand Source #
These are some short-hand functions to help in the construction of a
PathCommand. Named to match their respective SVG equivalent.
_H :: Pos X -> PathCommand Source #
These are some short-hand functions to help in the construction of a
PathCommand. Named to match their respective SVG equivalent.
_v :: Pos Y -> PathCommand Source #
These are some short-hand functions to help in the construction of a
PathCommand. Named to match their respective SVG equivalent.
_V :: Pos Y -> PathCommand Source #
These are some short-hand functions to help in the construction of a
PathCommand. Named to match their respective SVG equivalent.
_z :: PathCommand Source #
These are some short-hand functions to help in the construction of a
PathCommand. Named to match their respective SVG equivalent.
_Z :: PathCommand Source #
These are some short-hand functions to help in the construction of a
PathCommand. Named to match their respective SVG equivalent.
makePathProps :: SVG_Path -> Map Text Text Source #
Convert a SVG_Path to a Map Text Text that includes the correctly formatted d attribute.
pathCommandToText :: PathCommand -> Text Source #
Take a given PathCommand and produce a Text that is intended for a d
attribute of a <path> element.