Skip to content

Commit

Permalink
add lwG, hsG, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyrosenbluth committed Mar 30, 2014
1 parent 0b7bf60 commit d9bdc90
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/Diagrams/TwoD.hs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ module Diagrams.TwoD
, shaftColor
, shaftStyle
, HeadSize, headSize, headSizeA, getHeadSize
, hs, hsO, hsL, hsN
, hs, hsO, hsL, hsN, hsG
, TailSize, tailSize, tailSizeA, getTailSize
, ts, tsO, tsL, tsN
, ts, tsO, tsL, tsN, tsG

-- * Text
, text, topLeftText, alignedText, baselineText
Expand Down Expand Up @@ -233,12 +233,12 @@ module Diagrams.TwoD
, sized, sizedAs

-- ** Width
, LineWidth, getLineWidth, lineWidth, lineWidthA, lw, lwN, lwO, lwL
, LineWidth, getLineWidth, lineWidth, lineWidthA, lw, lwN, lwO, lwL, lwG
, ultraThin, veryThin, thin, medium, thick, veryThick

-- ** Dashing
, Dashing(..), DashingA, getDashing
, dashing, dashingO, dashingL, dashingN
, dashing, dashingO, dashingL, dashingN, dashingG

-- * Visual aids for understanding the internal model
, showOrigin
Expand Down
20 changes: 14 additions & 6 deletions src/Diagrams/TwoD/Arrow.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ module Diagrams.TwoD.Arrow

-- * Attributes
, HeadSize, headSize, headSizeA, getHeadSize
, hs, hsO, hsL, hsN
, hs, hsO, hsL, hsN, hsG
, TailSize, tailSize, tailSizeA, getTailSize
, ts, tsO, tsL, tsN
, ts, tsO, tsL, tsN, tsG

-- * Options
, ArrowOpts(..)
Expand Down Expand Up @@ -308,9 +308,13 @@ headSizeA = applyGTAttr
getHeadSize :: HeadSize -> Measure R2
getHeadSize (HeadSize (Last s)) = s

-- | A convenient synonym for 'headSize (Global w)'.
-- | Default for 'headSize'.
hs :: (HasStyle a, V a ~ R2) => Double -> a -> a
hs w = headSize (Global w)
hs = hsG

-- | A convenient synonym for 'headSize (Global w)'.
hsG :: (HasStyle a, V a ~ R2) => Double -> a -> a
hsG w = headSize (Global w)

-- | A convenient synonym for 'headSize (Normalized w)'.
hsN :: (HasStyle a, V a ~ R2) => Double -> a -> a
Expand Down Expand Up @@ -346,9 +350,13 @@ tailSizeA = applyGTAttr
getTailSize :: TailSize -> Measure R2
getTailSize (TailSize (Last s)) = s

-- | A convenient synonym for 'tailSize (Global w)'.
-- | Default for 'tailSize'
ts :: (HasStyle a, V a ~ R2) => Double -> a -> a
ts w = tailSize (Global w)
ts = tsG

-- | A convenient synonym for 'tailSize (Global w)'.
tsG :: (HasStyle a, V a ~ R2) => Double -> a -> a
tsG w = tailSize (Global w)

-- | A convenient synonym for 'tailSize (Normalized w)'.
tsN :: (HasStyle a, V a ~ R2) => Double -> a -> a
Expand Down
20 changes: 14 additions & 6 deletions src/Diagrams/TwoD/Attributes.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
module Diagrams.TwoD.Attributes (
-- ** Width
LineWidth, getLineWidth, lineWidth, lineWidthA
, lw, lwN, lwO, lwL
, lw, lwN, lwO, lwL, lwG
, ultraThin, veryThin, thin, medium, thick, veryThick

-- ** Dashing
, Dashing(..), DashingA, getDashing, setDashing
, dashing, dashingN, dashingO, dashingL
, dashing, dashingN, dashingO, dashingL, dashingG

) where

Expand Down Expand Up @@ -70,9 +70,13 @@ lineWidth = applyGTAttr . LineWidth . Last
lineWidthA :: (HasStyle a, V a ~ R2) => LineWidth -> a -> a
lineWidthA = applyGTAttr

-- | A convenient synonym for 'lineWidth (Global w)'.
-- | Default for 'lineWidth'.
lw :: (HasStyle a, V a ~ R2) => Double -> a -> a
lw w = lineWidth (Global w)
lw = lwG

-- | A convenient synonym for 'lineWidth (Global w)'.
lwG :: (HasStyle a, V a ~ R2) => Double -> a -> a
lwG w = lineWidth (Global w)

-- | A convenient synonym for 'lineWidth (Normalized w)'.
lwN :: (HasStyle a, V a ~ R2) => Double -> a -> a
Expand Down Expand Up @@ -130,9 +134,13 @@ setDashing :: (HasStyle a, V a ~ R2) =>
-> a -> a
setDashing ds offs = applyGTAttr (DashingA (Last (Dashing ds offs)))

-- | A convenient synonym for 'setDashing (Global w)'.
-- | Default for 'setDashing'.
dashing :: (HasStyle a, V a ~ R2) => [Double] -> Double -> a -> a
dashing w v = setDashing (map Global w) (Global v)
dashing = dashingG

-- | A convenient synonym for 'setDashing (Global w)'.
dashingG :: (HasStyle a, V a ~ R2) => [Double] -> Double -> a -> a
dashingG w v = setDashing (map Global w) (Global v)

-- | A convenient synonym for 'setDashing (Normalized w)'.
dashingN :: (HasStyle a, V a ~ R2) => [Double] -> Double -> a -> a
Expand Down
2 changes: 1 addition & 1 deletion src/Diagrams/TwoD/Text.hs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ instance AttributeClass FontSize
type instance V FontSize = R2

instance Default FontSize where
def = FontSize (Last (Local 1))
def = FontSize (Last (Output 1))

instance Transformable FontSize where
transform t (FontSize (Last s)) =
Expand Down

0 comments on commit d9bdc90

Please sign in to comment.