diff --git a/src/component/mxgraph/shape/activity-shapes.ts b/src/component/mxgraph/shape/activity-shapes.ts index 266ae3e99a..754dcebaa5 100644 --- a/src/component/mxgraph/shape/activity-shapes.ts +++ b/src/component/mxgraph/shape/activity-shapes.ts @@ -102,7 +102,8 @@ export abstract class BaseActivityShape extends mxRectangleShape { }; paintParameter.canvas.save(); // ensure we can later restore the configuration - // inspired from event-shapes that could be updated to not used "IconPainter.emptyIcon" and not called the function if it is not defined + // refactoring: management of the painter function --> move from "switch" to "map" + // It is inspired from event-shapes const markerPainter = this.iconPainters.get(marker as ShapeBpmnMarkerKind); markerPainter?.(paintParameter); diff --git a/src/component/mxgraph/shape/event-shapes.ts b/src/component/mxgraph/shape/event-shapes.ts index cdd7cc0c54..09ba8a66c9 100644 --- a/src/component/mxgraph/shape/event-shapes.ts +++ b/src/component/mxgraph/shape/event-shapes.ts @@ -102,10 +102,10 @@ export class EventShape extends mxgraph.mxEllipse { } private paintInnerShape(paintParameter: PaintParameter): void { - const paintIcon = - this.iconPainters.get(mxUtils.getValue(this.style, BpmnStyleIdentifier.EVENT_DEFINITION_KIND, ShapeBpmnEventDefinitionKind.NONE)) ?? - (() => this.iconPainter.paintEmptyIcon()); - paintIcon(paintParameter); + // REFACTOR proceed with the same pattern as for the activity markers + // No need to provide a default function calling "IconPainter.emptyIcon". Do not call the undefined function returned by the Map when there is no entry for the event definition kind. + const paintIcon = this.iconPainters.get(mxUtils.getValue(this.style, BpmnStyleIdentifier.EVENT_DEFINITION_KIND, ShapeBpmnEventDefinitionKind.NONE)); + paintIcon?.(paintParameter); } }