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

make _lastKnownPosition trackable at dragging #18069

Merged
merged 1 commit into from
Feb 7, 2025
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
18 changes: 15 additions & 3 deletions src/Avalonia.Base/Input/PointerOverPreProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,21 @@ public void OnError(Exception error)

public void OnNext(RawInputEventArgs value)
{
if (value is RawPointerEventArgs args
&& args.Root == _inputRoot
&& value.Device is IPointerDevice pointerDevice)
if (value is RawDragEvent dragArgs)
{
// When a platform drag operation is in progress, the application does not receive
// pointer move events until after the drop event. This is a problem because if a
// popup is shown at the pointer position in the drop event, it will be shown at
// the position at which the drag was initiated, not the position at which the drop
// occurred.
//
// Solve this by updating the last known pointer position when a drag event occurs.
_lastKnownPosition = ((Visual)_inputRoot).PointToScreen(dragArgs.Location);
}

else if (value is RawPointerEventArgs args
&& args.Root == _inputRoot
&& value.Device is IPointerDevice pointerDevice)
{
if (pointerDevice != _lastActivePointerDevice)
{
Expand Down