Snapshot for release 2026.10.29.2 (internal f1e8d4e)
This commit is contained in:
parent
0bfe184288
commit
8cb74c7685
8 changed files with 144 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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).
|
||||
|
|
|
|||
|
|
@ -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.");
|
||||
|
|
|
|||
39
src/RynthCore.Engine/ImGui/Panels/RadarWheel.cs
Normal file
39
src/RynthCore.Engine/ImGui/Panels/RadarWheel.cs
Normal 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);
|
||||
}
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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")}");
|
||||
|
|
|
|||
Loading…
Reference in a new issue