ArrowDecorator as default drag connection

227 views Asked by At

How to set ArrowDecorator as default connection decorator?

When a new instance is created by the "draw2d.policy.connection.ConnectionCreatePolicy", I want it to be decorated by the ArrowDecorator.

What is the best way to do this without modifying the code base? Currently I am just changing to code base by setting the target decorator in Connection.js

targetDecorator =  new draw2d.decoration.connection.ArrowDecorator()
1

There are 1 answers

0
Kshitiz Shakya On

Found the answer. Use the following code.

     canvas.installEditPolicy(  new draw2d.policy.connection.DragConnectionCreatePolicy({
        createConnection: function() {
            // return my special kind of connection
            var con =  new draw2d.Connection({
                targetDecorator: new draw2d.decoration.connection.ArrowDecorator()
            });
            return con;
        }
     }));   //canvas.add(c);