Closed csouchet closed 1 year ago
Prerequisite:
mxGraph examples that dynamically change the style of elements, once one or several elements are selected
See https://github.com/process-analytics/bpmn-visualization-pm4py/issues/3 and https://github.com/process-analytics/bpmn-visualization-pm4py/issues/15
When using model.setStyle
, the activities are not rounded anymore. Is it because the rounded property is hard coded in the shape source code and not configured with a style property?
We are setting the property direcly in the state.style
and not on the style of the cell in the model, because otherwise it wasn't applied. This is mentioned in https://github.com/process-analytics/bpmn-visualization-js/issues/942#issuecomment-768345971.
Here are some details of the way we iterate to find a working implementation. The following seemed not working:
Is your feature request related to a problem? Please describe.
We want to customize a Shape/Edge giving the CSS content programmatically, and not with the CSS class (already managed by #942).
Describe the solution you'd like
To do that, we can do something like done on the G6 Shape.
POC
2539
Decisions
For a first iteration, we decided to have this method as API signature:
This method will be available in the
BpmnElementsRegistry
class. We currently store all the methods related to the manipulation of the elements there. So let's continue to be consistent. We will probably change all the API locations in the future, so there is no need to add a dedicated API object at this time.Property signatures
Notes:
Properties
Common
mxConstants.STYLE_LABEL_WIDTH
mxConstants.STYLE_LABEL_POSITION
mxConstants.STYLE_VERTICAL_LABEL_POSITION
mxConstants.STYLE_LABEL_BACKGROUNDCOLOR
mxConstants.STYLE_LABEL_BORDERCOLOR
mxConstants.STYLE_LABEL_PADDING
Shape
lane
/pool
, as for their label.stroke color
andfill color
lane
andpool
: The behavior is very weird. Dash on the separator, but we don"t choose to dash it.:x: So, we decided to not implement it.
mxConstants.STYLE_SPACING
mxConstants.STYLE_SPACING_TOP
mxConstants.STYLE_SPACING_LEFT
mxConstants.STYLE_SPACING_BOTTOM
mxConstants.STYLE_SPACING_RIGHT
Edge
start fill
)envelope
See
BpmnConnector
:c.setFillColor(mxgraph.mxUtils.getValue(this.style, BpmnStyleIdentifier.EDGE_START_FILL_COLOR, this.stroke));
Tests to implement
As for the API managing the CSS class and the Overlays, we will privilege integration tests over visualization tests. In integration tests, we check that the mxGraph model is updated correctly when setting the style. We can easily check all properties and corner cases. In visual tests, we check that the style is actually updated. We will limit them to a few use cases: this is enough to ensure that we correctly call all the required mxGraph functions. Have as few visualization tests as possible as they are slow to run and harder to maintain that integration tests.
New features that will follow
Non exhaustive list. Here is some features that are already considered:
2558
2559