Luca D
Luca D

Reputation: 11

Prevent adding vertex to link when clicking on label

I want to change the behaviour of jointjs link/vertex:

I want to not add vertex to link when user click on LABELS, otherwise the link adds a vertex.

I tryed with interactive options of paper without success...

Thank you

Upvotes: 0

Views: 123

Answers (1)

Luca D
Luca D

Reputation: 11

Solved: in Paper.options:

linkView: joint.dia.LinkView.extend({
                pointerclick: function (evt, x, y) {
                    if (V(evt.target).hasClass('connection') || V(evt.target).hasClass('connection-wrap')) {
                        this.addVertex({x: x, y: y});
                    }
                }
            }),

...and...

interactive: function (cellView) {
                if (cellView.model.isLink()) {
                    // Disable the default vertex add functionality on pointerdown on Label
                    return {vertexAdd: false};
                }
                return true;
            }});

Upvotes: 1

Related Questions