0

I'm using Draw2D to render diagram. I'm rendering parent rectangles and child rectangles:

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));

However, according to the documentation,

Add a child figure to the figure. The hands over figure doesn't support drag&drop operations. It's only a decorator for the connection. Mainly for labels or other fancy decorations :-)

Besides, Figure object has no methods insertFigure and removeFigure.

How to properly wrap one figure by another in Draw2D?

Thorsten Niehues
  • 13,712
  • 22
  • 78
  • 113
Marboni
  • 2,399
  • 3
  • 25
  • 42
  • Can you please clearify you question. What do you want to do? Put the three children side by side to they all fit in the parent? – Thorsten Niehues Oct 08 '13 at 10:37
  • No, it's not about positioning. It's about creating and manipulating of children. I was wanted simple to add child element or insert it after another child element, then remove. As I understood, these basic function are not available for now. – Marboni Oct 08 '13 at 14:34
  • addFigure(figure, locator) does it - so where is the problem. I am experimenting a lot with 2d theses days - so if you clearify you question I may help. – Thorsten Niehues Oct 09 '13 at 08:13
  • Thanks for your proposition, but I already switched to GoJS (low SVG performance on initial loading, insufficient functionality and lack of support were the cause). Problem is that you have no methods to insert child in some position, remove child, change its position among another children. I implemented these functions by myself. – Marboni Oct 09 '13 at 11:45

1 Answers1

0

Seems, I should use draw2d.shape.layout.VerticalLayout or draw2d.shape.layout.HorizontalLayout to unite figures, but these classes still have no methods for inserting or deleting child nodes.

Marboni
  • 2,399
  • 3
  • 25
  • 42