focustense / StardewUI

UI/widget library for Stardew modding
MIT License
6 stars 1 forks source link

Implicit draw order should be the same as implicit event priorities #50

Closed focustense closed 6 days ago

focustense commented 1 week ago

This was specifically identified with the Panel layout but probably affects all other layout views as well.

While StardewUI always respects explicit z-index and has the correct behavior (highest z-index draws on top and receives pointer events), the implicit order when no z-index is specified acts differently, with the last child in the list drawing on top but being the last to receive events, i.e. being blocked by earlier children with no z-index.

It's not wrong, per se, but it could reasonably be called confusing and inconsistent.

Solution: Whenever iterating children for event purposes, traverse in reverse order after accounting for z-index. This can hopefully be done in the View base itself without requiring special logic for every layout.