"subject" "externalObjectDrop" 函数中的参数为空

"subject" parameter in "externalObjectDrop" function is empty

e.subject参数中"externalObjectDrop"函数自带count=0, 尽管拖动的部分被移动到模型中。

图中:

  allowCopy: true,
  allowUndo: false,
  allowInsert: true,
  allowDragOut: true,
  allowDrop: true,
  allowMove: true,
  "ExternalObjectsDropped": (e) => {
                this.externalObjectDrop(e);
            }

函数:

  externalObjectDrop(e) {
 e.diagram.commandHandler.deleteSelection();
 e.parameter.commandHandler.deleteSelection();
   //e.subject.count is 0.
}

e.subject 包含引用,而不是值。所以,在调用之后:e.parameter.commandHandler.deleteSelection() - e.subject 变为空。 所以我将 e.subject 保存到参数中,然后删除选择:

const nodes = e.subject.toArray();
 e.parameter.commandHandler.deleteSelection();