Merge remote-tracking branch 'origin/master' into 1.10

# Conflicts:
#	Source/Editor/Windows/Profiler/Memory.cs
This commit is contained in:
Wojtek Figat
2025-03-25 13:37:15 +01:00
94 changed files with 901 additions and 352 deletions

View File

@@ -473,6 +473,7 @@ namespace FlaxEngine.GUI
{
AnchorPreset = AnchorPresets.StretchAll,
BackgroundColor = Color.Transparent,
Pivot = Float2.Zero,
IsScrollable = true,
AutoSize = true,
Parent = popup.MainPanel,

View File

@@ -337,9 +337,7 @@ namespace FlaxEngine.GUI
size.X = _textSize.X + Margin.Width;
if (_autoHeight)
size.Y = _textSize.Y + Margin.Height;
var pivotRelative = PivotRelative;
Size = size;
PivotRelative = pivotRelative;
Resize(ref size);
}
}
}

View File

@@ -233,13 +233,7 @@ namespace FlaxEngine.GUI
{
ref TextBlock textBlock = ref textBlocks[i];
var textBlockSize = textBlock.Bounds.BottomRight - lineOrigin;
var ascender = textBlock.Ascender;
//if (ascender <= 0)
{
var textBlockFont = textBlock.Style.Font.GetFont();
if (textBlockFont)
ascender = textBlockFont.Ascender;
}
var ascender = textBlock.GetAscender();
lineAscender = Mathf.Max(lineAscender, ascender);
lineSize = Float2.Max(lineSize, textBlockSize);
}
@@ -256,13 +250,7 @@ namespace FlaxEngine.GUI
case TextBlockStyle.Alignments.Baseline:
{
// Match the baseline of the line (use ascender)
var ascender = textBlock.Ascender;
if (ascender <= 0)
{
var textBlockFont = textBlock.Style.Font.GetFont();
if (textBlockFont)
ascender = textBlockFont.Ascender;
}
var ascender = textBlock.GetAscender();
vOffset = lineAscender - ascender;
textBlock.Bounds.Location.Y += vOffset;
break;

View File

@@ -176,7 +176,8 @@ namespace FlaxEngine.GUI
var font = imageBlock.Style.Font.GetFont();
if (font)
imageBlock.Bounds.Size = new Float2(font.Height);
imageBlock.Bounds.Size.X *= image.Size.X / image.Size.Y; // Keep original aspect ratio
var imageSize = image.Size;
imageBlock.Bounds.Size.X *= imageSize.X / imageSize.Y; // Keep original aspect ratio
bool hasWidth = TryParseNumberTag(ref tag, "width", imageBlock.Bounds.Width, out var width);
imageBlock.Bounds.Width = width;
bool hasHeight = TryParseNumberTag(ref tag, "height", imageBlock.Bounds.Height, out var height);
@@ -185,9 +186,9 @@ namespace FlaxEngine.GUI
{
// Maintain aspect ratio after scaling by just width or height
if (hasHeight)
imageBlock.Bounds.Size.X = imageBlock.Bounds.Size.Y * image.Size.X / image.Size.Y;
imageBlock.Bounds.Size.X = imageBlock.Bounds.Size.Y * imageSize.X / imageSize.Y;
else
imageBlock.Bounds.Size.Y = imageBlock.Bounds.Size.X * image.Size.Y / image.Size.X;
imageBlock.Bounds.Size.Y = imageBlock.Bounds.Size.X * imageSize.Y / imageSize.X;
}
TryParseNumberTag(ref tag, "scale", 1.0f, out var scale);
imageBlock.Bounds.Size *= scale;