the hit target, on this stack:
PickEventSession.setCurrentHitTarget(ViewPort, Spatial, Vector2f, CollisionResult) line: 262
PickEventSession.cursorMoved(int, int) line: 482
MouseAppState.dispatchMotion() line: 93
MouseAppState(BasePickState).update(float) line: 169
(when the mouse cursor is over the button area without text of the selected listbox entry), is the top container (the one attached to the GuiNode).
(I think all these values below are correct/expected/workingProperly)
Such container is at world z=30.0 →
It’s listbox is at z=30.01 →
it’s gridpanel is at z=30.02 →
it’s selected cell is at z=30.03 →
it’s button is at z=30.04 →
it has 3 childrens:
- bitmattext (original text I guess) z=30.05
- bitmaptext (highlighted text I guess) z=31.05
- background geometry z=30.04
… I found the problem!
The “selectorArea” geometry is also at z=30.04
this code e.root.collideWith(mouseRay, results);
is unable to sort the button before the “selectorArea” as they are both at 30.04. But at other cells it work properly but by pure luck! right?
The 1st result (chosen as “hit”) is a geometry where:
(ListBox) → “selectorArea”(Node) → (Panel) → “background”(geometry)
1)I guess:
1.A) now I wonder if the button z placement could consider the “selectorArea” z and be put above it? so the “selectorArea” would be at 30.04 and the button I created would be placed at 30.05 and so on?
1.B) Basically, I think a 0.01 distance gap should be always available to place the “selectorArea” always below any cell buttons and other elements we create.
1.C) Or may be, some things like the “selectorArea” could have some hint to let it be skipped on the results list?
- Temporary workaround:
I did a workaround where instead of adding all buttons directly to the listbox cell container, I created another single base container to fill the cell container.
And after that, I added all my custom buttons into that new base container.
That made the mouse cursor work properly on non text areas, as my custom buttons were now above the “selectorArea” z order and so received the first raycast hit.
But I had to make all buttons color transparent (ex.: alpha 0.5f) so the listbox selector would be visible below them.