Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JointJS Non-interactive elements

Tags:

jointjs

I want to disable the movement of elements and links in JointJS Diagrams while keeping alive other featurs like hyperlinking of elements and highlighting of link on mouse:hover. I referred to the following links: https://groups.google.com/forum/#!searchin/jointjs/drag/jointjs/R0KZwKqfRbI/rGLJz3t4Un0J https://groups.google.com/forum/#!searchin/jointjs/read$20only/jointjs/o8CKU6N7EOI/1KGNFCQQHGUJ

But they didn't help me. I tried: paper.$el.css('pointer-events', 'none'); But it disables everything. I want to disable only element and link dragging

like image 427
Lahore Avatar asked Jun 03 '14 13:06

Lahore


2 Answers

Assuming that I understand you correctly than the 2nd link should give you the answer. You simply have to make the paper non-interactive:

var paper = new joint.dia.Paper({
    el: '#paper',
    width: 500,
    height: 500,
    gridSize: 1,
    graph: new joint.dia.Graph,
    interactive: false
});

This should disable any movement of elements/links/vertices while maintaining the highlighting features.

like image 90
ckuepker Avatar answered Sep 28 '22 13:09

ckuepker


paper.$el.css('pointer-events', 'none');

will disable the movement of everything on paper. If you want to disable the movement of specific element,use it.

element.attr({rect:{style:{'pointer-events':'none'}}});

Detail here: Make elements 'not selectable' in jointjs

like image 28
Aung Myat Hein Avatar answered Sep 28 '22 12:09

Aung Myat Hein