"Amélioration de l'UI AutoDetect Syncshell : ajout de paramètres récurrents, plages horaires et gestion des fuseaux horaires. Refactorisation des méthodes de dessin et introduction de boutons centrés pour une meilleure ergonomie. Mise à jour des fichiers de configuration et du projet avec des optimisations diverses."
This commit is contained in:
@@ -79,6 +79,8 @@ public class DrawGroupPair : DrawPairBase
|
||||
width += _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Plus).X + spacing;
|
||||
}
|
||||
|
||||
width += spacing * 1.2f;
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
@@ -215,6 +217,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
var pauseIcon = _fullInfoDto.GroupUserPermissions.IsPaused() ? FontAwesomeIcon.Play : FontAwesomeIcon.Pause;
|
||||
var pauseButtonWidth = _uiSharedService.GetIconButtonSize(pauseIcon).X;
|
||||
var barButtonWidth = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars).X;
|
||||
var rightEdgeGap = spacing * 1.2f;
|
||||
|
||||
float totalWidth = 0f;
|
||||
void Accumulate(bool condition, float width)
|
||||
@@ -242,7 +245,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
float cardPaddingX = UiSharedService.GetCardContentPaddingX();
|
||||
float rightMargin = cardPaddingX + 6f * ImGuiHelpers.GlobalScale;
|
||||
float baseX = MathF.Max(ImGui.GetCursorPosX(),
|
||||
ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - rightMargin - totalWidth);
|
||||
ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - rightMargin - rightEdgeGap - totalWidth);
|
||||
float currentX = baseX;
|
||||
|
||||
ImGui.SameLine();
|
||||
@@ -266,6 +269,16 @@ public class DrawGroupPair : DrawPairBase
|
||||
|
||||
if (showInfo && infoIconWidth > 0f)
|
||||
{
|
||||
bool centerWarning = permIcon == FontAwesomeIcon.ExclamationTriangle && showPause && showBars && !showShared && !showPlus;
|
||||
if (centerWarning)
|
||||
{
|
||||
float barsClusterWidth = showBars ? (barButtonWidth + spacing * 0.5f) : 0f;
|
||||
float leftAreaWidth = MathF.Max(totalWidth - pauseButtonWidth - barsClusterWidth, 0f);
|
||||
float warningX = baseX + MathF.Max((leftAreaWidth - infoIconWidth) / 2f, 0f);
|
||||
currentX = warningX;
|
||||
ImGui.SetCursorPosX(currentX);
|
||||
}
|
||||
|
||||
ImGui.SetCursorPosY(textPosY);
|
||||
if (individualAnimDisabled || individualSoundsDisabled || individualVFXDisabled)
|
||||
{
|
||||
@@ -359,7 +372,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
{
|
||||
ImGui.SetCursorPosY(originalY);
|
||||
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Plus))
|
||||
if (_uiSharedService.IconPlusButtonCentered())
|
||||
{
|
||||
var targetUid = _pair.UserData.UID;
|
||||
if (!string.IsNullOrEmpty(targetUid))
|
||||
@@ -376,7 +389,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
{
|
||||
float gapToBars = showBars ? spacing * 0.5f : spacing;
|
||||
ImGui.SetCursorPosY(originalY);
|
||||
if (_uiSharedService.IconButton(pauseIcon))
|
||||
if (pauseIcon == FontAwesomeIcon.Pause ? _uiSharedService.IconPauseButtonCentered() : _uiSharedService.IconButtonCentered(pauseIcon))
|
||||
{
|
||||
var newPermissions = _fullInfoDto.GroupUserPermissions ^ GroupUserPermissions.Paused;
|
||||
_fullInfoDto.GroupUserPermissions = newPermissions;
|
||||
@@ -391,7 +404,7 @@ public class DrawGroupPair : DrawPairBase
|
||||
if (showBars)
|
||||
{
|
||||
ImGui.SetCursorPosY(originalY);
|
||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Bars))
|
||||
if (_uiSharedService.IconButtonCentered(FontAwesomeIcon.Bars))
|
||||
{
|
||||
ImGui.OpenPopup("Syncshell Flyout Menu");
|
||||
}
|
||||
|
||||
@@ -42,8 +42,8 @@ public abstract class DrawPairBase
|
||||
var menuButtonSize = _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars);
|
||||
|
||||
float pauseClusterWidth = Math.Max(pauseButtonSize.X, playButtonSize.X);
|
||||
float pauseClusterHeight = Math.Max(pauseButtonSize.Y, playButtonSize.Y);
|
||||
float reservedSpacing = style.ItemSpacing.X * 2.4f;
|
||||
float pauseClusterHeight = Math.Max(Math.Max(pauseButtonSize.Y, playButtonSize.Y), ImGui.GetFrameHeight());
|
||||
float reservedSpacing = style.ItemSpacing.X * 1.6f;
|
||||
float rightButtonWidth =
|
||||
menuButtonSize.X +
|
||||
pauseClusterWidth +
|
||||
@@ -84,11 +84,15 @@ public abstract class DrawPairBase
|
||||
|
||||
ImGui.SetCursorPos(new Vector2(rowStartCursor.X + padding.X, iconTop));
|
||||
DrawLeftSide(iconTop, iconTop);
|
||||
ImGui.SameLine();
|
||||
ImGui.SetCursorPosY(textTop);
|
||||
var posX = ImGui.GetCursorPosX();
|
||||
|
||||
float leftReserved = GetLeftSideReservedWidth();
|
||||
float nameStartX = rowStartCursor.X + padding.X + leftReserved;
|
||||
|
||||
var rightSide = DrawRightSide(buttonTop, buttonTop);
|
||||
DrawName(textTop + padding.Y * 0.15f, posX, rightSide);
|
||||
|
||||
ImGui.SameLine(nameStartX);
|
||||
ImGui.SetCursorPosY(textTop);
|
||||
DrawName(textTop + padding.Y * 0.15f, nameStartX, rightSide);
|
||||
|
||||
ImGui.SetCursorPos(new Vector2(rowStartCursor.X, rowStartCursor.Y + totalHeight));
|
||||
ImGui.SetCursorPosX(rowStartCursor.X);
|
||||
@@ -100,6 +104,8 @@ public abstract class DrawPairBase
|
||||
|
||||
protected virtual float GetRightSideExtraWidth() => 0f;
|
||||
|
||||
protected virtual float GetLeftSideReservedWidth() => UiSharedService.GetIconSize(FontAwesomeIcon.Moon).X * 2f + ImGui.GetStyle().ItemSpacing.X * 1.5f;
|
||||
|
||||
private void DrawName(float originalY, float leftSide, float rightSide)
|
||||
{
|
||||
_displayHandler.DrawPairText(_id, _pair, leftSide, originalY, () => rightSide - leftSide);
|
||||
|
||||
@@ -60,8 +60,28 @@ public class DrawUserPair : DrawPairBase
|
||||
width += _uiSharedService.GetIconButtonSize(FontAwesomeIcon.Running).X + spacingX * 0.5f;
|
||||
}
|
||||
|
||||
width += spacingX * 1.2f;
|
||||
return width;
|
||||
}
|
||||
|
||||
protected override float GetLeftSideReservedWidth()
|
||||
{
|
||||
var style = ImGui.GetStyle();
|
||||
float spacing = style.ItemSpacing.X;
|
||||
float iconW = UiSharedService.GetIconSize(FontAwesomeIcon.Moon).X;
|
||||
|
||||
int icons = 1;
|
||||
if (!(_pair.UserPair!.OwnPermissions.IsPaired() && _pair.UserPair!.OtherPermissions.IsPaired()))
|
||||
icons++;
|
||||
else if (_pair.UserPair!.OwnPermissions.IsPaused() || _pair.UserPair!.OtherPermissions.IsPaused())
|
||||
icons++;
|
||||
if (_pair.IsOnline && _pair.IsVisible)
|
||||
icons++;
|
||||
|
||||
float iconsTotal = icons * iconW + Math.Max(0, icons - 1) * spacing;
|
||||
float cushion = spacing * 0.6f;
|
||||
return iconsTotal + cushion;
|
||||
}
|
||||
|
||||
protected override void DrawLeftSide(float textPosY, float originalY)
|
||||
{
|
||||
@@ -133,7 +153,8 @@ public class DrawUserPair : DrawPairBase
|
||||
var entryUID = _pair.UserData.AliasOrUID;
|
||||
var spacingX = ImGui.GetStyle().ItemSpacing.X;
|
||||
var edgePadding = UiSharedService.GetCardContentPaddingX() + 6f * ImGuiHelpers.GlobalScale;
|
||||
var windowEndX = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - edgePadding;
|
||||
var rightEdgeGap = spacingX * 1.2f;
|
||||
var windowEndX = ImGui.GetWindowContentRegionMin().X + UiSharedService.GetWindowContentRegionWidth() - edgePadding - rightEdgeGap;
|
||||
var rightSidePos = windowEndX - barButtonSize.X;
|
||||
|
||||
// Flyout Menu
|
||||
@@ -150,13 +171,12 @@ public class DrawUserPair : DrawPairBase
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
|
||||
// Pause (mutual pairs only)
|
||||
if (_pair.UserPair!.OwnPermissions.IsPaired() && _pair.UserPair!.OtherPermissions.IsPaired())
|
||||
{
|
||||
rightSidePos -= pauseIconSize.X + spacingX;
|
||||
ImGui.SameLine(rightSidePos);
|
||||
ImGui.SetCursorPosY(originalY);
|
||||
if (_uiSharedService.IconButton(pauseIcon))
|
||||
if (pauseIcon == FontAwesomeIcon.Pause ? _uiSharedService.IconPauseButtonCentered() : _uiSharedService.IconButtonCentered(pauseIcon))
|
||||
{
|
||||
var perm = _pair.UserPair!.OwnPermissions;
|
||||
perm.SetPaused(!perm.IsPaused());
|
||||
|
||||
Reference in New Issue
Block a user