Skip to content

feat: outline the hovered control with coreShaders.hover - #107

Merged
oglassdev merged 7 commits into
feat/barfrom
feat/hover
Oct 11, 2026
Merged

oglassdev merged 7 commits into
feat/barfrom
feat/hover

Conversation

@oglassdev

@oglassdev oglassdev commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Window UIs gave no feedback about what is clickable: vanilla highlights one inventory slot at a time, which doesn't match controls that span several slots. With coreShaders.hover on, the control under the cursor gets an outline around its whole rectangle. This reworks the approach from #66 on the current option layout.

window({ coreShaders: { hud: true, hover: true }, vanilla: { slotHighlight: false } })
<Button onClick={buy} span={6}>Buy</Button>          // outlined: takes clicks
<Tabs bind={sort} span={3} hover={false}>…</Tabs>    // never outlined
<Hotspot tooltip="Balance" span={3} hover />         // outlined without a click
  • With the option on, a region that takes clicks is outlined while hovered. hover={false} opts one out and hover opts in a region that takes no clicks, so disabled states and hotspots stay quiet by default. The industrial controls pass the prop through.
  • Setting hover on a region while coreShaders.hover is off fails the build, naming the region and the option.
  • vanilla.slotHighlight: false blanks vanilla's own slot highlight; a string replaces it with a 24x24 catalog sprite.
  • The outline is a fixed 1 px white line; colour and thickness are not configurable.
  • A pack with the option off is unchanged.

How it works: the compiler adds one outline glyph per distinct region size, and the runtime puts it in the tooltip title of the region's hitbox item, so the client only draws it while that region is hovered. The text shader moves it onto the region and cuts it out where the tooltip box covers it. Regions without a tooltip get an invisible tooltip style, so no box appears.

Limits:

  • An outlined region must be 4–256 px wide, at most 256 px tall, and start within 128 px of the GUI centre; otherwise the build fails and says to set hover={false}.
  • The outline shows only over slots holding the region's own hitbox item, not over slots where <Items> or a collection show a stack.
  • When the server can't know a tooltip's size (translated text, more than 29 lines, advanced tooltips with F3+H), no cut-out is made and the outline can show through the tooltip box.
  • Tooltip text in a font the server has no metrics for is measured with default widths, so its cut-out can be the wrong width.
  • Pack formats 85–88 only; other formats fail the build. One pack can't serve several format ranges until rpp supports plugin overlays.

Checked in a real 26.2 client at GUI scales 2 and 3, and again at scale 2 on this branch after the rebase onto the bar branch: the outline sits exactly on the region's rectangle for a tab with a tooltip and for a button without one (no tooltip box appears), nothing is drawn for a hover={false} tab, an item slot or a disabled button, vanilla's highlight is gone, and the HUDs render unchanged with both shaders on.

Not checked in a client: multi-line tooltips, the no-cut-out fallback, a catalog-sprite slotHighlight, formats 85–87, anvil windows and other container sizes, and Multistom.

Supersedes #66.

Checks: just test-rust -p window-core, just gradle :runtime:test --rerun, just check-ts, just test-ts, just golden, just lint, just fmt-check.

Stacked on #106.

🤖 Generated with Claude Code

…sized extent

A translatable tooltip encoded the maximum width and a long one a clamped line
count, so the shader erased visible outline outside the tooltip or left it
inside. Such tooltips now encode size zero, which the shader treats as no
cut-out: the whole outline is drawn.
@oglassdev
oglassdev added this pull request to stack #101 October 11, 2026 07:03
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.

1 participant