From 68fc02b1708a6cb8d643b6fd5702d38905846260 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 7 Jan 2022 20:50:32 +0100 Subject: [PATCH] Fixed paragraph links having incorrect hover locations when using special text alignments --- CHANGELOG.md | 3 +++ MLEM.Ui/Elements/Paragraph.cs | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d836072..013af60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,9 @@ Improvements - Allow for checkboxes and radio buttons to be disabled - Only set a paragraph's area dirty when a text change would cause it to change size +Fixes +- Fixed paragraph links having incorrect hover locations when using special text alignments + ### MLEM.Data Improvements - Rethrow exceptions when no RawContentManager readers could be constructed diff --git a/MLEM.Ui/Elements/Paragraph.cs b/MLEM.Ui/Elements/Paragraph.cs index 22b1c07..5c208bf 100644 --- a/MLEM.Ui/Elements/Paragraph.cs +++ b/MLEM.Ui/Elements/Paragraph.cs @@ -266,7 +266,10 @@ namespace MLEM.Ui.Elements { if (ret != null) return ret; // check if any of our token's parts are hovered - foreach (var rect in this.Token.GetArea(this.Parent.DisplayArea.Location, this.Scale * this.textScale)) { + var location = this.Parent.DisplayArea.Location; + if (this.Parent is Paragraph p) + location.X += p.GetAlignmentOffset(); + foreach (var rect in this.Token.GetArea(location, this.Scale * this.textScale)) { if (rect.Contains(this.TransformInverse(position))) return this; }