-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InlineUIContainer
dosen't correctly render with TextProperty=Wrap
#17183
Labels
Comments
Looks like this code if (drawable is EmbeddedControlRun controlRun
&& controlRun.Control is Control control)
{
control.Arrange(
new Rect(new Point(currentX, currentY),
new Size(control.DesiredSize.Width, textLine.Height)));
} in |
Created super simple fix that was written in 2 minutes: List<Control> _aabb = new();
protected override Size ArrangeOverride(Size finalSize)
{
var scale = LayoutHelper.GetLayoutScale(this);
var padding = LayoutHelper.RoundLayoutThickness(Padding, scale, scale);
//Fixes: #11019
if (finalSize.Width < _constraint.Width)
{
_textLayout?.Dispose();
_textLayout = null;
_constraint = finalSize.Deflate(padding);
}
if (HasComplexContent)
{
var currentY = padding.Top;
foreach (var cont in _aabb)
{
cont.Arrange(
new Rect(-cont.Bounds.Width, -cont.Bounds.Height, cont.Bounds.Width, cont.Bounds.Height));
}
foreach (var textLine in TextLayout.TextLines)
{
var currentX = padding.Left + textLine.Start;
foreach (var run in textLine.TextRuns)
{
if (run is DrawableTextRun drawable)
{
if (drawable is EmbeddedControlRun controlRun
&& controlRun.Control is Control control)
{
control.Arrange(
new Rect(new Point(currentX, currentY),
new Size(control.DesiredSize.Width, textLine.Height)));
if (!_aabb.Contains(control))
_aabb.Add(control);
}
currentX += drawable.Size.Width;
}
}
currentY += textLine.Height;
}
}
return finalSize;
} Works as i wanted. |
3 tasks
Gillibald
added a commit
to Gillibald/Avalonia
that referenced
this issue
Nov 14, 2024
…valoniaUI#17183) (AvaloniaUI#17194) * InlineUiContainer clip fix * Removed LINQ, redo check * bugfix/InlineUiContainer-clip-in-text: redo everything * fixes by Gillibald --------- Co-authored-by: Benedikt Stebner <Gillibald@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Right now if Inlines have InlineUIContainer inside and we have TextProperty=Wrap on TextBlock, everything is fine until InlineUIContainer renders.
After that, if i back to smaller width, InlineUiContainer will be rendered incorrectly, on top of my text.
I don't know what to do right now. I thought about using WrapPanel, but that means i need to rewrote whole system in my App.
To Reproduce
Expected behavior
Avalonia version
11.1.3
OS
Windows
Additional context
No response
The text was updated successfully, but these errors were encountered: