3

I am using this example as starting point for my implementation:

https://jgraph.github.io/mxgraph/javascript/examples/constituent.html

My requirement is that user should be able to select constituent component. However, independent movement of constituent element should be avoided. I.e. parent should move along with constituent element.

To enable selection of constituent element, I removed these two method overrides:

graph.selectCellForEvent = function(cell){
}

mxGraphHandler.prototype.getInitialCellForEvent = function(me){
}

I have overridden isCellMovable method to prevent movement of constituent:

graph.isCellMovable = function(cell){
    cell.parent === graph.getDefaultParent();
}

This works to an extent since it prevent movement of just the constituent element.

However, I would like to enable movement of constituent and move parent vertex along with it.

Gautam Kumar
  • 941
  • 2
  • 16
  • 37

0 Answers0