# -*- coding: utf-8 -*-
# gui/components/model_view/_scenario_facility_browse.py
"""Сценарий обзора уровня facility.

Hover по зонам: подсветка зоны под курсором (vtkPropPicker).
Клики обрабатываются через plotter callback (_on_plotter_click), не здесь.
"""

from __future__ import annotations

from typing import TYPE_CHECKING

from gui.components.model_view._interaction_scenario import (
    CameraPolicy,
    InteractionScenario,
)
from error_logger import log_exception

if TYPE_CHECKING:  # pragma: no cover
    from gui.components.model_view_widget import ModelViewWidget


class FacilityBrowseScenario(InteractionScenario):
    """Обзор уровня facility: hover-подсветка зон."""
 
    name = "facility_browse"
    camera_policy = CameraPolicy.FREE

    def on_activate(self, mv: "ModelViewWidget") -> None:
        mv._zone_pick_enabled = True

    def on_hover(self, mv: "ModelViewWidget", event) -> None:
        if not mv._zone_pick_enabled:
            return
        try:
            sx, sy = mv._event_to_vtk_display_xy(event)
            mv._handle_zone_hover_event(sx, sy)
        except Exception as _exc:
            log_exception(__name__, "on_hover", _exc)
