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
|
|
@ -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);
|
||||
}
|
||||
Loading…
Reference in a new issue