From 9c4e975cd483bdc3073f0a666001109b5c64a11e Mon Sep 17 00:00:00 2001 From: Thomas Bouffard <27200110+tbouffard@users.noreply.github.com> Date: Mon, 4 Mar 2024 17:41:13 +0100 Subject: [PATCH] simplify implementation --- src/component/mxgraph/shape/activity-shapes.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/component/mxgraph/shape/activity-shapes.ts b/src/component/mxgraph/shape/activity-shapes.ts index ce54915d74..ac942e17c5 100644 --- a/src/component/mxgraph/shape/activity-shapes.ts +++ b/src/component/mxgraph/shape/activity-shapes.ts @@ -27,15 +27,15 @@ import { orderActivityMarkers } from './render/utils'; function getMarkerIconOriginFunction(numberOfMarkers: number, markerPosition: number): (canvas: BpmnCanvas) => void { // work for 1, 2, 3 and 4 markers - const middleValue = (numberOfMarkers + 1) / 2; - if (markerPosition == middleValue) { + + // middle marker + if (markerPosition == (numberOfMarkers + 1) / 2) { return (canvas: BpmnCanvas) => canvas.setIconOriginForIconBottomCentered(); } - const translationFactor = 2 * markerPosition - (numberOfMarkers + 1); return (canvas: BpmnCanvas) => { canvas.setIconOriginForIconBottomCentered(); - const xTranslation = translationFactor * (StyleDefault.SHAPE_ACTIVITY_MARKER_ICON_SIZE + StyleDefault.SHAPE_ACTIVITY_MARKER_ICON_MARGIN) / 2; + const xTranslation = ((2 * markerPosition - (numberOfMarkers + 1)) * (StyleDefault.SHAPE_ACTIVITY_MARKER_ICON_SIZE + StyleDefault.SHAPE_ACTIVITY_MARKER_ICON_MARGIN)) / 2; canvas.translateIconOrigin(xTranslation, 0); }; }