Skip to content

Commit

Permalink
chore: Warn user when non-Z-only Translation is set on UIElement
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Dec 6, 2024
1 parent 52765aa commit 835e384
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Uno.UI/UI/Xaml/UIElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ namespace Microsoft.UI.Xaml
public partial class UIElement : DependencyObject, IXUidProvider
{
private protected static bool _traceLayoutCycle;
#if !__SKIA__
private bool _warnedAboutTranslation;
#endif

private static readonly TypedEventHandler<UIElement, BringIntoViewRequestedEventArgs> OnBringIntoViewRequestedHandler =
(UIElement sender, BringIntoViewRequestedEventArgs args) => sender.OnBringIntoViewRequested(args);
Expand Down Expand Up @@ -265,6 +268,19 @@ public Vector3 Translation
if (_translation != value)
{
_translation = value;

#if !__SKIA__
if (!_warnedAboutTranslation &&
(_translation.X != 0 || _translation.Y != 0))
{
_warnedAboutTranslation = true;
if (this.Log().IsEnabled(LogLevel.Warning))
{
this.Log().LogWarning("Translation supports only Z-axis on this target.");
}
}
#endif

UpdateShadow();
InvalidateArrange();
}
Expand Down

0 comments on commit 835e384

Please sign in to comment.