Fix: Use correct child count when ordering right box

Previously the `panelBoxChildCount` would just be the child count of the
right box before new items got added, which would result in incorrect
indices for new child insertions being used (in
`panel.insert_child_at_index`), since `panelBoxChildCount` would just
account for the current children, not for new ones.

This resulted in the following issue:
When you used the settings to move an item from e.g. the middle box to
the right box, the right box would get ordered incorrectly.

So fix this issue by getting the max of the right boxes current children
and the `validBoxOrder.length`.
This commit is contained in:
Julian 2021-06-21 21:26:26 +02:00
parent 65304a9894
commit d4514219ed
Signed by: julian
GPG Key ID: 094C2AC34192FA11

View File

@ -430,7 +430,7 @@ class Extension {
// This could happen, when the box order gets set to a permutation // This could happen, when the box order gets set to a permutation
// of an outdated box order. // of an outdated box order.
case "right": case "right":
panelBoxChildCount = panelBox.get_children().length; panelBoxChildCount = Math.max(panelBox.get_children().length, validBoxOrder.length);
for (let i = 0; i < validBoxOrder.length; i++) { for (let i = 0; i < validBoxOrder.length; i++) {
const role = validBoxOrder[validBoxOrder.length - 1 - i]; const role = validBoxOrder[validBoxOrder.length - 1 - i];
// Get the indicator container associated with the current role. // Get the indicator container associated with the current role.