Browse Source

Fix NativeControlHost not accounting for visual transforms in size calculation (#20785)

GetAbsoluteBounds() was using TransformToAABB only for the position but
then returning the untransformed Bounds.Size. This caused native controls
inside a Viewbox (or any parent with a visual transform) to be sized
incorrectly - the native window would appear at the right position but
at the wrong (unscaled) size.

Use the full transformed rect from TransformToAABB for both position and
size.

Fixes #13832

Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
release/11.3.13
mfkl 7 months ago
committed by Julien Lebosquain
parent
commit
27d1e21346
  1. 4
      src/Avalonia.Controls/NativeControlHost.cs

4
src/Avalonia.Controls/NativeControlHost.cs

@ -150,8 +150,8 @@ namespace Avalonia.Controls
var transformToVisual = this.TransformToVisual(_currentRoot);
if (transformToVisual == null)
return null;
var position = new Rect(default, bounds.Size).TransformToAABB(transformToVisual.Value).Position;
return new Rect(position, bounds.Size);
var transformedRect = new Rect(default, bounds.Size).TransformToAABB(transformToVisual.Value);
return transformedRect;
}
private void EnqueueForMoveResize()

Loading…
Cancel
Save