mxGraph-禁用用户移动单元格,但启用布局管理器

时间:2020-03-21 01:36:00

标签: mxgraph

我尝试设置graph.setCellsMovable(false),但是布局管理器不再起作用。 我只希望启用连接和布局管理器。

// if set this, layout manager not work
// this.graph.setCellsMovable(false);
this.graph.setCellsSelectable(false);

const layout = new mxStackLayout(this.graph, true);
layout.border = this.graph.border;

const layoutMgr = new mxLayoutManager(this.graph);
layoutMgr.getLayout = function (cell) {
  if(!cell.collapsed) {
    if (cell.parent != this.graph.model.root) {
      layout.resizeParent = true;
      layout.horizontal = false;
      layout.spacing = 10;
    } else {
      layout.resizeParent = true;
      layout.horizontal = true;
      layout.spacing = 40;
    }
    return layout;
  }
  return null;
};

0 个答案:

没有答案
相关问题