简体   繁体   中英

mxGraph how to stop edges from being dragged?

I have a simple graph and would like to prevent users from being able to drag the edges whilst still allowing them the ability to drag the nodes (with the edges adjusting as they currently are). I have almost achieved this by disabling selection but can not figure out how to get rid of edge dragging functionality.

Codesandbox

There are at least two ways to achive that. One will be setting it in default edge style:

style[mxConstants.STYLE_MOVABLE] = 0;

Another way would be to override isCellMovable to not allow moving the cell if it is an edge:

graph.isCellMovable = function(cell){
    return !cell.isEdge();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM