Skip to content
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] Add a new API to reset the modified style of given elements via APIs #2458

Closed
csouchet opened this issue Jan 16, 2023 · 0 comments · Fixed by #2732
Closed

[FEAT] Add a new API to reset the modified style of given elements via APIs #2458

csouchet opened this issue Jan 16, 2023 · 0 comments · Fixed by #2732
Assignees
Labels
BPMN diagram styling Change the standard rendering: stroke color, thickness enhancement New feature or request
Milestone

Comments

@csouchet
Copy link
Member

csouchet commented Jan 16, 2023

Is your feature request related to a problem? Please describe.

#1030 lets change the style of an element. Some use cases requires to reset the whole modifications applied to the element

  • highlight on mouse hover
  • switching from a data representation to another: the 2 representations don't need to customize the same style properties and may not know each other, so a reset should occur prior switching.

Describe the solution you'd like

Introduce a new API method that allows you to reset the style of an element or a list of elements as they were defined before any modification.

In the same class as for the "Update Style" API (see #1030)

resetStyle(bpmnElementIds?: string | string[]): void

Calling the method without argument will reset the style on all elements.
This signature matches the removeAllCssClasses signature (#2576) and the removeAllOverlays signature (#2577).

Additional Context

The implementation will depend on how mxGraph stores the styles in the model.

Prerequisites:

  • How does mxGraph store styles and compute them?
  • How to manipulate the style? State object or model object?
  • How to make style changes?
  • How can we reset to the initial style?

Experimentation done in the POC #2539

Alternative

Use the same logic as in #2574
Set all properties to null in the mxGraph style.
As explained in #2574, this will cause side effects for the font if the BPMN diagram defined a LabelStyle for the BPMN element whose style is updated (could work if label style is ignored, see #2468).
In addition, this won't let support the reset on all elements: we wouldn't register the update elements so we would have to apply the reset to all elements of the diagram instead on only these that have actually been updated.

@csouchet csouchet added the enhancement New feature or request label Jan 16, 2023
@csouchet csouchet added this to the 0.29.2 milestone Jan 16, 2023
@csouchet csouchet moved this to Q2 in Roadmap 2023 Jan 16, 2023
@tbouffard tbouffard changed the title [FEAT] Add a new API to reset the modified style via APIs [FEAT] Add a new API to reset the modified style of a givent element via APIs Jan 16, 2023
@tbouffard tbouffard added the BPMN diagram styling Change the standard rendering: stroke color, thickness label Jan 16, 2023
@tbouffard tbouffard changed the title [FEAT] Add a new API to reset the modified style of a givent element via APIs [FEAT] Add a new API to reset the modified style of given elements via APIs Feb 22, 2023
@tbouffard tbouffard moved this from In Progress to Todo in Roadmap 2023 Feb 22, 2023
@csouchet csouchet self-assigned this May 25, 2023
@csouchet csouchet moved this from Todo to In Progress in Roadmap 2023 May 25, 2023
@csouchet csouchet removed this from the 0.36.0 milestone Jun 12, 2023
@csouchet csouchet added this to the 0.37.0 milestone Jun 12, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Roadmap 2023 Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BPMN diagram styling Change the standard rendering: stroke color, thickness enhancement New feature or request
Projects
Archived in project
2 participants