mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-13 12:14:17 +01:00
Fix scrolling weirdness.
This commit is contained in:
parent
63fff56a60
commit
4a6e7fccec
2 changed files with 34 additions and 19 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
|
using Dalamud.Interface.Utility.Raii;
|
||||||
using Dalamud.Plugin;
|
using Dalamud.Plugin;
|
||||||
|
using ImGuiNET;
|
||||||
using Penumbra.Mods;
|
using Penumbra.Mods;
|
||||||
using Penumbra.Services;
|
using Penumbra.Services;
|
||||||
using Penumbra.UI.AdvancedWindow;
|
using Penumbra.UI.AdvancedWindow;
|
||||||
|
|
@ -12,6 +14,7 @@ public class ModPanel : IDisposable
|
||||||
private readonly ModEditWindow _editWindow;
|
private readonly ModEditWindow _editWindow;
|
||||||
private readonly ModPanelHeader _header;
|
private readonly ModPanelHeader _header;
|
||||||
private readonly ModPanelTabBar _tabs;
|
private readonly ModPanelTabBar _tabs;
|
||||||
|
private bool _resetCursor;
|
||||||
|
|
||||||
public ModPanel(DalamudPluginInterface pi, ModFileSystemSelector selector, ModEditWindow editWindow, ModPanelTabBar tabs,
|
public ModPanel(DalamudPluginInterface pi, ModFileSystemSelector selector, ModEditWindow editWindow, ModPanelTabBar tabs,
|
||||||
MultiModPanel multiModPanel, CommunicatorService communicator)
|
MultiModPanel multiModPanel, CommunicatorService communicator)
|
||||||
|
|
@ -32,8 +35,18 @@ public class ModPanel : IDisposable
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_resetCursor)
|
||||||
|
{
|
||||||
|
_resetCursor = false;
|
||||||
|
ImGui.SetScrollX(0);
|
||||||
|
}
|
||||||
|
|
||||||
_header.Draw();
|
_header.Draw();
|
||||||
_tabs.Draw(_mod);
|
ImGui.SetCursorPosX(ImGui.GetScrollX() + ImGui.GetCursorPosX());
|
||||||
|
using var child = ImRaii.Child("Tabs",
|
||||||
|
new Vector2(ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X, ImGui.GetContentRegionAvail().Y));
|
||||||
|
if (child)
|
||||||
|
_tabs.Draw(_mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
@ -47,6 +60,7 @@ public class ModPanel : IDisposable
|
||||||
|
|
||||||
private void OnSelectionChange(Mod? old, Mod? mod, in ModFileSystemSelector.ModState _)
|
private void OnSelectionChange(Mod? old, Mod? mod, in ModFileSystemSelector.ModState _)
|
||||||
{
|
{
|
||||||
|
_resetCursor = true;
|
||||||
if (mod == null || _selector.Selected == null)
|
if (mod == null || _selector.Selected == null)
|
||||||
{
|
{
|
||||||
_editWindow.IsOpen = false;
|
_editWindow.IsOpen = false;
|
||||||
|
|
|
||||||
|
|
@ -139,24 +139,6 @@ public class ModsTab : ITab
|
||||||
if (hovered)
|
if (hovered)
|
||||||
ImGui.SetTooltip($"The supported modifiers for '/penumbra redraw' are:\n{TutorialService.SupportedRedrawModifiers}");
|
ImGui.SetTooltip($"The supported modifiers for '/penumbra redraw' are:\n{TutorialService.SupportedRedrawModifiers}");
|
||||||
|
|
||||||
void DrawButton(Vector2 size, string label, string lower, string additionalTooltip)
|
|
||||||
{
|
|
||||||
using (var disabled = ImRaii.Disabled(additionalTooltip.Length > 0))
|
|
||||||
{
|
|
||||||
if (ImGui.Button(label, size))
|
|
||||||
{
|
|
||||||
if (lower.Length > 0)
|
|
||||||
_redrawService.RedrawObject(lower, RedrawType.Redraw);
|
|
||||||
else
|
|
||||||
_redrawService.RedrawAll(RedrawType.Redraw);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGuiUtil.HoverTooltip(lower.Length > 0
|
|
||||||
? $"Execute '/penumbra redraw {lower}'.{additionalTooltip}"
|
|
||||||
: $"Execute '/penumbra redraw'.{additionalTooltip}", ImGuiHoveredFlags.AllowWhenDisabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
using var id = ImRaii.PushId("Redraw");
|
using var id = ImRaii.PushId("Redraw");
|
||||||
using var disabled = ImRaii.Disabled(_clientState.LocalPlayer == null);
|
using var disabled = ImRaii.Disabled(_clientState.LocalPlayer == null);
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
@ -185,6 +167,25 @@ public class ModsTab : ITab
|
||||||
? "\nCan currently only be used for indoor furniture."
|
? "\nCan currently only be used for indoor furniture."
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
DrawButton(frameHeight with { X = ImGui.GetContentRegionAvail().X - 1 }, "Furniture", "furniture", tt);
|
DrawButton(frameHeight with { X = ImGui.GetContentRegionAvail().X - 1 }, "Furniture", "furniture", tt);
|
||||||
|
return;
|
||||||
|
|
||||||
|
void DrawButton(Vector2 size, string label, string lower, string additionalTooltip)
|
||||||
|
{
|
||||||
|
using (_ = ImRaii.Disabled(additionalTooltip.Length > 0))
|
||||||
|
{
|
||||||
|
if (ImGui.Button(label, size))
|
||||||
|
{
|
||||||
|
if (lower.Length > 0)
|
||||||
|
_redrawService.RedrawObject(lower, RedrawType.Redraw);
|
||||||
|
else
|
||||||
|
_redrawService.RedrawAll(RedrawType.Redraw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGuiUtil.HoverTooltip(lower.Length > 0
|
||||||
|
? $"Execute '/penumbra redraw {lower}'.{additionalTooltip}"
|
||||||
|
: $"Execute '/penumbra redraw'.{additionalTooltip}", ImGuiHoveredFlags.AllowWhenDisabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static unsafe bool IsIndoors()
|
private static unsafe bool IsIndoors()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue