sisby-folk / inventory-tabs

A minecraft mod that allows swapping to other in-world screens (blocks, entities, etc) via tabs. A fourth-generation rewrite of CakeWhip's InventoryTabs.
https://modrinth.com/mod/inventory-tabs
GNU Lesser General Public License v3.0
6 stars 3 forks source link

Centering logic does not take into account page arrows #27

Closed HestiMae closed 7 months ago

HestiMae commented 7 months ago

InventoryTabsScreen.java#L28: margins / 2 + i * tabWidth should be centering the tabs in the drawable area but I noticed it doesn't take into account the page arrows.

Here I've set a left offset of -50, but the right arrow still overhangs the right side. image

sisby-folk commented 7 months ago

At first I thought this was a bug too, but I think it's a solvable artifact of using offsets the way we are that's effectively working as intended.

Effectively, if the screenshot above is what you see, this is what the mod sees:

image

Which means there's no free space to adjust the arrows - it's still dead center of its safe rendering space.

The solution is to just add a negative offset to the right side as well:

image

(used -60, -14 here and drew in a fake obstruction for clarity)

Thanks for the report! Should help give appropriate config values to later issues that use your PR.