admin管理员组

文章数量:1317906

I have used Jointjs diagramming library in one of my project.

1) I'm curious to know whether it provides any way to restrict users not to play with the elements of the diagram. What I mean is: a user would be able to see the diagram as an image rather than interacting with it like resizing, changing position, dragging links, etc.

2) My app is depending on it badly. Though I have solved the issue of auto layout, but is that possible with Jointjs, can we just tell the lib that we want these elements and stuff and please help us in making the diagram with best suitable, non-colliding elements and with a minimum number of links colliding with each other and with the elements in their path if the links are continuous straight lines ?

3) Lastly, i want to know if we can check links colliding with other elements or with other links in the same diagram. I know it is possible in case of elements.

if (element1.getBBox().intersect(element2.getBBox())) {
    // elements intersect
}

I have used Jointjs diagramming library in one of my project.

1) I'm curious to know whether it provides any way to restrict users not to play with the elements of the diagram. What I mean is: a user would be able to see the diagram as an image rather than interacting with it like resizing, changing position, dragging links, etc.

2) My app is depending on it badly. Though I have solved the issue of auto layout, but is that possible with Jointjs, can we just tell the lib that we want these elements and stuff and please help us in making the diagram with best suitable, non-colliding elements and with a minimum number of links colliding with each other and with the elements in their path if the links are continuous straight lines ?

3) Lastly, i want to know if we can check links colliding with other elements or with other links in the same diagram. I know it is possible in case of elements.

if (element1.getBBox().intersect(element2.getBBox())) {
    // elements intersect
}
Share Improve this question asked Feb 25, 2014 at 19:05 softvarsoftvar 18.5k13 gold badges57 silver badges77 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

1) Use either new joint.dia.Paper({ interactive: false, ... }) or set pointer-events CSS property to none directly on the paper: paper.$el.css('pointer-events', 'none')

2) You can use the joint.layout.DirectedGraph plugin. This plugin is downloadable here: http://jointjs./download and a blog post describing it is here: http://www.daviddurman./automatic-graph-layout-with-jointjs-and-dagre.html.

3) This is not, in general, easy. I'd point you to this site for an example of puting intersection between two paths: http://www.kevlindev./geometry/2D/intersections/intersect_bezier2_bezier2.svg. Here is the library for download then: http://www.kevlindev./gui/math/intersection/index.htm

本文标签: javascriptMake elements 39not selectable39 in jointjsStack Overflow