Skip to content Skip to sidebar Skip to footer

Set Mxgraph Cell Only Draggable Within The Canvas Width

I have multiple vertex cells in the graph. I am using JavaScript library mxGraph. When i drag the cell from the boundary of canvas, the canvas extends. I want to disallow the cell

Solution 1:

You should give a try to the mxgraph.autoExtend property which seems to configure exactly what you are looking for

https://jgraph.github.io/mxgraph/docs/js-api/files/view/mxGraph-js.html#mxGraph.autoExtend

Specifies if the size of the graph should be automatically extended if the mouse goes near the container edge while dragging. This is only taken into account if the container has scrollbars. Default is true.

There are also other configuration properties about auto extend, like https://jgraph.github.io/mxgraph/docs/js-api/files/view/mxGraph-js.html#mxGraph.extendParentsOnAdd

Post a Comment for "Set Mxgraph Cell Only Draggable Within The Canvas Width"