Skip to content

Commit

Permalink
fixed a bug in attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
goyalarchit committed Nov 2, 2021
1 parent 01a376b commit a624f79
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions src/Dagre/Attributes.elm
Original file line number Diff line number Diff line change
Expand Up @@ -35,55 +35,71 @@ rankDir rDir =
{ a | rankDir = rDir }



{-
Note :
1. The following attributes can not have values < 0
2. If value "v" < 0 then absolute value of "v" is used
-}


widthDict : Dict G.NodeId Float -> Attribute
widthDict dict =
let
absDict =
Dict.map (\_ v -> abs v) dict
in
\a ->
{ a | widthDict = dict }
{ a | widthDict = absDict }


heightDict : Dict G.NodeId Float -> Attribute
heightDict dict =
let
absDict =
Dict.map (\_ v -> abs v) dict
in
\a ->
{ a | heightDict = dict }
{ a | heightDict = absDict }


width : Float -> Attribute
width w =
\a ->
{ a | width = w }
{ a | width = abs w }


height : Float -> Attribute
height h =
\a ->
{ a | height = h }
{ a | height = abs h }


nodeSep : Float -> Attribute
nodeSep nSep =
\a ->
{ a | nodeSep = nSep }
{ a | nodeSep = abs nSep }


edgeSep : Float -> Attribute
edgeSep eSep =
\a ->
{ a | edgeSep = eSep }
{ a | edgeSep = abs eSep }


rankSep : Float -> Attribute
rankSep rDir =
rankSep rSep =
\a ->
{ a | rankSep = rDir }
{ a | rankSep = abs rSep }


marginX : Float -> Attribute
marginX mX =
\a ->
{ a | marginX = mX }
{ a | marginX = abs mX }


marginY : Float -> Attribute
marginY mY =
\a ->
{ a | marginY = mY }
{ a | marginY = abs mY }

0 comments on commit a624f79

Please sign in to comment.