Browse Source

Revert thumb to using relative coordinates for drag.

Undoes the changes in #10892 and #11087.
pull/11252/head
Steven Kirk 3 years ago
parent
commit
4333cc33ba
  1. 9
      src/Avalonia.Controls/Primitives/Thumb.cs

9
src/Avalonia.Controls/Primitives/Thumb.cs

@ -4,7 +4,6 @@ using Avalonia.Controls.Automation.Peers;
using Avalonia.Controls.Metadata;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.VisualTree;
namespace Avalonia.Controls.Primitives
{
@ -85,22 +84,20 @@ namespace Avalonia.Controls.Primitives
{
if (_lastPoint.HasValue)
{
var point = e.GetPosition(null);
var ev = new VectorEventArgs
{
RoutedEvent = DragDeltaEvent,
Vector = point - _lastPoint.Value,
Vector = e.GetPosition(this) - _lastPoint.Value,
};
RaiseEvent(ev);
_lastPoint = point;
}
}
protected override void OnPointerPressed(PointerPressedEventArgs e)
{
e.Handled = true;
_lastPoint = e.GetPosition(null);
_lastPoint = e.GetPosition(this);
var ev = new VectorEventArgs
{
@ -123,7 +120,7 @@ namespace Avalonia.Controls.Primitives
var ev = new VectorEventArgs
{
RoutedEvent = DragCompletedEvent,
Vector = (Vector)e.GetPosition(null),
Vector = (Vector)e.GetPosition(this),
};
RaiseEvent(ev);

Loading…
Cancel
Save