-
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
Draft
elescogna
wants to merge
6
commits into
Courseography:master
Choose a base branch
from
elescogna:parse-all-transform
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Parse all transform #1475
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
142ecad
Temporarily save changes
elescogna 4c59208
Made corrections to parser for additional transformations
elescogna ea0d30c
Parse optional arguments correctly
elescogna 5e7b354
Updated the changelog
elescogna a02b873
Draft of changes to transformations processing
elescogna 045ba76
Support rendering transforms in front-end Graph components
david-yz-liu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,6 +177,7 @@ rectToSVG styled courseMap rect | |
_ -> "" | ||
|
||
in S.g ! A.id_ (textValue $ sanitizeId $ shapeId_ rect) | ||
! A.transform (stringValue . show . formatTransform $ shapeTransform rect) | ||
! A.class_ (textValue class_) | ||
! S.customAttribute "data-group" (textValue | ||
(getArea (shapeId_ rect))) | ||
|
@@ -206,6 +207,7 @@ rectToSVG styled courseMap rect | |
ellipseToSVG :: Bool -> Shape -> S.Svg | ||
ellipseToSVG styled ellipse = | ||
S.g ! A.id_ (textValue (shapeId_ ellipse)) | ||
! A.transform (stringValue . show . formatTransform $ shapeTransform ellipse) | ||
! A.class_ "bool" $ do | ||
S.ellipse ! A.cx (stringValue . show . fst $ shapePos ellipse) | ||
! A.cy (stringValue . show . snd $ shapePos ellipse) | ||
|
@@ -227,6 +229,7 @@ textToSVG styled type_ xPos' text = | |
then xPos | ||
else xPos') | ||
! A.y (stringValue $ show yPos) | ||
! A.transform (stringValue . show . formatTransform $ textTransform text) | ||
! (if styled then allStyles else baseStyles) | ||
$ toMarkup $ textText text | ||
where | ||
|
@@ -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 commentThe 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 commentThe 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" |
||
! A.markerEnd "url(#arrow)" | ||
! S.customAttribute "data-source-node" (textValue $ sanitizeId | ||
$ pathSource path) | ||
|
@@ -284,6 +288,7 @@ regionToSVG styled path = | |
S.path ! A.id_ (textValue $ T.append "region" (pathId_ path)) | ||
! A.class_ "region" | ||
! A.d (textValue . T.cons 'M' . buildPathString . pathPoints $ path) | ||
! A.transform (stringValue . show . formatTransform $ pathTransform path) | ||
! A.style (textValue $ T.concat ["fill:", pathFill path, ";", | ||
if styled | ||
then | ||
|
@@ -331,3 +336,9 @@ areaMap = M.fromList | |
"csc485", "csc486"], (aiDark, "ai")), | ||
(["csc104", "csc120", "csc108", "csc148"], (introDark, "intro")), | ||
(["calc1", "calc2", "alg1", "sta1", "sta2"], (mathDark, "math"))] | ||
|
||
|
||
-- Format SVG transform correctly from database | ||
formatTransform :: [Double] -> String | ||
formatTransform [a, b, c, d, e, f] = "matrix(" ++ unwords (map show [a, b, c, d, e, f]) ++ ")" | ||
formatTransform _ = error "Transform is expected to be stored in the form [a,b,c,d,e,f]" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.