From 1a0da84a8e2f7a374c4d2a040a92ce066012e0bf Mon Sep 17 00:00:00 2001 From: Piotr Justyna Date: Mon, 22 Apr 2024 13:43:26 +0000 Subject: [PATCH] more refined rendering --- app/Main.hs | 22 +++++++++++++++------- hello-world.svg | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 5241c41..bbfbf8c 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -239,12 +239,12 @@ visualGraph = do let startingDepth = 0.0 let firstChildIconDepth = startingDepth + (-1.0) * cellHeight let Icon { iconText = titleIconText, iconType = _ } = payload titleIcon - let text = conditionalRenderingSuffix titleIconText renderingOrder startingWidth troubleshootingMode + let conditionalText = conditionalRenderingSuffix titleIconText renderingOrder startingWidth troubleshootingMode let titleIconDependenciesKeys = dependencies titleIcon let titleIconDependencies = iconsWithKeys titleIconDependenciesKeys let (_, _, childSubgraphVisualData) = visualSubgraph titleIconDependencies (renderingOrder + 1) startingWidth firstChildIconDepth startingWidth startingDepth - (Diagrams.Prelude.p2 (0.0, 0.0), titleShape text) : childSubgraphVisualData + (Diagrams.Prelude.p2 (0.0, 0.0), titleShape conditionalText) : childSubgraphVisualData visualSubgraph :: [GHC.Data.Graph.Directed.Node Int Icon] -> @@ -356,7 +356,7 @@ correctShape :: Double -> String -> Diagrams.Prelude.Diagram Diagrams.Backend.SVG.CmdLine.B -correctShape Title parentIconVectorX parentIconVectorY x = titleShape x +correctShape Title _ _ x = titleShape x correctShape End parentIconVectorX parentIconVectorY x = endShape parentIconVectorX parentIconVectorY x correctShape Question parentIconVectorX parentIconVectorY x = questionShape parentIconVectorX parentIconVectorY x correctShape Action parentIconVectorX parentIconVectorY x = actionShape parentIconVectorX parentIconVectorY x @@ -388,6 +388,8 @@ titleShape x = do Diagrams.Prelude.roundedRect iconWidth iconHeight 0.5 Diagrams.Prelude.# Diagrams.Prelude.fc (Data.Colour.SRGB.sRGB (236.0/255.0) (249.0/255.0) (254.0/255.0)) + Diagrams.Prelude.# + Diagrams.Prelude.lw Diagrams.Prelude.none -- (text x 0.0 0.0 -- Diagrams.Prelude.=== @@ -414,6 +416,8 @@ actionShape Diagrams.Prelude.rect iconWidth iconHeight Diagrams.Prelude.# Diagrams.Prelude.fc (Data.Colour.SRGB.sRGB (220.0/255.0) (232.0/255.0) (235.0/255.0)) + Diagrams.Prelude.# + Diagrams.Prelude.lw Diagrams.Prelude.none let shape = if troubleshootingMode then Diagrams.Prelude.showOrigin $ baseShape @@ -421,7 +425,7 @@ actionShape (text x 0.0 0.0) <> shape - <> connectionToParentIcon parentIconVectorX parentIconVectorY + <> (connectionToParentIcon parentIconVectorX parentIconVectorY Diagrams.Prelude.# Diagrams.Prelude.lw Diagrams.Prelude.ultraThin) questionShape :: Double -> @@ -447,6 +451,8 @@ questionShape Diagrams.Prelude.# Diagrams.Prelude.fc (Data.Colour.SRGB.sRGB (203.0/255.0) (219.0/255.0) (224.0/255.0)) Diagrams.Prelude.# + Diagrams.Prelude.lw Diagrams.Prelude.none + Diagrams.Prelude.# Diagrams.Prelude.translate (Diagrams.Prelude.r2 ((iconWidth - 0.1 - 0.1) * (-0.5), -0.2)) let shape = if troubleshootingMode @@ -457,7 +463,7 @@ questionShape <> text "yes" (iconWidth * (-0.1)) (iconHeight * (-0.7)) <> text "no" (iconWidth * 0.55) (iconHeight * 0.15) <> shape - <> connectionToParentIcon parentIconVectorX parentIconVectorY + <> (connectionToParentIcon parentIconVectorX parentIconVectorY Diagrams.Prelude.# Diagrams.Prelude.lw Diagrams.Prelude.ultraThin) endShape :: Double -> @@ -472,6 +478,8 @@ endShape Diagrams.Prelude.roundedRect iconWidth iconHeight 0.5 Diagrams.Prelude.# Diagrams.Prelude.fc (Data.Colour.SRGB.sRGB (190.0/255.0) (210.0/255.0) (217.0/255.0)) + Diagrams.Prelude.# + Diagrams.Prelude.lw Diagrams.Prelude.none let shape = if troubleshootingMode then Diagrams.Prelude.showOrigin $ baseShape @@ -479,7 +487,7 @@ endShape (text x 0.0 0.0) <> shape - <> connectionToParentIcon parentIconVectorX parentIconVectorY + <> (connectionToParentIcon parentIconVectorX parentIconVectorY Diagrams.Prelude.# Diagrams.Prelude.lw Diagrams.Prelude.ultraThin) main :: IO () @@ -490,4 +498,4 @@ main = do Diagrams.Prelude.# Diagrams.Prelude.bg (Data.Colour.SRGB.sRGB (247.0/255.0) (249.0/255.0) (254.0/255.0)) Diagrams.Prelude.# - Diagrams.Prelude.lw Diagrams.Prelude.veryThin \ No newline at end of file + Diagrams.Prelude.lw Diagrams.Prelude.none \ No newline at end of file diff --git a/hello-world.svg b/hello-world.svg index c58748f..d9c4a25 100644 --- a/hello-world.svg +++ b/hello-world.svg @@ -1,3 +1,3 @@ end 4 | rendering order: 12 | max width: 6.0end 3 | rendering order: 11 | max width: 4.0action 4 | rendering order: 10 | max width: 4.0noyesquestion 3 | rendering order: 9 | max width: 4.0end 2 | rendering order: 8 | max width: 2.0action 3 | rendering order: 7 | max width: 2.0end 1 | rendering order: 6 | max width: 0.0action 2 | rendering order: 5 | max width: 0.0noyesquestion 2 | rendering order: 4 | max width: 0.0action 1 | rendering order: 3 | max width: 0.0noyesquestion 1 | rendering order: 2 | max width: 0.0start | rendering order: 1 | max width: 0.0 \ No newline at end of file + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">end 4 | rendering order: 12 | max width: 6.0end 3 | rendering order: 11 | max width: 4.0action 4 | rendering order: 10 | max width: 4.0noyesquestion 3 | rendering order: 9 | max width: 4.0end 2 | rendering order: 8 | max width: 2.0action 3 | rendering order: 7 | max width: 2.0end 1 | rendering order: 6 | max width: 0.0action 2 | rendering order: 5 | max width: 0.0noyesquestion 2 | rendering order: 4 | max width: 0.0action 1 | rendering order: 3 | max width: 0.0noyesquestion 1 | rendering order: 2 | max width: 0.0start | rendering order: 1 | max width: 0.0 \ No newline at end of file