Snapshot for release 2026.10.29.2 (internal f1e8d4e)

This commit is contained in:
Tom Bohar 2026-10-29 07:19:17 -04:00
commit 8cb74c7685
8 changed files with 144 additions and 9 deletions

View file

@ -814,8 +814,11 @@ internal static class EngineFrameController
bool typing = io.WantTextInput || ImGuiTextFocus.MainBoxActive;
// A plate that is only hovered lets the mouse moves through, so AC's own
// mouse-over stays current (MonsterHud.MouseMovesToGame, Compatibility/AcMouseOver).
// A docked click-through panel under the cursor that zooms with the wheel (the radar's
// "Mouse wheel still zooms"): the wheel is its own, clicks and moves still the game's.
Win32Backend.UpdateCaptureFlags(io.WantCaptureMouse || Hud.MonsterHud.WantsMouse, typing,
mouseMovesToGame: !io.WantCaptureMouse && Hud.MonsterHud.MouseMovesToGame);
mouseMovesToGame: !io.WantCaptureMouse && Hud.MonsterHud.MouseMovesToGame,
wheelToUi: !io.WantCaptureMouse && PanelsLive && ImGuiPanelHost.WheelWanted);
Compatibility.AcMouseOver.Tick(); // /rc acmouse watch, when on
// The UI is released (Insert): no text box keeps the keyboard. Keys are not
// gated by the toggle any more (Win32Backend.UpdateCaptureFlags), so the edit

View file

@ -111,6 +111,13 @@ internal interface IImGuiPanel
/// </summary>
bool ClickThrough => false;
/// <summary>
/// While <see cref="ClickThrough"/>: the mouse wheel over the panel is the panel's (the face reads
/// io.MouseWheel itself) and doesn't reach the game; clicks and moves still do. Answered by the
/// face's last Draw (the radar's "Mouse wheel still zooms", 2026-10-29).
/// </summary>
bool ClickThroughWantsWheel => false;
/// <summary>
/// Popped out and not hovered or in use: how often the face is redrawn (Hz).
/// Its pictures are only pushed when they change; this bounds the cost of
@ -571,6 +578,13 @@ internal static class ImGuiPanelHost
/// </summary>
public static float BodyGripReserve { get; private set; }
/// <summary>
/// The last DrawAll: a docked click-through panel has the mouse wheel over it
/// (IImGuiPanel.ClickThroughWantsWheel), so the wheel is kept from the game while the clicks
/// still reach it (EngineFrameController, Win32Backend.UpdateCaptureFlags). AC thread.
/// </summary>
public static bool WheelWanted { get; private set; }
// ── Frame (AC thread) ──────────────────────────────────────────────
/// <summary>
@ -581,6 +595,7 @@ internal static class ImGuiPanelHost
public static void DrawAll(float uiScale)
{
_frameScale = uiScale;
WheelWanted = false;
float placeScale = PlacementScale();
ApplyFaceChanges(placeScale); // plugin windows taking over (or giving back) engine panels
while (Requests.TryDequeue(out var req))
@ -1168,6 +1183,8 @@ internal static class ImGuiPanelHost
BodyGripReserve = inlineGrip && gripRoom == 0f ? gSize + 1f * uiScale : 0f;
try { DrawBody(entry); }
finally { BodyGripReserve = 0f; }
// A click-through face that takes the wheel over itself (IImGuiPanel.ClickThroughWantsWheel).
if (clickThrough) try { if (entry.Instance.ClickThroughWantsWheel) WheelWanted = true; } catch { }
}
// Grip painted on top of the face when the body covers the corner
// (a GripInBody face's even while it lets clicks through: its slot stays).

View file

@ -85,6 +85,11 @@ internal sealed class RadarFace : IImGuiPanel
public bool ClickThrough =>
RadarSettingsStore.CtrlGatedClickThrough && !ImGuiNET.ImGui.GetIO().KeyCtrl && !_hot;
// Click-through with "Mouse wheel still zooms": the mouse was on the radar this frame, so the
// wheel is the radar's (RadarWheel); the engine keeps it from the game.
private bool _wheelHere;
public bool ClickThroughWantsWheel => _wheelHere;
public void OnShown()
{
RadarSettingsStore.Load();
@ -100,6 +105,8 @@ internal sealed class RadarFace : IImGuiPanel
public void Draw()
{
bool clickThroughNow = ClickThrough; // what the host gave this frame's window (before UpdateHot moves _hot)
_wheelHere = false;
var dl = ImGuiNET.ImGui.GetWindowDrawList();
Vector2 origin = ImGuiNET.ImGui.GetCursorScreenPos();
Vector2 size = ImGuiNET.ImGui.GetContentRegionAvail();
@ -202,12 +209,17 @@ internal sealed class RadarFace : IImGuiPanel
UpdateHot(view, centre, worldMin, worldMax, gearPos, new Vector2(closePos.X + btn, closePos.Y + btn));
if (view != null && RadarSettingsStore.ClickToSelect)
MarkerInput(dl, view, centre, worldMin, worldMax, surfaceClicked);
if (ImGuiNET.ImGui.IsItemHovered())
// Click-through: the window takes no input, so it is never "hovered"; the wheel is read here
// instead when the option says so (RadarWheel.Owns).
var wio = ImGuiNET.ImGui.GetIO();
_wheelHere = RadarWheel.Owns(RadarSettingsStore.ClickThroughWheelZoom, clickThroughNow, ImGuiPopOuts.InPopOutFrame,
wio.WantCaptureMouse, wio.MousePos, origin, frameMax, _round ? new RoundMask(centre, frameR) : null);
if (ImGuiNET.ImGui.IsItemHovered() || _wheelHere)
{
float wheel = ImGuiNET.ImGui.GetIO().MouseWheel;
float wheel = wio.MouseWheel;
if (wheel != 0)
{
float next = Math.Clamp(RadarSettingsStore.Zoom + wheel * 0.15f, 0.5f, 6.0f);
float next = RadarWheel.Zoomed(RadarSettingsStore.Zoom, wheel);
if (next != RadarSettingsStore.Zoom) { RadarSettingsStore.Zoom = next; RadarSettingsStore.Save(); }
}
}
@ -740,6 +752,14 @@ internal sealed class RadarFace : IImGuiPanel
changed |= Check("Docked click-through (dots still work; Ctrl for the rest)", ref RadarSettingsStore.CtrlGatedClickThrough);
if (ImGuiNET.ImGui.IsItemHovered())
ImGuiNET.ImGui.SetTooltip("On: docked clicks pass through to the game, except on a dot (hover it, click to select) and the two buttons; hold Ctrl to drag or resize.");
if (RadarSettingsStore.CtrlGatedClickThrough)
{
ImGuiNET.ImGui.Indent();
changed |= Check("Mouse wheel still zooms the radar", ref RadarSettingsStore.ClickThroughWheelZoom);
if (ImGuiNET.ImGui.IsItemHovered())
ImGuiNET.ImGui.SetTooltip("On: with click-through, the wheel over the radar zooms it instead of the game's camera. Clicks still go through to the game.");
ImGuiNET.ImGui.Unindent();
}
changed |= Check("Click a dot to select it", ref RadarSettingsStore.ClickToSelect);
if (ImGuiNET.ImGui.IsItemHovered())
ImGuiNET.ImGui.SetTooltip("Left-click a dot to select that object in game. Hover a dot for its name and distance.");

View file

@ -0,0 +1,39 @@
// ============================================================================
// RynthCore.Engine - ImGui/Panels/RadarWheel.cs
// Whether the mouse wheel belongs to a click-through radar (2026-10-29). Docked
// click-through makes the radar's window take no input, so ImGui never sees it
// hovered and the wheel went to the game (AC's camera zoom) instead of zooming the
// radar. With "Mouse wheel still zooms" on, a wheel over the radar's picture is the
// radar's: RadarFace zooms, and the engine keeps that wheel from the game
// (IImGuiPanel.ClickThroughWantsWheel, Win32Backend). Clicks and moves still go
// through to the game.
//
// Pure (no ImGui), so tools\RadarSettingsTests links it.
// ============================================================================
using System;
using System.Numerics;
namespace RynthCore.Engine.ImGuiBackend.Panels;
internal static class RadarWheel
{
public const float MinZoom = 0.5f, MaxZoom = 6.0f, StepPerNotch = 0.15f;
/// <summary>
/// The wheel is the click-through radar's: the option is on, click-through holds the window this
/// frame (docked; Ctrl or a dot under the mouse makes it interactive, and then the wheel is its
/// own anyway), no other RynthCore window has the mouse, and the mouse is on the radar's picture
/// (inside the circle for the round radar).
/// </summary>
public static bool Owns(bool optionOn, bool clickThroughNow, bool poppedOut, bool uiWantsMouse,
Vector2 mouse, Vector2 min, Vector2 max, RoundMask? round)
{
if (!optionOn || !clickThroughNow || poppedOut || uiWantsMouse) return false;
if (mouse.X < min.X || mouse.Y < min.Y || mouse.X > max.X || mouse.Y > max.Y) return false;
return round is not { } circle || circle.Contains(mouse);
}
/// <summary>The zoom after <paramref name="notches"/> of wheel (up = in), kept to the slider's range.</summary>
public static float Zoomed(float zoom, float notches) => Math.Clamp(zoom + notches * StepPerNotch, MinZoom, MaxZoom);
}

View file

@ -415,6 +415,9 @@ internal static unsafe class Win32Backend
/// WM_MOUSEMOVE still reaches AC, so AC's own mouse-over follows the cursor (Compatibility/AcMouseOver).
/// Means nothing while _wantCaptureMouse is false.</summary>
private static volatile bool _mouseMovesToGame;
/// <summary>The mouse wheel only is the UI's: a docked click-through panel under the cursor reads it
/// (ImGuiPanelHost.WheelWanted, the radar's "Mouse wheel still zooms"). Clicks and moves still reach AC.</summary>
private static volatile bool _wheelToUi;
/// <summary>
/// True while the game window eats mouse input for the ImGui layer: the capture
@ -534,6 +537,7 @@ internal static unsafe class Win32Backend
_hasFocus = false;
_focusInitialized = false;
_wantCaptureMouse = false;
_wheelToUi = false;
_wantCaptureKeyboard = false;
_insertWasDown = false;
_swallowEnterTail = false;
@ -629,6 +633,7 @@ internal static unsafe class Win32Backend
_pendingInput.Clear();
Array.Clear(_mouseButtons, 0, _mouseButtons.Length);
_wantCaptureMouse = false;
_wheelToUi = false;
_wantCaptureKeyboard = false;
if (_hasMouseCapture)
{
@ -1085,6 +1090,9 @@ internal static unsafe class Win32Backend
if (_wantCaptureMouse && IsMouseMessage(msg) && !_heldButtonsBelongToGame
&& !(msg == WM_MOUSEMOVE && _mouseMovesToGame))
return IntPtr.Zero;
// The wheel over a click-through panel that zooms with it (it was queued for ImGui above).
if (_wheelToUi && (msg == WM_MOUSEWHEEL || msg == WM_MOUSEHWHEEL))
return IntPtr.Zero;
// An ImGui text box is being typed in (io.WantTextInput): keep keys from
// the game, except key-ups. A key held before the click must still get
@ -1591,11 +1599,12 @@ internal static unsafe class Win32Backend
/// <paramref name="mouseMovesToGame"/>: the mouse is wanted only by a nameplate under
/// the cursor (no ImGui window, no press held); its clicks are eaten, its moves are not.
/// </summary>
public static void UpdateCaptureFlags(bool wantMouse, bool wantTextInput, bool mouseMovesToGame = false)
public static void UpdateCaptureFlags(bool wantMouse, bool wantTextInput, bool mouseMovesToGame = false, bool wheelToUi = false)
{
bool live = _uiCaptureEnabled && _hasFocus;
_mouseMovesToGame = mouseMovesToGame;
_wantCaptureMouse = live && wantMouse;
_wheelToUi = live && wheelToUi;
_wantCaptureKeyboard = wantTextInput;
ImGuiTextInputActive = wantTextInput;
if (wantTextInput) _keyboardExpiryLogged = false;
@ -1606,12 +1615,13 @@ internal static unsafe class Win32Backend
public static bool UiCaptureEnabled => _uiCaptureEnabled;
public static string DescribeCapture() =>
$"wantMouse={_wantCaptureMouse} wantText={_wantCaptureKeyboard} popOutText={ImGuiPopOuts.TextFocusTitle ?? "-"} insertToggle={_uiCaptureEnabled} focus={_hasFocus} heldButtons=0x{_heldMouseButtons:X} heldForGame={_heldButtonsBelongToGame}";
$"wantMouse={_wantCaptureMouse} wheelToUi={_wheelToUi} wantText={_wantCaptureKeyboard} popOutText={ImGuiPopOuts.TextFocusTitle ?? "-"} insertToggle={_uiCaptureEnabled} focus={_hasFocus} heldButtons=0x{_heldMouseButtons:X} heldForGame={_heldButtonsBelongToGame}";
/// <summary>No ImGui frame this tick: ImGui wants nothing.</summary>
public static void ClearCaptureFlags()
{
_wantCaptureMouse = false;
_wheelToUi = false;
_wantCaptureKeyboard = false;
ImGuiTextInputActive = false;
}
@ -1636,12 +1646,15 @@ internal static unsafe class Win32Backend
/// </summary>
private static void ExpireStaleCaptureFlags()
{
if (!_wantCaptureMouse && !_wantCaptureKeyboard && !ImGuiTextInputActive)
if (!_wantCaptureMouse && !_wantCaptureKeyboard && !ImGuiTextInputActive && !_wheelToUi)
return;
long now = Stopwatch.GetTimestamp();
long frame = Volatile.Read(ref _captureFlagsTicks);
if (_wantCaptureMouse && now - frame > Stopwatch.Frequency * CaptureStaleMs / 1000)
if ((_wantCaptureMouse || _wheelToUi) && now - frame > Stopwatch.Frequency * CaptureStaleMs / 1000)
{
_wantCaptureMouse = false;
_wheelToUi = false;
}
if (!_wantCaptureKeyboard && !ImGuiTextInputActive)
return;
if (_firstMessageSinceFrameTicks < frame)

View file

@ -30,6 +30,9 @@ internal static class RadarSettingsStore
/// <summary>ImGui face: a round radar (everything cut to a circle) instead of the square one.</summary>
public static bool RoundRadar;
public static bool CtrlGatedClickThrough = false;
/// <summary>ImGui face, with click-through on: the mouse wheel over the docked radar still zooms it
/// (and doesn't reach the game); clicks still go through. Off by default (2026-10-29).</summary>
public static bool ClickThroughWheelZoom = false;
public static bool ShowMonsters = true;
public static bool ShowNpcs = true;
public static bool ShowPortals = true;
@ -187,6 +190,7 @@ internal static class RadarSettingsStore
case "showGoldRim": ShowGoldRim = val == "1"; break;
case "round": RoundRadar = val == "1"; break;
case "ctrlClickThrough": CtrlGatedClickThrough = val == "1"; break;
case "clickThroughWheel": ClickThroughWheelZoom = val == "1"; break;
case "showMonsters": ShowMonsters = val == "1"; break;
case "showNpcs": ShowNpcs = val == "1"; break;
case "showPortals": ShowPortals = val == "1"; break;
@ -249,6 +253,7 @@ internal static class RadarSettingsStore
sw.WriteLine($"showGoldRim={(ShowGoldRim ? "1" : "0")}");
sw.WriteLine($"round={(RoundRadar ? "1" : "0")}");
sw.WriteLine($"ctrlClickThrough={(CtrlGatedClickThrough ? "1" : "0")}");
sw.WriteLine($"clickThroughWheel={(ClickThroughWheelZoom ? "1" : "0")}");
sw.WriteLine($"showMonsters={(ShowMonsters ? "1" : "0")}");
sw.WriteLine($"showNpcs={(ShowNpcs ? "1" : "0")}");
sw.WriteLine($"showPortals={(ShowPortals ? "1" : "0")}");

View file

@ -46,6 +46,7 @@ namespace RadarSettingsTests
Run("StyleKeysClampAndIgnore", StyleKeysClampAndIgnore);
Run("WorldMapBackdropSettings", () => WorldMapBackdropSettings(root));
Run("RoundRadarAndClipping", () => RoundRadarAndClipping(root));
Run("ClickThroughWheelZoom", () => ClickThroughWheelZoom(root));
}
finally
{
@ -252,6 +253,42 @@ namespace RadarSettingsTests
Check(text.Contains("worldMap=0\n"), "saved worldMap=0 when off");
}
// The round radar: the setting saves, and the geometry cuts shapes to the circle.
// Docked click-through with "Mouse wheel still zooms" (2026-10-29): the wheel over the radar is
// the radar's, everywhere else and in every other case it stays the game's.
private static void ClickThroughWheelZoom(string root)
{
Check(!RadarSettingsStore.ClickThroughWheelZoom, "off by default");
string saved = Path.Combine(root, "wheel.txt");
Environment.SetEnvironmentVariable("RYNTHCORE_RADAR_SETTINGS", saved);
RadarSettingsStore.ClickThroughWheelZoom = true;
RadarSettingsStore.Save();
Check(File.ReadAllText(saved).Replace("\r\n", "\n").Contains("clickThroughWheel=1\n"), "saved clickThroughWheel=1");
RadarSettingsStore.ClickThroughWheelZoom = false;
RadarSettingsStore.Save();
Check(File.ReadAllText(saved).Replace("\r\n", "\n").Contains("clickThroughWheel=0\n"), "saved clickThroughWheel=0");
// (The store loads once per process, so a file from before - no clickThroughWheel line - is
// covered by the default above: Load only sets the switch from its own line.)
var min = new System.Numerics.Vector2(100, 100);
var max = new System.Numerics.Vector2(300, 300);
var mid = new System.Numerics.Vector2(200, 200);
Check(RadarWheel.Owns(true, true, false, false, mid, min, max, null), "on, click-through, mouse on the radar: the radar's");
Check(!RadarWheel.Owns(false, true, false, false, mid, min, max, null), "option off: the game's");
Check(!RadarWheel.Owns(true, false, false, false, mid, min, max, null), "not click-through this frame (Ctrl, a dot): the window has the wheel itself");
Check(!RadarWheel.Owns(true, true, true, false, mid, min, max, null), "popped out: always interactive");
Check(!RadarWheel.Owns(true, true, false, true, mid, min, max, null), "another RynthCore window has the mouse");
Check(!RadarWheel.Owns(true, true, false, false, new System.Numerics.Vector2(99, 200), min, max, null), "just left of the radar");
Check(!RadarWheel.Owns(true, true, false, false, new System.Numerics.Vector2(200, 301), min, max, null), "just under it");
Check(RadarWheel.Owns(true, true, false, false, max, min, max, null), "its corner counts (square)");
var circle = new RoundMask(mid, 100);
Check(!RadarWheel.Owns(true, true, false, false, new System.Numerics.Vector2(105, 105), min, max, circle), "round: the box's corner is outside the circle");
Check(RadarWheel.Owns(true, true, false, false, new System.Numerics.Vector2(200, 105), min, max, circle), "round: inside the circle");
Check(Math.Abs(RadarWheel.Zoomed(1.5f, 1f) - 1.65f) < 0.0001f, "one notch up: +0.15");
Check(Math.Abs(RadarWheel.Zoomed(1.5f, -2f) - 1.2f) < 0.0001f, "two down: -0.30");
Check(RadarWheel.Zoomed(5.95f, 3f) == RadarWheel.MaxZoom && RadarWheel.Zoomed(0.6f, -3f) == RadarWheel.MinZoom, "kept to 0.5..6 like the slider");
}
private static void RoundRadarAndClipping(string root)
{
Check(!RadarSettingsStore.RoundRadar, "round off by default");

View file

@ -25,6 +25,7 @@
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\RadarSnapshotJson.cs" Link="Engine\RadarSnapshotJson.cs" />
<Compile Include="..\..\src\RynthCore.Engine\UI\Panels\MarkerStyleSettings.cs" Link="Engine\MarkerStyleSettings.cs" />
<Compile Include="..\..\src\RynthCore.Engine\ImGui\Panels\CircleClip.cs" Link="Engine\CircleClip.cs" />
<Compile Include="..\..\src\RynthCore.Engine\ImGui\Panels\RadarWheel.cs" Link="Engine\RadarWheel.cs" />
</ItemGroup>
</Project>