feat(chat): Campaign CH slice CH6a — retail chat-window layout + 8-grip resize
Swap ChatWindowController's imported main-chat LayoutDesc from the wrong 0x21000006 (an unrelated layout whose root and 800px resize bar appear nowhere in the EoR gameplay UI) to retail's ACTUAL main chat window, 0x2100006F (window root 0x10000600, authored 410x100 — confirmed by a direct DAT dump, found in dats.Local not dats.Portal). Every downstream compensation that existed only to paper over the wrong import is deleted: the hand-cropped 490px content width, the dropped 800px resize bar, the 9px transcript patch, the orphan-sibling pruning, the max/min-vs-scrollbar overlap shift, and the scrollbar top-reclaim. The window now mounts with RetailWindowChrome.Imported (0x2100006F's own 8 border/corner elements are its complete chrome) instead of the universal nine-slice wrapper. LayoutImporter/DatWidgetFactory gain a Type-9 (UIElement_Resizebar) case: UiResizeGrip decodes retail's exact four-bool BorderLocation algorithm (0x2A=bottom/0x2B=left/0x2C=right/0x2D=top, UIElement_Resizebar::StartMouseResizing @0x0046B7E0) into a ResizeEdges bitmask. A direct DAT dump established the true shape: only 7 of the 8 grip-position ids are Type 9 — the straight top-EDGE strip (0x1000069C) is a Type-2 Dragbar (move handle), not a Resizebar, because the main window has no title bar. UiRoot now gives a directly-hit grip's own edges priority over its generic proximity heuristic, and a directly-hit move handle the same priority over ambient proximity — so the plain top strip moves the window while its two corner grips resize it including the Y axis, and all 4 edges + 4 corners work everywhere else. This also fixes the reported "no diagonal cursor at corners" (CursorFeedbackController's existing RetailCursorCatalog cursor ids already matched the DAT exactly; they just never received a genuine diagonal edge combination) and "cannot grow in Y from the bottom-right corner" (the old NineSlice+crop mount's indirection is gone; the Imported mount uses the DAT's real minH=100/maxH=2000/minW=300/maxW=2000 directly). The 8 cosmetic "_Locked" border-art twins default hidden (register row AP-185 — retail's UiLocked-driven art swap between the two skins is not ported; UiRoot.UiLocked continues to gate the underlying interaction correctly either way). The 4 chat-window-1..4 indicator buttons import generically (visible, inert) for CH6b to wire. The two hand-drawn translucent-black tints on the transcript/input are removed now that their parent panels draw their own authored background sprites. Filed #366 (chat window's new-unseen-text indicator 0x1000048C is swallowed by UiText.ConsumesDatChildren, pre-existing and out of scope). Corrected the research doc's "all eight grips" claim against the direct DAT dump. Full Release suite: 12,317 passed / 4 skipped / 0 failed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
ab82347d42
commit
1fd515436c
19 changed files with 6734 additions and 5694 deletions
|
|
@ -10,8 +10,10 @@ using AcDream.UI.Abstractions.Panels.Chat;
|
|||
namespace AcDream.App.UI.Layout;
|
||||
|
||||
/// <summary>
|
||||
/// Binds the imported chat LayoutDesc (0x21000006) to live behavior — the acdream
|
||||
/// analogue of retail <c>ChatInterface</c> + <c>gmMainChatUI::PostInit @0x4ce130</c>.
|
||||
/// Binds the imported chat LayoutDesc (<c>0x2100006F</c>, retail's ACTUAL main chat
|
||||
/// window — see <c>docs/research/2026-08-09-chat-retail-window-shell.md</c> §2.1/§5,
|
||||
/// Campaign CH slice CH6a) to live behavior — the acdream analogue of retail
|
||||
/// <c>ChatInterface</c> + <c>gmMainChatUI::PostInit @0x4ce130</c>.
|
||||
///
|
||||
/// <para>
|
||||
/// The transcript (<c>0x10000011</c>) is Type-12 and is built as a <see cref="UiText"/>
|
||||
|
|
@ -23,15 +25,31 @@ namespace AcDream.App.UI.Layout;
|
|||
/// place. The channel menu (<c>0x10000014</c>) is built as <see cref="UiMenu"/> (Type 6)
|
||||
/// and bound in place.
|
||||
/// </para>
|
||||
///
|
||||
/// <para>
|
||||
/// CH6a retired the wrong <c>0x21000006</c> import (a different, unrelated chat
|
||||
/// layout whose root <c>0x1000000E</c> and 800px resize bar <c>0x1000000F</c>
|
||||
/// appear nowhere in the EoR gameplay UI) along with every downstream compensation
|
||||
/// that existed only to paper over it: the hand-cropped 490px content width, the
|
||||
/// dropped resize bar, the 9px transcript-panel patch, the orphan-sibling pruning,
|
||||
/// the max/min-vs-scrollbar overlap shift, and the scrollbar top-reclaim. All of
|
||||
/// those elements/gaps do not exist in <c>0x2100006F</c>'s authored 410×100 tree —
|
||||
/// nothing was ever missing; the wrong layout was imported. The eight authored
|
||||
/// resize grips (<c>0x1000069B</c>-<c>0x100006A2</c>, Type 9
|
||||
/// <c>UIElement_Resizebar</c> minus the top strip which is a Type-2
|
||||
/// <c>UIElement_Dragbar</c> move handle) import generically via
|
||||
/// <see cref="DatWidgetFactory"/>/<see cref="UiResizeGrip"/> and need no
|
||||
/// controller-side binding; <see cref="UiRoot"/> gives a directly-hit grip's own
|
||||
/// edges priority over its generic proximity heuristic.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public sealed class ChatWindowController : IRetainedWindowStateController, IRetainedPanelController
|
||||
{
|
||||
public const uint LayoutId = 0x21000006u;
|
||||
public const uint LayoutId = 0x2100006Fu;
|
||||
private bool _disposed;
|
||||
|
||||
// Element ids from chat LayoutDesc 0x21000006 (confirmed in Task D/G1).
|
||||
private const uint RootId = 0x1000000Eu;
|
||||
private const uint ResizeBarId = 0x1000000Fu; // dat top resize bar (800px — dropped; nine-slice grips replace it)
|
||||
// Element ids from chat LayoutDesc 0x2100006F (Campaign CH slice CH6a).
|
||||
private const uint RootId = 0x10000600u; // gmFloatyMainChatUI window root, 410x100
|
||||
private const uint TranscriptPanelId = 0x10000010u;
|
||||
private const uint TranscriptId = 0x10000011u; // Type-12 prototype — skipped by factory
|
||||
private const uint TrackId = 0x10000012u;
|
||||
|
|
@ -41,6 +59,31 @@ public sealed class ChatWindowController : IRetainedWindowStateController, IReta
|
|||
private const uint SendId = 0x10000019u;
|
||||
private const uint MaxMinId = 0x1000046Fu;
|
||||
|
||||
// Chat-window 1-4 state-mirror indicator buttons
|
||||
// (gmMainChatUI::RecvNotice_SetPanelVisibility @0x004CCD80): the button lights
|
||||
// up iff the corresponding floating chat window is visible. The mechanism is
|
||||
// one-directional (window visibility drives the button, not the reverse) and
|
||||
// the floating windows themselves are CH6b's scope — these import generically
|
||||
// (visible, inert) here and are left for CH6b to wire.
|
||||
private const uint Indicator1Id = 0x10000522u;
|
||||
private const uint Indicator2Id = 0x10000523u;
|
||||
private const uint Indicator3Id = 0x10000524u;
|
||||
private const uint Indicator4Id = 0x10000525u;
|
||||
|
||||
// The 8 cosmetic "_Locked" border-art twins
|
||||
// (gmFloatyMainChatUI::UpdateLockedStatus @0x004D23D0 swaps these in for the 8
|
||||
// live Resizebar/Dragbar grips above when PlayerModule::LockUI is true — see
|
||||
// research doc §1.6). CH6a does not implement the lock-state art swap (register
|
||||
// row AP-185 — UiRoot.UiLocked already gates INTERACTION generically, independent
|
||||
// of which art is shown); default to the unlocked visual (hide these, show the
|
||||
// live grips) to match UiRoot's own UiLocked=false default and avoid double
|
||||
// rendering two overlapping border-art layers.
|
||||
private static readonly uint[] LockedTwinIds =
|
||||
{
|
||||
0x10000693u, 0x10000694u, 0x10000695u, 0x10000696u,
|
||||
0x10000697u, 0x10000698u, 0x10000699u, 0x1000069Au,
|
||||
};
|
||||
|
||||
// Channel menu sprite ids (confirmed in chat element dump).
|
||||
private const uint MenuNormal = 0x06004D65u; // button face
|
||||
private const uint MenuPressed = 0x06004D66u; // button pressed
|
||||
|
|
@ -182,15 +225,10 @@ public sealed class ChatWindowController : IRetainedWindowStateController, IReta
|
|||
return null;
|
||||
}
|
||||
|
||||
// LayoutDesc 0x21000006 has SEVERAL top-level elements: the gmMainChatUI window
|
||||
// (RootId 0x1000000E) PLUS stray auxiliary elements that are NOT part of the docked
|
||||
// window — a separate Field+ListBox (0x1000001C/1D, the floaty scrollback), the
|
||||
// talk-focus highlight strip (0x1000001E), and a scroll-button prototype (0x10000526).
|
||||
// LayoutImporter.ImportInfos wraps all top-level elements in a synthetic Type-3 root,
|
||||
// so using layout.Root would render the strays overlapping the real window (the
|
||||
// red-striped garbage in the first live render). Use the gmMainChatUI window itself:
|
||||
// GameWindow adds this to the host, which re-parents it out of the synthetic wrapper,
|
||||
// orphaning the strays so they never draw.
|
||||
// LayoutDesc 0x2100006F has exactly ONE top-level element — the
|
||||
// gmFloatyMainChatUI window root itself (RootId 0x10000600, authored
|
||||
// 410x100). No stray auxiliary siblings, no synthetic-wrapper orphaning
|
||||
// needed: FindElement/layout.Root agree.
|
||||
var window = layout.FindElement(RootId) ?? layout.Root;
|
||||
var c = new ChatWindowController
|
||||
{
|
||||
|
|
@ -198,17 +236,13 @@ public sealed class ChatWindowController : IRetainedWindowStateController, IReta
|
|||
DatWindowInfo = FindInfo(rootInfo, RootId) ?? rootInfo,
|
||||
};
|
||||
|
||||
// Drop the dat top resize bar (0x1000000F): it is authored 800px wide and
|
||||
// juts out of the content-width window. The host wraps this content in the
|
||||
// universal nine-slice chrome, whose grips provide the resize affordance.
|
||||
if (layout.FindElement(ResizeBarId) is { Parent: { } rbParent } resizeBar)
|
||||
rbParent.RemoveChild(resizeBar);
|
||||
|
||||
// Reclaim the 9px strip the dropped resize bar occupied (rows 0-8 of the root):
|
||||
// grow the transcript panel up to the window top so its dark bg fills the strip.
|
||||
// Otherwise the root element's brown bg shows through as a sliver along the top.
|
||||
transcriptPanel.Top = 0f;
|
||||
transcriptPanel.Height += 9f; // dat resize-bar height (0x1000000F H=9)
|
||||
// The 8 cosmetic "_Locked" border-art twins default HIDDEN — CH6a does not
|
||||
// implement retail's UiLocked-driven art swap (see the class doc + the
|
||||
// LockedTwinIds field comment); the 8 live grip/dragbar elements (which
|
||||
// occupy the SAME rects one ReadOrder layer above) are the ones shown.
|
||||
foreach (uint id in LockedTwinIds)
|
||||
if (layout.FindElement(id) is { } twin)
|
||||
twin.Visible = false;
|
||||
|
||||
// ── Transcript ───────────────────────────────────────────────────
|
||||
// The factory now builds the Type-12 transcript element (0x10000011) as a UiText.
|
||||
|
|
@ -225,7 +259,11 @@ public sealed class ChatWindowController : IRetainedWindowStateController, IReta
|
|||
c.Transcript.RightAligned = false;
|
||||
c.Transcript.OneLine = false;
|
||||
c.Transcript.Selectable = true;
|
||||
c.Transcript.BackgroundColor = new Vector4(0f, 0f, 0f, 0.35f); // retail translucent transcript
|
||||
// No hand-drawn tint (Campaign CH slice CH6a, item 5): the transcript's
|
||||
// PARENT panel (0x10000010) carries its own authored background sprite
|
||||
// (0x06004CC2) that draws automatically via the generic UiDatElement
|
||||
// fallback — a flat overlay here only mismatched it under the wrong
|
||||
// (0x21000006) layout, whose transcript panel lacked one.
|
||||
c.Transcript.LinesProvider = () => c.GetTranscriptLines(vm);
|
||||
|
||||
// ── Input ────────────────────────────────────────────────────────
|
||||
|
|
@ -234,7 +272,9 @@ public sealed class ChatWindowController : IRetainedWindowStateController, IReta
|
|||
c.Input = input;
|
||||
c.Input.DatFont = datFont;
|
||||
c.Input.Font = debugFont;
|
||||
c.Input.BackgroundColor = new Vector4(0f, 0f, 0f, 0.35f);
|
||||
// No hand-drawn tint here either — the input ROW panel (0x10000013) carries
|
||||
// its own authored background sprite (0x0600113A); same reasoning as the
|
||||
// transcript above.
|
||||
c.Input.SpriteResolve = resolve;
|
||||
c.Input.OnSubmit = text => ChatCommandRouter.Submit(text, vm, busProvider(), c._activeChannel);
|
||||
|
||||
|
|
@ -272,14 +312,12 @@ public sealed class ChatWindowController : IRetainedWindowStateController, IReta
|
|||
|
||||
// ── Scrollbar — bind the factory-built Type-11 track element ────────
|
||||
// The factory now builds the Type-11 track element (0x10000012) as a UiScrollbar
|
||||
// directly. Find it, bind it in place — no remove/add needed.
|
||||
// directly. Find it, bind it in place — no remove/add needed. The dat authors it
|
||||
// flush with the transcript panel's top (Top=0, Height=73 == the panel's own
|
||||
// height) — no top-reclaim adjustment needed under the correct layout.
|
||||
var track = layout.FindElement(TrackId);
|
||||
if (track is UiScrollbar bar)
|
||||
{
|
||||
float oldTop = bar.Top;
|
||||
bar.Top = 0f; // pull up to the panel top (resize-bar reclaim)
|
||||
bar.Height = bar.Height + oldTop;
|
||||
bar.ResetAnchorCapture();
|
||||
bar.Model = c.Transcript.Scroll;
|
||||
bar.SpriteResolve ??= resolve;
|
||||
c.Scrollbar = bar;
|
||||
|
|
@ -343,14 +381,11 @@ public sealed class ChatWindowController : IRetainedWindowStateController, IReta
|
|||
}
|
||||
|
||||
// ── Max/min toggle — gmMainChatUI::HandleMaximizeButton ──
|
||||
// The dat already authors max/min (368,5,16,16) just left of the scrollbar
|
||||
// column (389,5,16,73 abs) with a natural 5px gap — no overlap under the
|
||||
// correct layout, so no positional shift is needed.
|
||||
if (layout.FindElement(MaxMinId) is UiButton maxMinEl)
|
||||
{
|
||||
// The dat puts max/min and the scrollbar up-button at the SAME X (both
|
||||
// right-anchored), so at content width they overlap. Retail shows max/min
|
||||
// just LEFT of the scrollbar column — shift it one button-width left.
|
||||
if (track is not null)
|
||||
maxMinEl.Left = track.Left - maxMinEl.Width;
|
||||
maxMinEl.ResetAnchorCapture();
|
||||
c._maxMinButton = maxMinEl;
|
||||
maxMinEl.OnClick = c.ToggleMaximize;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public static class DatWidgetFactory
|
|||
Func<UiStringInfoValue, string?>? stringResolve = null)
|
||||
{
|
||||
// Retail Type 3 = UIElement_Field (reg :126190), but in acdream's CURRENT layouts
|
||||
// (vitals 0x2100006C / chat 0x21000006) Type-3 elements are sprite-bearing chrome +
|
||||
// (vitals 0x2100006C / chat 0x2100006F) Type-3 elements are sprite-bearing chrome +
|
||||
// containers (the 8-piece bevel corners/edges, the transcript/input panels), NOT
|
||||
// editable fields — retail draws those as inert media-bearing Fields, which our
|
||||
// UiDatElement reproduces pixel-for-pixel (and without the spurious focus/edit
|
||||
|
|
@ -95,6 +95,7 @@ public static class DatWidgetFactory
|
|||
// gmUIElement_*Indicator custom button classes
|
||||
6 => new UiMenu(), // UIElement_Menu (reg :120163)
|
||||
7 => BuildMeter(info, resolve, elementFont), // UIElement_Meter
|
||||
9 => BuildResizeGrip(info), // UIElement_Resizebar (reg 0x0046B920)
|
||||
0xD => new UiViewport(), // UIElement_Viewport — 3-D mini-scene blit leaf
|
||||
11 => BuildScrollbar(info, resolve), // UIElement_Scrollbar (reg :124137)
|
||||
12 => BuildText(info, resolve, elementFont, stringResolve), // UIElement_Text
|
||||
|
|
@ -255,6 +256,29 @@ public static class DatWidgetFactory
|
|||
return bar;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds a <see cref="UiResizeGrip"/> from a Type-9 <c>UIElement_Resizebar</c>
|
||||
/// element: retail <c>StartMouseResizing @0x0046B7E0</c> reads four BOOL
|
||||
/// attributes — <c>0x2A</c>=bottom, <c>0x2B</c>=left, <c>0x2C</c>=right,
|
||||
/// <c>0x2D</c>=top — and decodes them into a <c>BorderLocation</c>. A grip with
|
||||
/// no true bool (the inert <c>_Locked</c> cosmetic twins are a DIFFERENT
|
||||
/// element type entirely and never reach this factory case, but an
|
||||
/// all-false Type-9 element is handled defensively the same way retail's own
|
||||
/// BORDER_NONE fallback does) decodes to <see cref="UiResizeGrip.Border.None"/>
|
||||
/// — <see cref="UiRoot"/> then treats it as contributing no resize edges.
|
||||
/// </summary>
|
||||
private static UiResizeGrip BuildResizeGrip(ElementInfo info)
|
||||
{
|
||||
bool bottom = info.TryGetEffectiveBool(0x2Au, out bool bottomValue) && bottomValue;
|
||||
bool left = info.TryGetEffectiveBool(0x2Bu, out bool leftValue) && leftValue;
|
||||
bool right = info.TryGetEffectiveBool(0x2Cu, out bool rightValue) && rightValue;
|
||||
bool top = info.TryGetEffectiveBool(0x2Du, out bool topValue) && topValue;
|
||||
return new UiResizeGrip
|
||||
{
|
||||
BorderLocation = UiResizeGrip.DecodeBorderLocation(bottom, left, right, top),
|
||||
};
|
||||
}
|
||||
|
||||
private static UiLayoutPolicy? CreateLayoutPolicy(ElementInfo info)
|
||||
{
|
||||
if (!info.HasOriginalParentSize) return null;
|
||||
|
|
|
|||
|
|
@ -684,7 +684,7 @@ public sealed class RetailUiRuntime : IDisposable
|
|||
}
|
||||
if (info is null || layout is null)
|
||||
{
|
||||
Console.WriteLine("[D.2b] chat: LayoutDesc 0x21000006 not found.");
|
||||
Console.WriteLine("[D.2b] chat: LayoutDesc 0x2100006F not found.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -698,7 +698,7 @@ public sealed class RetailUiRuntime : IDisposable
|
|||
_bindings.Assets.ResolveSprite);
|
||||
if (controller is null)
|
||||
{
|
||||
Console.WriteLine("[D.2b] chat: required role elements missing in 0x21000006.");
|
||||
Console.WriteLine("[D.2b] chat: required role elements missing in 0x2100006F.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -712,27 +712,39 @@ public sealed class RetailUiRuntime : IDisposable
|
|||
new RetailWindowFrame.Options
|
||||
{
|
||||
WindowName = WindowNames.Chat,
|
||||
Chrome = RetailWindowChrome.NineSlice,
|
||||
// 0x2100006F's root already IS the complete retail window — its own
|
||||
// 8 border/corner elements (the live Resizebar/Dragbar grips, or their
|
||||
// _Locked cosmetic twins) are its chrome, at its authored 410x100
|
||||
// extent. No universal nine-slice wrapper or content crop needed
|
||||
// (Campaign CH slice CH6a; the wrapper + 490px crop were compensations
|
||||
// for importing the wrong 0x21000006 layout).
|
||||
Chrome = RetailWindowChrome.Imported,
|
||||
Left = 10f,
|
||||
Top = 440f,
|
||||
ContentWidth = 490f,
|
||||
ContentHeight = root.Height,
|
||||
RebaseContentLayout = true,
|
||||
DatConstraintSource = controller.DatWindowInfo,
|
||||
MinWidth = 200f,
|
||||
// Bumping this resets any locally-persisted width/height captured
|
||||
// under the old, wrong-layout mount (490px-cropped content, patched
|
||||
// 9px height) to the newly authored 410x100 default on next load.
|
||||
AuthoredGeometryRevision = 1,
|
||||
ResizeX = true,
|
||||
ResizeY = true,
|
||||
// The imported 9px top Resizebar is deliberately removed by
|
||||
// ChatWindowController. Its replacement top chrome is the move
|
||||
// affordance; only the other three wrapper edges resize.
|
||||
ResizableEdges = ResizeEdges.Left | ResizeEdges.Right | ResizeEdges.Bottom,
|
||||
Opacity = 0.75f,
|
||||
// All 4 edges + 4 corners resize via the authored Resizebar grips
|
||||
// (UiRoot gives a directly-hit grip's own edges priority over this
|
||||
// blanket mask); the default already covers every edge, and the
|
||||
// plain top-STRIP correctly remains a move-only affordance because
|
||||
// its own element is a Type-2 Dragbar, not a grip (research doc §2.1,
|
||||
// §2.3 — the top edge authors NO Resizebar of its own; only its two
|
||||
// corners do).
|
||||
// Opacity: retail's whole-window alpha (ChatInterface::SetOpacity
|
||||
// @0x004F3120) is CH6c's scope — UiRenderContext.AlphaMod currently has
|
||||
// no draw-path consumer, so any value here is presentation-inert; leave
|
||||
// the frame at the default 1f rather than assert a value with no effect.
|
||||
Controller = controller,
|
||||
StateController = controller,
|
||||
});
|
||||
controller.AttachWindow(handle);
|
||||
Host.Root.DefaultTextInput = controller.Input;
|
||||
Console.WriteLine("[D.2b] retail chat window from LayoutDesc importer (0x21000006).");
|
||||
Console.WriteLine("[D.2b] retail chat window from LayoutDesc importer (0x2100006F).");
|
||||
}
|
||||
|
||||
private void MountToolbar()
|
||||
|
|
|
|||
85
src/AcDream.App/UI/UiResizeGrip.cs
Normal file
85
src/AcDream.App/UI/UiResizeGrip.cs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
namespace AcDream.App.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Retail <c>UIElement_Resizebar</c> (element class 9,
|
||||
/// <c>UIElement_Resizebar::Register @0x0046B920</c> registers class 9 with the
|
||||
/// LayoutDesc element factory). A leaf grip authored at exactly one edge or
|
||||
/// corner of a window; retail authors 4 edge grips + 4 corner grips per
|
||||
/// resizable window (main chat: <c>0x1000069B</c>-<c>0x100006A2</c>, minus the
|
||||
/// straight top strip which is a retail <c>UIElement_Dragbar</c> move handle
|
||||
/// instead — see the class doc on <see cref="AcDream.App.UI.Layout.DatWidgetFactory"/>
|
||||
/// and <c>docs/research/2026-08-09-chat-retail-window-shell.md</c> §2.1/§2.3).
|
||||
///
|
||||
/// <para>
|
||||
/// <c>UIElement_Resizebar::StartMouseResizing @0x0046B7E0</c> reads four BOOL
|
||||
/// attributes off the element — <c>0x2A</c>=bottom, <c>0x2B</c>=left,
|
||||
/// <c>0x2C</c>=right, <c>0x2D</c>=top — and combines them into a
|
||||
/// <c>BorderLocation</c> (<c>acclient.h:4327</c>). <see cref="DecodeBorderLocation"/>
|
||||
/// is a verbatim port of that branch order. acdream's engine expresses resize
|
||||
/// direction as an edge-flag bitmask (<see cref="ResizeEdges"/>) rather than
|
||||
/// retail's nine-case enum; <see cref="Edges"/> is the lossless projection —
|
||||
/// every <see cref="Border"/> value maps to exactly one <see cref="ResizeEdges"/>
|
||||
/// combination and back.
|
||||
/// </para>
|
||||
///
|
||||
/// <para>
|
||||
/// A grip is a small (5px) leaf with no children and no authored background
|
||||
/// media beyond its own cursor-feedback sprite; it exists purely as a precise
|
||||
/// hit region. <see cref="AcDream.App.UI.UiRoot"/> gives a directly-hit grip's
|
||||
/// own <see cref="Edges"/> priority over the generic proximity-based
|
||||
/// <see cref="AcDream.App.UI.UiRoot.HitEdges"/> heuristic, so e.g. the chat
|
||||
/// window's top-left/top-right CORNER grips resize (including the Y/top axis)
|
||||
/// while the plain top EDGE strip in between remains a pure move handle.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public sealed class UiResizeGrip : UiElement
|
||||
{
|
||||
/// <summary>Retail <c>BorderLocation</c> (<c>acclient.h:4327</c>):
|
||||
/// <c>BORDER_NONE=0, BORDER_UL=1, BORDER_TOP=2, BORDER_UR=3, BORDER_RIGHT=4,
|
||||
/// BORDER_LR=5, BORDER_BOTTOM=6, BORDER_LL=7, BORDER_LEFT=8</c>.</summary>
|
||||
public enum Border
|
||||
{
|
||||
None = 0,
|
||||
UpperLeft = 1,
|
||||
Top = 2,
|
||||
UpperRight = 3,
|
||||
Right = 4,
|
||||
LowerRight = 5,
|
||||
Bottom = 6,
|
||||
LowerLeft = 7,
|
||||
Left = 8,
|
||||
}
|
||||
|
||||
/// <summary>Decoded retail BorderLocation for this grip.</summary>
|
||||
public Border BorderLocation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Exact port of <c>UIElement_Resizebar::StartMouseResizing @0x0046B7E0</c>'s
|
||||
/// if/else-if chain (right beats left beats top beats bottom when more than
|
||||
/// two bools are set, which retail's authored data never does — corners set
|
||||
/// exactly two adjacent bools, edges set exactly one).
|
||||
/// </summary>
|
||||
public static Border DecodeBorderLocation(bool bottom, bool left, bool right, bool top)
|
||||
{
|
||||
if (right) return top ? Border.UpperRight : bottom ? Border.LowerRight : Border.Right;
|
||||
if (left) return top ? Border.UpperLeft : bottom ? Border.LowerLeft : Border.Left;
|
||||
if (top) return Border.Top;
|
||||
if (bottom) return Border.Bottom;
|
||||
return Border.None;
|
||||
}
|
||||
|
||||
/// <summary>The <see cref="ResizeEdges"/> projection <see cref="UiRoot"/>'s resize
|
||||
/// drag state machine consumes — a lossless re-encoding of <see cref="BorderLocation"/>.</summary>
|
||||
public ResizeEdges Edges => BorderLocation switch
|
||||
{
|
||||
Border.UpperLeft => ResizeEdges.Left | ResizeEdges.Top,
|
||||
Border.Top => ResizeEdges.Top,
|
||||
Border.UpperRight => ResizeEdges.Right | ResizeEdges.Top,
|
||||
Border.Right => ResizeEdges.Right,
|
||||
Border.LowerRight => ResizeEdges.Right | ResizeEdges.Bottom,
|
||||
Border.Bottom => ResizeEdges.Bottom,
|
||||
Border.LowerLeft => ResizeEdges.Left | ResizeEdges.Bottom,
|
||||
Border.Left => ResizeEdges.Left,
|
||||
_ => ResizeEdges.None,
|
||||
};
|
||||
}
|
||||
|
|
@ -91,11 +91,47 @@ public sealed class UiRoot : UiElement
|
|||
{
|
||||
var target = Pick(MouseX, MouseY);
|
||||
var window = FindWindow(target);
|
||||
return !UiLocked && window is { Resizable: true }
|
||||
? HitEdges(window, MouseX, MouseY, ResizeGrip)
|
||||
: ResizeEdges.None;
|
||||
if (UiLocked || window is not { Resizable: true })
|
||||
return ResizeEdges.None;
|
||||
|
||||
// A directly-hovered authored Resizebar grip (retail element class 9)
|
||||
// is precise geometry, not a proximity heuristic — it wins outright.
|
||||
var gripEdges = EffectiveGripEdges(target, window);
|
||||
if (gripEdges != ResizeEdges.None)
|
||||
return gripEdges;
|
||||
|
||||
// An authored move handle (retail UIElement_Dragbar, class 2) directly
|
||||
// under the cursor takes precedence over ambient edge-proximity — e.g.
|
||||
// the main chat window's top strip moves the window even though its
|
||||
// own top-left/top-right CORNERS (separate Resizebar grips) resize it
|
||||
// (docs/research/2026-08-09-chat-retail-window-shell.md §2.1/§2.3).
|
||||
if (FindDragHandleWindow(target) is not null)
|
||||
return ResizeEdges.None;
|
||||
|
||||
return HitEdges(window, MouseX, MouseY, ResizeGrip);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolve the resize edges a literal, directly-hit <see cref="UiResizeGrip"/>
|
||||
/// contributes, masked by the window's own <see cref="UiElement.ResizeX"/> /
|
||||
/// <see cref="UiElement.ResizeY"/> axis gates and <see cref="UiElement.ResizableEdges"/>
|
||||
/// mask (the same gates <see cref="HitEdges"/> applies to its proximity heuristic).
|
||||
/// Returns <see cref="ResizeEdges.None"/> when <paramref name="target"/> is not
|
||||
/// itself an authored grip.
|
||||
/// </summary>
|
||||
private static ResizeEdges EffectiveGripEdges(UiElement? target, UiElement? window)
|
||||
{
|
||||
if (window is null || target is not UiResizeGrip grip)
|
||||
return ResizeEdges.None;
|
||||
|
||||
ResizeEdges edges = grip.Edges;
|
||||
if (!window.ResizeX) edges &= ~(ResizeEdges.Left | ResizeEdges.Right);
|
||||
if (!window.ResizeY) edges &= ~(ResizeEdges.Top | ResizeEdges.Bottom);
|
||||
edges &= window.ResizableEdges;
|
||||
return edges;
|
||||
}
|
||||
|
||||
public bool HoverWindowMove
|
||||
{
|
||||
get
|
||||
|
|
@ -469,9 +505,18 @@ public sealed class UiRoot : UiElement
|
|||
if (raiseWindow is not null) BringToFront(raiseWindow);
|
||||
if (btn == UiMouseButton.Left && raiseWindow is not null && !UiLocked)
|
||||
{
|
||||
var edges = window is { Resizable: true }
|
||||
? HitEdges(window, x, y, ResizeGrip)
|
||||
: ResizeEdges.None;
|
||||
// A directly-pressed authored Resizebar grip is precise geometry and
|
||||
// wins outright, regardless of an overlapping move handle or the
|
||||
// generic proximity heuristic. Failing that, a directly-pressed move
|
||||
// handle (dragbar) wins over ambient edge-proximity — the chat
|
||||
// window's top strip must move the window even though it sits
|
||||
// within ResizeGrip px of the window's own top edge.
|
||||
var gripEdges = EffectiveGripEdges(target, window);
|
||||
var edges = gripEdges != ResizeEdges.None
|
||||
? gripEdges
|
||||
: (handleWindow is null && window is { Resizable: true }
|
||||
? HitEdges(window, x, y, ResizeGrip)
|
||||
: ResizeEdges.None);
|
||||
if (edges != ResizeEdges.None)
|
||||
{
|
||||
// Edge resize still wins, even over a CapturesPointerDrag child:
|
||||
|
|
|
|||
|
|
@ -9,8 +9,9 @@ namespace AcDream.App.UI;
|
|||
/// thumb size = trackLen * ThumbRatio (min 8px); step ±1 line.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Dat element ids (chat LayoutDesc 0x21000006): track 0x10000012 (X=474 Y=6 W=16 H=68),
|
||||
/// thumb 0x1000048C. The track is instanced from base layout 0x2100003E which contains
|
||||
/// Dat element ids (chat LayoutDesc 0x2100006F, Campaign CH slice CH6a — retired the
|
||||
/// wrong 0x21000006 import): track 0x10000012 (X=384 Y=0 W=16 H=73 relative to the
|
||||
/// transcript panel). The track is instanced from base layout 0x2100003E which contains
|
||||
/// the full scrollbar widget with distinct up/down button children:
|
||||
/// Up button element 0x10000071 — Y=0, 16×16, Normal sprite 0x06004C69.
|
||||
/// Down button element 0x10000072 — Y=32, 16×16, Normal sprite 0x06004C6C.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue