如何在Draw2D Touch中正确地使一个图形在另一个图形上



我正在使用Draw2D来渲染图表。我正在渲染父矩形和子矩形:

var parent = new draw2d.shape.basic.Rectangle(90, 30);
var child1 = new draw2d.shape.basic.Rectangle(30, 30);
var child2 = new draw2d.shape.basic.Rectangle(30, 30);
var child3 = new draw2d.shape.basic.Rectangle(30, 30);
parent.addFigure(child1, new draw2d.layout.locator.CenterLocator(parent));
parent.addFigure(child2, new draw2d.layout.locator.CenterLocator(parent));
parent.addFigure(child3, new draw2d.layout.locator.CenterLocator(parent));

但是,根据文档,

将子图形添加到图形中。交手数字没有 支持拖放操作。它只是一个装饰器 连接。主要用于标签或其他花哨的装饰品:-)

此外,Figure对象没有方法insertFigureremoveFigure

如何在 Draw2D 中正确包裹一个图形?

似乎,我应该使用draw2d.shape.layout.VerticalLayoutdraw2d.shape.layout.HorizontalLayout来统一图形,但是这些类仍然没有插入或删除子节点的方法。

最新更新