mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-06 05:27:14 -05:00
Fix drag&drop exception
immediately after dropping the file, move the mouse outside of the box slots DoDragDrop re-performs the drop event at the same coordinate as the mouse; if the mouse isn't outside of the box area it'll do nothing, thus the need to create a new event to fire. Closes #1178
This commit is contained in:
parent
92ca1e2263
commit
11aab91eee
|
|
@ -96,6 +96,7 @@ public void EnableDragDrop(DragEventHandler enter, DragEventHandler drop)
|
|||
tab.DragEnter += enter;
|
||||
tab.DragDrop += drop;
|
||||
}
|
||||
M.RequestExternalDragDrop += drop;
|
||||
}
|
||||
|
||||
// Generic Subfunctions //
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public class SlotChangeManager
|
|||
public int colorizedbox = -1;
|
||||
public int colorizedslot = -1;
|
||||
public Image colorizedcolor;
|
||||
public event DragEventHandler RequestExternalDragDrop;
|
||||
|
||||
public SlotChangeManager(SAVEditor se)
|
||||
{
|
||||
|
|
@ -201,7 +202,7 @@ public void HandleDropPKM(object sender, DragEventArgs e, bool overwrite, bool c
|
|||
}
|
||||
if (DragInfo.Source.Offset < 0) // external source
|
||||
{
|
||||
TryLoadFiles(files);
|
||||
TryLoadFiles(files, e);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +211,7 @@ public void HandleDropPKM(object sender, DragEventArgs e, bool overwrite, bool c
|
|||
if (DragInfo.Source.Parent == null) // internal file
|
||||
DragInfo.Reset();
|
||||
}
|
||||
private void TryLoadFiles(string[] files)
|
||||
private void TryLoadFiles(string[] files, DragEventArgs e)
|
||||
{
|
||||
if (files.Length <= 0)
|
||||
return;
|
||||
|
|
@ -218,7 +219,7 @@ private void TryLoadFiles(string[] files)
|
|||
FileInfo fi = new FileInfo(file);
|
||||
if (!PKX.getIsPKM(fi.Length) && !MysteryGift.getIsMysteryGift(fi.Length))
|
||||
{
|
||||
SE.ParentForm?.DoDragDrop(new DataObject(DataFormats.FileDrop, new[] { file }), DragDropEffects.Move);
|
||||
RequestExternalDragDrop?.Invoke(this, e); // pass thru
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user