From 574347e81083acc55f6abd26b076027739dd61ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dariusz=20Komosi=C5=84ski?= Date: Tue, 13 Jul 2021 16:11:40 +0200 Subject: [PATCH] Merge pull request #6244 from megazyz/fixes/6243-thumb-mousecaptureloss Fix: Thumb should handle pointer capture loss --- src/Avalonia.Controls/Primitives/Thumb.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Avalonia.Controls/Primitives/Thumb.cs b/src/Avalonia.Controls/Primitives/Thumb.cs index 348922b71d..91141058e4 100644 --- a/src/Avalonia.Controls/Primitives/Thumb.cs +++ b/src/Avalonia.Controls/Primitives/Thumb.cs @@ -56,6 +56,26 @@ namespace Avalonia.Controls.Primitives { } + protected override void OnPointerCaptureLost(PointerCaptureLostEventArgs e) + { + if (_lastPoint.HasValue) + { + var ev = new VectorEventArgs + { + RoutedEvent = DragCompletedEvent, + Vector = _lastPoint.Value, + }; + + _lastPoint = null; + + RaiseEvent(ev); + } + + PseudoClasses.Remove(":pressed"); + + base.OnPointerCaptureLost(e); + } + protected override void OnPointerMoved(PointerEventArgs e) { if (_lastPoint.HasValue)