|
|
@ -1,6 +1,5 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
namespace myBlazorApp.Components;
|
|
|
|
namespace myBlazorApp.Components;
|
|
|
|
|
|
|
|
|
|
|
|
using Blazorise;
|
|
|
|
using Blazorise;
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
using myBlazorApp.Models;
|
|
|
|
using myBlazorApp.Models;
|
|
|
@ -9,27 +8,41 @@ public partial class InventoryItem
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[Parameter]
|
|
|
|
[Parameter]
|
|
|
|
public Item Item { get; set; }
|
|
|
|
public Item Item { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
[Parameter]
|
|
|
|
public int Index { get; set; }
|
|
|
|
public int Index { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
|
|
|
public bool NoDrop { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[CascadingParameter]
|
|
|
|
[CascadingParameter]
|
|
|
|
public MyInventory Parent { get; set; }
|
|
|
|
public MyInventory Parent { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
internal void OnDragEnter()
|
|
|
|
internal void OnDragEnter()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (NoDrop)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Enter", Item = this.Item, Index = this.Index });
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Enter", Item = this.Item, Index = this.Index });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal void OnDragLeave()
|
|
|
|
internal void OnDragLeave()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (NoDrop)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Leave", Item = this.Item, Index = this.Index });
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Leave", Item = this.Item, Index = this.Index });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal void OnDrop()
|
|
|
|
internal void OnDrop()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (NoDrop)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
this.Item = Parent.CurrentDragItem;
|
|
|
|
this.Item = Parent.CurrentDragItem;
|
|
|
|
|
|
|
|
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drop", Item = this.Item, Index = this.Index });
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drop", Item = this.Item, Index = this.Index });
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -37,7 +50,6 @@ public partial class InventoryItem
|
|
|
|
private void OnDragStart()
|
|
|
|
private void OnDragStart()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Parent.CurrentDragItem = this.Item;
|
|
|
|
Parent.CurrentDragItem = this.Item;
|
|
|
|
|
|
|
|
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Start", Item = this.Item, Index = this.Index });
|
|
|
|
Parent.Actions.Add(new InventoryAction { Action = "Drag Start", Item = this.Item, Index = this.Index });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|