Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Aetherphone/Apps/Activity/ActivityApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ private int GoalRow(Rect row, string label, string value, float scale)
var minusCenter = new Vector2(row.Max.X - radius - 106f * scale, row.Center.Y);
var valueCenter = new Vector2((plusCenter.X + minusCenter.X) * 0.5f, row.Center.Y);
var labelMaxWidth = MathF.Max(1f, minusCenter.X - radius - 12f * scale - row.Min.X);
var labelHovering = ImGui.IsMouseHoveringRect(new Vector2(row.Min.X, row.Min.Y),
var labelHovering = UiInteract.Hover(new Vector2(row.Min.X, row.Min.Y),
new Vector2(row.Min.X + labelMaxWidth, row.Max.Y));
Marquee.DrawLeft("activity.goalrow." + label, label, row.Min.X, row.Center.Y - 8f * scale, labelMaxWidth,
TextStyles.Subheadline, AppPalettes.Activity.BodyInk, labelHovering);
Expand Down
4 changes: 2 additions & 2 deletions src/Aetherphone/Apps/Aethergram/AethergramApp.Compose.cs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ private void DrawCaptionCard(Rect card, Rect screen, float scale)
var nameTop = avatarCenter.Y - 8f * scale;
var nameMaxWidth = MathF.Max(1f, card.Max.X - padding - nameLeft);
var nameHeight = Typography.Measure(displayName, nameStyle).Y;
var nameHovering = ImGui.IsMouseHoveringRect(new Vector2(nameLeft, nameTop),
var nameHovering = UiInteract.Hover(new Vector2(nameLeft, nameTop),
new Vector2(nameLeft + nameMaxWidth, nameTop + nameHeight));
Marquee.DrawLeft("aethergram.compose.author." + me.Handle, displayName, nameLeft, nameTop, nameMaxWidth,
nameStyle, theme.TextStrong, nameHovering);
Expand Down Expand Up @@ -554,7 +554,7 @@ private bool DrawShareBar(Rect rect, string label, bool enabled)
{
var scale = ImGuiHelpers.GlobalScale;
var drawList = ImGui.GetWindowDrawList();
var hovered = enabled && ImGui.IsMouseHoveringRect(rect.Min, rect.Max);
var hovered = enabled && UiInteract.Hover(rect.Min, rect.Max);
var radius = rect.Height * 0.5f;
var fill = enabled
? (hovered ? Palette.Mix(Accent, theme.TextStrong, 0.12f) : Accent)
Expand Down
8 changes: 4 additions & 4 deletions src/Aetherphone/Apps/Aethergram/AethergramApp.Detail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ private void DrawDetail(Rect area, string postId)
var headerMetaSize = Typography.Measure(headerMeta, 0.78f);
var headerTextGap = 3f * scale;
var headerNameY = avatarCenter.Y - (headerNameSize.Y + headerTextGap + headerMetaSize.Y) * 0.5f;
var headerNameHovering = ImGui.IsMouseHoveringRect(new Vector2(nameLeft, headerNameY),
var headerNameHovering = UiInteract.Hover(new Vector2(nameLeft, headerNameY),
new Vector2(nameLeft + headerTextMaxWidth, headerNameY + headerNameSize.Y));
Marquee.DrawLeft("aethergram.detail.header." + post.Id, displayName, nameLeft, headerNameY,
headerTextMaxWidth, headerNameStyle, theme.TextStrong, headerNameHovering);
var headerMetaTop = headerNameY + headerNameSize.Y + headerTextGap;
var headerMetaHovering = ImGui.IsMouseHoveringRect(new Vector2(nameLeft, headerMetaTop),
var headerMetaHovering = UiInteract.Hover(new Vector2(nameLeft, headerMetaTop),
new Vector2(nameLeft + headerTextMaxWidth, headerMetaTop + headerMetaSize.Y));
Marquee.DrawLeft("aethergram.detail.headermeta." + post.Id, headerMeta, nameLeft, headerMetaTop,
headerTextMaxWidth, new TextStyle(0.78f, FontWeight.Regular), AppPalettes.Aethergram.MutedInk,
Expand Down Expand Up @@ -173,7 +173,7 @@ private void DrawDetail(Rect area, string postId)
var captionPos = ImGui.GetCursorScreenPos();
var captionNameMaxWidth = width * 0.5f;
var captionNameSize = Typography.Measure(displayName, 0.9f, FontWeight.SemiBold);
var captionNameHovering = ImGui.IsMouseHoveringRect(captionPos,
var captionNameHovering = UiInteract.Hover(captionPos,
new Vector2(captionPos.X + captionNameMaxWidth, captionPos.Y + captionNameSize.Y));
var nameWidth = Marquee.DrawLeft("aethergram.detail.captionname." + post.Id, displayName,
captionPos.X, captionPos.Y, captionNameMaxWidth, new TextStyle(0.9f, FontWeight.SemiBold),
Expand Down Expand Up @@ -285,7 +285,7 @@ private void DrawComment(CommentDto comment)
string.Empty, comment.AuthorAvatarUrl, 0.8f, 28);

var nameTop = bubbleTop + padTop;
var commentNameHovering = ImGui.IsMouseHoveringRect(new Vector2(textLeft, nameTop),
var commentNameHovering = UiInteract.Hover(new Vector2(textLeft, nameTop),
new Vector2(textRight, nameTop + nameHeight));
var nameWidth = Marquee.DrawLeft("aethergram.comment." + comment.Id, displayName, textLeft, nameTop,
textRight - textLeft, commentNameStyle, theme.TextStrong, commentNameHovering);
Expand Down
6 changes: 3 additions & 3 deletions src/Aetherphone/Apps/Aethergram/AethergramApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -851,14 +851,14 @@ private void DrawGramCard(PostDto post)
var headerTextMaxWidth = MathF.Max(1f, headerTextRight - nameLeft);
var cardNameStyle = new TextStyle(1f, FontWeight.SemiBold);
var cardNameHeight = Typography.Measure(displayName, cardNameStyle).Y;
var cardNameHovering = ImGui.IsMouseHoveringRect(new Vector2(nameLeft, origin.Y + pad),
var cardNameHovering = UiInteract.Hover(new Vector2(nameLeft, origin.Y + pad),
new Vector2(nameLeft + headerTextMaxWidth, origin.Y + pad + cardNameHeight));
Marquee.DrawLeft("aethergram.card." + post.Id, displayName, nameLeft, origin.Y + pad, headerTextMaxWidth,
cardNameStyle, theme.TextStrong, cardNameHovering);
var subline = SocialIdentity.FeedMeta(post.AuthorHandle, TimeText.Short(post.CreatedAtUnix));
var sublineTop = origin.Y + pad + PostCardMetrics.SublineTop * scale;
var sublineSize = Typography.Measure(subline, 0.85f);
var sublineHovering = ImGui.IsMouseHoveringRect(new Vector2(nameLeft, sublineTop),
var sublineHovering = UiInteract.Hover(new Vector2(nameLeft, sublineTop),
new Vector2(nameLeft + headerTextMaxWidth, sublineTop + sublineSize.Y));
Marquee.DrawLeft("aethergram.card.sub." + post.Id, subline, nameLeft, sublineTop, headerTextMaxWidth,
new TextStyle(0.85f, FontWeight.Regular), AppPalettes.Aethergram.MutedInk, sublineHovering);
Expand Down Expand Up @@ -1025,7 +1025,7 @@ private int DrawGramCarousel(Rect imageRect, PostDto post, string[] photos, floa

private void HandleLikeGesture(Rect imageRect, PostDto post, string[] photos, int page)
{
if (!ImGui.IsMouseHoveringRect(imageRect.Min, imageRect.Max))
if (!UiInteract.Hover(imageRect.Min, imageRect.Max))
{
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private void DrawCard(AnnouncementDto announcement, float scale, int maxBodyLine
Typography.Draw(drawList, new Vector2(stampLeft, footerCenterY - stampSize.Y * 0.5f), stamp, ui.MutedInk,
TextStyles.Footnote);

var hovered = ImGui.IsMouseHoveringRect(origin, cardMax);
var hovered = UiInteract.Hover(origin, cardMax);
DrawChevron(drawList, new Vector2(cardMax.X - pad, footerCenterY), 5f * scale, Metrics.Stroke.Thin * scale,
hovered ? ui.TitleInk : Palette.WithAlpha(ui.MutedInk, 0.7f));
if (hovered)
Expand Down
2 changes: 1 addition & 1 deletion src/Aetherphone/Apps/AppStore/AppStoreApp.Catalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private bool DrawCategoryCard(Rect card, int categoryIndex, float scale)
var labelLeft = card.Min.X + pad;
var labelTop = card.Max.Y - 28f * scale;
var labelSize = Typography.Measure(label, TextStyles.Headline);
var labelHovering = ImGui.IsMouseHoveringRect(new Vector2(labelLeft, labelTop),
var labelHovering = UiInteract.Hover(new Vector2(labelLeft, labelTop),
new Vector2(labelLeft + MathF.Min(labelSize.X, maxLabelWidth), labelTop + labelSize.Y));
Marquee.DrawLeft("appstore.category.label.shadow." + category, label, labelLeft, labelTop + 1f * scale,
maxLabelWidth, TextStyles.Headline, CardInkShadow, labelHovering);
Expand Down
2 changes: 1 addition & 1 deletion src/Aetherphone/Apps/AppStore/AppStoreApp.Detail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private float DrawDetailHead(Vector2 origin, float width, IPhoneApp app, in Stor
var textLeft = origin.X + (DetailIconSize + 14f) * scale;
var textWidth = origin.X + width - textLeft;
var nameY = top + 6f * scale;
var nameHovering = ImGui.IsMouseHoveringRect(new Vector2(textLeft, nameY),
var nameHovering = UiInteract.Hover(new Vector2(textLeft, nameY),
new Vector2(textLeft + textWidth, nameY + Typography.Measure(app.DisplayName, TextStyles.Title2).Y));
Marquee.DrawLeft("appstore.detail.name." + app.Id, app.DisplayName, textLeft, nameY, textWidth,
TextStyles.Title2, ui.TitleInk, nameHovering);
Expand Down
4 changes: 2 additions & 2 deletions src/Aetherphone/Apps/AppStore/AppStoreApp.Rows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ private bool DrawAppRow(Rect row, IPhoneApp app, float scale)
var textWidth = pill.Min.X - textLeft - 10f * scale;
var entry = AppStoreCatalog.For(app.Id);
var nameY = row.Center.Y - 18f * scale;
var nameHovering = ImGui.IsMouseHoveringRect(new Vector2(textLeft, nameY),
var nameHovering = UiInteract.Hover(new Vector2(textLeft, nameY),
new Vector2(textLeft + textWidth, nameY + Typography.Measure(app.DisplayName, TextStyles.Headline).Y));
Marquee.DrawLeft("appstore.row.name." + app.Id, app.DisplayName, textLeft, nameY, textWidth,
TextStyles.Headline, ui.TitleInk, nameHovering);
var subtitle = Loc.T(entry.Subtitle);
var subtitleY = row.Center.Y + 2f * scale;
var subtitleHovering = ImGui.IsMouseHoveringRect(new Vector2(textLeft, subtitleY),
var subtitleHovering = UiInteract.Hover(new Vector2(textLeft, subtitleY),
new Vector2(textLeft + textWidth, subtitleY + Typography.Measure(subtitle, TextStyles.Footnote).Y));
Marquee.DrawLeft("appstore.row.subtitle." + app.Id, subtitle, textLeft, subtitleY, textWidth,
TextStyles.Footnote, ui.MutedInk, subtitleHovering);
Expand Down
2 changes: 1 addition & 1 deletion src/Aetherphone/Apps/AppStore/AppStoreApp.Today.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private void DrawHero(Rect card, IPhoneApp app, float scale)
Palette.WithAlpha(new Vector4(1f, 1f, 1f, 1f), 0.78f), TextStyles.Caption1);
var nameY = card.Min.Y + pad + 20f * scale;
var nameMaxWidth = card.Width - pad * 2f;
var nameHovering = ImGui.IsMouseHoveringRect(new Vector2(card.Min.X + pad, nameY),
var nameHovering = UiInteract.Hover(new Vector2(card.Min.X + pad, nameY),
new Vector2(card.Min.X + pad + nameMaxWidth, nameY + Typography.Measure(app.DisplayName, TextStyles.Title1).Y));
Marquee.DrawLeft("appstore.today.name." + app.Id, app.DisplayName, card.Min.X + pad, nameY, nameMaxWidth,
TextStyles.Title1, new Vector4(1f, 1f, 1f, 1f), nameHovering);
Expand Down
6 changes: 3 additions & 3 deletions src/Aetherphone/Apps/Calculator/CalculatorApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private void DrawHistoryTape(Rect rect, float scale)
var entry = history[index];
var origin = ImGui.GetCursorScreenPos();
var row = new Rect(origin, new Vector2(origin.X + width, origin.Y + rowHeight));
var hovered = ImGui.IsMouseHoveringRect(row.Min, row.Max);
var hovered = UiInteract.Hover(row.Min, row.Max);
if (hovered)
{
Squircle.Fill(drawList, row.Min, row.Max, 6f * scale,
Expand Down Expand Up @@ -253,7 +253,7 @@ private void DrawZeroKey(float gridLeft, float gridTop, float button, float gap,
var min = new Vector2(left, top);
var max = new Vector2(left + button * 2f + gap, top + button);
var center = new Vector2((min.X + max.X) * 0.5f, (min.Y + max.Y) * 0.5f);
var hovered = ImGui.IsMouseHoveringRect(min, max);
var hovered = UiInteract.Hover(min, max);
var fill = hovered ? Palette.Mix(DigitBg, White, 0.14f) : DigitBg;
var drawList = ImGui.GetWindowDrawList();
Squircle.Fill(drawList, min, max, radius, ImGui.GetColorU32(fill));
Expand Down Expand Up @@ -281,7 +281,7 @@ private static bool DrawKey(Vector2 center, float radius, string label, Vector4
{
var min = center - new Vector2(radius, radius);
var max = center + new Vector2(radius, radius);
var hovered = ImGui.IsMouseHoveringRect(min, max);
var hovered = UiInteract.Hover(min, max);
var fill = hovered ? Palette.Mix(background, White, 0.14f) : background;
var drawList = ImGui.GetWindowDrawList();
drawList.AddCircleFilled(center, radius, ImGui.GetColorU32(fill), 40);
Expand Down
4 changes: 2 additions & 2 deletions src/Aetherphone/Apps/Calendar/CalendarApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void DrawAddButton(Vector2 center, float radius)
{
var drawList = ImGui.GetWindowDrawList();
var iconColor = ui.Theme.TextStrong;
var hovered = ImGui.IsMouseHoveringRect(center - new Vector2(radius, radius), center + new Vector2(radius, radius));
var hovered = UiInteract.Hover(center - new Vector2(radius, radius), center + new Vector2(radius, radius));
drawList.AddCircleFilled(center, radius, ImGui.GetColorU32(Palette.WithAlpha(iconColor, hovered ? 0.20f : 0.12f)), 32);
using (ImRaii.PushFont(UiBuilder.IconFont))
{
Expand Down Expand Up @@ -251,7 +251,7 @@ private void DrawTitleField(Rect rect, float scale)
private bool DrawSaveButton(Rect rect, float scale, bool enabled)
{
var drawList = ImGui.GetWindowDrawList();
var hovered = enabled && ImGui.IsMouseHoveringRect(rect.Min, rect.Max);
var hovered = enabled && UiInteract.Hover(rect.Min, rect.Max);
var fill = !enabled ? Palette.WithAlpha(ui.Accent, 0.35f) :
hovered ? Palette.Mix(ui.Accent, new Vector4(0f, 0f, 0f, 1f), 0.12f) : ui.Accent;
Squircle.Fill(drawList, rect.Min, rect.Max, rect.Height * 0.5f, ImGui.GetColorU32(fill));
Expand Down
4 changes: 2 additions & 2 deletions src/Aetherphone/Apps/Calendar/CalendarDayList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static float Draw(AppSkin ui, Rect area, DateTime selectedDate,
var cardHeight = Math.Max(textHeight + CardPaddingY * 2f * scale, 40f * scale);
var cardMax = new Vector2(cardMin.X + contentWidth, cardMin.Y + cardHeight);
var clickable = !string.IsNullOrEmpty(dayEvent.Url);
var cardHovered = ImGui.IsMouseHoveringRect(cardMin, cardMax);
var cardHovered = UiInteract.Hover(cardMin, cardMax);
var hovered = clickable && cardHovered;

ui.Card(drawList, cardMin, cardMax, CardRounding * scale);
Expand Down Expand Up @@ -101,7 +101,7 @@ private static void DrawDeleteButton(ImDrawListPtr drawList, Vector2 cardMax, fl
var center = new Vector2(cardMax.X - AccentBarInset * scale - radius, cardMax.Y - AccentBarInset * scale - radius + 2f * scale);
var min = center - new Vector2(radius, radius);
var max = center + new Vector2(radius, radius);
var hovered = ImGui.IsMouseHoveringRect(min, max);
var hovered = UiInteract.Hover(min, max);
if (hovered)
{
ImGui.SetMouseCursor(ImGuiMouseCursor.Hand);
Expand Down
4 changes: 2 additions & 2 deletions src/Aetherphone/Apps/Calendar/CalendarMonthView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private static void DrawTodayButton(AppSkin ui, ImDrawListPtr drawList, float ri
var height = NavHeight * scale * 0.68f;
var max = new Vector2(rightLimitX - gapX, navY + NavHeight * scale * 0.5f + height * 0.5f);
var min = new Vector2(max.X - textSize.X - padX * 2f, max.Y - height);
var hovered = ImGui.IsMouseHoveringRect(min, max);
var hovered = UiInteract.Hover(min, max);
Squircle.Fill(drawList, min, max, height * 0.5f,
ImGui.GetColorU32(Palette.WithAlpha(ui.Accent, hovered ? 0.24f : 0.14f)));
Typography.DrawCentered(drawList, (min + max) * 0.5f, todayText, ui.Accent, feScale, feWeight);
Expand All @@ -212,7 +212,7 @@ private static bool DrawNavChevron(AppSkin ui, ImDrawListPtr drawList, Vector2 o
var min = new Vector2(origin.X + 4f * scale, origin.Y);
var max = new Vector2(min.X + 30f * scale, min.Y + NavHeight * scale);
var mid = (min + max) * 0.5f;
var hovered = ImGui.IsMouseHoveringRect(min, max);
var hovered = UiInteract.Hover(min, max);
if (hovered)
{
Squircle.Fill(drawList, min, max, (max.Y - min.Y) * 0.5f, ImGui.GetColorU32(ui.HoverTint));
Expand Down
3 changes: 2 additions & 1 deletion src/Aetherphone/Apps/Camera/CameraApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Aetherphone.Core.Localization;
using Aetherphone.Core.Photos;
using Aetherphone.Core.Theme;
using Aetherphone.Windows.Components;
using Dalamud.Bindings.ImGui;
using Dalamud.Game.Gui.NamePlate;
using Dalamud.Interface.Textures;
Expand Down Expand Up @@ -391,7 +392,7 @@ private void HandleFocusTap(Rect viewfinder, bool consumed)
}

var mouse = ImGui.GetMousePos();
if (!viewfinder.Contains(mouse))
if (!UiInteract.Hover(viewfinder.Min, viewfinder.Max))
{
return;
}
Expand Down
Loading