More tests and WIP vibe work
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Model;
|
||||
|
||||
namespace Shared.Services;
|
||||
|
||||
public class CardPreviewService
|
||||
{
|
||||
public CardData? HoveredCard { get; private set; }
|
||||
public double X { get; private set; }
|
||||
public double Y { get; private set; }
|
||||
public bool IsVisible { get; private set; }
|
||||
|
||||
public event Action? OnChange;
|
||||
|
||||
public void Show(CardData card, double x, double y)
|
||||
{
|
||||
HoveredCard = card;
|
||||
X = x;
|
||||
Y = y;
|
||||
IsVisible = true;
|
||||
NotifyStateChanged();
|
||||
}
|
||||
|
||||
public void Hide()
|
||||
{
|
||||
IsVisible = false;
|
||||
NotifyStateChanged();
|
||||
}
|
||||
|
||||
private void NotifyStateChanged() => OnChange?.Invoke();
|
||||
}
|
||||
Reference in New Issue
Block a user