|
|
|
@ -215,7 +215,7 @@ namespace Avalonia.Controls |
|
|
|
impl, dependencyResolver, () => ClientSize); |
|
|
|
_source.Renderer.SceneInvalidated += SceneInvalidated; |
|
|
|
|
|
|
|
_scaling = ValidateScaling(impl.RenderScaling); |
|
|
|
_scaling = LayoutHelper.ValidateScaling(impl.RenderScaling); |
|
|
|
_actualTransparencyLevel = PlatformImpl.TransparencyLevel; |
|
|
|
|
|
|
|
|
|
|
|
@ -234,7 +234,7 @@ namespace Avalonia.Controls |
|
|
|
impl.Closed = HandleClosed; |
|
|
|
impl.Paint = HandlePaint; |
|
|
|
impl.Resized = HandleResized; |
|
|
|
impl.ScalingChanged = HandleScalingChanged; |
|
|
|
impl.ScalingChanged += HandleScalingChanged; |
|
|
|
impl.TransparencyLevelChanged = HandleTransparencyLevelChanged; |
|
|
|
|
|
|
|
CreatePlatformImplBinding(TransparencyLevelHintProperty, hint => PlatformImpl.SetTransparencyLevelHint(hint ?? Array.Empty<WindowTransparencyLevel>())); |
|
|
|
@ -709,7 +709,7 @@ namespace Avalonia.Controls |
|
|
|
/// <param name="scaling">The window scaling.</param>
|
|
|
|
private void HandleScalingChanged(double scaling) |
|
|
|
{ |
|
|
|
_scaling = ValidateScaling(scaling); |
|
|
|
_scaling = LayoutHelper.ValidateScaling(scaling); |
|
|
|
LayoutHelper.InvalidateSelfAndChildrenMeasure(this); |
|
|
|
Dispatcher.UIThread.Send(_ => ScalingChanged?.Invoke(this, EventArgs.Empty)); |
|
|
|
|
|
|
|
@ -833,23 +833,5 @@ namespace Avalonia.Controls |
|
|
|
{ |
|
|
|
// Do nothing becuase TopLevel should't apply MirrorTransform on himself.
|
|
|
|
} |
|
|
|
|
|
|
|
private double ValidateScaling(double scaling) |
|
|
|
{ |
|
|
|
if (MathUtilities.IsNegativeOrNonFinite(scaling) || MathUtilities.IsZero(scaling)) |
|
|
|
{ |
|
|
|
throw new InvalidOperationException( |
|
|
|
$"Invalid {nameof(ITopLevelImpl.RenderScaling)} value {scaling} returned from {PlatformImpl?.GetType()}"); |
|
|
|
} |
|
|
|
|
|
|
|
if (MathUtilities.IsOne(scaling)) |
|
|
|
{ |
|
|
|
// Ensure we've got exactly 1.0 and not an approximation,
|
|
|
|
// so we don't have to use MathUtilities.IsOne in various layout hot paths.
|
|
|
|
return 1.0; |
|
|
|
} |
|
|
|
|
|
|
|
return scaling; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|