Skip to content

Commit

Permalink
IconPainter.paintLoopIcon add comment about why changing impl (fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbouffard committed Mar 6, 2024
1 parent 8ab5806 commit b4d50a4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/component/mxgraph/shape/render/icon-painter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit b4d50a4

Please sign in to comment.