feat(window): wire move/resize flags and consolidate the duplicate toggle
This commit is contained in:
@@ -15,16 +15,6 @@ internal sealed class GeneralTab
|
||||
{
|
||||
if (ImGui.CollapsingHeader("Behavior", ImGuiTreeNodeFlags.DefaultOpen))
|
||||
{
|
||||
DrawToggle(
|
||||
"Allow window movement",
|
||||
() => Plugin.Config.CanMove,
|
||||
v => Plugin.Config.CanMove = v
|
||||
);
|
||||
DrawToggle(
|
||||
"Allow window resize",
|
||||
() => Plugin.Config.CanResize,
|
||||
v => Plugin.Config.CanResize = v
|
||||
);
|
||||
DrawToggle(
|
||||
"Reduce motion (no theme crossfade)",
|
||||
() => Plugin.Config.ReduceMotion,
|
||||
|
||||
@@ -48,6 +48,11 @@ internal sealed class WindowTab
|
||||
|
||||
if (ImGui.CollapsingHeader("Resize behavior", ImGuiTreeNodeFlags.DefaultOpen))
|
||||
{
|
||||
DrawToggle(
|
||||
"Allow movement",
|
||||
() => Plugin.Config.CanMove,
|
||||
v => Plugin.Config.CanMove = v
|
||||
);
|
||||
DrawToggle(
|
||||
"Allow resize",
|
||||
() => Plugin.Config.CanResize,
|
||||
|
||||
@@ -66,9 +66,6 @@ internal sealed class MainWindow : Window
|
||||
MinimumSize = new Vector2(MinWidth, MinHeight),
|
||||
MaximumSize = new Vector2(float.MaxValue, float.MaxValue),
|
||||
};
|
||||
// The message list owns its own scroll inside the body child;
|
||||
// the outer window must not show a second scrollbar.
|
||||
Flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse;
|
||||
IsOpen = Plugin.Config.MainWindowOpen;
|
||||
RespectCloseHotkey = false;
|
||||
}
|
||||
@@ -80,6 +77,22 @@ internal sealed class MainWindow : Window
|
||||
internal float ResolveBgAlpha(bool isFocused) =>
|
||||
isFocused ? Plugin.Config.WindowOpacity : Plugin.Config.WindowOpacityInactive;
|
||||
|
||||
// B1-2: rebuild flags from a fresh base every frame so toggling CanMove/
|
||||
// CanResize back on actually CLEARS NoMove/NoResize (not accumulating).
|
||||
// Move/resize toggle logic as 1.5.6 (ChatLogWindow.PreOpenCheck
|
||||
// 1d3b429:703-707); base flags = today's MainWindow set (NoScrollbar|
|
||||
// NoScrollWithMouse — the message list owns its own scroll; 1.5.6's
|
||||
// NoFocusOnAppearing/NoTitleBar are deliberately not restored).
|
||||
internal static ImGuiWindowFlags ResolveFlags(bool canMove, bool canResize)
|
||||
{
|
||||
var flags = ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse;
|
||||
if (!canMove)
|
||||
flags |= ImGuiWindowFlags.NoMove;
|
||||
if (!canResize)
|
||||
flags |= ImGuiWindowFlags.NoResize;
|
||||
return flags;
|
||||
}
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
// Dalamud's WindowHost turns Window.BgAlpha into SetNextWindowBgAlpha
|
||||
@@ -100,6 +113,8 @@ internal sealed class MainWindow : Window
|
||||
else
|
||||
BgAlpha = null;
|
||||
}
|
||||
|
||||
Flags = ResolveFlags(Plugin.Config.CanMove, Plugin.Config.CanResize);
|
||||
}
|
||||
|
||||
public Tab? ActiveTab => _activeTab;
|
||||
|
||||
Reference in New Issue
Block a user