diff --git a/HelloWorld.hs b/HelloWorld.hs index 415fd5f..bfb3d9b 100644 --- a/HelloWorld.hs +++ b/HelloWorld.hs @@ -42,6 +42,11 @@ stepHeight = cellHeight *stepHeightToCellHeightRatio shortestDistanceBetweenSteps :: Double shortestDistanceBetweenSteps = cellHeight * (1.0 - stepHeightToCellHeightRatio) +connectionToPreviousStep :: Double -> Double -> Diagram B +connectionToPreviousStep x y = + fromOffsets [V2 0 (y - (if (abs x) > 0 then stepHeight * 0.5 else stepHeight))] # translate (r2 (0, stepHeight * 0.5)) <> + fromOffsets [V2 (if (abs x > 0) then (x + (stepWidth * 0.5)) else 0) 0] # translate (r2 (0, y)) + startShape :: Main.Name -> Diagram B startShape name = text (name ++ ": start") # fontSize (local 0.1) # light # font "courier" <> roundedRect stepWidth stepHeight 0.5 # showOrigin # named name @@ -49,14 +54,13 @@ 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 0 y] <> - fromOffsets [V2 x 0] # translate (r2 (0, y)) + connectionToPreviousStep x 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 0 y] <> - fromOffsets [V2 x 0] # translate (r2 (0, y)) + fromOffsets [V2 0 (y - (if (abs x) > 0 then stepHeight * 0.5 else stepHeight))] # translate (r2 (0, stepHeight * 0.5)) <> + fromOffsets [V2 (if (abs x > 0) then (x + (stepWidth * 0.5)) else 0) 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" <> @@ -67,8 +71,8 @@ decisionShape name x y = text name # fontSize (local 0.1) # light # font "courie 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)) <> + fromOffsets [V2 0 (y - (if (abs x) > 0 then stepHeight * 0.5 else stepHeight))] # translate (r2 (0, stepHeight * 0.5)) <> + fromOffsets [V2 (if (abs x > 0) then (x + (stepWidth * 0.5)) else 0) 0] # translate (r2 (0, y)) <> text "yes" # fontSize (local 0.1) # light # font "courier" # translate (r2 (stepWidth * (-0.1), stepHeight * (-0.7))) <> text "no" # fontSize (local 0.1) # light # font "courier" # translate (r2 (stepWidth * 0.6, stepHeight * 0.15)) diff --git a/hello-world.svg b/hello-world.svg index 012a0ed..8314d75 100644 --- a/hello-world.svg +++ b/hello-world.svg @@ -1,3 +1,3 @@ x0.0y-7.0: endx0.0y-6.0x2.0y-7.0: endx2.0y-6.0noyesx0.0y-5.0x0.0y-2.0x2.0y-4.0: endx2.0y-3.0x4.0y-3.0: endnoyesx2.0y-2.0noyesx0.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.0noyesx0.0y-5.0x0.0y-2.0x2.0y-4.0: endx2.0y-3.0x4.0y-3.0: endnoyesx2.0y-2.0noyesx0.0y-1.0x0.0y0.0: start \ No newline at end of file