Skip to content

About

tool tips that aren't hidden behind the cursor

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Readable Tool Tips

A small Civilization VII UI mod that keeps tooltips out from under the mouse pointer, on any screen size. It only moves tooltips; fonts, colors, sizes and contents are untouched.

Why tooltips end up under the pointer

The game draws its pointer at 32px times your UI scale: 32px at 1080p, 48px when the game scales the UI for a 2880x1800 screen, 64px at 4K. Its tooltips keep a fixed gap from the pointer (24px, 22px on the map), so on a bigger screen they start under the pointer. Tooltips pinned to the thing you're hovering (leader and civ portraits on the setup screens, unit actions, some panels) sit right on its edge, so the pointer covers their top when you hover near the bottom of it.

What it does

Civilization VII 1.5 draws tooltips with three systems, and the mod handles each:

Tooltips Examples Game gap With the mod
#tooltip-root (TooltipController) yields, the top-left buttons, diplomacy ribbon, minimap, main menu 24px 36px × UI scale
#tooltips (TooltipManager) relationship and war-support icons, trade routes, production items 22px 34px × UI scale
ui-next PlotTooltip hovering map tiles 22px 34px × UI scale

The UI scale is the one the game sizes its pointer with: the resolution basis when the game scales the UI itself, or your UI scale setting. Below 100% the gap stays at the 100% size.

Every other tooltip, including ones pinned to their element and the newer ui-next tooltips on the setup screens, is checked after the game places it. If it overlaps the pointer's reach (36px × UI scale down and right of the tip), the mod moves it the shortest way clear (down, right, up or left) that stays on-screen, with a margin, so the game's own position is left alone.

Near a screen edge each system flips its tooltip to the left of or above the pointer. The mod adds its gap on the side the tooltip actually opened, so a flipped tooltip is pushed further away, and every tooltip stays on-screen.

How it works

  • TooltipController.reposition is wrapped to push the cursor anchor for the duration of the call, before the controller's own on-screen clamp.
  • TooltipManager.updateTooltipPosition is wrapped the same way, and the manager's resize observer is rebound to the wrapped method.
  • PlotTooltip is re-registered through ui-next's ComponentRegistry override mechanism as the same component with a wider offset.
  • ui/rt-keep-clear.js follows the pointer (mousemove) and watches the three tooltip hosts; when a drawn tooltip overlaps the pointer's reach it sets a margin on it. With a gamepad there's no pointer, and the margins come off.

Tuning

The gaps at UI scale 1 are at the top of ui/readable-tooltips.js (CONTROLLER_GAP_PX, MANAGER_GAP_PX, PLOT_GAP_PX), and the pointer's reach is CLEAR_BOX_PX in ui/rt-keep-clear.js.

Compatibility with other mods

  • Each wrapper calls the original method and restores every field it touches, so it composes with other mods that patch the same methods.
  • The PlotTooltip override wraps whatever plot tooltip is registered, at the same priority, so a plot-tooltip mod that loads later still replaces it; the wrapper then re-applies itself on top of that mod's version. It's been watched doing that over QD Improved Plot Tooltip, also with Map Trix loaded. Map Trix's own tooltip, the one you see when Map Trix is your only plot-tooltip mod, takes the same offset setting going by its source, but that pair is still to be checked in a game. The offset is a fixed target, so layered wrappers never stack it, and a larger gap set by another mod is kept.
  • A tooltip you lock with K stays where it is, so you can move onto it and hover what's inside. Pablo's Better Yield Tooltip works that way (lock a tile's tooltip, then hover its yield row for the breakdown), and it was watched working alongside this mod on 2026-11-14.
  • It doesn't add a stylesheet or replace any base-game files. The only style it writes is a margin on a tooltip that would sit under the pointer.
  • AffectsSavedGames is 0, so the mod applies to existing saves.

How it loads

ui/readable-tooltips.js is registered in both the shell (main menu and setup screens) and game scopes, and imports ui/rt-keep-clear.js. Every patch is idempotent and guarded: if a future game update moves a method, that one part is skipped and the UI keeps working.

Watched on 1.5.1

Lab games on 2026-11-12, every other mod off, UI scale 90% (tools/plans/readable-tooltips-151/):

  • Leader portrait on Create Game, pointer 6px above the portrait's bottom edge: the game put the tooltip on that edge (y 464, pointer at 458); the mod moved it to y 494, 36px below the pointer's tip.
  • Top-left Age Progress button: the tooltip went from 28px off the pointer to 36px, the same as the yields.
  • Same button with the UI scale set to 150% and 200% for the test: 54px and 72px.
  • A real-pointer capture at 90%: the game's pointer measured about 21x34 screen pixels, so the page's pixels are screen pixels and the scale the mod reads matches the pointer you see.

Tests

npm run verify runs lint, a syntax check, and unit tests for the pointer scale, the scaled gaps, flip direction, the plot offset and the keep-clear move. The three wrappers are tested against small stand-ins for the game modules the script imports (tests/stubs/, mapped in by tests/loader.mjs): a second patch adds nothing, a missing method only skips that offset, and fixed-position, touch and gamepad tooltips go straight to the game's code.

Civilopedia History Corrections

This mod also carries Civilopedia History Corrections, a text patch for Civilopedia Expanded: Independents. With that mod on, six East Asian history pages (Goguryeo, the Oirat, two Ryukyu pages, Nanzhao and Balhae) give each side where historians in different countries disagree, and a few factual errors are fixed. With it off, the game's pages stay as they are. The text is in history-corrections/, in English, Simplified Chinese and Traditional Chinese. Every Tower mod that carries it writes the same text, so running several of them together is fine.

Those paragraphs were replaced because they didn't hold up. Some repeated Chinese state historiography as settled fact, or recast a question most historians consider answered as still open. Some got basic dates and places wrong. And the Oirat page called a genocide, the Qing destruction of most of the Dzungar people in 1755-1757, a "pacification." I'm not leaving that in place. More corrections to Civilopedia Expanded may be added at any time, in any update. Corrections may also be added for any other mod whose text I judge, in my sole discretion, to be bigoted, genocide-denying or otherwise historically inaccurate. Running this mod alongside any of them means you accept those replacements, including any added later. Switch this mod off and their pages read as their authors wrote them.

License

Up to version 1.0.7 this mod was MIT, and copies of those versions stay MIT. Versions after 1.0.7 are under the Tower Mod License 1.0 in LICENSE, written in plain English.

You're welcome to play it, read the code to see how it works, and change your own copy for your own games. If you'd like to reupload it, put parts of it in your own mod, or use it some other way, ask me first: open an issue here or message Tower on Steam. ui/settings-keeper.js stays MIT so other mods can keep embedding it.

I don't want this mod's code, text or art used to train AI models, collected into AI training sets, or handed to AI tools to copy into other projects, and the license doesn't allow it without my written permission. I also reserve the rights to text and data mining of this work under Article 4(3) of the EU's Directive 2019/790.

Because the source is on GitHub, GitHub and its affiliates (Microsoft included) have their own license to it under GitHub's Terms of Service, and since April 2026 that covers training their AI. Valve and Take-Two have the rights their own terms give them. Sid Meier's Civilization VII and its assets belong to Firaxis Games and 2K. Material from other people is listed in LICENSE.

About

tool tips that aren't hidden behind the cursor

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages