From c17062f8667eee6410ced7a768ed4a3a648e0fcb Mon Sep 17 00:00:00 2001 From: Piotr Justyna Date: Sun, 31 Mar 2024 20:25:16 +0000 Subject: [PATCH] straight lines only for connections --- HelloWorld.hs | 25 ++++++++++++++----------- hello-world.svg | 2 +- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/HelloWorld.hs b/HelloWorld.hs index 0064d77..52a5657 100644 --- a/HelloWorld.hs +++ b/HelloWorld.hs @@ -49,23 +49,26 @@ startShape name = text (name ++ ": start") # fontSize (local 0.1) # light # font endShape :: Main.Name -> Double -> Double -> Diagram B endShape name x y = text (name ++ ": end") # fontSize (local 0.1) # thinWeight # font "courier" <> roundedRect stepWidth stepHeight 0.5 # showOrigin # named name <> - fromOffsets [V2 x y] + fromOffsets [V2 0 y] <> + fromOffsets [V2 x 0] # translate (r2 (0, y)) commandShape :: Main.Name -> Double -> Double -> Diagram B commandShape name x y = text name # fontSize (local 0.1) # light # font "courier" <> rect stepWidth stepHeight # showOrigin # named name <> - fromOffsets [V2 x y] + fromOffsets [V2 0 y] <> + fromOffsets [V2 x 0] # translate (r2 (0, y)) decisionShape :: Main.Name -> Double -> Double -> Diagram B decisionShape name x y = text name # fontSize (local 0.1) # light # font "courier" <> - fromOffsets - [V2 (-0.1) (stepHeight * 0.5), - V2 0.1 (stepHeight * 0.5), - V2 (stepWidth - 0.1 - 0.1) 0.0, - V2 0.1 (stepHeight * (-0.5)), - V2 (-0.1) (stepHeight * (-0.5)), - V2 ((stepWidth - 0.1 - 0.1) * (-1.0)) 0.0] # translate (r2 (((stepWidth - 0.1 - 0.1) * (-0.5)), (-0.2))) # showOrigin # named name <> - fromOffsets [V2 x y] + fromOffsets + [V2 (-0.1) (stepHeight * 0.5), + V2 0.1 (stepHeight * 0.5), + V2 (stepWidth - 0.1 - 0.1) 0.0, + V2 0.1 (stepHeight * (-0.5)), + V2 (-0.1) (stepHeight * (-0.5)), + V2 ((stepWidth - 0.1 - 0.1) * (-1.0)) 0.0] # translate (r2 (((stepWidth - 0.1 - 0.1) * (-0.5)), (-0.2))) # showOrigin # named name <> + fromOffsets [V2 0 y] <> + fromOffsets [V2 x 0] # translate (r2 (0, y)) uniqueName :: Double -> Double -> Main.Name uniqueName x y = "x" ++ (show x) ++ "y" ++ (show y) @@ -159,5 +162,5 @@ render Main.Decision x1 y1 x2 y2 = decisionShape (uniqueName x1 y1) x2 y2 render Main.Command x1 y1 x2 y2 = commandShape (uniqueName x1 y1) x2 y2 main = mainWith $ - position (uniqueCoordinates steps1 0.0 0.0 0.0 0.0 []) + position (uniqueCoordinates steps 0.0 0.0 0.0 0.0 []) # lw veryThin diff --git a/hello-world.svg b/hello-world.svg index 5eeb3d4..12b01f6 100644 --- a/hello-world.svg +++ b/hello-world.svg @@ -1,3 +1,3 @@ x0.0y-4.0: endx0.0y-3.0x2.0y-6.0: endx4.0y-6.0: endx2.0y-5.0x2.0y-4.0x2.0y-3.0x0.0y-2.0x0.0y-1.0x0.0y0.0: start \ No newline at end of file + "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">x0.0y-7.0: endx0.0y-6.0x2.0y-7.0: endx2.0y-6.0x0.0y-5.0x0.0y-2.0x2.0y-4.0: endx2.0y-3.0x4.0y-3.0: endx2.0y-2.0x0.0y-1.0x0.0y0.0: start \ No newline at end of file