Skip to content

Commit

Permalink
WIP markers position generalization: same for 1 and 3 markers
Browse files Browse the repository at this point in the history
  • Loading branch information
tbouffard committed Mar 4, 2024
1 parent 81b44eb commit 57f08f0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/component/mxgraph/shape/activity-shapes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,19 @@ import { orderActivityMarkers } from './render/utils';

function getMarkerIconOriginFunction(numberOfMarkers: number, markerPosition: number): (canvas: BpmnCanvas) => void {
let setIconOriginFunction: (canvas: BpmnCanvas) => void;
if (numberOfMarkers === 1) {
setIconOriginFunction = (canvas: BpmnCanvas) => canvas.setIconOriginForIconBottomCentered();
} else if (numberOfMarkers === 2) {
// if (numberOfMarkers === 1) {
// setIconOriginFunction = (canvas: BpmnCanvas) => canvas.setIconOriginForIconBottomCentered();
// } else
if (numberOfMarkers === 2) {
const translationFactor = Math.pow(-1, markerPosition);
setIconOriginFunction = (canvas: BpmnCanvas) => {
canvas.setIconOriginForIconBottomCentered();
// TODO the margin value should be divided by 2. See issue about reviewing the margin of the markers
// what should be done: 1st element translate from half margin on the left, 2nd element translated from half margin on the right
// --> resulting margin: ratio 1. Here we have a double margin between elements
// TODO the size of the marker is not enforced, the size depends on the implementation of the painted marker (try with triangle which is larger that 16 and it is not inside the activity)
// The SHAPE_ACTIVITY_MARKER_ICON_SIZE value is 20 but it should be 16 according to the current implementation
const xTranslation = Math.pow(-1, markerPosition) * (StyleDefault.SHAPE_ACTIVITY_MARKER_ICON_SIZE / 2 + StyleDefault.SHAPE_ACTIVITY_MARKER_ICON_MARGIN);
const xTranslation = translationFactor * (StyleDefault.SHAPE_ACTIVITY_MARKER_ICON_SIZE / 2 + StyleDefault.SHAPE_ACTIVITY_MARKER_ICON_MARGIN);
canvas.translateIconOrigin(xTranslation, 0);
};
}
Expand Down Expand Up @@ -107,6 +109,7 @@ export abstract class BaseActivityShape extends mxRectangleShape {
}
case ShapeBpmnMarkerKind.ADHOC: {
this.iconPainter.paintAdHocIcon(paintParameter);
// this.iconPainter.paintExpandIcon(paintParameter);
break;
}
}
Expand Down

0 comments on commit 57f08f0

Please sign in to comment.