Browse Source
Moves InlineUIContainer Child measure and arrange to the IInlineHost (#8849)
pull/8852/head
Benedikt Stebner
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
28 additions and
13 deletions
-
src/Avalonia.Controls/Documents/InlineUIContainer.cs
-
src/Avalonia.Controls/RichTextBlock.cs
|
|
|
@ -87,18 +87,7 @@ namespace Avalonia.Controls.Documents |
|
|
|
|
|
|
|
public override TextRunProperties? Properties { get; } |
|
|
|
|
|
|
|
public override Size Size |
|
|
|
{ |
|
|
|
get |
|
|
|
{ |
|
|
|
if (!Control.IsMeasureValid) |
|
|
|
{ |
|
|
|
Control.Measure(Size.Infinity); |
|
|
|
} |
|
|
|
|
|
|
|
return Control.DesiredSize; |
|
|
|
} |
|
|
|
} |
|
|
|
public override Size Size => Control.DesiredSize; |
|
|
|
|
|
|
|
public override double Baseline |
|
|
|
{ |
|
|
|
@ -118,7 +107,7 @@ namespace Avalonia.Controls.Documents |
|
|
|
|
|
|
|
public override void Draw(DrawingContext drawingContext, Point origin) |
|
|
|
{ |
|
|
|
Control.Arrange(new Rect(origin, Size)); |
|
|
|
//noop
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -544,6 +544,32 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected override Size MeasureOverride(Size availableSize) |
|
|
|
{ |
|
|
|
foreach (var child in VisualChildren) |
|
|
|
{ |
|
|
|
if (child is Control control) |
|
|
|
{ |
|
|
|
control.Measure(Size.Infinity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return base.MeasureOverride(availableSize); |
|
|
|
} |
|
|
|
|
|
|
|
protected override Size ArrangeOverride(Size finalSize) |
|
|
|
{ |
|
|
|
foreach (var child in VisualChildren) |
|
|
|
{ |
|
|
|
if (child is Control control) |
|
|
|
{ |
|
|
|
control.Arrange(new Rect(control.DesiredSize)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return base.ArrangeOverride(finalSize); |
|
|
|
} |
|
|
|
|
|
|
|
private string GetSelection() |
|
|
|
{ |
|
|
|
if (!IsTextSelectionEnabled) |
|
|
|
|