Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
防止顶点移动到组中 使用mxGraph版本1.10.1.1_Mxgraph_Jgraphx - Fatal编程技术网

防止顶点移动到组中 使用mxGraph版本1.10.1.1

防止顶点移动到组中 使用mxGraph版本1.10.1.1,mxgraph,jgraphx,Mxgraph,Jgraphx,该图包含一个组和组外的一个顶点。基于顶点的属性,如何防止用户将此节点拖到组中 侦听mxEvent.CELLS\u MOVED似乎没有帮助,因为事件没有应用到图形,并且目标单元格还没有父组信息。我想除非这个事件被消耗掉 有没有一种简单的方法可以阻止移动完成,或者有没有一种方法可以在满足条件后回滚事务?我使用的当前实现是覆盖mxGraphHandler.prototype.mouseUp并在调用moveCells之前检查目标和单元格。目前它还有效,但不是理想的解决方案 mxGraphHandler.

该图包含一个组和组外的一个顶点。基于顶点的属性,如何防止用户将此节点拖到组中

侦听mxEvent.CELLS\u MOVED似乎没有帮助,因为事件没有应用到图形,并且目标单元格还没有父组信息。我想除非这个事件被消耗掉


有没有一种简单的方法可以阻止移动完成,或者有没有一种方法可以在满足条件后回滚事务?

我使用的当前实现是覆盖
mxGraphHandler.prototype.mouseUp
并在调用
moveCells
之前检查目标和单元格。目前它还有效,但不是理想的解决方案

mxGraphHandler.prototype.mouseUp = function(sender, me) {
    var hasRestricted = false;
    if (!me.isConsumed()) {
        var graph = this.graph;
        ...

    if (graph.isSplitEnabled() && graph.isSplitTarget(target, this.cells, me.getEvent())) {
        graph.splitEdge(target, this.cells, null, dx, dy);
    } else {
        // Check if this.target is a group and if this.cells contain the restricted cells
        if (this.target.getAttribute('type') !== 'relevantType' || this.cells.indexOf('restrictedVertexType') === -1) {
            this.moveCells(this.cells, dx, dy, clone, this.target, me.getEvent());
        }
    ...
};