Hi, when I have a nested containers, pointerdown event is fired in unexpected order.
eg)
scene.input.topOnly = false;
Red (container with setInteractive)
Green (child of red, a container with setInteractive)
Blue (child of green, a container with setInteractive)
when i click on Blue, I see pointerdown event in “Blue” -> “Green” -> “Red” order as expected.
now if i remove setInteractive from Green and click Blue, I see “Red” -> “Blue” (reversed)
I am seeing this behaviour from version 3.18 to 3.22. Is this bug? Thanks.
gabe
update: I looked at sortHandlerGO predicate, and curious about this:
// Container index check
var listA = childA.getIndexList();
var listB = childB.getIndexList();
var len = Math.min(listA.length, listB.length);
for (var i = 0; i < len; i++)
{
var indexA = listA[i];
var indexB = listB[i];
if (indexA === indexB)
{
// Go to the next level down
continue;
}
else
{
// Non-matching parents, so return
return indexB - indexA;
}
}
Shouldn’t it compare the length of indexList of listA and listB instead? so in the example above, Red’s index is [0], while blue [0,0], yet this predicate returns 0, when Blue is clearly deeper.
Also for performance, isn’t it better to assign some value when a GO is added to a container and use this value to sort, instead of calculating indexlist by walking up the parentContainer tree?
Thanks!