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] Render Collapsed Embedded Sub-Process #378

Merged
merged 7 commits into from
Jul 6, 2020

Conversation

csouchet
Copy link
Member

@csouchet csouchet commented Jul 1, 2020

Closes #305

Example with sub-process without label bounds

using all_activity_types.bpmn

image

image

With BPMN.io:
image

Example with B.1.0 from migw-test-suite

image

@csouchet csouchet added dependencies Pull requests that update a dependency (dev or runtime) depends on another PR ⚠️ Pull request depending on another one. The depending must be merged first BPMN rendering Something about the way the lib is rendering BPMN elements labels Jul 1, 2020
@csouchet csouchet changed the title 305 render collapsed embedded sub process [FEAT] Render Collapsed Embedded Sub-Process Jul 1, 2020
@csouchet csouchet marked this pull request as ready for review July 1, 2020 15:49
@csouchet csouchet requested review from tbouffard and aibcmars and removed request for tbouffard July 1, 2020 15:49
@csouchet csouchet force-pushed the 305-Render_Collapsed_Embedded_Sub-Process branch 2 times, most recently from a241bf9 to a6954b5 Compare July 1, 2020 16:23
@csouchet csouchet added enhancement New feature or request and removed dependencies Pull requests that update a dependency (dev or runtime) labels Jul 2, 2020
@csouchet csouchet force-pushed the 305-Render_Collapsed_Embedded_Sub-Process branch from a6954b5 to 5aa8371 Compare July 2, 2020 08:31
@tbouffard tbouffard added the rebase needed 💥 Pull request that must be rebased on the latest master commit prior being reviewed or merged label Jul 2, 2020
@tbouffard tbouffard self-assigned this Jul 2, 2020
@tbouffard tbouffard force-pushed the 305-Render_Collapsed_Embedded_Sub-Process branch from 5aa8371 to 0c767e5 Compare July 2, 2020 12:42
@tbouffard tbouffard removed depends on another PR ⚠️ Pull request depending on another one. The depending must be merged first rebase needed 💥 Pull request that must be rebased on the latest master commit prior being reviewed or merged labels Jul 2, 2020
Copy link
Member

@tbouffard tbouffard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stroke of the cross is not large enough which make it render as gray when it is small. I will try to do some tests with largest values later
Some pending questions


public static translateIconToShapeBottomCenter(canvas: mxgraph.mxXmlCanvas2D, shape: ShapeConfiguration, iconSize: Size): void {
const insetW = (shape.w - iconSize.width) / 2;
const insetH = shape.h - iconSize.height - 7;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ where does the -7 comes from? Is this something you found empirically when testing with various BPMN diagrams?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I just test with different values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we can put it in some constant (TASK_SHAPE_BOTTOM_MARGIN)
I do not know If we would have other Flow elements with this plus icon?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
I have also noticed that in BPMN2.0 spec icon is sticked to the bottom

Copy link
Member

@tbouffard tbouffard Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spec states

The Sub-Process marker MUST be a small square with a plus sign (+) inside. The square MUST be positioned at the bottom center of the shape.

A lot of BPMN vendor don't stick it to the bottom, so this seems valid

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aibcmars the other flow using this marker will be the call activity and we aim to reuse the current marker implementation

if (StyleUtils.getBpmnIsExpanded(this.style) === 'false') {
const subProcessKind = StyleUtils.getBpmnSubProcessKind(this.style);
if (subProcessKind === ShapeBpmnSubProcessKind.EMBEDDED) {
const paintParameter = IconPainter.buildPaintParameter((c as unknown) as mxgraph.mxXmlCanvas2D, x, y, w, h, (this as unknown) as mxgraph.mxShape, 0.17, false, 1.5);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ same question about the 0.17 and 1.5 magic numbers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I just test with different values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic numbers for ratios are OK I think - it is more problem of the conversion from SVG -> mxGraph
(however as I remember the ratio params were somewhere in the XML file after generation)
perhaps just adding a comment from where they come can be sufficient

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I calculate myself these numbers, so there is no comment to add.

@tbouffard
Copy link
Member

tbouffard commented Jul 2, 2020

@csouchet I give a try with a stroke of 3 on commit bcab1e2 and here are the comparison with a stroke of 2

all_activity_types.bpmn

overview
01_actvities_cross_rendered_stroke_2_and_3_overview

zoom on the sub-process
02_actvities_cross_rendered_stroke_2_and_3_zoom

B.1.0

03_B 1 0_cross_rendered_stroke_2_and_3

@csouchet
Copy link
Member Author

csouchet commented Jul 2, 2020

@csouchet I give a try with a stroke of 3 on commit bcab1e and here are the comparison with a stroke of 2

I think 3 is too big. Maybe, a value between 2 and 3 is better.

@tbouffard
Copy link
Member

@csouchet new comparison with B.1.0, stroke 2, 2.5 and 3

03_B 1 0_cross_rendered_stroke_2_then_2 5_and_3

04_B 1 0_cross_rendered_stroke_2_then_2 5_and_3_zoom

@tbouffard
Copy link
Member

With stroke of 2 (what we have in bcab1e2) and not rounded. I guess this this the rounded part which adds some fuzziness.
I prefer this configuration: rounded for the outer rectangle, cross not rounded

image

image

@NathalieC
Copy link
Contributor

ok for 2 with "not rounded" option

@csouchet csouchet requested a review from tbouffard July 6, 2020 08:03

public static translateIconToShapeBottomCenter(canvas: mxgraph.mxXmlCanvas2D, shape: ShapeConfiguration, iconSize: Size): void {
const insetW = (shape.w - iconSize.width) / 2;
const insetH = shape.h - iconSize.height - 7;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we can put it in some constant (TASK_SHAPE_BOTTOM_MARGIN)
I do not know If we would have other Flow elements with this plus icon?


public static translateIconToShapeBottomCenter(canvas: mxgraph.mxXmlCanvas2D, shape: ShapeConfiguration, iconSize: Size): void {
const insetW = (shape.w - iconSize.width) / 2;
const insetH = shape.h - iconSize.height - 7;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
I have also noticed that in BPMN2.0 spec icon is sticked to the bottom

if (StyleUtils.getBpmnIsExpanded(this.style) === 'false') {
const subProcessKind = StyleUtils.getBpmnSubProcessKind(this.style);
if (subProcessKind === ShapeBpmnSubProcessKind.EMBEDDED) {
const paintParameter = IconPainter.buildPaintParameter((c as unknown) as mxgraph.mxXmlCanvas2D, x, y, w, h, (this as unknown) as mxgraph.mxShape, 0.17, false, 1.5);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic numbers for ratios are OK I think - it is more problem of the conversion from SVG -> mxGraph
(however as I remember the ratio params were somewhere in the XML file after generation)
perhaps just adding a comment from where they come can be sufficient

@csouchet csouchet merged commit 1275615 into master Jul 6, 2020
@csouchet csouchet deleted the 305-Render_Collapsed_Embedded_Sub-Process branch July 6, 2020 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BPMN rendering Something about the way the lib is rendering BPMN elements enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] Render Collapsed Embedded Sub-Process (Sub-Process)
4 participants