Gokul Maha
Gokul Maha

Reputation: 298

How to prevent double click on a JointJs Rectangle?

I am developing a simple graphic tool using JointJs. while double clicking on a element will executes a function. How to prevent double click event for rectangle.

Already tried the below snippet but I need to drag the rectangle

rect: { 
          style: { 'pointer-events': 'none' }
      }

Upvotes: 0

Views: 664

Answers (1)

vt.
vt.

Reputation: 1428

paper.on('cell:pointerdblclick', function(cellView) {

    if (cellView.model.get('type') === 'basic.Rect') {
        return;
    }

    console.log("not a rect")
});

or, using css:

.joint-element[data-type="basic.Rect"] {
    pointer-events: none;
}

Upvotes: 1

Related Questions