-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat(style): add support for fill color gradient in the Update Style API #2760
feat(style): add support for fill color gradient in the Update Style API #2760
Conversation
afcd449
to
b1c8756
Compare
7b1b14c
to
91b90b3
Compare
🎊 PR Preview 542e307 has been successfully built and deployed to https://process-analytics-bpmn-visualization-js-demo_preview-pr-2760.surge.sh 🕐 Build time: 0.017s 🤖 By surge-preview |
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 only have minor suggestions for changes
✔️ implementation and tests cover all use cases
✔️ elements-identification.html OK (tested with the surge preview)
* {@link https://jgraph.github.io/mxgraph/docs/js-api/files/util/mxConstants-js.html#mxConstants.STYLE_GRADIENTCOLOR} | ||
* | ||
* **Notes**: | ||
* Using the same color for the start color and end color will have the same effect as setting only the fill color with an HTML color name, HEX code or special keyword. |
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.
praise: 👍🏿
expectedModel.isSwimLaneLabelHorizontal && (style.horizontal = Number(expectedModel.isSwimLaneLabelHorizontal)); | ||
|
||
// ignore marker order, which is only relevant when rendering the shape (it has its own order algorithm) | ||
'markers' in expectedModel && (style.markers = expectedModel.markers.sort()); | ||
style.markers = expectedModel.markers?.sort(); |
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.
nitpick: I don't understand the need for this refactoring and it changes the resulting style object.
Previously the style object didn't contain the properties, not they are set to undefined.
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.
The object returned by buildExpectedShapeCellStyle
will have the markers
property set to undefined
if we either don't set it or explicitly set it to undefined
. Since it is the same returned object, this way of expressing it is easier to read 🙂
export interface ExpectedFill { | ||
color?: string; | ||
opacity?: Opacity; | ||
} |
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.
thought: needed as in the Fill type, the color can be an object and here, the checks expect it to be a string.
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.
If you look my first implementation for the integration tests, I used the same implementation for the update style API.
But, the calculation of what we really test was hidden from the reading of the tests.
As the direction
is not the same value between the API and mxgraph
, I needed to change it.
♻️ PR Preview 542e307 has been successfully destroyed since this PR has been closed. 🤖 By surge-preview |
Kudos, SonarCloud Quality Gate passed! |
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
Thanks
This pull request introduces the ability to use fill color gradients in the Update Style API, improving customization for shapes.
Major changes include:
FillColorGradient
andDirection
, to handle gradient fill colors.The
FillColorGradient
type defines properties for thestartColor
,endColor
anddirection
.The
Direction' type provides options such as
left-to-rightand
bottom-to-top` for specifying the gradient direction.color' property of the
Fill' type, to accept either a solid color string, or a new `FillColorGradient' type.CallActivity
with the fill gradient color.Closes #2559