You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
986 B
52 lines
986 B
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace BlazorApp1.Components
|
|
{
|
|
public partial class InventoryItem
|
|
{
|
|
[Parameter]
|
|
public int Index { get; set; }
|
|
|
|
[Parameter]
|
|
public Item Item { get; set; }
|
|
|
|
[Parameter]
|
|
public bool NoDrop { get; set; }
|
|
|
|
[CascadingParameter]
|
|
public Inventory Parent { get; set; }
|
|
|
|
internal void OnDragEnter()
|
|
{
|
|
if (NoDrop)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
internal void OnDragLeave()
|
|
{
|
|
if (NoDrop)
|
|
{
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
internal void OnDrop()
|
|
{
|
|
if (NoDrop)
|
|
{
|
|
return;
|
|
}
|
|
|
|
this.Item = Parent.CurrentDragItem;
|
|
}
|
|
|
|
private void OnDragStart()
|
|
{
|
|
Parent.CurrentDragItem = this.Item;
|
|
}
|
|
}
|
|
}
|