Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
fix: add reverse drawing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchiDog1998 committed Jul 17, 2024
1 parent 66eeaa2 commit 15e7015
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
3 changes: 3 additions & 0 deletions ActionTimelineEx/Configurations/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ public class Settings : IPluginConfiguration
[UI("Draw the rotation Vertically", Parent = nameof(DrawRotation))]
public bool VerticalDraw { get; set; } = false;

[UI("Reverse Draw", Parent = nameof(VerticalDraw))]
public bool Reverse { get; set; } = false;

[JsonIgnore]
[TimelineChoices]
[UI("Rotation Choice", 3)]
Expand Down
2 changes: 1 addition & 1 deletion ActionTimelineEx/Helpers/RotationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ internal static class RotationHelper
private static DrawingHighlightHotbar? _highLight;
public static ActionSetting? ActiveAction => Actions.FirstOrDefault();

public static IEnumerable<ActionSetting> Actions => RotationSetting.Actions.Skip((int)Count);
public static IEnumerable<ActionSetting> Actions => RotationSetting.Actions.Skip((int)Count);

public static RotationSetting RotationSetting => Plugin.Settings.RotationHelper.RotationSetting;

Expand Down
2 changes: 1 addition & 1 deletion ActionTimelineEx/Localization/Localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@
"ActionTimelineEx.Configurations.ActionSettingType.Action": "Action",
"ActionTimelineEx.Configurations.ActionSettingType.Item": "Item",
"ActionTimelineEx.Configurations.ActionSettingName.IsLast": "Is the Last Ability during GCD",
"ActionTimelineEx.Configurations.ActionSettingDescription": "Circle of Scorn (Ability)"
"ActionTimelineEx.Configurations.ActionSettingDescription": "Heavy Swing (GCD)"
}
6 changes: 4 additions & 2 deletions ActionTimelineEx/Windows/RotationHelperItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public override void Draw(ConfigWindow window)
_group ??= new CollapsingHeaderGroup(new()
{
{ () => UiString.RotationSetting.Local(), () => DrawSetting(window) },
{ () => UiString.Rotation.Local(), () => DrawRotation(window, setting)},
{ () => UiString.Rotation.Local(), () => DrawRotation(window)},
});

_group.Draw();
Expand All @@ -71,8 +71,10 @@ private static void DrawSetting(ConfigWindow window)
window.Collection.DrawItems(1);
}

private static void DrawRotation(ConfigWindow window, RotationsSetting setting)
private static void DrawRotation(ConfigWindow window)
{
var setting = Plugin.Settings.RotationHelper;

if (ImGui.Button(UiString.RotationReset.Local()))
{
RotationHelper.Clear();
Expand Down
21 changes: 17 additions & 4 deletions ActionTimelineEx/Windows/RotationHelperWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ private static void DrawContent()
var drawList = ImGui.GetWindowDrawList();

var pos = ImGui.GetWindowPos() + new Vector2(gcdHeight * 0.2f,
Plugin.Settings.VerticalDraw ? gcdHeight * 0.2f : ImGui.GetWindowSize().Y / 2 - gcdHeight / 2);
Plugin.Settings.VerticalDraw
? (Plugin.Settings.Reverse
? ImGui.GetWindowSize().Y - gcdHeight * 1.4f
: gcdHeight * 0.2f)
: ImGui.GetWindowSize().Y / 2 - gcdHeight / 2);
var maxX = ImGui.GetWindowPos().X + ImGui.GetWindowSize().X;
var maxY = ImGui.GetWindowPos().Y + ImGui.GetWindowSize().Y;
var minY = ImGui.GetWindowPos().Y;
var maxY = minY + ImGui.GetWindowSize().Y;
var minPosX = pos.X;

bool isFirst = true;
Expand All @@ -66,7 +71,15 @@ private static void DrawContent()
if (item.IsGCD && Plugin.Settings.VerticalDraw && !isFirst)
{
pos.X = minPosX;
pos.Y += gcdHeight + spacing;

if (Plugin.Settings.Reverse)
{
pos.Y -= gcdHeight + spacing;
}
else
{
pos.Y += gcdHeight + spacing;
}
}

item.Draw(drawList, pos, size);
Expand All @@ -78,7 +91,7 @@ private static void DrawContent()

pos += new Vector2(size + spacing, 0);

if (pos.X >= maxX || pos.Y >= maxY) break;
if (pos.X >= maxX || pos.Y >= maxY || pos.Y <= minY) break;
}
}
}
2 changes: 1 addition & 1 deletion ECommons
2 changes: 1 addition & 1 deletion XIVConfigUI

0 comments on commit 15e7015

Please sign in to comment.