-
Notifications
You must be signed in to change notification settings - Fork 19
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
refactor: simplify reset of StyleDefault #505
Conversation
Introduce a shared function capable of resetting StyleDefault independently of the values that have been overridden.
b268079
to
56deae6
Compare
for (let key of Object.keys(bpmnvisu.StyleDefault)) { | ||
bpmnvisu.StyleDefault[key] = originalStyleDefault[key]; | ||
} |
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: this is the only implementation I've managed to get to work.
For example, the following has no effect. For example, the following has no effect. There's probably a good reason for this, but I haven't looked into it, because I've found another solution.
bpmnvisu.StyleDefault = { ...bpmnvisu.StyleDefault };
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 normal to have no effect, if we set a variable with its own value 😄
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.
Well, I put the wrong code snippet 😸 , I meant
bpmnvisu.StyleDefault = { ...originalStyleDefault };
Introduce a shared function capable of resetting
StyleDefault
independently of the values that have been overridden.This simplifies the code: it is no longer necessary to save and then manually restore the values that are modified in each example.
Live environment of examples
https://cdn.statically.io/gh/process-analytics/bpmn-visualization-examples/ba1eccd/examples/index.html
Previous urls
Notes
Also created to test that the new StyleDefault implementation is still working. See process-analytics/bpmn-visualization-js#2728