JointJS:joint.dia.Graph.prototype.clear不起作用

时间:2019-11-28 15:46:26

标签: jointjs

joint.dia.Graph.prototype.clear对我不起作用。当我清除并记录图形时,它似乎仍然包含所有元素。清除异步功能了吗?

this.graph.clear();
appLogger.info({graph: this.graph}, "Graph with zero elem");

给予

[2019-11-28T21:03:46+05:30] info: Graph with zero elem
graph: child
attributes:
cells: child
    cellNamespace: null
    graph: child {cid: "c1", attributes: {…}, _changing: false, _previousAttributes: {…}, changed: {…}, …}
    length: 3
    models: (3) [child, child, child]
    _byId: {c2: child, 5d55f246-c572-4462-b6a0-1325040b2d1a: child, c3: child, 143b2670-c8b4-43d0-8007-c7860405f530: child, c4: child, …}
    _events: {all: Array(1), add: Array(1), remove: Array(2), reset: Array(1), change:source: Array(1), …}
    __proto__: Backbone.Collection
    __proto__: Object
changed:
    cells: child
    cellNamespace: null
    graph: child {cid: "c1", attributes: {…}, _changing: false,         _previousAttributes: {…}, changed: {…}, …}
    length: 3
    models: (3) [child, child, child]
    _byId: {c2: child, 5d55f246-c572-4462-b6a0-1325040b2d1a: child, c3: child, 143b2670-c8b4-43d0-8007-c7860405f530: child, c4: child, …}
    _events: {all: Array(1), add: Array(1), remove: Array(2), reset: Array(1), change:source: Array(1), …}
    __proto__: Backbone.Collection
    __proto__: Object
cid: "c1"
_changing: false**

能请你帮忙吗?

1 个答案:

答案 0 :(得分:0)

此方法非常简单,没有陷阱。它通过调用元素/链接上的remove一一删除所有单元格。您是否在任何单元格上都覆盖了remove?特别是图中剩下的3个?