diff --git a/MareSynchronos/UI/CompactUI.cs b/MareSynchronos/UI/CompactUI.cs index c104bff..5ad5319 100644 --- a/MareSynchronos/UI/CompactUI.cs +++ b/MareSynchronos/UI/CompactUI.cs @@ -68,6 +68,7 @@ public class CompactUi : WindowMediatorSubscriberBase private bool _showModalForUserAddition; private bool _wasOpen; private bool _nearbyOpen = true; + private bool _visibleOpen = true; private bool _selfAnalysisOpen = false; private List _nearbyEntries = new(); private const long SelfAnalysisSizeWarningThreshold = 300L * 1024 * 1024; @@ -682,6 +683,9 @@ if (showNearby && pendingInvites > 0) var allUsers = GetFilteredUsers().OrderBy(u => u.GetPairSortKey(), StringComparer.Ordinal).ToList(); var visibleUsersSource = allUsers.Where(u => u.IsVisible).ToList(); var nonVisibleUsers = allUsers.Where(u => !u.IsVisible).ToList(); + var nearbyEntriesForDisplay = _configService.Current.EnableAutoDetectDiscovery + ? GetNearbyEntriesForDisplay() + : new List(); ImGui.BeginChild("list", new Vector2(WindowContentWidth, ySize), border: false); @@ -698,21 +702,35 @@ if (showNearby && pendingInvites > 0) if (mode == PairContentMode.VisibleOnly) { var visibleUsers = visibleUsersSource.Select(c => new DrawUserPair("Visible" + c.UserData.UID, c, _uidDisplayHandler, _apiController, Mediator, _selectGroupForPairUi, _uiSharedService, _charaDataManager, _serverManager)).ToList(); - if (visibleUsers.Count == 0) + bool showVisibleCard = visibleUsers.Count > 0; + bool showNearbyCard = nearbyEntriesForDisplay.Count > 0; + + if (!showVisibleCard && !showNearbyCard) { - UiSharedService.ColorTextWrapped("Aucune paire visible pour l'instant.", ImGuiColors.DalamudGrey3); + const string calmMessage = "C'est bien trop calme ici... Il n'y a rien pour le moment."; + using (_uiSharedService.UidFont.Push()) + { + var regionMin = ImGui.GetWindowContentRegionMin(); + var availableWidth = UiSharedService.GetWindowContentRegionWidth(); + var regionHeight = UiSharedService.GetWindowContentRegionHeight(); + var textSize = ImGui.CalcTextSize(calmMessage, hideTextAfterDoubleHash: false, availableWidth); + var xOffset = MathF.Max(0f, (availableWidth - textSize.X) / 2f); + var yOffset = MathF.Max(0f, (regionHeight - textSize.Y) / 2f); + ImGui.SetCursorPos(new Vector2(regionMin.X + xOffset, regionMin.Y + yOffset)); + UiSharedService.ColorTextWrapped(calmMessage, ImGuiColors.DalamudGrey3, regionMin.X + availableWidth); + } } else { - foreach (var visibleUser in visibleUsers) + if (showVisibleCard) { - visibleUser.DrawPairedClient(); + DrawVisibleCard(visibleUsers); } - } - if (_configService.Current.EnableAutoDetectDiscovery) - { - DrawNearbyCard(); + if (showNearbyCard) + { + DrawNearbyCard(nearbyEntriesForDisplay); + } } } else @@ -726,9 +744,10 @@ if (showNearby && pendingInvites > 0) .ToList(); Action? drawVisibleExtras = null; - if (_configService.Current.EnableAutoDetectDiscovery) + if (nearbyEntriesForDisplay.Count > 0) { - drawVisibleExtras = () => DrawNearbyCard(); + var entriesForExtras = nearbyEntriesForDisplay; + drawVisibleExtras = () => DrawNearbyCard(entriesForExtras); } _pairGroupsUi.Draw(visibleUsers, onlineUsers, offlineUsers, drawVisibleExtras); @@ -737,8 +756,71 @@ if (showNearby && pendingInvites > 0) ImGui.EndChild(); } - private void DrawNearbyCard() + private List GetNearbyEntriesForDisplay() { + if (_nearbyEntries == null || _nearbyEntries.Count == 0) + { + return new List(); + } + + return _nearbyEntries + .Where(e => e.IsMatch && e.AcceptPairRequests && !string.IsNullOrEmpty(e.Token) && !IsAlreadyPairedQuickMenu(e)) + .OrderBy(e => e.Distance) + .ToList(); + } + + private void DrawVisibleCard(List visibleUsers) + { + if (visibleUsers.Count == 0) + { + return; + } + + ImGuiHelpers.ScaledDummy(4f); + using (ImRaii.PushId("group-Visible")) + { + UiSharedService.DrawCard("visible-card", () => + { + bool visibleState = _visibleOpen; + UiSharedService.DrawArrowToggle(ref visibleState, "##visible-toggle"); + if (visibleState != _visibleOpen) + { + _visibleOpen = visibleState; + } + + ImGui.SameLine(0f, 6f * ImGuiHelpers.GlobalScale); + ImGui.AlignTextToFramePadding(); + ImGui.TextUnformatted($"Visible ({visibleUsers.Count})"); + if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) + { + _visibleOpen = !_visibleOpen; + } + + if (!_visibleOpen) + { + return; + } + + ImGuiHelpers.ScaledDummy(4f); + var indent = 18f * ImGuiHelpers.GlobalScale; + ImGui.Indent(indent); + foreach (var visibleUser in visibleUsers) + { + visibleUser.DrawPairedClient(); + } + ImGui.Unindent(indent); + }, stretchWidth: true); + } + ImGuiHelpers.ScaledDummy(4f); + } + + private void DrawNearbyCard(IReadOnlyList nearbyEntries) + { + if (nearbyEntries.Count == 0) + { + return; + } + ImGuiHelpers.ScaledDummy(4f); using (ImRaii.PushId("group-Nearby")) { @@ -752,7 +834,7 @@ if (showNearby && pendingInvites > 0) } ImGui.SameLine(0f, 6f * ImGuiHelpers.GlobalScale); - var onUmbra = _nearbyEntries?.Count(e => e.IsMatch && e.AcceptPairRequests && !string.IsNullOrEmpty(e.Token) && !IsAlreadyPairedQuickMenu(e)) ?? 0; + var onUmbra = nearbyEntries.Count; ImGui.AlignTextToFramePadding(); ImGui.TextUnformatted($"Nearby ({onUmbra})"); if (ImGui.IsItemClicked(ImGuiMouseButton.Left)) @@ -768,51 +850,41 @@ if (showNearby && pendingInvites > 0) ImGuiHelpers.ScaledDummy(4f); var indent = 18f * ImGuiHelpers.GlobalScale; ImGui.Indent(indent); - var nearby = _nearbyEntries == null - ? new List() - : _nearbyEntries.Where(e => e.IsMatch && e.AcceptPairRequests && !string.IsNullOrEmpty(e.Token) && !IsAlreadyPairedQuickMenu(e)) - .OrderBy(e => e.Distance) - .ToList(); - if (nearby.Count == 0) + foreach (var e in nearbyEntries) { - UiSharedService.ColorTextWrapped("Aucun nouveau joueur detecté.", ImGuiColors.DalamudGrey3); - } - else - { - foreach (var e in nearby) + if (!e.AcceptPairRequests || string.IsNullOrEmpty(e.Token)) { - if (!e.AcceptPairRequests || string.IsNullOrEmpty(e.Token)) - continue; + continue; + } - var name = e.DisplayName ?? e.Name; - ImGui.AlignTextToFramePadding(); - ImGui.TextUnformatted(name); - var right = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth(); - ImGui.SameLine(); + var name = e.DisplayName ?? e.Name; + ImGui.AlignTextToFramePadding(); + ImGui.TextUnformatted(name); + var right = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth(); + ImGui.SameLine(); - var statusButtonSize = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.UserPlus); - ImGui.SetCursorPosX(right - statusButtonSize.X); - if (!e.AcceptPairRequests) + var statusButtonSize = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.UserPlus); + ImGui.SetCursorPosX(right - statusButtonSize.X); + if (!e.AcceptPairRequests) + { + _uiSharedService.IconText(FontAwesomeIcon.Ban, ImGuiColors.DalamudGrey3); + UiSharedService.AttachToolTip("Les demandes sont désactivées pour ce joueur"); + } + else if (!string.IsNullOrEmpty(e.Token)) + { + using (ImRaii.PushId(e.Token ?? e.Uid ?? e.Name ?? string.Empty)) { - _uiSharedService.IconText(FontAwesomeIcon.Ban, ImGuiColors.DalamudGrey3); - UiSharedService.AttachToolTip("Les demandes sont désactivées pour ce joueur"); - } - else if (!string.IsNullOrEmpty(e.Token)) - { - using (ImRaii.PushId(e.Token ?? e.Uid ?? e.Name ?? string.Empty)) + if (_uiSharedService.IconButton(FontAwesomeIcon.UserPlus)) { - if (_uiSharedService.IconButton(FontAwesomeIcon.UserPlus)) - { - _ = _autoDetectRequestService.SendRequestAsync(e.Token!, e.Uid, e.DisplayName); - } + _ = _autoDetectRequestService.SendRequestAsync(e.Token!, e.Uid, e.DisplayName); } - UiSharedService.AttachToolTip("Envoyer une invitation d'apparaige"); - } - else - { - _uiSharedService.IconText(FontAwesomeIcon.QuestionCircle, ImGuiColors.DalamudGrey3); - UiSharedService.AttachToolTip("Impossible d'inviter ce joueur"); } + UiSharedService.AttachToolTip("Envoyer une invitation d'apparaige"); + } + else + { + _uiSharedService.IconText(FontAwesomeIcon.QuestionCircle, ImGuiColors.DalamudGrey3); + UiSharedService.AttachToolTip("Impossible d'inviter ce joueur"); } } ImGui.Unindent(indent); diff --git a/MareSynchronos/UI/Components/DrawGroupPair.cs b/MareSynchronos/UI/Components/DrawGroupPair.cs index e7565b1..dc96bfb 100644 --- a/MareSynchronos/UI/Components/DrawGroupPair.cs +++ b/MareSynchronos/UI/Components/DrawGroupPair.cs @@ -210,23 +210,47 @@ public class DrawGroupPair : DrawPairBase var permIcon = (individualAnimDisabled || individualSoundsDisabled || individualVFXDisabled) ? FontAwesomeIcon.ExclamationTriangle : ((soundsDisabled || animDisabled || vfxDisabled) ? FontAwesomeIcon.InfoCircle : FontAwesomeIcon.None); var runningIconWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Running).X; - var infoIconWidth = UiSharedService.GetIconSize(permIcon).X; + var infoIconWidth = showInfo && permIcon != FontAwesomeIcon.None ? UiSharedService.GetIconSize(permIcon).X : 0f; var plusButtonWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Plus).X; var pauseIcon = _fullInfoDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause; var pauseButtonWidth = _uiSharedService.GetIconButtonSize(pauseIcon).X; var barButtonWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars).X; - var pos = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() + spacing - - (showShared ? (runningIconWidth + spacing) : 0) - - (showInfo ? (infoIconWidth + spacing) : 0) - - (showPlus ? (plusButtonWidth + spacing) : 0) - - (showPause ? (pauseButtonWidth + spacing) : 0) - - (showBars ? (barButtonWidth + spacing) : 0); + float totalWidth = 0f; + void Accumulate(bool condition, float width) + { + if (!condition || width <= 0f) return; + if (totalWidth > 0f) totalWidth += spacing; + totalWidth += width; + } - ImGui.SameLine(pos); + Accumulate(showShared, runningIconWidth); + Accumulate(showInfo && infoIconWidth > 0f, infoIconWidth); + Accumulate(showPlus, plusButtonWidth); + Accumulate(showPause, pauseButtonWidth); + if (showBars) + { + if (totalWidth > 0f) totalWidth += spacing; + totalWidth += barButtonWidth; + } + if (showPause && showBars) + { + totalWidth -= spacing * 0.5f; + if (totalWidth < 0f) totalWidth = 0f; + } + + float cardPaddingX = UiSharedService.GetCardContentPaddingX(); + float rightMargin = cardPaddingX + 6f * ImGuiHelpers.GlobalScale; + float baseX = MathF.Max(ImGui.GetCursorPosX(), + ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - rightMargin - totalWidth); + float currentX = baseX; + + ImGui.SameLine(); + ImGui.SetCursorPosX(baseX); if (showShared) { + ImGui.SetCursorPosY(textPosY); _uiSharedService.IconText(FontAwesomeIcon.Running); UiSharedService.AttachToolTip($"This user has shared {sharedData!.Count} Character Data Sets with you." + UiSharedService.TooltipSeparator @@ -236,95 +260,99 @@ public class DrawGroupPair : DrawPairBase { _mediator.Publish(new OpenCharaDataHubWithFilterMessage(_pair.UserData)); } - ImGui.SameLine(); + currentX += runningIconWidth + spacing; + ImGui.SetCursorPosX(currentX); } - if (individualAnimDisabled || individualSoundsDisabled) + if (showInfo && infoIconWidth > 0f) { ImGui.SetCursorPosY(textPosY); - ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow); - _uiSharedService.IconText(permIcon); - ImGui.PopStyleColor(); - if (ImGui.IsItemHovered()) + if (individualAnimDisabled || individualSoundsDisabled) { - ImGui.BeginTooltip(); - - ImGui.TextUnformatted("Individual User permissions"); - - if (individualSoundsDisabled) + ImGui.PushStyleColor(ImGuiCol.Text, ImGuiColors.DalamudYellow); + _uiSharedService.IconText(permIcon); + ImGui.PopStyleColor(); + if (ImGui.IsItemHovered()) { - var userSoundsText = "Sound sync disabled with " + _pair.UserData.AliasOrUID; - _uiSharedService.IconText(FontAwesomeIcon.VolumeMute); - ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); - ImGui.TextUnformatted(userSoundsText); - ImGui.NewLine(); - ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); - ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableSounds() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableSounds() ? "Disabled" : "Enabled")); - } + ImGui.BeginTooltip(); - if (individualAnimDisabled) - { - var userAnimText = "Animation sync disabled with " + _pair.UserData.AliasOrUID; - _uiSharedService.IconText(FontAwesomeIcon.WindowClose); - ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); - ImGui.TextUnformatted(userAnimText); - ImGui.NewLine(); - ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); - ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableAnimations() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableAnimations() ? "Disabled" : "Enabled")); - } + ImGui.TextUnformatted("Individual User permissions"); - if (individualVFXDisabled) - { - var userVFXText = "VFX sync disabled with " + _pair.UserData.AliasOrUID; - _uiSharedService.IconText(FontAwesomeIcon.TimesCircle); - ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); - ImGui.TextUnformatted(userVFXText); - ImGui.NewLine(); - ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); - ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableVFX() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableVFX() ? "Disabled" : "Enabled")); - } + if (individualSoundsDisabled) + { + var userSoundsText = "Sound sync disabled with " + _pair.UserData.AliasOrUID; + _uiSharedService.IconText(FontAwesomeIcon.VolumeMute); + ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); + ImGui.TextUnformatted(userSoundsText); + ImGui.NewLine(); + ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); + ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableSounds() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableSounds() ? "Disabled" : "Enabled")); + } - ImGui.EndTooltip(); + if (individualAnimDisabled) + { + var userAnimText = "Animation sync disabled with " + _pair.UserData.AliasOrUID; + _uiSharedService.IconText(FontAwesomeIcon.WindowClose); + ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); + ImGui.TextUnformatted(userAnimText); + ImGui.NewLine(); + ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); + ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableAnimations() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableAnimations() ? "Disabled" : "Enabled")); + } + + if (individualVFXDisabled) + { + var userVFXText = "VFX sync disabled with " + _pair.UserData.AliasOrUID; + _uiSharedService.IconText(FontAwesomeIcon.TimesCircle); + ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); + ImGui.TextUnformatted(userVFXText); + ImGui.NewLine(); + ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); + ImGui.TextUnformatted("You: " + (_pair.UserPair!.OwnPermissions.IsDisableVFX() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableVFX() ? "Disabled" : "Enabled")); + } + + ImGui.EndTooltip(); + } } - ImGui.SameLine(); - } - else if ((animDisabled || soundsDisabled)) - { - ImGui.SetCursorPosY(textPosY); - _uiSharedService.IconText(permIcon); - if (ImGui.IsItemHovered()) + else { - ImGui.BeginTooltip(); - - ImGui.TextUnformatted("Syncshell User permissions"); - - if (soundsDisabled) + _uiSharedService.IconText(permIcon); + if (ImGui.IsItemHovered()) { - var userSoundsText = "Sound sync disabled by " + _pair.UserData.AliasOrUID; - _uiSharedService.IconText(FontAwesomeIcon.VolumeMute); - ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); - ImGui.TextUnformatted(userSoundsText); - } + ImGui.BeginTooltip(); - if (animDisabled) - { - var userAnimText = "Animation sync disabled by " + _pair.UserData.AliasOrUID; - _uiSharedService.IconText(FontAwesomeIcon.WindowClose); - ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); - ImGui.TextUnformatted(userAnimText); - } + ImGui.TextUnformatted("Syncshell User permissions"); - if (vfxDisabled) - { - var userVFXText = "VFX sync disabled by " + _pair.UserData.AliasOrUID; - _uiSharedService.IconText(FontAwesomeIcon.TimesCircle); - ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); - ImGui.TextUnformatted(userVFXText); - } + if (soundsDisabled) + { + var userSoundsText = "Sound sync disabled by " + _pair.UserData.AliasOrUID; + _uiSharedService.IconText(FontAwesomeIcon.VolumeMute); + ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); + ImGui.TextUnformatted(userSoundsText); + } - ImGui.EndTooltip(); + if (animDisabled) + { + var userAnimText = "Animation sync disabled by " + _pair.UserData.AliasOrUID; + _uiSharedService.IconText(FontAwesomeIcon.WindowClose); + ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); + ImGui.TextUnformatted(userAnimText); + } + + if (vfxDisabled) + { + var userVFXText = "VFX sync disabled by " + _pair.UserData.AliasOrUID; + _uiSharedService.IconText(FontAwesomeIcon.TimesCircle); + ImGui.SameLine(40 * ImGuiHelpers.GlobalScale); + ImGui.TextUnformatted(userVFXText); + } + + ImGui.EndTooltip(); + } } - ImGui.SameLine(); + + currentX += infoIconWidth + spacing; + ImGui.SetCursorPosX(currentX); } if (showPlus) @@ -340,13 +368,14 @@ public class DrawGroupPair : DrawPairBase } } UiSharedService.AttachToolTip(AppendSeenInfo("Send pairing invite to " + entryUID)); - ImGui.SameLine(); + currentX += plusButtonWidth + spacing; + ImGui.SetCursorPosX(currentX); } if (showPause) { + float gapToBars = showBars ? spacing * 0.5f : spacing; ImGui.SetCursorPosY(originalY); - if (_uiSharedService.IconButton(pauseIcon)) { var newPermissions = _fullInfoDto.GroupUserPermissions ^ GroupUserPermissions.Paused; @@ -355,19 +384,20 @@ public class DrawGroupPair : DrawPairBase } UiSharedService.AttachToolTip(AppendSeenInfo((_fullInfoDto.GroupUserPermissions.IsPaused() ? "Resume" : "Pause") + " syncing with " + entryUID)); - ImGui.SameLine(); + currentX += pauseButtonWidth + gapToBars; + ImGui.SetCursorPosX(currentX); } if (showBars) { ImGui.SetCursorPosY(originalY); - if (_uiSharedService.IconButton(FontAwesomeIcon.Bars)) { - ImGui.OpenPopup("Popup"); + ImGui.OpenPopup("Syncshell Flyout Menu"); } + currentX += barButtonWidth; + ImGui.SetCursorPosX(currentX); } - if (ImGui.BeginPopup("Popup")) { if ((userIsModerator || userIsOwner) && !(entryIsMod || entryIsOwner)) @@ -453,7 +483,7 @@ public class DrawGroupPair : DrawPairBase ImGui.EndPopup(); } - return pos - spacing; + return baseX - spacing; } private string AppendSeenInfo(string tooltip) diff --git a/MareSynchronos/UI/Components/DrawUserPair.cs b/MareSynchronos/UI/Components/DrawUserPair.cs index 45040c2..6de3e2b 100644 --- a/MareSynchronos/UI/Components/DrawUserPair.cs +++ b/MareSynchronos/UI/Components/DrawUserPair.cs @@ -132,7 +132,7 @@ public class DrawUserPair : DrawPairBase var barButtonSize = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars); var entryUID = _pair.UserData.AliasOrUID; var spacingX = ImGui.GetStyle().ItemSpacing.X; - var edgePadding = ImGui.GetStyle().WindowPadding.X + 4f * ImGuiHelpers.GlobalScale; + var edgePadding = UiSharedService.GetCardContentPaddingX() + 6f * ImGuiHelpers.GlobalScale; var windowEndX = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - edgePadding; var rightSidePos = windowEndX - barButtonSize.X; diff --git a/MareSynchronos/UI/Components/GroupPanel.cs b/MareSynchronos/UI/Components/GroupPanel.cs index c1f4c00..4a2ae22 100644 --- a/MareSynchronos/UI/Components/GroupPanel.cs +++ b/MareSynchronos/UI/Components/GroupPanel.cs @@ -646,7 +646,8 @@ internal sealed class GroupPanel var isOwner = string.Equals(groupDto.OwnerUID, ApiController.UID, StringComparison.Ordinal); var spacingX = ImGui.GetStyle().ItemSpacing.X; - var windowEndX = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth(); + var cardPaddingX = UiSharedService.GetCardContentPaddingX(); + var windowEndX = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - cardPaddingX - 6f * ImGuiHelpers.GlobalScale; var pauseIcon = groupDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause; var pauseIconSize = _uiShared.GetIconButtonSize(pauseIcon); diff --git a/MareSynchronos/UI/UISharedService.cs b/MareSynchronos/UI/UISharedService.cs index 174cf24..f9a9ea6 100644 --- a/MareSynchronos/UI/UISharedService.cs +++ b/MareSynchronos/UI/UISharedService.cs @@ -118,7 +118,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase { e.OnPreBuild(tk => tk.AddDalamudAssetFont(Dalamud.DalamudAsset.NotoSansJpMedium, new() { - SizePx = 35, + SizePx = 27, GlyphRanges = [0x20, 0x7E, 0] })); }); @@ -349,6 +349,12 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase return state; } + public static float GetCardContentPaddingX() + { + var style = ImGui.GetStyle(); + return style.FramePadding.X + 4f * ImGuiHelpers.GlobalScale; + } + public static void DrawGroupedCenteredColorText(string text, Vector4 color, float? maxWidth = null) { var availWidth = ImGui.GetContentRegionAvail().X;