Change logic to not do anything if file not exist.

This commit is contained in:
Hongtao Zhang 2022-10-30 11:33:30 -05:00
parent 234156b153
commit 9ca67acc5d
No known key found for this signature in database
GPG key ID: 75F655B91C7AC9BB

View file

@ -80,20 +80,18 @@ namespace Flow.Launcher
return; return;
} }
Point mpos = e.GetPosition(null); Point mousePosition = e.GetPosition(null);
Vector diff = this.start - mpos; Vector diff = this.start - mousePosition;
if (Math.Abs(diff.X) < SystemParameters.MinimumHorizontalDragDistance if (Math.Abs(diff.X) < SystemParameters.MinimumHorizontalDragDistance
|| Math.Abs(diff.Y) < SystemParameters.MinimumVerticalDragDistance) || Math.Abs(diff.Y) < SystemParameters.MinimumVerticalDragDistance
|| !File.Exists(file))
return; return;
DataObject data; var data = new DataObject(DataFormats.FileDrop, new[]
data = File.Exists(file) {
? new DataObject(DataFormats.FileDrop, new[] file
{ });
file
})
: new DataObject(DataFormats.UnicodeText, file);
DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy); DragDrop.DoDragDrop((DependencyObject)sender, data, DragDropEffects.Move | DragDropEffects.Copy);
e.Handled = true; e.Handled = true;
} }