Open ThomThomson opened 2 weeks ago
Pinging @elastic/kibana-presentation (Team:Presentation)
Here is a breakdown of what happens in this case.
Panel1
is expanded one space to the rightPanel1
is colliding with panel5
panel1
and panel5
is 4panel5
is moved down 4 spaces...panel6
checks for collisions... panel5
is now completely below panel6
so there are no collisions. panel6
stays where it is.panel7
and panel8
.In React grid layout, the algorithm is slower but does not suffer from this issue. Instead of pushing the panel down by the full amount of overlap in step 4 it moves the panel down by just one space, and then recurses.
Best case scenario here, we can keep our faster implementation while removing this edge case. In the worst case scenario, we can use an approach similar to the recursive one in React Grid Layout.
The
kbn-grid-layout
algorithm defined inpackages/kbn-grid-layout/grid/resolve_grid_row.ts
is quite different from the one inreact grid layout
. This causes an edge case when a panel is resized into colliding with multiple panels at once. This results in the following undesired behaviour:react grid layout
kbn grid layout
In the gif above, notice how the relative orders of panels 6, 7, and 8 are not maintained in kbn grid layout. Note that this only happens when a single operation causes collisions with multiple panels, which makes it quite rare.