aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/features/inventory
diff options
context:
space:
mode:
authorNatalia Spence <52349324+Septikai@users.noreply.github.com>2025-11-24 12:56:27 +0000
committerLinnea Gräf <nea@nea.moe>2025-11-30 11:48:49 +0100
commit4ef10fdfc6e73418a8af4eafd7adfc7a88730b12 (patch)
tree7defe65ad2dbcd3d8795071e16223790609c07e2 /src/main/kotlin/features/inventory
parent15aedb39ea7f732c2ae24c11fc3d528965aeaac0 (diff)
downloadFirmament-4ef10fdfc6e73418a8af4eafd7adfc7a88730b12.tar.gz
Firmament-4ef10fdfc6e73418a8af4eafd7adfc7a88730b12.tar.bz2
Firmament-4ef10fdfc6e73418a8af4eafd7adfc7a88730b12.zip
fix: small optimisation for inactive storage tooltips
Diffstat (limited to 'src/main/kotlin/features/inventory')
-rw-r--r--src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt
index 3e0bb4b..d56e4d2 100644
--- a/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt
+++ b/src/main/kotlin/features/inventory/storageoverlay/StorageOverlayScreen.kt
@@ -529,6 +529,7 @@ class StorageOverlayScreen : Screen(Component.literal("")) {
PAGE_SLOTS_WIDTH,
inv.rows * SLOT_SIZE
)
+ val scrollPanel = getScrollPanelInner()
inv.stacks.forEachIndexed { index, stack ->
val slotX = (index % 9) * SLOT_SIZE + x + 3
val slotY = (index / 9) * SLOT_SIZE + y + 5 + font.lineHeight + 1
@@ -538,11 +539,10 @@ class StorageOverlayScreen : Screen(Component.literal("")) {
context.renderItem(stack, slotX, slotY)
context.renderItemDecorations(font, stack, slotX, slotY)
SlotRenderEvents.After.publish(SlotRenderEvents.After(context, fakeSlot))
- val rect = getScrollPanelInner()
if (StorageOverlay.TConfig.showInactivePageTooltips && !stack.isEmpty &&
mouseX >= slotX && mouseY >= slotY &&
mouseX <= slotX + 16 && mouseY <= slotY + 16 &&
- mouseY >= rect.minY && mouseY <= rect.maxY) {
+ scrollPanel.contains(mouseX, mouseY)) {
try {
context.setTooltipForNextFrame(font, stack, mouseX, mouseY)
} catch (e: IllegalStateException) {