Skip to content

Commit

Permalink
start steps also connects + cleaned up rendering shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrJustyna committed Mar 17, 2024
1 parent 8059beb commit 530605c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
37 changes: 9 additions & 28 deletions HelloWorld.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,48 +44,29 @@ shortestDistanceBetweenSteps = cellHeight * (1.0 - stepHeightToCellHeightRatio)

startShape :: Main.Name -> Diagram B
startShape x = text ((show x) ++ ": start") # fontSize (local 0.1) # light # font "courier" <>
roundedRect stepWidth stepHeight 0.5
# showOrigin
# named x
roundedRect stepWidth stepHeight 0.5 # showOrigin # named x <>
fromOffsets [V2 0.0 (shortestDistanceBetweenSteps * (-1.0))] # translate (r2 (0.0, stepHeight * (-0.5)))

endShape :: Main.Name -> Diagram B
endShape x = text ((show x) ++ ": end") # fontSize (local 0.1) # thinWeight # font "courier" <>
roundedRect stepWidth stepHeight 0.5
# showOrigin
# named x
roundedRect stepWidth stepHeight 0.5 # showOrigin # named x

commandShape :: Main.Name -> Diagram B
commandShape x = text (show x) # fontSize (local 0.1) # light # font "courier" <>
fromOffsets
[V2 (stepWidth * (-1.0)) 0.0,
V2 0.0 stepHeight,
V2 stepWidth 0.0,
V2 0.0 (stepHeight * (-1.0)),
V2 (stepWidth * (-0.5)) 0.0,
V2 0.0 (shortestDistanceBetweenSteps * (-1.0))]
# translate (r2 (stepWidth * 0.5, stepHeight * (-0.5)))
# showOrigin
# named x
rect stepWidth stepHeight # showOrigin # named x <>
fromOffsets [V2 0.0 (shortestDistanceBetweenSteps * (-1.0))] # translate (r2 (0.0, stepHeight * (-0.5)))

decisionShape :: Main.Name -> Diagram B
decisionShape x = text (show x) # fontSize (local 0.1) # light # font "courier" <>
fromOffsets
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 ((cellWidth + cellWidth - stepWidth) * 0.5) 0.0,
V2 0.0 (-0.8),
V2 0.0 0.8,
V2 ((cellWidth + cellWidth - stepWidth) * (-0.5)) 0.0,
V2 (-0.1) (stepHeight * (-0.5)),
V2 ((stepWidth - 0.1 - 0.1) * (-0.5)) 0.0,
V2 (0.0) (-0.6),
V2 (0.0) (0.6),
V2 ((stepWidth - 0.1 - 0.1) * (-0.5)) 0.0]
# translate (r2 (((stepWidth - 0.1 - 0.1) * (-0.5)), (-0.2)))
# showOrigin
# named x
V2 ((stepWidth - 0.1 - 0.1) * (-1.0)) 0.0] # translate (r2 (((stepWidth - 0.1 - 0.1) * (-0.5)), (-0.2))) # showOrigin # named x <>
fromOffsets [V2 0.0 (shortestDistanceBetweenSteps * (-1.0))] # translate (r2 (0.0, stepHeight * (-0.5))) <>
fromOffsets [V2 (cellWidth - (stepWidth * 0.5)) 0.0, V2 0.0 (shortestDistanceBetweenSteps + (stepHeight * 0.5)) * (-1.0)] # translate (r2 (stepWidth * 0.5, 0.0))

uniqueName :: Double -> Double -> Main.Name
uniqueName x y = "x" ++ (show x) ++ "y" ++ (show y)
Expand Down
Loading

0 comments on commit 530605c

Please sign in to comment.