Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix HRI not being draggable (backport #18873) #18893

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/Uno.UI.Toolkit/Diagnostics/DiagnosticsOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,11 @@ protected override void OnVisibilityChanged(Visibility oldValue, Visibility newV
/// <inheritdoc />
protected override void OnApplyTemplate()
{
if (_anchor is not null)
if (_toolbar is not null)
{
//_anchor.Tapped -= OnAnchorTapped;
_anchor.ManipulationDelta -= OnAnchorManipulated;
_anchor.ManipulationCompleted -= OnAnchorManipulatedCompleted;
_toolbar.ManipulationDelta -= OnAnchorManipulated;
_toolbar.ManipulationCompleted -= OnAnchorManipulatedCompleted;
}
if (_notificationPresenter is not null)
{
Expand All @@ -377,12 +377,12 @@ protected override void OnApplyTemplate()
_anchor = GetTemplateChild(AnchorPartName) as UIElement;
_notificationPresenter = GetTemplateChild(NotificationPartName) as ContentPresenter;

if (_anchor is not null)
if (_toolbar is not null)
{
//_anchor.Tapped += OnAnchorTapped;
_anchor.ManipulationDelta += OnAnchorManipulated;
_anchor.ManipulationCompleted += OnAnchorManipulatedCompleted;
_anchor.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY | ManipulationModes.TranslateInertia;
_toolbar.ManipulationDelta += OnAnchorManipulated;
_toolbar.ManipulationCompleted += OnAnchorManipulatedCompleted;
_toolbar.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY | ManipulationModes.TranslateInertia;
RenderTransform = new TranslateTransform();
}
if (_notificationPresenter is not null)
Expand All @@ -399,9 +399,14 @@ protected override void OnApplyTemplate()
static void OnToolBarSizeChanged(object sender, SizeChangedEventArgs args)
{
// Patches pointer event dispatch on a 0x0 Canvas
if (sender is UIElement uie && uie.GetTemplatedParent() is DiagnosticsOverlay { TemplatedRoot: Canvas canvas })
if (sender is UIElement uie && uie.GetTemplatedParent() is DiagnosticsOverlay { TemplatedRoot: Canvas canvas } overlay)
{
canvas.Width = args.NewSize.Width;

#if __ANDROID__
// Required for Android to effectively update the ActualSize allowing the RenderTransformAdapter to accept to apply the transform.
overlay.DispatcherQueue.TryEnqueue(() => canvas.InvalidateMeasure());
#endif
}
}
#endif
Expand Down
Loading