MohammadMu99 opened a new pull request, #4015: URL: https://github.com/apache/incubator-kie-tools/pull/4015
Closes https://github.com/apache/incubator-kie-issues/issues/2401 ## Summary Sequence Flow labels in the BPMN Editor are positioned automatically and can't be moved. When a gateway has several outgoing flows, the labels overlap near the gateway, and it is hard to tell which label belongs to which flow. This PR lets users drag a Sequence Flow label to a new position. The position is saved as standard BPMN DI, so it is kept after saving and reopening the file: ```xml <bpmndi:BPMNEdge id="..." bpmnElement="..."> <di:waypoint x="739" y="196"/> <di:waypoint x="739" y="292"/> <bpmndi:BPMNLabel id="..."> <dc:Bounds x="718.8" y="231.8" width="78" height="31"/> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> ``` ## Behavior - Drag a label to move it. The model is updated once on drop (one undo step). Escape cancels the drag. - Pressing a label selects its Sequence Flow. - Labels without saved bounds keep the current automatic position, so existing diagrams look the same. - A moved label keeps its place relative to its line when the line changes: moving or resizing connected nodes, adding, moving or removing waypoints, reconnecting the edge, and copy/paste. - Labels can't be moved when the editor is read-only. ## Changes - `mutations/repositionEdgeLabel.ts` (new): saves the label bounds, and recalculates them when the edge waypoints change. - `diagram/edges/Edges.tsx`, `Edges.css`: label dragging on Sequence Flow edges. - `repositionNode.ts`, `resizeNode.ts`, `addEdgeWaypoint.ts`, `deleteEdgeWaypoint.ts`, `repositionEdgeWaypoint.ts`, `addEdge.ts`, `BpmnDiagram.tsx`, `clipboard/offsetPastedNodes.ts`: keep a moved label attached to its edge. - Most of the `BpmnDiagram.tsx` diff is Prettier re-indentation, because `onNodeRepositioned` got a new dependency. ## Tests - Added `tests-e2e/flowElements/moveSequenceFlowLabel.spec.ts`: - moving a label saves its position; - a moved label stays next to its Sequence Flow when a connected node moves. - Added `getLabel`/`moveLabel` to the edges fixture and `getEdge` to the jsonModel fixture. - BPMN Editor E2E suite run locally on Chromium (Windows): 284 passed, 1 skipped (already skipped upstream). - Screenshot comparisons were not run locally. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
