Hello everyone!
I tried to implement a rule where I allow to move boundary elements along the boundary but it is not allowed to be not attached anymore. So every event has to be attached.
I tried the following:
function canMove(context){
var shapes = context.shape,
target = context.target,
source = context.source,
position = context.position;
var businessObject = context.shapes[0].businessObject;
if(target != undefined){
var targetBusinessObject = target.businessObject;
console.log(context.shapes[0].host);
if(context.shapes[0].type === 'bpmn:BoundaryEvent' && (context.shapes[0].host === 'undefined' || context.shapes[0].host === null || context.shapes[0].host)) {
//if(is(context.shapes[0], "bpmn:BoundaryEvent")){
return false;
}}
}
this.addRule('elements.move', 4000, function(context) {
return canMove(context);
});
The problem is that this code forbids the complete movement of events. Has anyone any idea how I can fix it?
Martin
March 6, 2023, 2:48pm
2
Hi @TestUser ,
When you mention moving, do you mean moving with the arrow keys? Than this is the related issue on github:
opened 10:46AM - 13 Jan 23 UTC
bug
modeling
good first issue
pr welcome
backlog
__Describe the Bug__
Given I have an error boundary event, when I press arrow… keys, I can create an intermediate error catch event which is not allowed in BPMN.
https://user-images.githubusercontent.com/28307541/212301657-da2554cb-9691-4f63-9b1c-efc4f61764d9.mov
__Steps to Reproduce__
1. Create an error boundary event and select it
2. Press arrow keys to detach it
3. ???
<!--
If you report a modeling related issue, ensure you can reproduce it on [demo.bpmn.io](https://demo.bpmn.io/new)
When reporting a library error, try to build an example that reproduces your problem. You can use our playgrounds for [viewer](https://jsfiddle.net/07envcu1/) or [modeler](https://jsfiddle.net/bg97r61t/) as a starting point or put a demo up on [GitHub](https://github.com/) for inspection.
-->
__Expected Behavior__
No such stuff is allowed. Either error event definition should be dropped, or the action should be ignored (element should not move).
__Environment__
- Browser: [e.g. IE 11, Chrome 69]
- OS: [e.g. Windows 7]
- Library version: [e.g. 2.0.0]
Unfortunately, the Keyboard Move Selection
does not handle attachments at all at the moment. The fix for this is unfortunately a bit more complicated than a rule.
If you want, have a look at the issue. We are always happy about community contributions
1 Like
system
Closed
March 13, 2023, 2:49pm
3
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.