-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse all transform #1475
base: master
Are you sure you want to change the base?
Parse all transform #1475
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elescogna the code looks good. I left one comment about handling optional arguments, since you seem to have made good progress on that front. Make sure to update the changelog as well.
Keep me posted on your debugging the issues you found through manual testing 👍
57b7d75
to
a02b873
Compare
@@ -177,6 +177,7 @@ rectToSVG styled courseMap rect | |||
_ -> "" | |||
|
|||
in S.g ! A.id_ (textValue $ sanitizeId $ shapeId_ rect) | |||
! A.transform (stringValue . show . formatTransform $ shapeTransform rect) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the line I added to add the transformation to the new SVG file. It made sense to me looking at how the other attributes were added, though it does not appear to be working as it is now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry I didn't clue into this earlier! This module is used to generate the SVG for the static images (produced when "exporting"), but not the front-end graph rendering. So you should keep these changes, but also I added one commit which adds the changes for the front-end to get the transform
attribute properly applied.
@@ -263,6 +266,7 @@ edgeToSVG styled path = | |||
S.path ! A.id_ (textValue . T.append "path" . pathId_ $ path) | |||
! A.class_ "path" | |||
! A.d (textValue . T.cons 'M' . buildPathString . pathPoints $ path) | |||
! A.transform (stringValue . show . formatTransform $ pathTransform path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am unsure this is the right place to add this line since it is not included in a tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear what you mean by "not included in a tag"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elescogna I did some digging here, but it's a tough problem! First, I added one commit to this branch to incorporate some front-end changes to get the transform
attribute to be properly applied. (So you'll need to pull from this branch to get my latest commit.)
As for the actual intersection issues: I wasn't able to pinpoint the source. There's a problem even for just the raw graph (just translations!). I believe the issue is in how the text and shape intersection code is working (e.g. buildRect
); when I reverted those changes specifically, the original graph looked better, but still not perfect.
One thing I noticed in Svg.Parser
: in parseGraph
, a globalTransform
is being applied to each point in the associated shape/text/path. This is logically incorrect, and this transform should instead be applied to each entitie's individual transform
attribute. I'm not sure if this will itself solve the problem, but you should make this change!
@@ -263,6 +266,7 @@ edgeToSVG styled path = | |||
S.path ! A.id_ (textValue . T.append "path" . pathId_ $ path) | |||
! A.class_ "path" | |||
! A.d (textValue . T.cons 'M' . buildPathString . pathPoints $ path) | |||
! A.transform (stringValue . show . formatTransform $ pathTransform path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear what you mean by "not included in a tag"
@@ -177,6 +177,7 @@ rectToSVG styled courseMap rect | |||
_ -> "" | |||
|
|||
in S.g ! A.id_ (textValue $ sanitizeId $ shapeId_ rect) | |||
! A.transform (stringValue . show . formatTransform $ shapeTransform rect) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah sorry I didn't clue into this earlier! This module is used to generate the SVG for the static images (produced when "exporting"), but not the front-end graph rendering. So you should keep these changes, but also I added one commit which adds the changes for the front-end to get the transform
attribute properly applied.
Proposed Changes
This PR adds new parsers for all types of transformations in SVG files, specifically it adds parsers for
matrix
,rotate
,scale
,skewX
, andskewY
. After parsing the SVG transformations, they are represented as matrices.How I tested my changes:
rotate
,scale
,skewX
, andskewY
, I added some arbitrary transformations to the existing Computer Science graph, and I checked that they were displayed accordingly on the courseography graph page after parsing themmatrix
, I checked that the result remained unvaried when I substituted each of the of the other transformations for their corresponding matrix equivalent....
Screenshots of your changes (if applicable)
Type of Change
(Write an
X
or a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]
into a[x]
in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
(Include any questions or comments you have regarding your changes.)