I'm currently working on a Flowchart builder that uses the MXGraph library. It would be nice to have the abilitie to draw a line when hovering over the edge of a vertex. Just like Lucidchart has: https://www.lucidchart.com but I have no clue in how to build this.
I've fiddled with the mxConnectionHandler but this will draw the line when hovering the center of the vertex. This is not really what I want. Here is the code for my MXGraph setup:
function main(graphContainer, toolbarContainer, formatbarContainer) {
if (!mxClient.isBrowserSupported()) {
mxUtils.error('Browser is not supported!', 200, false);
}
else {
mxEvent.disableContextMenu(graphContainer);
let doc = mxUtils.createXmlDocument();
let editor = new mxEditor();
let model = new mxGraphModel();
let graph = new mxGraph(graphContainer, model);
let keyHandler = new mxKeyHandler(graph);
editor.graph = graph;
graph.setCellsEditable(false);
graph.setCellsDisconnectable(false);
graph.setHtmlLabels(true);
graph.setConnectable(true);
graph.edgeLabelsMovable = false;
mxConstants.WORD_WRAP = 'break-word';
graphFunctions.addCustomShapes(graph);
createToolbar(toolbarContainer, editor, model, keyHandler);
createFormatbar(formatbarContainer, editor, model);
createRubberband(graph);
}
};
It would be nice if someone can help me on the way in order to achieve this.