using HarmonyLib;
namespace IdleSpectator;
///
/// WorldBox zooms on mouse wheel even over UI while a unit is focused
/// (!isOverUI || MoveCamera.inSpectatorMode()). Absorb wheel zoom when
/// the cursor is over Lore or the dossier so ScrollRect history can scroll.
///
[HarmonyPatch]
internal static class CameraZoomPatches
{
/// Harness: force the zoom block without needing a real mouse position.
public static bool ForceAbsorbForHarness;
private static bool Absorb()
{
return ForceAbsorbForHarness || ChronicleHud.ShouldAbsorbScrollZoom();
}
[HarmonyPatch(typeof(MoveCamera), nameof(MoveCamera.zoomInWheel))]
[HarmonyPrefix]
private static bool PrefixZoomInWheel()
{
return !Absorb();
}
[HarmonyPatch(typeof(MoveCamera), nameof(MoveCamera.zoomOutWheel))]
[HarmonyPrefix]
private static bool PrefixZoomOutWheel()
{
return !Absorb();
}
}