Is there any way to prohibit dragging flow lines
You can implement a Custom Rule Provider to prevent connection.updateWaypoints
commands from being executed.
Please see this example: https://github.com/bpmn-io/bpmn-js-examples/tree/master/custom-modeling-rules
In the example we provide a rule for shape.create
instead.
In your custom rule logic, you’d just return false in any case.
Thank you for your reply。
I did , but it doesn’t work
import inherits from 'inherits';
import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider';
/**
* A custom rule provider that decides what elements can be
* dropped where based on a `vendor:allowDrop` BPMN extension.
*
* See {@link BpmnRules} for the default implementation
* of BPMN 2.0 modeling rules provided by bpmn-js.
*
* @param {EventBus} eventBus
*/
export default function CustomRules(eventBus) {
RuleProvider.call(this, eventBus);
}
inherits(CustomRules, RuleProvider);
CustomRules.$inject = [ 'eventBus' ];
CustomRules.prototype.init = function() {
debugger
this.addRule('connection.updateWaypoints', function(context) {
return false;
});
};
Well, in your CustomRules.prototype.init
you are actually blocking the main process by calling debugger
. It could be nice if you removed it : )
CustomRules.prototype.init = function() {
this.addRule('connection.updateWaypoints', function(context) {
return false;
});
};
It doesn’t work
Could you demonstrate that with a CodeSandbox please: https://codesandbox.io/s/unruffled-sun-ch6oz?file=/src/index.js
You still need to inject your custom module into bpmn-js as an additional module: How to add additional modules to the Modeler?
Hey,
Thanks for the Sandbox, it was useful!
So I figured it out, all you need to do disable the BendPoints feature and you’re good to go. You don’t even need to create a custom rule.
Just add:
bendpoints: [ 'value', {} ]
to additionalModules
when you are creating the bpmn-js instance.
Here’s the updated Sandbox: https://codesandbox.io/s/charming-lehmann-nr05e
thank you so much.
it works
how to disable move node ?
Could you explain what do you mean by a “move node”? Moving of any shape in general?
For new questions please open a new topic so others can find it.