module Diagrams.TwoD.Align
(
alignL, alignR, alignT, alignB
, alignTL, alignTR, alignBL, alignBR
, snugL, snugR, snugT, snugB
, snugTL, snugTR, snugBL, snugBR
, alignX, snugX, alignY, snugY
, centerX, centerY, centerXY
, snugCenterX, snugCenterY, snugCenterXY
) where
import Diagrams.Core
import Diagrams.Align
import Diagrams.TwoD.Types
import Diagrams.TwoD.Vector
import Data.VectorSpace
alignL :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
alignL = align (negateV unitX)
snugL :: (Fractional (Scalar (V a)), Alignable a, Traced a,
HasOrigin a, V a ~ R2) => a -> a
snugL = snug (negateV unitX)
alignR :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
alignR = align unitX
snugR :: (Fractional (Scalar (V a)), Alignable a, Traced a,
HasOrigin a, V a ~ R2) => a -> a
snugR = snug unitX
alignT :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
alignT = align unitY
snugT:: (Fractional (Scalar (V a)), Alignable a, Traced a,
HasOrigin a, V a ~ R2) => a -> a
snugT = snug unitY
alignB :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
alignB = align (negateV unitY)
snugB :: (Fractional (Scalar (V a)), Alignable a, Traced a,
HasOrigin a, V a ~ R2) => a -> a
snugB = snug (negateV unitY)
alignTL, alignTR, alignBL, alignBR :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
alignTL = alignT . alignL
alignTR = alignT . alignR
alignBL = alignB . alignL
alignBR = alignB . alignR
snugTL, snugTR, snugBL, snugBR
:: (Fractional (Scalar (V a)), Alignable a, Traced a, HasOrigin a, V a ~ R2)
=> a -> a
snugTL = snugT . snugL
snugTR = snugT . snugR
snugBL = snugB . snugL
snugBR = snugB . snugR
alignX :: (Alignable a, HasOrigin a, V a ~ R2) => Double -> a -> a
alignX = alignBy unitX
snugX :: (Fractional (Scalar (V a)), Alignable a, Traced a,
HasOrigin a, V a ~ R2) => Double -> a -> a
snugX = snugBy unitX
alignY :: (Alignable a, HasOrigin a, V a ~ R2) => Double -> a -> a
alignY = alignBy unitY
snugY :: (Fractional (Scalar (V a)), Alignable a, Traced a,
HasOrigin a, V a ~ R2) => Double -> a -> a
snugY = snugBy unitY
centerX :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
centerX = alignBy unitX 0
snugCenterX :: (Fractional (Scalar (V a)), Alignable a, Traced a,
HasOrigin a, V a ~ R2) => a -> a
snugCenterX = snugBy unitX 0
centerY :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
centerY = alignBy unitY 0
snugCenterY :: (Fractional (Scalar (V a)), Alignable a, Traced a,
HasOrigin a, V a ~ R2) => a -> a
snugCenterY = snugBy unitY 0
centerXY :: (Alignable a, HasOrigin a, V a ~ R2) => a -> a
centerXY = center
snugCenterXY :: (Fractional (Scalar (V a)), Alignable a, Traced a,
HasOrigin a, V a ~ R2) => a -> a
snugCenterXY = snugCenter