Browse Source

fix drag and drop state

HOME 1 year ago
parent
commit
ed9ead0cd6

+ 4 - 4
FNZCM/FNZCM.BlazorWasm/UI/Views/Default/Playlist/PlaylistTable.razor

@@ -21,9 +21,9 @@
         await JSRuntime.InvokeVoidAsync(Prefix + ".resolveSelectTextClickConflict", ElementId, DotNetRef);
     }
 
-    private async Task DragMouseDown() => await JSRuntime.InvokeVoidAsync(Prefix + ".setDraggableOn", ElementId);
+    private async Task EnableDragDrop() => await JSRuntime.InvokeVoidAsync(Prefix + ".setDraggableOn", ElementId);
 
-    private async Task DragMouseUp() => await JSRuntime.InvokeVoidAsync(Prefix + ".setDraggableOff", ElementId);
+    private async Task DisableDragDrop() => await JSRuntime.InvokeVoidAsync(Prefix + ".setDraggableOff", ElementId);
 
 
     [JSInvokable("FnzDragStartProvideContent")]
@@ -60,7 +60,7 @@
             {
                 var arr = PlaylistHelper[Playlist.Id];
 
-                <tr id="@ElementId" class="table-primary">
+                <tr id="@ElementId" class="table-primary" @ondragend="DisableDragDrop">
                     <td style="width:0" @onclick="()=>{isExpand=!isExpand;}">
                         <button type="button" class="btn btn-primary p-2">
                             @if (isExpand)
@@ -88,7 +88,7 @@
                             var isLast = ListItemIndex == ListItemCount - 1;
 
                             <div class="dropstart">
-                                <button type="button" class="btn btn-primary p-2" data-bs-toggle="dropdown" @onmousedown="DragMouseDown" @onmouseup="DragMouseUp">
+                                <button type="button" class="btn btn-primary p-2" data-bs-toggle="dropdown" @onmousedown="EnableDragDrop" @onmouseup="DisableDragDrop">
                                     <i class="bi bi-arrow-down-up"></i>
                                 </button>
                                 <div class="dropdown-menu text-end p-1 text-nowrap" style="width: initial;min-width: initial;">

+ 4 - 4
FNZCM/FNZCM.BlazorWasm/UI/Views/Default/Playlist/PlaylistTableItem.razor

@@ -17,9 +17,9 @@
         await JSRuntime.InvokeVoidAsync(Prefix + ".initDropZone", ElementId, DotNetRef, FnzConst.DragDropTypePlaylistItem);
     }
 
-    private async Task DragMouseDown() => await JSRuntime.InvokeVoidAsync(Prefix + ".setDraggableOn", ElementId);
+    private async Task EnableDragDrop() => await JSRuntime.InvokeVoidAsync(Prefix + ".setDraggableOn", ElementId);
 
-    private async Task DragMouseUp() => await JSRuntime.InvokeVoidAsync(Prefix + ".setDraggableOff", ElementId);
+    private async Task DisableDragDrop() => await JSRuntime.InvokeVoidAsync(Prefix + ".setDraggableOff", ElementId);
 
     [JSInvokable("FnzDragStartProvideContent")]
     public string FnzDragStartProvideContent(string dataType)
@@ -40,7 +40,7 @@
     }
 }
 
-<tr id="@ElementId" class="mouse-hilight">
+<tr id="@ElementId" class="mouse-hilight" @ondragend="DisableDragDrop">
     <td colspan="2" style="width:0">
         <img src="@Track.Disc.CoverPath" style="height:50px" @onclick="()=>dlgDisc.Show(Track.Disc)" />
         <DiscDialog @ref="dlgDisc"></DiscDialog>
@@ -58,7 +58,7 @@
     </td>
     <td>
         <div class="dropend">
-            <div id="@(ElementId)-handle" data-bs-toggle="dropdown" class="p-2 border border-primary" style="cursor: move" @onmousedown="DragMouseDown" @onmouseup="DragMouseUp">
+            <div id="@(ElementId)-handle" data-bs-toggle="dropdown" class="p-2 border border-primary" style="cursor: move" @onmousedown="EnableDragDrop" @onmouseup="DisableDragDrop">
                 <i class="bi bi-list"></i>
             </div>
             @if (TrackCount > 1)