Skip to content

Commit

Permalink
Merge pull request #19483 from unoplatform/mergify/bp/release/stable/…
Browse files Browse the repository at this point in the history
…5.6/pr-19479

feat: Prevent HRI to move out of area by inertia (backport #19479)
  • Loading branch information
jeromelaban authored Feb 8, 2025
2 parents 3197aba + b8ef171 commit 7e57f0a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Uno.UI.Toolkit/Diagnostics/DiagnosticsOverlay.Placement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ private void OnAnchorManipulated(object sender, ManipulationDeltaRoutedEventArgs
_location.X += _origin.HasFlag(PlacementOrigin.Right) ? -e.Delta.Translation.X : e.Delta.Translation.X;
_location.Y += _origin.HasFlag(PlacementOrigin.Bottom) ? -e.Delta.Translation.Y : e.Delta.Translation.Y;

if (e.IsInertial)
{
var area = GetSafeArea();
if (_location.X < 0 || _location.X > area.Width
|| _location.Y < 0 || _location.Y > area.Height)
{
e.Complete();

return;
}
}

ApplyLocation();
}

Expand Down

0 comments on commit 7e57f0a

Please sign in to comment.