mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
Allow adding Link children to non-Paragraph elements
This commit is contained in:
parent
01bec459de
commit
8fac4a0b69
2 changed files with 4 additions and 1 deletions
|
@ -27,6 +27,7 @@ Additions
|
||||||
Improvements
|
Improvements
|
||||||
- Removed LINQ Any and All usage in various methods to improve memory usage
|
- Removed LINQ Any and All usage in various methods to improve memory usage
|
||||||
- Explicitly disallow creating Paragraphs without fonts to make starting out with MLEM.Ui less confusing
|
- Explicitly disallow creating Paragraphs without fonts to make starting out with MLEM.Ui less confusing
|
||||||
|
- Allow adding Link children to non-Paragraph elements
|
||||||
|
|
||||||
Fixes
|
Fixes
|
||||||
- Fixed a crash if a paragraph has a link formatting code, but no font
|
- Fixed a crash if a paragraph has a link formatting code, but no font
|
||||||
|
|
|
@ -237,7 +237,9 @@ namespace MLEM.Ui.Elements {
|
||||||
public override void ForceUpdateArea() {
|
public override void ForceUpdateArea() {
|
||||||
// set the position offset and size to the token's first area
|
// set the position offset and size to the token's first area
|
||||||
var area = this.Token.GetArea(Vector2.Zero, this.textScale).FirstOrDefault();
|
var area = this.Token.GetArea(Vector2.Zero, this.textScale).FirstOrDefault();
|
||||||
this.PositionOffset = area.Location + new Vector2(((Paragraph) this.Parent).GetAlignmentOffset() / this.Parent.Scale, 0);
|
if (this.Parent is Paragraph p)
|
||||||
|
area.Location += new Vector2(p.GetAlignmentOffset() / p.Scale, 0);
|
||||||
|
this.PositionOffset = area.Location;
|
||||||
this.IsHidden = area.IsEmpty;
|
this.IsHidden = area.IsEmpty;
|
||||||
this.Size = area.Size;
|
this.Size = area.Size;
|
||||||
base.ForceUpdateArea();
|
base.ForceUpdateArea();
|
||||||
|
|
Loading…
Reference in a new issue