mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-24 09:14:12 -05:00
main dragout: track drag operation, keep cursor
drag enter was triggering once the mouse moved, resetting to hand -- not anymore.
This commit is contained in:
@@ -1209,6 +1209,8 @@ private void Main_DragDrop(object? sender, DragEventArgs? e)
|
||||
e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
|
||||
private bool mainDragOutActive;
|
||||
|
||||
// ReSharper disable once AsyncVoidMethod
|
||||
private async void Dragout_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
@@ -1238,6 +1240,7 @@ private async void Dragout_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
await File.WriteAllBytesAsync(newfile, data).ConfigureAwait(true);
|
||||
|
||||
mainDragOutActive = true;
|
||||
var pb = (PictureBox)sender;
|
||||
if (pb.Image is Bitmap img)
|
||||
C_SAV.M.Drag.SetOwnedCursor(pb, img);
|
||||
@@ -1249,6 +1252,7 @@ private async void Dragout_MouseDown(object sender, MouseEventArgs e)
|
||||
{ WinFormsUtil.Error("Drag && Drop Error", x); }
|
||||
finally
|
||||
{
|
||||
mainDragOutActive = false;
|
||||
C_SAV.M.Drag.ResetCursor(this);
|
||||
await DeleteAsync(newfile, 20_000).ConfigureAwait(false);
|
||||
}
|
||||
@@ -1275,13 +1279,14 @@ private static async Task DeleteAsync(string path, int delay)
|
||||
private void DragoutEnter(object sender, EventArgs e)
|
||||
{
|
||||
dragout.BackgroundImage = PKME_Tabs.Entity.Species > 0 ? SpriteUtil.Spriter.Set : SpriteUtil.Spriter.Delete;
|
||||
Cursor = Cursors.Hand;
|
||||
if (!mainDragOutActive)
|
||||
Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
private void DragoutLeave(object sender, EventArgs e)
|
||||
{
|
||||
dragout.BackgroundImage = SpriteUtil.Spriter.Transparent;
|
||||
if (Cursor == Cursors.Hand)
|
||||
if (!mainDragOutActive && Cursor == Cursors.Hand)
|
||||
Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user