@nikku
I have implement an new RuleProvider and would like to append(add) some restriction(rule).
but I found the code below would override all the “connection.create” rule. How can I add the origin rule back?
this.addRule('connection.create', HIGH_PRIORITY, function(context) {
var source = context.source,
target = context.target;
//return is(source, 'bpmn:ExclusiveGateway');
return some condition;
});
Rule provides may either give the final yes or no decision or indicate that evaluation should continued by returning nothing (i.e. via empty return statement).
Our documentation was actually wrong about this and I corrected it. Take a look at the RuleProvider.
Have a look at the example we provide there:
/**
* Return `true`, `false` or nothing to denote
* _allowed_, _not allowed_ and _continue evaluating_.
*/
this.addRule('shape.resize', function(context) {
var shape = context.shape;
if (!context.newBounds) {
// check general resizability
if (!shape.resizable) {
return false;
}
// not returning anything (read: undefined)
// will continue the evaluation of other rules
// (with lower priority)
return;
} else {
// element must have minimum size of 10*10 points
return context.newBounds.width > 10 && context.newBounds.height > 10;
}
});