-
Notifications
You must be signed in to change notification settings - Fork 41
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
188616847 stroke point plot background color import/export V2 #1802
Conversation
…ormats that are exported with graphs.
Adds isTransparent to list of format properties exported.
Adds point transparency, and stroke transparency to items imported to V2 Removes legend graphs from graph format test document
Adds plotBackgroundOpacity to data display content model Adds plotBackgroundOpacity import and export
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1802 +/- ##
==========================================
+ Coverage 84.66% 85.81% +1.15%
==========================================
Files 633 633
Lines 32585 32621 +36
Branches 8507 9151 +644
==========================================
+ Hits 27587 27994 +407
+ Misses 4842 4288 -554
- Partials 156 339 +183
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
codap-v3
|
Project |
codap-v3
|
Branch Review |
main
|
Run status |
|
Run duration | 01m 47s |
Commit |
|
Committer | eireland |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
3
|
View all changes introduced in this branch ↗︎ |
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.
👍 LGTM -- I added a commit which tweaked some of the types and moved some of the graph-specific logic from color-utils
to v2-graph-exporter
. Note the remaining comments/questions.
? 0.4 : getTransparency(graph.pointDescription.pointStrokeColor, "stroke"), | ||
pointSizeMultiplier: graph.pointDescription.pointSizeMultiplier, | ||
strokeSameAsFill: graph.pointDescription.pointStrokeSameAsFill, | ||
plotBackgroundColor: graph.plotBackgroundColor === "#FFFFFF" |
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.
Do we need to worry about other variations (e.g. #ffffff
or white
?) or is this string canonicalized to this format?
@@ -230,13 +232,39 @@ function getPlotModels(graph: IGraphContentModel): Partial<ICodapV2GraphStorage> | |||
return storage | |||
} | |||
|
|||
const getTransparency = (color: string, type: "point" | "stroke") => { | |||
const rgbaColor = colord(color).toRgb() | |||
return rgbaColor.a ?? (type === "point" ? 0.84 : 1) |
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 moved this function here because it contains graph-specific logic rather than something appropriate to all clients of color-utils
. That said, in practice it doesn't matter because toRgb()
is documented to always return an alpha, so the ?? (type === "point" ? 0.84 : 1)
will never have any effect. If there are some circumstances in which 0.84
should be returned, then the logic will need to be clarified.
@kswenson I tweaked the code based on your comments. |
Adds import from V2 and export to V2 for graph: