Skip to content

Add option to hide the histogram when the inventory is closed - #9

Open
SnavvieJD wants to merge 1 commit into
JarateKing:masterfrom
SnavvieJD:hide-with-inventory
Open

Add option to hide the histogram when the inventory is closed#9
SnavvieJD wants to merge 1 commit into
JarateKing:masterfrom
SnavvieJD:hide-with-inventory

Conversation

@SnavvieJD

Copy link
Copy Markdown

Closes #8.

The overlay is normally positioned over the inventory panel. When the inventory is closed the panel disappears but the histogram stays, leaving the tick marks floating over the game world.

HistogramOverlay had no access to game state — it was constructed with only the config — so it couldn't tell whether the inventory was open.

What this does

  • Adds a Hide When Inventory Closed boolean to the Panel section, defaulting to off so existing behaviour is unchanged
  • Passes the plugin's already-injected Client through to the overlay
  • Returns null early from render when the toggle is on and InterfaceID.Inventory.ITEMS is null or hidden

One thing worth a look: I moved updateDelta() and updateEvents() to the top of render, before the visibility check, rather than leaving them between the fill and the draw. Without that, events would keep accumulating in the deque while the panel was hidden (they're still added by the plugin's subscribers) and delta would spike on the frame it reappeared, since lastnano only advances in updateDelta. The fill doesn't depend on either call, so the reorder is otherwise inert.

Testing

I have not built or run this. I don't have a JDK on this machine, so it's compile-unverified — please treat it as a suggestion rather than something ready to merge. HistogramPluginTest doesn't reference HistogramOverlay, so the constructor change shouldn't affect it, but that's from reading rather than running.

I used net.runelite.api.gameval.InterfaceID since ComponentID is gone from current RuneLite and the build targets latest.release. If you support older client versions, that import may need to change.

Happy to adjust or close this if you'd rather implement it your own way.

The overlay is typically positioned over the inventory panel. When the
inventory is closed the panel disappears but the histogram stays, leaving
the tick marks floating over the game world.

HistogramOverlay had no access to game state (it was constructed with only
the config), so it couldn't tell whether the inventory was open. This passes
the plugin's existing injected Client through to the overlay and adds a
"Hide When Inventory Closed" toggle to the Panel section, defaulting to off
so existing behaviour is unchanged.

The event updates now run before the visibility check rather than after the
draw, so events are still aged and pruned while the panel is hidden and the
frame delta doesn't spike when it reappears.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to hide the overlay when the inventory panel is closed

1 participant