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 :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- alignR :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- alignT :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- alignB :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- alignTL :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- alignTR :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- alignBL :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- alignBR :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- snugL :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
- snugR :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
- snugT :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
- snugB :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
- snugTL :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
- snugTR :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
- snugBL :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
- snugBR :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
- alignX :: (Alignable a, HasOrigin a, V a ~ R2) => Double -> a -> a
- snugX :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => Double -> a -> a
- alignY :: (Alignable a, HasOrigin a, V a ~ R2) => Double -> a -> a
- snugY :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => Double -> a -> a
- centerX :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- centerY :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- centerXY :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
- snugCenterX :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
- snugCenterY :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
- snugCenterXY :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a
Absolute alignment
Align by envelope
alignL :: (Alignable a, HasOrigin a, V a ~ R2) => 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.
Align by trace
snugTL :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a Source
snugTR :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a Source
snugBL :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a Source
snugBR :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a Source
Relative alignment
alignX :: (Alignable a, HasOrigin a, V a ~ R2) => Double -> 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 :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => Double -> a -> a Source
See the documentation for alignX
.
alignY :: (Alignable a, HasOrigin a, V a ~ R2) => Double -> 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 :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => Double -> a -> a Source
Centering
centerX :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a Source
Center the local origin along the X-axis.
centerY :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a Source
Center the local origin along the Y-axis.
centerXY :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a Source
Center along both the X- and Y-axes.
snugCenterX :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a Source
snugCenterY :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a Source
snugCenterXY :: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2) => a -> a Source