Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rect defaults #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions src/Graphics/Svg/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ data PreserveAspectRatio = PreserveAspectRatio
deriving (Eq, Show)

instance WithDefaultSvg PreserveAspectRatio where
defaultSvg = PreserveAspectRatio
defaultSvg = PreserveAspectRatio
{ _aspectRatioDefer = False
, _aspectRatioAlign = AlignxMidYMid
, _aspectRatioMeetSlice = Nothing
Expand Down Expand Up @@ -674,38 +674,38 @@ data Rectangle = Rectangle
, _rectUpperLeftCorner :: !Point
-- | Rectangle width, correspond, strangely, to
-- the `width` attribute.
, _rectWidth :: !Number
, _rectWidth :: !(Maybe Number)
-- | Rectangle height, correspond, amazingly, to
-- the `height` attribute.
, _rectHeight :: !Number
, _rectHeight :: !(Maybe Number)
-- | Define the rounded corner radius radius
-- of the rectangle. Correspond to the `rx` and
-- `ry` attributes.
, _rectCornerRadius :: !(Number, Number)
, _rectCornerRadius :: !(Maybe Number, Maybe Number)
}
deriving (Eq, Show)

-- makeClassy ''Rectangle
-- | Lenses for the Rectangle type.
class HasRectangle a where
rectangle :: Lens' a Rectangle
rectCornerRadius :: Lens' a (Number, Number)
rectCornerRadius :: Lens' a (Maybe Number, Maybe Number)
{-# INLINE rectCornerRadius #-}
rectCornerRadius = rectangle . rectCornerRadius

rectDrawAttributes :: Lens' a DrawAttributes
{-# INLINE rectDrawAttributes #-}
rectDrawAttributes = rectangle . rectDrawAttributes

rectHeight :: Lens' a Number
rectHeight :: Lens' a (Maybe Number)
{-# INLINE rectHeight #-}
rectHeight = rectangle . rectHeight

rectUpperLeftCorner :: Lens' a Point
{-# INLINE rectUpperLeftCorner #-}
rectUpperLeftCorner = rectangle . rectUpperLeftCorner

rectWidth :: Lens' a Number
rectWidth :: Lens' a (Maybe Number)
{-# INLINE rectWidth #-}
rectWidth = rectangle . rectWidth

Expand Down Expand Up @@ -734,9 +734,9 @@ instance WithDefaultSvg Rectangle where
defaultSvg = Rectangle
{ _rectDrawAttributes = mempty
, _rectUpperLeftCorner = (Num 0, Num 0)
, _rectWidth = Num 0
, _rectHeight = Num 0
, _rectCornerRadius = (Num 0, Num 0)
, _rectWidth = Nothing
, _rectHeight = Nothing
, _rectCornerRadius = (Nothing, Nothing)
}

-- | Type mapping the `<path>` svg tag.
Expand Down Expand Up @@ -2193,7 +2193,7 @@ data Pattern = Pattern
-- attribute.
, _patternUnit :: !CoordinateUnits
-- | Value of the "preserveAspectRatio" attribute
, _patternAspectRatio :: !PreserveAspectRatio
, _patternAspectRatio :: !PreserveAspectRatio
-- | Value of "patternTransform" attribute
, _patternTransform :: !(Maybe [Transformation])
}
Expand Down Expand Up @@ -2486,7 +2486,7 @@ instance CssMatcheable Tree where
--------------------------------------------------------------------------
--- Dumped
--------------------------------------------------------------------------
-- makeClassy ''PreserveAspectRatio
-- makeClassy ''PreserveAspectRatio
--
-- | Lenses for the PreserveAspectRatio type
class HasPreserveAspectRatio a where
Expand Down Expand Up @@ -2699,4 +2699,3 @@ instance HasDrawAttributes DrawAttributes where
fmap (\y -> attr { _textAnchor = y }) (f $ _textAnchor attr)
transform f attr =
fmap (\y -> attr { _transform = y }) (f $ _transform attr)