Fix begin/end child and window.

This commit is contained in:
Ottermandias 2021-09-01 21:57:37 +02:00
parent 52108d6198
commit 8a355e3905
4 changed files with 19 additions and 29 deletions

View file

@ -26,10 +26,10 @@ namespace Penumbra.UI
| ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoResize
| ImGuiWindowFlags.NoSavedSettings; | ImGuiWindowFlags.NoSavedSettings;
private readonly SettingsInterface _base; private readonly SettingsInterface _base;
public ManageModsButton( SettingsInterface ui ) public ManageModsButton( SettingsInterface ui )
=> _base = ui; => _base = ui;
public void Draw() public void Draw()
{ {
@ -43,12 +43,8 @@ namespace Penumbra.UI
ImGui.SetNextWindowPos( ss - WindowPosOffset, ImGuiCond.Always ); ImGui.SetNextWindowPos( ss - WindowPosOffset, ImGuiCond.Always );
if( !ImGui.Begin( MenuButtonsName, ButtonFlags ) ) if( ImGui.Begin( MenuButtonsName, ButtonFlags )
{ && ImGui.Button( MenuButtonLabel, WindowSize ) )
return;
}
if( ImGui.Button( MenuButtonLabel, WindowSize ) )
{ {
_base.FlipVisibility(); _base.FlipVisibility();
} }

View file

@ -254,6 +254,7 @@ namespace Penumbra.UI
{ {
if( !ImGui.BeginChild( "##CollectionChild", AutoFillSize, true ) ) if( !ImGui.BeginChild( "##CollectionChild", AutoFillSize, true ) )
{ {
ImGui.EndChild();
return; return;
} }
@ -285,7 +286,6 @@ namespace Penumbra.UI
} }
DrawNewCharacterCollection(); DrawNewCharacterCollection();
ImGui.EndChild(); ImGui.EndChild();
} }
@ -296,21 +296,18 @@ namespace Penumbra.UI
return; return;
} }
if( !ImGui.BeginChild( "##CollectionHandling", new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 6 ), true ) ) if( ImGui.BeginChild( "##CollectionHandling", new Vector2( -1, ImGui.GetTextLineHeightWithSpacing() * 6 ), true ) )
{ {
ImGui.EndTabItem(); DrawCurrentCollectionSelector( true );
return;
ImGui.Dummy( new Vector2( 0, 10 ) );
DrawNewCollectionInput();
} }
DrawCurrentCollectionSelector( true );
ImGui.Dummy( new Vector2( 0, 10 ) );
DrawNewCollectionInput();
ImGui.EndChild(); ImGui.EndChild();
DrawCharacterCollectionSelectors(); DrawCharacterCollectionSelectors();
ImGui.EndTabItem(); ImGui.EndTabItem();
} }
} }

View file

@ -504,12 +504,8 @@ namespace Penumbra.UI
try try
{ {
var ret = ImGui.BeginChild( LabelModPanel, AutoFillSize, true ); var ret = ImGui.BeginChild( LabelModPanel, AutoFillSize, true );
if( !ret )
{
return;
}
if( Mod == null ) if( !ret || Mod == null )
{ {
ImGui.EndChild(); ImGui.EndChild();
return; return;

View file

@ -764,15 +764,16 @@ namespace Penumbra.UI
ImGui.PushStyleVar( ImGuiStyleVar.ItemSpacing, Vector2.Zero ); ImGui.PushStyleVar( ImGuiStyleVar.ItemSpacing, Vector2.Zero );
ImGui.BeginGroup(); ImGui.BeginGroup();
// Inlay selector list // Inlay selector list
ImGui.BeginChild( LabelSelectorList, if( ImGui.BeginChild( LabelSelectorList,
new Vector2( SelectorPanelWidth * _selectorScalingFactor, -ImGui.GetFrameHeightWithSpacing() ), new Vector2( SelectorPanelWidth * _selectorScalingFactor, -ImGui.GetFrameHeightWithSpacing() ),
true, ImGuiWindowFlags.HorizontalScrollbar ); true, ImGuiWindowFlags.HorizontalScrollbar ) )
{
ImGui.PushStyleVar( ImGuiStyleVar.IndentSpacing, 12.5f );
ImGui.PushStyleVar( ImGuiStyleVar.IndentSpacing, 12.5f ); var modIndex = 0;
DrawFolderContent( _modManager.StructuredMods, ref modIndex );
var modIndex = 0; ImGui.PopStyleVar();
DrawFolderContent( _modManager.StructuredMods, ref modIndex ); }
ImGui.PopStyleVar();
ImGui.EndChild(); ImGui.EndChild();