Implement ADV layout cursor and bounds
This commit is contained in:
@@ -159,6 +159,20 @@ public sealed class GodotAdvHost : IHost
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Layout that owns the ordinary ADV overlay. Nested callback scripts such as HISTORY can select and
|
||||
/// mutate other layouts while the parent wait remains parked; those transient selections must not move
|
||||
/// the parent page when its overlay becomes visible again.
|
||||
/// </summary>
|
||||
public int AdvPageLayoutSlot
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_textLock)
|
||||
return IsWaiting && _activeWaitLayout != 0 ? _activeWaitLayout : _currentAdvLayout;
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<SurfaceTextDraw> SnapshotSurfaceText(int surfaceSlot)
|
||||
{
|
||||
lock (_textLock)
|
||||
|
||||
@@ -714,8 +714,10 @@ public partial class Main : Godot.Control
|
||||
_text.Visible = !_host.IsAdvPagePresentationSuspended && !_vm.IsRawInputCallbackActive;
|
||||
if (!_text.Visible) return;
|
||||
var t = _host.SnapshotAdvText();
|
||||
_text.Position = new Vector2(t.X, 430 + t.Y);
|
||||
_text.Size = new Vector2(System.Math.Max(1, 720 - t.X), System.Math.Max(1, 147 - t.Y));
|
||||
var layout = _vm.TextHistory.GetLayoutSnapshot(_host.AdvPageLayoutSlot);
|
||||
_text.Position = new Vector2(layout.OriginX + layout.CursorX, layout.OriginY + layout.CursorY);
|
||||
_text.Size = new Vector2(System.Math.Max(1, layout.Right - layout.CursorX),
|
||||
System.Math.Max(1, layout.Bottom - layout.CursorY));
|
||||
int count = System.Math.Clamp(t.VisibleGlyphs, 0, t.Text.Length);
|
||||
_text.Text = count == 0 ? "" : t.Text[..count];
|
||||
}
|
||||
@@ -733,8 +735,8 @@ public partial class Main : Godot.Control
|
||||
}
|
||||
var layout = batch.Layout;
|
||||
label.Position = new Vector2(layout.OriginX + layout.CursorX, layout.OriginY + layout.CursorY);
|
||||
label.Size = new Vector2(System.Math.Max(1, layout.Width - layout.CursorX),
|
||||
System.Math.Max(1, layout.Height - layout.CursorY));
|
||||
label.Size = new Vector2(System.Math.Max(1, layout.Right - layout.CursorX),
|
||||
System.Math.Max(1, layout.Bottom - layout.CursorY));
|
||||
label.Text = batch.Text;
|
||||
ApplyAdvTextStyle(label, batch.Style);
|
||||
label.Visible = true;
|
||||
|
||||
Reference in New Issue
Block a user