在 mxGraph-js 中,我使用以下代码将叠加层添加到顶点。
graph.addCellOverlay(cell, overlay);
并将图编码为 xml
var graph = new mxGraph(container);
var xml = encoder.encode(graph.getModel());
然后使用以下方法将其解码回来。
var doc = mxUtils.parseXml(xml);
var codec = new mxCodec(doc);
codec.decode(doc.documentElement, graph.getModel());
我的问题是在解码编码图时,它会绘制没有覆盖的图。似乎编码覆盖没有被编码到xml中。
如何使用覆盖对图形进行编码,然后正确解码?