Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Fixed a bug that was causing the focus info popup to appear blank
- Fixed a bug on the generate page causing extraneous ellipses to appear when hovering over a course to highlight its prerequisites
- Fixed a bug on the generate page where an extraneous info popup would appear when hovering over the top left corner of the graph viewing window
- Fixed a bug that led code to crash when parsing all pre-generated graphs from svg (i.e., program graphs)

### 🔧 Internal changes

Expand Down
43 changes: 24 additions & 19 deletions app/Svg/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -182,26 +182,31 @@ parseTextHelper :: GraphId -- ^ The Text's corresponding graph identifier.
-> [Text]
parseTextHelper _ _ _ _ [] = []
parseTextHelper key styles' trans globalTrans (headTag:restTags) =
let [[a, c, e], [b, d, f], _] = completeTrans
in [Text key
(fromAttrib "id" headTag) -- TODO: Why are we setting an id?
(readAttr "x" headTag, readAttr "y" headTag)
(TS.escapeHTML $ trim $ TS.innerText (headTag:restTags))
align
fill
[a, b, c, d, e, f]
]
if not $ any (TS.isTagOpenName "tspan") restTags
then
let [[a, c, e], [b, d, f], _] = completeTrans
in [Text key
(fromAttrib "id" headTag) -- TODO: Why are we setting an id?
(readAttr "x" headTag, readAttr "y" headTag)
(TS.escapeHTML $ trim $ TS.innerText (headTag:restTags))
align
fill
[a, b, c, d, e, f]
]
else
let tspanTags = TS.partitions (TS.isTagOpenName "tspan") (headTag:restTags)
in
concatMap (parseTextHelper key newStyle newTrans globalTrans) tspanTags
where
newStyle = styles headTag ++ styles'
currTrans = getTransform headTag
newTrans = matrixMultiply trans currTrans
completeTrans = matrixMultiply globalTrans newTrans
alignAttr = styleVal "text-anchor" newStyle
align = if T.null alignAttr
then "start"
else alignAttr
fill = styleVal "fill" newStyle

newStyle = styles headTag ++ styles'
currTrans = getTransform headTag
newTrans = matrixMultiply trans currTrans
completeTrans = matrixMultiply globalTrans newTrans
alignAttr = styleVal "text-anchor" newStyle
align = if T.null alignAttr
then "start"
else alignAttr
fill = styleVal "fill" newStyle

-- | Create a rectangle from a list of attributes.
parseRect :: Matrix
Expand Down