There is another canConnect()-Function in the BpmnRules() class called: canConnectSequenceFlow()
You must override this method in your CustomRules class and add your own CustomConnection into this canConnectSequenceFlow() method, otherwise your connection will be deleted when you move your CustomElement, because all connections are being validated after a movement. When this connection is not “allowed”, it will be deleted!
It’s seem canConnectSequenceFlow() in BpmnRules was called from ReplaceConnectionHehavios, so, my override canConnectSequenceFlow in my CustomRules is not effected.
As you can see in the custom elements example connections are not lost on elements move. What changes did you make to the example? I see you enabled having sequence flows connecting BPMN elements to custom elements. How did you implement this?
You are right, the canConnectSequenceFlow() is located in the ReplaceConnectionBehavior!!
Did you fix the problem?
My first suggestion is to create your own CustomReplaceConnectionBehaviour and override the canConnectSequenceFlow OR you could create your own “CustomConnection”