Internal/EventDispatch.cs
using System;
using Sandbox.UI;

namespace Goo.Internal;

/// <summary>Invokes a user mouse handler and, if it ran, requests a rebuild.
/// Centralizes the "auto-rebuild after a handler fires" rule for every event-host panel.</summary>
internal static class EventDispatch
{
    public static void Fire(Action<MousePanelEvent>? handler, MousePanelEvent e, Action? requestRebuild)
    {
        if (handler == null) return;
        handler.Invoke(e);
        requestRebuild?.Invoke();
    }
}