I have big problems with layouting dynamic generated Figures with figures in figures.
I expect the following:
So if I execute this:
public void tester() {
list[Figure] list1 = [];
for ( i <- [0..3]) {
list[Figure] list2 = [];
list2 = list2 + box(size(30,200),fillColor("brown"));
list2 = list2 + box(size(50,610),fillColor("black"));
list2 = list2 + box(size(100,310),fillColor("gray"));
list1 = list1 + pack(list2,gap(10),fillColor("red"));
};
render(pack(list1,gap(10),fillColor("blue")));
}
I expect something like this (or layout vertically I do not care), and if there is not enough room I expect scrollbars under and right of the figure:
However what I get is the following. But this is not what I asked for. I did not ask for individual scrollbars (I want outer scrollbars if needed). Also the blue and red border (because of gap) is not visible.
How do I get this more in line with what I expected, and why is it behaving as it is?
The critical issue seems to be that a size specification is missing in the inner pack
. If you rewrite your code as follows things look much better:
public void tester() {
list[Figure] list1 = [];
for ( i <- [0..3]) {
list[Figure] list2 = [];
list2 = list2 + box(size(30,200),fillColor("brown"));
list2 = list2 + box(size(50,610),fillColor("black"));
list2 = list2 + box(size(100,310),fillColor("gray"));
list1 = list1 + pack(list2,gap(10),size(200,500),fillColor("red"));
};
render(pack(list1,gap(10),fillColor("blue")));
}
The resulting figure is as follows (note that all packs have a scrollbar and the right one has been scrolled down a bit):
As a side note: the current handling of sizes and resizing is really confusing and we are working on a better solution.