From 4c89bccff65c995e4e367d4071ba790ca0ebcb4c Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:42:24 +0100 Subject: [PATCH] IconPainter.paintLoopIcon add comment about why changing impl (fix) --- .../mxgraph/shape/render/icon-painter.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/component/mxgraph/shape/render/icon-painter.ts b/src/component/mxgraph/shape/render/icon-painter.ts index 769a719d03..708cf28eff 100644 --- a/src/component/mxgraph/shape/render/icon-painter.ts +++ b/src/component/mxgraph/shape/render/icon-painter.ts @@ -562,7 +562,22 @@ export class IconPainter { paintLoopIcon(paintParameter: PaintParameter): void { // this implementation is adapted from the draw.io BPMN 'Loop' // https://github.com/jgraph/drawio/blob/9394fb0f1430d2c869865827b2bbef5639f63478/src/main/webapp/stencils/bpmn.xml#L543 + + // FIX side effects: configure paintLoop to not update the iconConfig shared by all markers + // This had a side effects on subsequent markers that needed to be filled (for example, compensation marker). + // Directly set the fillColor of the underlying mxGraph canvas, like this done in + // - paintParallelMultiInstanceIcon + // - paintSequentialMultiInstanceIcon + // As for the multi instance icon, there is no need to make the fill configurable (via iconConfig in PaintParameter) as the + // arrow of the loop must always be filled. + // + // Previous implementation causing issues + // const { iconStyleConfig } = paintParameter; + // iconStyleConfig.fillColor = iconStyleConfig.strokeColor; + const canvas = this.newBpmnCanvas(paintParameter, { width: 22.49, height: 21.62 }); + + // New implementation fixing the problem const { canvas: mxCanvas, iconStyleConfig } = paintParameter; mxCanvas.setFillColor(iconStyleConfig.strokeColor);