Repository navigation
Conversation
`hover` on a region and the industrial controls takes art as well as a boolean. Art that stretches covers the region; other art is drawn at its own size, centered on it. A hover glyph is now its art between two data rows that the text shader reads and discards, so the art keeps its own colors and alpha. The generated white outline uses the same layout, which limits a hover to 254 px tall.
Frames and images are interned in separate tables, so a frame and an image could share a name and with it a hover glyph.
…iew option
hover={art} now always stretches the art over the region like a frame.
The object form { art, fit, tint } centers it at its own size or
multiplies its colors at build time, and preview(..., { hovers: true })
draws every region's hover as the pack draws it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
coreShaders.hovercould only outline a hovered region with a fixed 1px white rectangle. A pack with rounded buttons, or buttons whose icon overhangs the body, could not make the hover match its art or color it (a red hover on a close button, a gray one on a disabled control).hovernow takes art as well as a boolean:This is the first step toward #112; nothing else from #112 is built here.
Examples
Bare art stretches over the region exactly as
frame={art}would. A 5x5 ring withinsetsbecomes a ring of any size:tintmultiplies the art's colors at build time, so one white texture serves every color. It takes a hex color or a theme token:fit: "center"draws the art at its own size, centered on the region. Art larger than the control overhangs it, which is how to draw a ring around a control rather than on its edge:Art can follow the theme like any other art. A control draws it only in the states that take clicks, so this disabled button shows no hover:
A preview can draw every region's hover at once, to check alignment without a client:
The example workshop, before and after
Before, a buyable card could only take the white rectangle:
After, a buyable card draws a gold ring and the exit button a red one, both from one white 5x5 texture. The other controls keep the default outline:
Behavior
hover={art}andfit: "stretch"(the default) cover the region as aframewould.fit: "center"draws the art at its own size, centered, and may overhang; an odd size difference puts the art the odd pixel toward the top-left. A shape centered this way needs awidthandheight, or the build fails.tintis baked in. A runtimetint(...)handle on a hover is a type error and a build error.<Region>and the industrial controls that passhoverthrough (Button,Toggle,Choice,Tabs,Repeater,Hotspot,Face.hover). The prop's type is exported asHover.hovers: trueon a preview draws what the pack draws: nothing whencoreShaders.hoveris off, no pixels under 10% alpha, and the same build error for a hover outside the size and reach limits. It does not draw the tooltip cut-out.coreShaders.hoveris off are unchanged.How
hover/{w}x{h}for the outline andhover/frame|image/{art}[/{tint}]/{w}x{h}for art, so hovers that draw the same pixels share a glyph.HoverEntry.x/yis now the top-left of what is drawn rather than of the region.Limits
fit: "center"with art sized for that control.Testing
just test-rust -p window-core,just lint,just fmt-check,just check-ts,just test-tsandjust goldenpass.hovercase, which gained a stretched art hover and a centered, tinted one: both text shaders,font/ui.json, the two outline PNGs,debug.json,MenuView.kt,WindowEntries.kt, plus two new art glyph PNGs.just example-pack; its generatedWindowEntries.ktis regenerated for the new hovers, and its newupgrades_hoverspreview shows gold rings on the buyable cards and a red one on Exit.The shader change is untested in game. When playtesting, check that art keeps its colors, that no stray data pixels show above or below the art (especially at rounded corners), that the art is aligned to the control with its first and last rows intact, and that the tooltip cut-out still works.
🤖 Generated with Claude Code