I have flow panel with 3 items on board, with 2 different elem category.
Same flow panel and templates of items is used in palette and in diagram.
Somehow in diagram it moves second element to the next row, dont know whats wrong with it.
I’m taking into account fontSize when I break text into 2 lines.
Never the less problem exists in wider node, I would agree with your assumption if it would be the opposite case.
I dragged the 1009 node from the palette and dropped it into the main diagram.
The two nodes are clearly different widths: in the palette it’s actualBounds.width is 185, in the main diagram it’s 234. So of course the “Flow” Panel, which stretches horizontally, will be of different widths, causing the panel layout to produce different results with the same data.
Parent panel of flow panel has different maxSize, why in smaller width it looks better?
Am I missing the point behind something? How come is that for smaller width it looks ok, but when node is bigger its doesn’t? I can’t accept your explanation, doesn’t make any sense to me…
Anyway can you suggest something to make it work?
because I have a different design for palette and for main diagram.
Anyway even if I would take a single template and set all bunch of conditions to handle both designs - I will still end up with 2 different node width which is according to your explanation will break the flow panel.
Can you please explain exactly how come Flow Panel breaks when it has bigger room for its content.
I agree on the point about fontSize, but as you might noticed if you checked out the code in codepen, its being taken into account when splitting text into lines.
Anyway - bigger font - wider node, should not cause any troubles.
ItemsArray are the same - using same templates - with difference of fontSize
I did see that code, but I did not take the time to debug it. Doing a lot of calculations based on text measurements is inherently platform dependent, so that’s another potential cause of variation in the results that people see.
If there is a bug in “Flow” PanelLayout, I would appreciate it if you could create a minimal sample reproducing the problem.
You have it in codepen… Do you want me to reduce the size of the code there?
Regarding text measurements - you are right, and I’m accepting this risk, I dont have another way to split the text into 2 lines based on the parent panel width…
That is your choice. If you believe that there is a bug in PanelLayoutFlow, it would be helpful to demonstrate that there really is a bug there. It’s hard to do that when there is so much text measurement going on, which is going to be different on different platforms.
Here is a complete sample that I believe most people would believe is close to a minimal sample. It’s just missing the data needed to show a bug at a particular width or in some other circumstances.
If you want I can get rid of palette as well, add some nodes to diagram.model on init, and it will be even less code. Tell me if it still too much
I’ve added palette with its own template to demonstrate weird behavior of Flow panel, since itemArrayand itemsTemplateMap of Flow panel are shared between palette and diagram.
I’ve tried to figure out whats wrong - but there is no answer its just magic.
If I use buildItemArray without fontSize condition - everything looks ok.
Doesnt make any sense - and I’m giving up on trying to make any sense out of it.
I will do change it in project - if it will work I will leave it with a comment “do not touch, no one knows how it works”
UPD. it actually works.
I understand that this is an issue which comes form my execution context, not Flow panel. It still doesnt make much sense to me, but If I use copy of buildItemArray without conditions in both places (not same func called from different places - an actual copy of a func, with difference in removing conditions and supplying different fontSize values for different templates) everything works ok.
As always thanks @walter for making this path with me.