Copyright | (c) 2011 diagrams-lib team (see LICENSE) |
---|---|

License | BSD-style (see LICENSE) |

Maintainer | diagrams-discuss@googlegroups.com |

Safe Haskell | None |

Language | Haskell2010 |

Alignment combinators specialized for two dimensions. See Diagrams.Align for more general alignment combinators.

The basic idea is that alignment is achieved by moving diagrams'
local origins relative to their envelopes or traces (or some other
sort of boundary). For example, to align several diagrams along
their tops, we first move their local origins to the upper edge of
their boundary (using e.g. `map `

), and then put them
together with their local origins along a horizontal line (using
e.g. `alignTop`

`hcat`

from Diagrams.TwoD.Combinators).

- alignL :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
- alignR :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
- alignT :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
- alignB :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
- alignTL :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
- alignTR :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
- alignBL :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
- alignBR :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
- snugL :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
- snugR :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
- snugT :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
- snugB :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
- snugTL :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
- snugTR :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
- snugBL :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
- snugBR :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
- alignX :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a
- snugX :: (InSpace v n a, R1 v, Fractional n, Alignable a, Traced a, HasOrigin a) => n -> a -> a
- alignY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a
- snugY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => n -> a -> a
- centerX :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => a -> a
- centerY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a
- centerXY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a
- snugCenterX :: (InSpace v n a, R1 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
- snugCenterY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
- snugCenterXY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a

# Absolute alignment

## Align by envelope

alignL :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a Source #

Align along the left edge, i.e. translate the diagram in a horizontal direction so that the local origin is on the left edge of the envelope.

alignR :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a Source #

Align along the right edge.

alignT :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a Source #

Align along the top edge.

alignB :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a Source #

Align along the bottom edge.

## Align by trace

# Relative alignment

alignX :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a Source #

`alignX`

and `snugX`

move the local origin horizontally as follows:

`alignX (-1)`

moves the local origin to the left edge of the boundary;`align 1`

moves the local origin to the right edge;- any other argument interpolates linearly between these. For
example,
`alignX 0`

centers,`alignX 2`

moves the origin one "radius" to the right of the right edge, and so on. `snugX`

works the same way.

snugX :: (InSpace v n a, R1 v, Fractional n, Alignable a, Traced a, HasOrigin a) => n -> a -> a Source #

See the documentation for `alignX`

.

alignY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a Source #

Like `alignX`

, but moving the local origin vertically, with an
argument of `1`

corresponding to the top edge and `(-1)`

corresponding
to the bottom edge.

snugY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => n -> a -> a Source #

See the documentation for `alignY`

.

# Centering

centerX :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => a -> a Source #

Center the local origin along the X-axis.

centerY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a Source #

Center the local origin along the Y-axis.

centerXY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a Source #

Center along both the X- and Y-axes.

snugCenterX :: (InSpace v n a, R1 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a Source #

snugCenterY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a Source #

snugCenterXY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a Source #