Skip to content

Commit

Permalink
fix(connect-snapping): snap to sub process mid
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme authored and fake-join[bot] committed Sep 13, 2019
1 parent dcf440b commit 83e9f05
Show file tree
Hide file tree
Showing 3 changed files with 235 additions and 188 deletions.
4 changes: 2 additions & 2 deletions lib/features/snapping/BpmnConnectSnapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ export default function BpmnConnectSnapping(eventBus, rules) {
// snap source
context.sourcePosition = mid(source);

if (isAny(target, ['bpmn:Event', 'bpmn:Gateway'])) {
if (isAny(target, [ 'bpmn:Event', 'bpmn:Gateway' ])) {
snapToPosition(event, mid(target));
}

if (is(target, 'bpmn:Task')) {
if (isAny(target, [ 'bpmn:Task', 'bpmn:SubProcess' ])) {
snapToTaskMid(event, target);
}

Expand Down
66 changes: 37 additions & 29 deletions test/spec/features/snapping/BpmnConnectSnapping.bpmn
Original file line number Diff line number Diff line change
Expand Up @@ -6,78 +6,86 @@
<bpmn:participant id="Participant_3" processRef="Process_3" />
</bpmn:collaboration>
<bpmn:process id="Process_1" isExecutable="true">
<bpmn:endEvent id="EndEvent_1" />
<bpmn:dataObjectReference id="DataObjectReference_1" dataObjectRef="DataObject_16xfc7e" />
<bpmn:dataObject id="DataObject_16xfc7e" />
<bpmn:exclusiveGateway id="Gateway_1" />
<bpmn:subProcess id="SubProcess" />
<bpmn:boundaryEvent id="BoundaryEvent" attachedToRef="SubProcess" />
<bpmn:boundaryEvent id="BoundaryEventRight" attachedToRef="SubProcess" />
<bpmn:boundaryEvent id="BoundaryEvent_Right" attachedToRef="SubProcess" />
<bpmn:boundaryEvent id="BoundaryEvent_Bottom" attachedToRef="SubProcess" />
<bpmn:startEvent id="StartEvent_1" />
<bpmn:exclusiveGateway id="Gateway_1" />
<bpmn:endEvent id="EndEvent_1" />
<bpmn:task id="Task_1" />
<bpmn:dataObjectReference id="DataObjectReference_1" dataObjectRef="DataObject_16xfc7e" />
<bpmn:dataObject id="DataObject_16xfc7e" />
</bpmn:process>
<bpmn:process id="Process_2" isExecutable="false">
<bpmn:task id="Task_2" />
<bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1">
<bpmn:messageEventDefinition />
</bpmn:intermediateCatchEvent>
<bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1">
<bpmn:messageEventDefinition />
</bpmn:intermediateThrowEvent>
<bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1">
<bpmn:messageEventDefinition />
</bpmn:intermediateCatchEvent>
<bpmn:task id="Task_2" />
</bpmn:process>
<bpmn:process id="Process_3" isExecutable="false">
<bpmn:startEvent id="StartEvent_2" />
<bpmn:startEvent id="StartEvent_3" />
<bpmn:task id="Task_3" />
<bpmn:subProcess id="SubProcess_1" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1">
<bpmndi:BPMNShape id="Participant_03743bx_di" bpmnElement="Participant_1" isHorizontal="true">
<dc:Bounds x="32" y="61.5" width="800" height="383" />
<dc:Bounds x="0" y="0" width="800" height="383" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="82" y="82" width="36" height="36" />
<dc:Bounds x="62" y="32" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1fetlei_di" bpmnElement="EndEvent_1">
<dc:Bounds x="182" y="182" width="36" height="36" />
<dc:Bounds x="62" y="222" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_0ed1rn5_di" bpmnElement="Task_1">
<dc:Bounds x="250" y="260" width="100" height="80" />
<dc:Bounds x="200" y="200" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataObjectReference_0pf2ezq_di" bpmnElement="DataObjectReference_1">
<dc:Bounds x="382" y="375" width="36" height="50" />
<dc:Bounds x="562" y="285" width="36" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Participant_1ooemal_di" bpmnElement="Participant_2" isHorizontal="true">
<dc:Bounds x="32" y="479" width="600" height="250" />
<dc:Bounds x="0" y="420" width="600" height="250" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_0iwlfts_di" bpmnElement="Task_2">
<dc:Bounds x="350" y="560" width="100" height="80" />
<dc:Bounds x="370" y="510" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_08covmw_di" bpmnElement="IntermediateCatchEvent_1">
<dc:Bounds x="182" y="582" width="36" height="36" />
<dc:Bounds x="162" y="532" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateThrowEvent_1jsmhky_di" bpmnElement="IntermediateThrowEvent_1">
<dc:Bounds x="82" y="582" width="36" height="36" />
<dc:Bounds x="52" y="532" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_di" bpmnElement="SubProcess" isExpanded="true">
<dc:Bounds x="411" y="100" width="350" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BoundaryEvent_di" bpmnElement="BoundaryEvent">
<dc:Bounds x="582" y="282" width="36" height="36" />
<dc:Bounds x="400" y="30" width="360" height="170" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BoundaryEventRight_di" bpmnElement="BoundaryEventRight">
<dc:Bounds x="743" y="200" width="36" height="36" />
<bpmndi:BPMNShape id="BoundaryEvent_di" bpmnElement="BoundaryEvent_Bottom">
<dc:Bounds x="572" y="182" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1nir8te_di" bpmnElement="Gateway_1" isMarkerVisible="true">
<dc:Bounds x="299" y="75" width="50" height="50" />
<dc:Bounds x="225" y="25" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Participant_0echqt5_di" bpmnElement="Participant_3" isHorizontal="true">
<dc:Bounds x="32" y="760" width="600" height="250" />
<dc:Bounds x="0" y="710" width="600" height="430" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0dv3wii_di" bpmnElement="StartEvent_2">
<dc:Bounds x="82" y="877" width="36" height="36" />
<dc:Bounds x="62" y="827" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_04e4734_di" bpmnElement="Task_3">
<dc:Bounds x="170" y="855" width="100" height="80" />
<dc:Bounds x="150" y="805" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0wio031_di" bpmnElement="StartEvent_3">
<dc:Bounds x="62" y="1007" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_0c0l60x_di" bpmnElement="SubProcess_1" isExpanded="true">
<dc:Bounds x="150" y="925" width="350" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BoundaryEventRight_di" bpmnElement="BoundaryEvent_Right">
<dc:Bounds x="742" y="112" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
Expand Down
Loading

0 comments on commit 83e9f05

Please sign in to comment.