mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Slight modifications to button offset PR.
This commit is contained in:
parent
5802f6b6d7
commit
0e552d24a6
3 changed files with 322 additions and 318 deletions
|
|
@ -37,7 +37,7 @@ namespace Penumbra
|
||||||
public Dictionary< string, string > ModSortOrder { get; set; } = new();
|
public Dictionary< string, string > ModSortOrder { get; set; } = new();
|
||||||
|
|
||||||
public bool InvertModListOrder { internal get; set; }
|
public bool InvertModListOrder { internal get; set; }
|
||||||
public Vector2 ManageModsButtonOffset { get; set; } = Vector2.Zero;
|
public Vector2 ManageModsButtonOffset { get; set; } = 50 * Vector2.One;
|
||||||
|
|
||||||
public static Configuration Load()
|
public static Configuration Load()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,19 @@
|
||||||
using System.Numerics;
|
using Dalamud.Interface;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
using Penumbra.UI.Custom;
|
||||||
|
|
||||||
|
namespace Penumbra.UI;
|
||||||
|
|
||||||
namespace Penumbra.UI
|
|
||||||
{
|
|
||||||
public partial class SettingsInterface
|
public partial class SettingsInterface
|
||||||
{
|
{
|
||||||
private class ManageModsButton
|
private class ManageModsButton
|
||||||
{
|
{
|
||||||
// magic numbers
|
// magic numbers
|
||||||
private const int Padding = 50;
|
|
||||||
private const int Width = 200;
|
private const int Width = 200;
|
||||||
private const int Height = 45;
|
private const int Height = 45;
|
||||||
private const string MenuButtonsName = "Penumbra Menu Buttons";
|
private const string MenuButtonsName = "Penumbra Menu Buttons";
|
||||||
private const string MenuButtonLabel = "Manage Mods";
|
private const string MenuButtonLabel = "Manage Mods";
|
||||||
|
|
||||||
private static readonly Vector2 WindowSize = new( Width, Height );
|
|
||||||
private static readonly Vector2 WindowPosOffset = new( Padding + Width, Padding + Height );
|
|
||||||
|
|
||||||
private const ImGuiWindowFlags ButtonFlags =
|
private const ImGuiWindowFlags ButtonFlags =
|
||||||
ImGuiWindowFlags.AlwaysAutoResize
|
ImGuiWindowFlags.AlwaysAutoResize
|
||||||
| ImGuiWindowFlags.NoBackground
|
| ImGuiWindowFlags.NoBackground
|
||||||
|
|
@ -24,6 +21,7 @@ namespace Penumbra.UI
|
||||||
| ImGuiWindowFlags.NoMove
|
| ImGuiWindowFlags.NoMove
|
||||||
| ImGuiWindowFlags.NoScrollbar
|
| ImGuiWindowFlags.NoScrollbar
|
||||||
| ImGuiWindowFlags.NoResize
|
| ImGuiWindowFlags.NoResize
|
||||||
|
| ImGuiWindowFlags.NoFocusOnAppearing
|
||||||
| ImGuiWindowFlags.NoSavedSettings;
|
| ImGuiWindowFlags.NoSavedSettings;
|
||||||
|
|
||||||
private readonly SettingsInterface _base;
|
private readonly SettingsInterface _base;
|
||||||
|
|
@ -31,20 +29,26 @@ namespace Penumbra.UI
|
||||||
public ManageModsButton( SettingsInterface ui )
|
public ManageModsButton( SettingsInterface ui )
|
||||||
=> _base = ui;
|
=> _base = ui;
|
||||||
|
|
||||||
|
internal bool ForceDraw = false;
|
||||||
|
|
||||||
public void Draw()
|
public void Draw()
|
||||||
{
|
{
|
||||||
if( Dalamud.Conditions.Any() || _base._menu.Visible )
|
if( !ForceDraw && ( Dalamud.Conditions.Any() || _base._menu.Visible ) )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using var color = ImGuiRaii.PushColor( ImGuiCol.Button, 0xFF0000C8, ForceDraw );
|
||||||
|
|
||||||
var ss = ImGui.GetMainViewport().Size + ImGui.GetMainViewport().Pos;
|
var ss = ImGui.GetMainViewport().Size + ImGui.GetMainViewport().Pos;
|
||||||
ImGui.SetNextWindowViewport( ImGui.GetMainViewport().ID );
|
ImGui.SetNextWindowViewport( ImGui.GetMainViewport().ID );
|
||||||
|
|
||||||
ImGui.SetNextWindowPos( ss - WindowPosOffset + Penumbra.Config.ManageModsButtonOffset, ImGuiCond.Always );
|
var windowSize = ImGuiHelpers.ScaledVector2( Width, Height );
|
||||||
|
|
||||||
|
ImGui.SetNextWindowPos( ss - windowSize - Penumbra.Config.ManageModsButtonOffset * ImGuiHelpers.GlobalScale, ImGuiCond.Always );
|
||||||
|
|
||||||
if( ImGui.Begin( MenuButtonsName, ButtonFlags )
|
if( ImGui.Begin( MenuButtonsName, ButtonFlags )
|
||||||
&& ImGui.Button( MenuButtonLabel, WindowSize ) )
|
&& ImGui.Button( MenuButtonLabel, windowSize ) )
|
||||||
{
|
{
|
||||||
_base.FlipVisibility();
|
_base.FlipVisibility();
|
||||||
}
|
}
|
||||||
|
|
@ -53,4 +57,3 @@ namespace Penumbra.UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
@ -12,8 +12,8 @@ using Penumbra.Mods;
|
||||||
using Penumbra.UI.Custom;
|
using Penumbra.UI.Custom;
|
||||||
using Penumbra.Util;
|
using Penumbra.Util;
|
||||||
|
|
||||||
namespace Penumbra.UI
|
namespace Penumbra.UI;
|
||||||
{
|
|
||||||
public partial class SettingsInterface
|
public partial class SettingsInterface
|
||||||
{
|
{
|
||||||
private class TabSettings
|
private class TabSettings
|
||||||
|
|
@ -34,7 +34,7 @@ namespace Penumbra.UI
|
||||||
private const string LabelDisableNotifications = "Disable filesystem change notifications";
|
private const string LabelDisableNotifications = "Disable filesystem change notifications";
|
||||||
private const string LabelEnableHttpApi = "Enable HTTP API";
|
private const string LabelEnableHttpApi = "Enable HTTP API";
|
||||||
private const string LabelReloadResource = "Reload Player Resource";
|
private const string LabelReloadResource = "Reload Player Resource";
|
||||||
private const string LabelManageModsOffset = "\"Manage mods\" title screen button offset";
|
private const string LabelManageModsOffset = "\"Manage mods\"-Button Offset";
|
||||||
|
|
||||||
private readonly SettingsInterface _base;
|
private readonly SettingsInterface _base;
|
||||||
private readonly Configuration _config;
|
private readonly Configuration _config;
|
||||||
|
|
@ -160,15 +160,17 @@ namespace Penumbra.UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawManageModsButtonOffset()
|
private void DrawManageModsButtonOffsetButton()
|
||||||
{
|
{
|
||||||
var manageModsButtonOffset = _config.ManageModsButtonOffset;
|
var manageModsButtonOffset = _config.ManageModsButtonOffset;
|
||||||
ImGui.SetNextItemWidth( 150f );
|
ImGui.SetNextItemWidth( 150 * ImGuiHelpers.GlobalScale );
|
||||||
if( ImGui.DragFloat2( LabelManageModsOffset, ref manageModsButtonOffset, 1f ) )
|
if( ImGui.DragFloat2( LabelManageModsOffset, ref manageModsButtonOffset, 1f ) )
|
||||||
{
|
{
|
||||||
_config.ManageModsButtonOffset = manageModsButtonOffset;
|
_config.ManageModsButtonOffset = manageModsButtonOffset;
|
||||||
_configChanged = true;
|
_configChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_base._manageModsButton.ForceDraw = ImGui.IsItemActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawSortFoldersFirstBox()
|
private void DrawSortFoldersFirstBox()
|
||||||
|
|
@ -317,7 +319,7 @@ namespace Penumbra.UI
|
||||||
ImGuiCustom.VerticalDistance( DefaultVerticalSpace );
|
ImGuiCustom.VerticalDistance( DefaultVerticalSpace );
|
||||||
DrawScaleModSelectorBox();
|
DrawScaleModSelectorBox();
|
||||||
DrawSortFoldersFirstBox();
|
DrawSortFoldersFirstBox();
|
||||||
DrawManageModsButtonOffset();
|
DrawManageModsButtonOffsetButton();
|
||||||
DrawShowAdvancedBox();
|
DrawShowAdvancedBox();
|
||||||
|
|
||||||
if( _config.ShowAdvanced )
|
if( _config.ShowAdvanced )
|
||||||
|
|
@ -333,4 +335,3 @@ namespace Penumbra.UI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue