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