Skip to content

Commit

Permalink
preparing for rebdering many parent icons
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrJustyna committed Apr 25, 2024
1 parent 248d2b1 commit 36daa5c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ visualGraph = do

(Diagrams.Prelude.p2 (0.0, 0.0), titleShape titleIconText renderingOrder startingWidth) : childSubgraphVisualData

-- we should have a bit of new logic here:
-- if, while iterating through the list of icons, you come across and end icon (later any icon)
-- that is already in the returned collection of triples (rendering order, max width, (coordinates, diagram))
-- take that found end icon from the returned collection and mappend a connection to the new parent node to it
visualSubgraph ::
[GHC.Data.Graph.Directed.Node Int Icon] ->
Int ->
Expand Down Expand Up @@ -374,6 +378,18 @@ connectionToParentIcon x y =
Diagrams.Prelude.translate
(Diagrams.Prelude.r2 (0, y))

connectionToParentIcons ::
[(Double, Double)] ->
Diagrams.Prelude.Diagram Diagrams.Backend.SVG.CmdLine.B
connectionToParentIcons parentIconOriginVectors =
foldl
(\acc (vectorX, vectorY) ->
acc
<>
connectionToParentIcon vectorX vectorY) -- translate to 0,0 before next connection starts
mempty
parentIconOriginVectors

correctShape ::
IconType ->
Double ->
Expand Down Expand Up @@ -596,7 +612,7 @@ endShape
Diagrams.Prelude.#
Diagrams.Prelude.translate (Diagrams.Prelude.r2 (0, fontSize))
<> shape
<> connectionToParentIcon parentIconVectorX parentIconVectorY
<> connectionToParentIcons [(parentIconVectorX, parentIconVectorY)]
Diagrams.Prelude.#
Diagrams.Prelude.lc lineColour
Diagrams.Prelude.#
Expand Down

0 comments on commit 36daa5c

Please sign in to comment.