Javascript MxGraph-拖动源时高亮显示某些单元格

Javascript MxGraph-拖动源时高亮显示某些单元格,javascript,drag-and-drop,mxgraph,Javascript,Drag And Drop,Mxgraph,我已经在React应用程序中集成了mxGraph。现在,我想在从编辑器的侧栏拖动组件时高亮显示一些单元格。此突出显示的单元格应指示此源可以放置的位置 有一个函数,它应该为我提供获取下降目标的可能性,应该自动突出显示。但是这个函数根本不起作用,也从来没有被调用过 makeDraggable: function(element, graphF, funct, dragElement, dx, dy, autoscroll, scalePreview, highlightDropTargets, ge

我已经在React应用程序中集成了mxGraph。现在,我想在从编辑器的侧栏拖动组件时高亮显示一些单元格。此突出显示的单元格应指示此源可以放置的位置

有一个函数,它应该为我提供获取下降目标的可能性,应该自动突出显示。但是这个函数根本不起作用,也从来没有被调用过

makeDraggable: function(element, graphF, funct, dragElement, dx, dy, autoscroll, scalePreview, highlightDropTargets, getDropTarget)
是否有其他选项-例如,侦听此拖动源的“开始移动”事件或类似事件

我的应用程序或多或少类似于以下示例:


此单元格可以用作函数“funct”中的目标单元格。通过执行此操作,单元格下方的单元格将高亮显示。希望这有助于拖动图形中已存在的单元格,您可以覆盖isValidDropTarget:

mxGraph.prototype.isValidDropTarget = function (target, cells, evt) {
    return target._type == 'phase' && cells.every(c => c._type != 'phase');
};
mxDragSource.prototype.getDropTarget = function (graph, x, y) {
    let cell = graph.getCellAt(x, y);
    return cell && cell._type == 'phase' ? cell : null;
};
要从工具栏拖动新单元格(dragSource),可以覆盖getDropTarget:

mxGraph.prototype.isValidDropTarget = function (target, cells, evt) {
    return target._type == 'phase' && cells.every(c => c._type != 'phase');
};
mxDragSource.prototype.getDropTarget = function (graph, x, y) {
    let cell = graph.getCellAt(x, y);
    return cell && cell._type == 'phase' ? cell : null;
};
在我的示例中,我已经实现了一个定制的_类型属性来满足我们的业务需求,但基线是验证单元格