Improve tag button positioning.

This commit is contained in:
Ottermandias 2024-03-18 17:12:30 +01:00
parent c34cc4638c
commit 0f89e24377
3 changed files with 7 additions and 8 deletions

@ -1 +1 @@
Subproject commit 5a2e12a1acd6760a3a592447a92215135e79197c Subproject commit c59b1c09ff7b8093d3a70c45957f9c41341dd3a4

View file

@ -29,17 +29,18 @@ public class ModPanelDescriptionTab(
ImGui.Dummy(ImGuiHelpers.ScaledVector2(2)); ImGui.Dummy(ImGuiHelpers.ScaledVector2(2));
ImGui.Dummy(ImGuiHelpers.ScaledVector2(2)); ImGui.Dummy(ImGuiHelpers.ScaledVector2(2));
var sharedTagsEnabled = predefinedTagsConfig.SharedTags.Count > 0; var (predefinedTagsEnabled, predefinedTagButtonOffset) = predefinedTagsConfig.SharedTags.Count > 0
var sharedTagButtonOffset = sharedTagsEnabled ? ImGui.GetFrameHeight() + ImGui.GetStyle().FramePadding.X : 0; ? (true, ImGui.GetFrameHeight() + ImGui.GetStyle().WindowPadding.X + (ImGui.GetScrollMaxY() > 0 ? ImGui.GetStyle().ScrollbarSize : 0))
: (false, 0);
var tagIdx = _localTags.Draw("Local Tags: ", var tagIdx = _localTags.Draw("Local Tags: ",
"Custom tags you can set personally that will not be exported to the mod data but only set for you.\n" "Custom tags you can set personally that will not be exported to the mod data but only set for you.\n"
+ "If the mod already contains a local tag in its own tags, the local tag will be ignored.", selector.Selected!.LocalTags, + "If the mod already contains a local tag in its own tags, the local tag will be ignored.", selector.Selected!.LocalTags,
out var editedTag, rightEndOffset: sharedTagButtonOffset); out var editedTag, rightEndOffset: predefinedTagButtonOffset);
tutorial.OpenTutorial(BasicTutorialSteps.Tags); tutorial.OpenTutorial(BasicTutorialSteps.Tags);
if (tagIdx >= 0) if (tagIdx >= 0)
modManager.DataEditor.ChangeLocalTag(selector.Selected!, tagIdx, editedTag); modManager.DataEditor.ChangeLocalTag(selector.Selected!, tagIdx, editedTag);
if (sharedTagsEnabled) if (predefinedTagsEnabled)
predefinedTagsConfig.DrawAddFromSharedTagsAndUpdateTags(selector.Selected!.LocalTags, selector.Selected!.ModTags, true, predefinedTagsConfig.DrawAddFromSharedTagsAndUpdateTags(selector.Selected!.LocalTags, selector.Selected!.ModTags, true,
selector.Selected!); selector.Selected!);

View file

@ -110,9 +110,7 @@ public sealed class PredefinedTagManager : ISavable
public void DrawAddFromSharedTagsAndUpdateTags(IReadOnlyCollection<string> localTags, IReadOnlyCollection<string> modTags, bool editLocal, public void DrawAddFromSharedTagsAndUpdateTags(IReadOnlyCollection<string> localTags, IReadOnlyCollection<string> modTags, bool editLocal,
Mods.Mod mod) Mods.Mod mod)
{ {
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - ImGui.GetFrameHeightWithSpacing()); ImGui.SameLine(ImGui.GetContentRegionMax().X - ImGui.GetFrameHeight() - ImGui.GetStyle().WindowPadding.X);
ImGui.SetCursorPosX(ImGui.GetWindowWidth() - ImGui.GetFrameHeight() - ImGui.GetStyle().FramePadding.X);
var sharedTag = DrawAddFromSharedTags(localTags, modTags, editLocal); var sharedTag = DrawAddFromSharedTags(localTags, modTags, editLocal);
if (sharedTag.Length > 0) if (sharedTag.Length > 0)