reanimate-svg 0.9.1.0 → 0.9.1.1
raw patch · 6 files changed
+57/−37 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Graphics.SvgTree.Types: attrClass :: HasDrawAttributes c_apMp => Lens' c_apMp [Text]
+ Graphics.SvgTree.Types: attrClass :: HasDrawAttributes c_apER => Lens' c_apER [Text]
- Graphics.SvgTree.Types: attrId :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe String)
+ Graphics.SvgTree.Types: attrId :: HasDrawAttributes c_apER => Lens' c_apER (Maybe String)
- Graphics.SvgTree.Types: class HasColorMatrix c_ayQB
+ Graphics.SvgTree.Types: class HasColorMatrix c_ayIT
- Graphics.SvgTree.Types: class HasComposite c_ayHk
+ Graphics.SvgTree.Types: class HasComposite c_ayzC
- Graphics.SvgTree.Types: class HasDocument c_axTn
+ Graphics.SvgTree.Types: class HasDocument c_axLE
- Graphics.SvgTree.Types: class HasDrawAttributes c_apMp
+ Graphics.SvgTree.Types: class HasDrawAttributes c_apER
- Graphics.SvgTree.Types: class HasGaussianBlur c_ayVO
+ Graphics.SvgTree.Types: class HasGaussianBlur c_ayO6
- Graphics.SvgTree.Types: class HasTextPath c_ayvu
+ Graphics.SvgTree.Types: class HasTextPath c_aynM
- Graphics.SvgTree.Types: clipPathRef :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
+ Graphics.SvgTree.Types: clipPathRef :: HasDrawAttributes c_apER => Lens' c_apER (Last ElementRef)
- Graphics.SvgTree.Types: clipRule :: HasDrawAttributes c_apMp => Lens' c_apMp (Last FillRule)
+ Graphics.SvgTree.Types: clipRule :: HasDrawAttributes c_apER => Lens' c_apER (Last FillRule)
- Graphics.SvgTree.Types: colorMatrix :: HasColorMatrix c_ayQB => Lens' c_ayQB ColorMatrix
+ Graphics.SvgTree.Types: colorMatrix :: HasColorMatrix c_ayIT => Lens' c_ayIT ColorMatrix
- Graphics.SvgTree.Types: colorMatrixDrawAttributes :: HasColorMatrix c_ayQB => Lens' c_ayQB DrawAttributes
+ Graphics.SvgTree.Types: colorMatrixDrawAttributes :: HasColorMatrix c_ayIT => Lens' c_ayIT DrawAttributes
- Graphics.SvgTree.Types: colorMatrixFilterAttr :: HasColorMatrix c_ayQB => Lens' c_ayQB FilterAttributes
+ Graphics.SvgTree.Types: colorMatrixFilterAttr :: HasColorMatrix c_ayIT => Lens' c_ayIT FilterAttributes
- Graphics.SvgTree.Types: colorMatrixIn :: HasColorMatrix c_ayQB => Lens' c_ayQB (Last FilterSource)
+ Graphics.SvgTree.Types: colorMatrixIn :: HasColorMatrix c_ayIT => Lens' c_ayIT (Last FilterSource)
- Graphics.SvgTree.Types: colorMatrixType :: HasColorMatrix c_ayQB => Lens' c_ayQB ColorMatrixType
+ Graphics.SvgTree.Types: colorMatrixType :: HasColorMatrix c_ayIT => Lens' c_ayIT ColorMatrixType
- Graphics.SvgTree.Types: colorMatrixValues :: HasColorMatrix c_ayQB => Lens' c_ayQB String
+ Graphics.SvgTree.Types: colorMatrixValues :: HasColorMatrix c_ayIT => Lens' c_ayIT String
- Graphics.SvgTree.Types: composite :: HasComposite c_ayHk => Lens' c_ayHk Composite
+ Graphics.SvgTree.Types: composite :: HasComposite c_ayzC => Lens' c_ayzC Composite
- Graphics.SvgTree.Types: compositeDrawAttributes :: HasComposite c_ayHk => Lens' c_ayHk DrawAttributes
+ Graphics.SvgTree.Types: compositeDrawAttributes :: HasComposite c_ayzC => Lens' c_ayzC DrawAttributes
- Graphics.SvgTree.Types: compositeFilterAttr :: HasComposite c_ayHk => Lens' c_ayHk FilterAttributes
+ Graphics.SvgTree.Types: compositeFilterAttr :: HasComposite c_ayzC => Lens' c_ayzC FilterAttributes
- Graphics.SvgTree.Types: compositeIn :: HasComposite c_ayHk => Lens' c_ayHk (Last FilterSource)
+ Graphics.SvgTree.Types: compositeIn :: HasComposite c_ayzC => Lens' c_ayzC (Last FilterSource)
- Graphics.SvgTree.Types: compositeIn2 :: HasComposite c_ayHk => Lens' c_ayHk (Last FilterSource)
+ Graphics.SvgTree.Types: compositeIn2 :: HasComposite c_ayzC => Lens' c_ayzC (Last FilterSource)
- Graphics.SvgTree.Types: compositeK1 :: HasComposite c_ayHk => Lens' c_ayHk Number
+ Graphics.SvgTree.Types: compositeK1 :: HasComposite c_ayzC => Lens' c_ayzC Number
- Graphics.SvgTree.Types: compositeK2 :: HasComposite c_ayHk => Lens' c_ayHk Number
+ Graphics.SvgTree.Types: compositeK2 :: HasComposite c_ayzC => Lens' c_ayzC Number
- Graphics.SvgTree.Types: compositeK3 :: HasComposite c_ayHk => Lens' c_ayHk Number
+ Graphics.SvgTree.Types: compositeK3 :: HasComposite c_ayzC => Lens' c_ayzC Number
- Graphics.SvgTree.Types: compositeK4 :: HasComposite c_ayHk => Lens' c_ayHk Number
+ Graphics.SvgTree.Types: compositeK4 :: HasComposite c_ayzC => Lens' c_ayzC Number
- Graphics.SvgTree.Types: compositeOperator :: HasComposite c_ayHk => Lens' c_ayHk CompositeOperator
+ Graphics.SvgTree.Types: compositeOperator :: HasComposite c_ayzC => Lens' c_ayzC CompositeOperator
- Graphics.SvgTree.Types: definitions :: HasDocument c_axTn => Lens' c_axTn (Map String Tree)
+ Graphics.SvgTree.Types: definitions :: HasDocument c_axLE => Lens' c_axLE (Map String Tree)
- Graphics.SvgTree.Types: description :: HasDocument c_axTn => Lens' c_axTn String
+ Graphics.SvgTree.Types: description :: HasDocument c_axLE => Lens' c_axLE String
- Graphics.SvgTree.Types: document :: HasDocument c_axTn => Lens' c_axTn Document
+ Graphics.SvgTree.Types: document :: HasDocument c_axLE => Lens' c_axLE Document
- Graphics.SvgTree.Types: documentLocation :: HasDocument c_axTn => Lens' c_axTn FilePath
+ Graphics.SvgTree.Types: documentLocation :: HasDocument c_axLE => Lens' c_axLE FilePath
- Graphics.SvgTree.Types: drawAttributes :: HasDrawAttributes c_apMp => Lens' c_apMp DrawAttributes
+ Graphics.SvgTree.Types: drawAttributes :: HasDrawAttributes c_apER => Lens' c_apER DrawAttributes
- Graphics.SvgTree.Types: elements :: HasDocument c_axTn => Lens' c_axTn [Tree]
+ Graphics.SvgTree.Types: elements :: HasDocument c_axLE => Lens' c_axLE [Tree]
- Graphics.SvgTree.Types: fillColor :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Texture)
+ Graphics.SvgTree.Types: fillColor :: HasDrawAttributes c_apER => Lens' c_apER (Last Texture)
- Graphics.SvgTree.Types: fillOpacity :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe Float)
+ Graphics.SvgTree.Types: fillOpacity :: HasDrawAttributes c_apER => Lens' c_apER (Maybe Float)
- Graphics.SvgTree.Types: fillRule :: HasDrawAttributes c_apMp => Lens' c_apMp (Last FillRule)
+ Graphics.SvgTree.Types: fillRule :: HasDrawAttributes c_apER => Lens' c_apER (Last FillRule)
- Graphics.SvgTree.Types: filterRef :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
+ Graphics.SvgTree.Types: filterRef :: HasDrawAttributes c_apER => Lens' c_apER (Last ElementRef)
- Graphics.SvgTree.Types: fontFamily :: HasDrawAttributes c_apMp => Lens' c_apMp (Last [String])
+ Graphics.SvgTree.Types: fontFamily :: HasDrawAttributes c_apER => Lens' c_apER (Last [String])
- Graphics.SvgTree.Types: fontSize :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Number)
+ Graphics.SvgTree.Types: fontSize :: HasDrawAttributes c_apER => Lens' c_apER (Last Number)
- Graphics.SvgTree.Types: fontStyle :: HasDrawAttributes c_apMp => Lens' c_apMp (Last FontStyle)
+ Graphics.SvgTree.Types: fontStyle :: HasDrawAttributes c_apER => Lens' c_apER (Last FontStyle)
- Graphics.SvgTree.Types: gaussianBlur :: HasGaussianBlur c_ayVO => Lens' c_ayVO GaussianBlur
+ Graphics.SvgTree.Types: gaussianBlur :: HasGaussianBlur c_ayO6 => Lens' c_ayO6 GaussianBlur
- Graphics.SvgTree.Types: gaussianBlurDrawAttributes :: HasGaussianBlur c_ayVO => Lens' c_ayVO DrawAttributes
+ Graphics.SvgTree.Types: gaussianBlurDrawAttributes :: HasGaussianBlur c_ayO6 => Lens' c_ayO6 DrawAttributes
- Graphics.SvgTree.Types: gaussianBlurEdgeMode :: HasGaussianBlur c_ayVO => Lens' c_ayVO EdgeMode
+ Graphics.SvgTree.Types: gaussianBlurEdgeMode :: HasGaussianBlur c_ayO6 => Lens' c_ayO6 EdgeMode
- Graphics.SvgTree.Types: gaussianBlurFilterAttr :: HasGaussianBlur c_ayVO => Lens' c_ayVO FilterAttributes
+ Graphics.SvgTree.Types: gaussianBlurFilterAttr :: HasGaussianBlur c_ayO6 => Lens' c_ayO6 FilterAttributes
- Graphics.SvgTree.Types: gaussianBlurIn :: HasGaussianBlur c_ayVO => Lens' c_ayVO (Last FilterSource)
+ Graphics.SvgTree.Types: gaussianBlurIn :: HasGaussianBlur c_ayO6 => Lens' c_ayO6 (Last FilterSource)
- Graphics.SvgTree.Types: gaussianBlurStdDeviationX :: HasGaussianBlur c_ayVO => Lens' c_ayVO Number
+ Graphics.SvgTree.Types: gaussianBlurStdDeviationX :: HasGaussianBlur c_ayO6 => Lens' c_ayO6 Number
- Graphics.SvgTree.Types: gaussianBlurStdDeviationY :: HasGaussianBlur c_ayVO => Lens' c_ayVO (Last Number)
+ Graphics.SvgTree.Types: gaussianBlurStdDeviationY :: HasGaussianBlur c_ayO6 => Lens' c_ayO6 (Last Number)
- Graphics.SvgTree.Types: groupOpacity :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe Float)
+ Graphics.SvgTree.Types: groupOpacity :: HasDrawAttributes c_apER => Lens' c_apER (Maybe Float)
- Graphics.SvgTree.Types: height :: HasDocument c_axTn => Lens' c_axTn (Maybe Number)
+ Graphics.SvgTree.Types: height :: HasDocument c_axLE => Lens' c_axLE (Maybe Number)
- Graphics.SvgTree.Types: markerEnd :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
+ Graphics.SvgTree.Types: markerEnd :: HasDrawAttributes c_apER => Lens' c_apER (Last ElementRef)
- Graphics.SvgTree.Types: markerMid :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
+ Graphics.SvgTree.Types: markerMid :: HasDrawAttributes c_apER => Lens' c_apER (Last ElementRef)
- Graphics.SvgTree.Types: markerStart :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
+ Graphics.SvgTree.Types: markerStart :: HasDrawAttributes c_apER => Lens' c_apER (Last ElementRef)
- Graphics.SvgTree.Types: maskRef :: HasDrawAttributes c_apMp => Lens' c_apMp (Last ElementRef)
+ Graphics.SvgTree.Types: maskRef :: HasDrawAttributes c_apER => Lens' c_apER (Last ElementRef)
- Graphics.SvgTree.Types: preRendered :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe String)
+ Graphics.SvgTree.Types: preRendered :: HasDrawAttributes c_apER => Lens' c_apER (Maybe String)
- Graphics.SvgTree.Types: strokeColor :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Texture)
+ Graphics.SvgTree.Types: strokeColor :: HasDrawAttributes c_apER => Lens' c_apER (Last Texture)
- Graphics.SvgTree.Types: strokeDashArray :: HasDrawAttributes c_apMp => Lens' c_apMp (Last [Number])
+ Graphics.SvgTree.Types: strokeDashArray :: HasDrawAttributes c_apER => Lens' c_apER (Last [Number])
- Graphics.SvgTree.Types: strokeLineCap :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Cap)
+ Graphics.SvgTree.Types: strokeLineCap :: HasDrawAttributes c_apER => Lens' c_apER (Last Cap)
- Graphics.SvgTree.Types: strokeLineJoin :: HasDrawAttributes c_apMp => Lens' c_apMp (Last LineJoin)
+ Graphics.SvgTree.Types: strokeLineJoin :: HasDrawAttributes c_apER => Lens' c_apER (Last LineJoin)
- Graphics.SvgTree.Types: strokeMiterLimit :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Double)
+ Graphics.SvgTree.Types: strokeMiterLimit :: HasDrawAttributes c_apER => Lens' c_apER (Last Double)
- Graphics.SvgTree.Types: strokeOffset :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Number)
+ Graphics.SvgTree.Types: strokeOffset :: HasDrawAttributes c_apER => Lens' c_apER (Last Number)
- Graphics.SvgTree.Types: strokeOpacity :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe Float)
+ Graphics.SvgTree.Types: strokeOpacity :: HasDrawAttributes c_apER => Lens' c_apER (Maybe Float)
- Graphics.SvgTree.Types: strokeWidth :: HasDrawAttributes c_apMp => Lens' c_apMp (Last Number)
+ Graphics.SvgTree.Types: strokeWidth :: HasDrawAttributes c_apER => Lens' c_apER (Last Number)
- Graphics.SvgTree.Types: textAnchor :: HasDrawAttributes c_apMp => Lens' c_apMp (Last TextAnchor)
+ Graphics.SvgTree.Types: textAnchor :: HasDrawAttributes c_apER => Lens' c_apER (Last TextAnchor)
- Graphics.SvgTree.Types: textPath :: HasTextPath c_ayvu => Lens' c_ayvu TextPath
+ Graphics.SvgTree.Types: textPath :: HasTextPath c_aynM => Lens' c_aynM TextPath
- Graphics.SvgTree.Types: textPathMethod :: HasTextPath c_ayvu => Lens' c_ayvu TextPathMethod
+ Graphics.SvgTree.Types: textPathMethod :: HasTextPath c_aynM => Lens' c_aynM TextPathMethod
- Graphics.SvgTree.Types: textPathName :: HasTextPath c_ayvu => Lens' c_ayvu String
+ Graphics.SvgTree.Types: textPathName :: HasTextPath c_aynM => Lens' c_aynM String
- Graphics.SvgTree.Types: textPathSpacing :: HasTextPath c_ayvu => Lens' c_ayvu TextPathSpacing
+ Graphics.SvgTree.Types: textPathSpacing :: HasTextPath c_aynM => Lens' c_aynM TextPathSpacing
- Graphics.SvgTree.Types: textPathStartOffset :: HasTextPath c_ayvu => Lens' c_ayvu Number
+ Graphics.SvgTree.Types: textPathStartOffset :: HasTextPath c_aynM => Lens' c_aynM Number
- Graphics.SvgTree.Types: transform :: HasDrawAttributes c_apMp => Lens' c_apMp (Maybe [Transformation])
+ Graphics.SvgTree.Types: transform :: HasDrawAttributes c_apER => Lens' c_apER (Maybe [Transformation])
- Graphics.SvgTree.Types: viewBox :: HasDocument c_axTn => Lens' c_axTn (Maybe (Double, Double, Double, Double))
+ Graphics.SvgTree.Types: viewBox :: HasDocument c_axLE => Lens' c_axLE (Maybe (Double, Double, Double, Double))
- Graphics.SvgTree.Types: width :: HasDocument c_axTn => Lens' c_axTn (Maybe Number)
+ Graphics.SvgTree.Types: width :: HasDocument c_axLE => Lens' c_axLE (Maybe Number)
Files
- reanimate-svg.cabal +2/−1
- src/Graphics/SvgTree/CssTypes.hs +10/−15
- src/Graphics/SvgTree/Misc.hs +19/−0
- src/Graphics/SvgTree/PathParser.hs +11/−10
- src/Graphics/SvgTree/Types.hs +11/−8
- src/Graphics/SvgTree/XmlParser.hs +4/−3
reanimate-svg.cabal view
@@ -1,5 +1,5 @@ name: reanimate-svg-version: 0.9.1.0+version: 0.9.1.1 synopsis: SVG file loader and serializer description: reanimate-svg provides types representing a SVG document,@@ -40,6 +40,7 @@ other-modules: Graphics.SvgTree.XmlParser , Graphics.SvgTree.CssParser , Graphics.SvgTree.ColorParser+ , Graphics.SvgTree.Misc if impl(ghc >= 8.0) ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
src/Graphics/SvgTree/CssTypes.hs view
@@ -29,10 +29,11 @@ import qualified Data.Text as T import qualified Data.Text.Lazy.Builder as TB import Text.Printf-import Data.Ratio import Codec.Picture (PixelRGBA8 (..)) +import Graphics.SvgTree.Misc+ -- | Alias describing a "dot per inch" information -- used for size calculation (see toUserUnit). type Dpi = Int@@ -214,21 +215,15 @@ -- CSS or a svg attributes. serializeNumber :: Number -> String serializeNumber n = case n of- Num c -> ppDouble c- Px c -> printf "%.*gpx" precision c- Em cc -> printf "%.*gem" precision cc+ Num c -> ppD c+ Px c -> printf "%spx" (ppD c)+ Em cc -> printf "%sem" (ppD cc) Percent p -> printf "%d%%" (floor $ 100 * p :: Int)- Pc p -> printf "%.*gpc" precision p- Mm m -> printf "%.*gmm" precision m- Cm c -> printf "%.*gcm" precision c- Point p -> printf "%.*gpt" precision p- Inches i -> printf "%.*gin" precision i- where- ppDouble d = pickMin- (printf "%.*g" precision d)- (printf "%g" d)- pickMin a b = if length a < length b then a else b- precision = 6 :: Int+ Pc p -> printf "%spc" (ppD p)+ Mm m -> printf "%smm" (ppD m)+ Cm c -> printf "%scm" (ppD c)+ Point p -> printf "%spt" (ppD p)+ Inches i -> printf "%sin" (ppD i) instance TextBuildable Number where tserialize = TB.fromText . T.pack . serializeNumber
+ src/Graphics/SvgTree/Misc.hs view
@@ -0,0 +1,19 @@+module Graphics.SvgTree.Misc where++import Numeric++ppD :: Double -> String+ppD c = pickMin (showFFloat Nothing c "") (showFFloat (Just precision) c "")+ where+ pickMin [] _ = []+ pickMin _ [] = []+ pickMin (x:xs) (_:ys) = x : pickMin xs ys+ precision = 6++ppF :: Float -> String+ppF c = pickMin (showFFloat Nothing c "") (showFFloat (Just precision) c "")+ where+ pickMin [] _ = []+ pickMin _ [] = []+ pickMin (x:xs) (_:ys) = x : pickMin xs ys+ precision = 6
src/Graphics/SvgTree/PathParser.hs view
@@ -26,10 +26,10 @@ import Data.Scientific (toRealFloat) import Numeric-import Text.Show import Data.List import qualified Data.Text as T import Graphics.SvgTree.Types+import Graphics.SvgTree.Misc import Linear hiding (angle, point) import Text.Printf (printf) @@ -52,7 +52,7 @@ iParse = num <* skipSpace serializeViewBox :: (Double, Double, Double, Double) -> String-serializeViewBox (a, b, c, d) = printf "%g %g %g %g" a b c d+serializeViewBox (a, b, c, d) = printf "%s %s %s %s" (ppD a) (ppD b) (ppD c) (ppD d) commaWsp :: Parser () commaWsp = skipSpace *> option () (string "," *> return ()) <* skipSpace@@ -157,14 +157,15 @@ EndPath -> showChar 'Z' where serializeArg (a, b, c, d, e, V2 x y) =- showFFloat Nothing a . showChar ' ' .- showFFloat Nothing b . showChar ' ' .- showFFloat Nothing c . showChar ' ' .- shows (fromEnum d) . showChar ' ' .- shows (fromEnum e) . showChar ' ' .- showFFloat Nothing x . showChar ',' .- showFFloat Nothing y- -- printf "%g %g %g %d %d %g,%g" a b c (fromEnum d) (fromEnum e) x y+ -- ppD a . showChar ' ' .+ -- ppD b . showChar ' ' .+ -- ppD c . showChar ' ' .+ -- shows (fromEnum d) . showChar ' ' .+ -- shows (fromEnum e) . showChar ' ' .+ -- ppD x . showChar ',' .+ -- ppd y+ printf "%s %s %s %d %d %s,%s"+ (ppD a) (ppD b) (ppD c) (fromEnum d) (fromEnum e) (ppD x) (ppD y) serializeArgs = unwordsS . fmap serializeArg
src/Graphics/SvgTree/Types.hs view
@@ -221,6 +221,7 @@ import Data.Semigroup (Semigroup (..)) import qualified Data.Text as T import Graphics.SvgTree.CssTypes+import Graphics.SvgTree.Misc import Linear hiding (angle) import Text.Printf@@ -399,14 +400,16 @@ serializeTransformation t = case t of TransformUnknown -> "" TransformMatrix a b c d e f ->- printf "matrix(%g, %g, %g, %g, %g, %g)" a b c d e f- Translate x y -> printf "translate(%g, %g)" x y- Scale x Nothing -> printf "scale(%g)" x- Scale x (Just y) -> printf "scale(%g, %g)" x y- Rotate angle Nothing -> printf "rotate(%g)" angle- Rotate angle (Just (x, y))-> printf "rotate(%g, %g, %g)" angle x y- SkewX x -> printf "skewX(%g)" x- SkewY y -> printf "skewY(%g)" y+ printf "matrix(%s, %s, %s, %s, %s, %s)"+ (ppD a) (ppD b) (ppD c) (ppD d) (ppD e) (ppD f)+ Translate x y -> printf "translate(%s, %s)" (ppD x) (ppD y)+ Scale x Nothing -> printf "scale(%s)" (ppD x)+ Scale x (Just y) -> printf "scale(%s, %s)" (ppD x) (ppD y)+ Rotate angle Nothing -> printf "rotate(%s)" (ppD angle)+ Rotate angle (Just (x, y))-> printf "rotate(%s, %s, %s)"+ (ppD angle) (ppD x) (ppD y)+ SkewX x -> printf "skewX(%s)" (ppD x)+ SkewY y -> printf "skewY(%s)" (ppD y) -- | Transform a list of transformations to a string for svg -- `transform` attributes.
src/Graphics/SvgTree/XmlParser.hs view
@@ -46,6 +46,7 @@ CssElement (..)) import Graphics.SvgTree.PathParser import Graphics.SvgTree.Types+import Graphics.SvgTree.Misc import qualified Text.XML.Light as X import Text.XML.Light.Proc (elChildren, findAttrBy) @@ -111,7 +112,7 @@ instance ParseableAttribute Double where aparse = parseMayStartDot num- aserialize v = Just $ printf "%g" v+ aserialize v = Just $ printf "%s" (ppD v) instance ParseableAttribute Texture where aparse = parse textureParser@@ -492,7 +493,7 @@ opacitySetter attribute elLens = SvgAttributeLens attribute updater serializer where- serializer a = printf "%g" <$> a ^. elLens+ serializer a = printf "%s" . ppF <$> a ^. elLens updater el str = case parseMayStartDot num str of Nothing -> el Just v -> el & elLens .~ Just (realToFrac v)@@ -982,7 +983,7 @@ rotateNotEmpty [] = Nothing rotateNotEmpty lst =- Just . unwords $ printf "%g" <$> lst+ Just . unwords $ printf "%s" . ppD <$> lst instance XMLUpdatable TextPath where