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

[BUG] The label's position of the exclusiveGateway element is incorrect #2306

Closed
13322211021 opened this issue Oct 19, 2022 · 5 comments
Closed
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@13322211021
Copy link

13322211021 commented Oct 19, 2022

Describe the bug
The exclusiveGateway label is far from the exclusiveGateway element.

To Reproduce
Please render the the test.txt(please change the suffix to .bpmn).

Screenshots
bpmn-visualization screenshot
image

bpmn-io screenshot
image

Desktop (please complete the following information):

  • OS: [Mac iOS]
  • Browser [chrome]
  • Version [0.27.1]
@13322211021 13322211021 added the bug Something isn't working label Oct 19, 2022
@tbouffard
Copy link
Member

tbouffard commented Oct 20, 2022

Hi @13322211021
There are no label bounds in the BPMN diagram provided in the description of the issue. So, what you see are the default positions of the gateway labels.
bpmn-js places them above the gateway whereas bpmn-visualization places them at the top left. This applies to all gateway kinds and not only to exclusive gateways.

Here is how bpmn-visualization places labels by default 👇. The screenshot is taken from the non regression visual tests for version 0.27.1. Default positions haven't changed for a while, so if you are still using v0.20.1 because of #2221, defaults are the same.

bpmn-visualization@0.27.1 labels default position

Labels are supposed to be positioned at modeling time, so please consider the default positions as a fallback.
For bpmn-visualization, we chose a tradeoff to handle short and large labels. However, for short labels, they are not placed very close to the gateway.

Here are a comparison of default positions for large labels using gateway_label_default_positions_large_labels.bpmn.txt

bpmn-js bpmn-visualization
bpmn-js bpmn-visualization_0 27 1

@tbouffard tbouffard added the wontfix This will not be worked on label Oct 20, 2022
@tbouffard
Copy link
Member

tbouffard commented Oct 20, 2022

The default position of gateway labels is defined here:

ShapeUtil.gatewayKinds().forEach(kind => {
const style: StyleMap = {};
style[mxgraph.mxConstants.STYLE_SHAPE] = kind;
style[mxgraph.mxConstants.STYLE_PERIMETER] = mxgraph.mxPerimeter.RhombusPerimeter;
style[mxgraph.mxConstants.STYLE_STROKEWIDTH] = StyleDefault.STROKE_WIDTH_THIN;
style[mxgraph.mxConstants.STYLE_VERTICAL_ALIGN] = mxgraph.mxConstants.ALIGN_TOP;
// Default label positioning
style[mxgraph.mxConstants.STYLE_LABEL_POSITION] = mxgraph.mxConstants.ALIGN_LEFT;
style[mxgraph.mxConstants.STYLE_VERTICAL_LABEL_POSITION] = mxgraph.mxConstants.ALIGN_TOP;
this.putCellStyle(kind, style);
});

It is possible to change these defaults by overriding the mxGraph style applied to gateways

// assuming that bpmnVisualization is the instance of bpmn-visualization in the application
// get the mxGraph stylesheet
const styleSheet = bpmnVisualization.graph.getStylesheet()

// let's apply the changes to all kind of gateways
ShapeUtil.gatewayKinds().forEach(kind => {
  const style = styleSheet.styles[kind];
  delete style['labelPosition'];
  delete style['verticalLabelPosition'];
}

See also https://github.com/process-analytics/bpmn-visualization-examples/blob/v0.27.1/examples/custom-bpmn-theme/custom-colors/index.js for more ways to customize styles.

@tbouffard
Copy link
Member

tbouffard commented Oct 20, 2022

In conclusion, feel free to continue to open up these kinds of issues in the future. It is often difficult to understand why there are differences in rendering between BPMN tools, so it is always useful to ask or report a bug.

Recently, another user opened one about the same topic: #2253.
These questions help clarify the behavior and will help all users better understand the internals of bpmn-visualization 😃

@13322211021
Copy link
Author

Thanks for your quick reply, I will try it.

@tbouffard tbouffard closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2022
@tbouffard
Copy link
Member

Closing as this is not a bug.
Feel free to post new comments if you have more questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants