import React from "react";
import { MultiViewPickingInfoAssembler } from "./MultiViewPickingInfoAssembler";
// Make a documentation comment for the function
/**
 * Hook for multi-view picking.
 *
 * @param props - The hook properties.
 * @returns The hook return value.
 */
export function useMultiViewPicking(props) {
    const assembler = React.useRef(null);
    const [info, setInfo] = React.useState({
        pickingInfoPerView: {},
        activeViewportId: "",
    });
    React.useEffect(function onPropsChangeEffect() {
        assembler.current = new MultiViewPickingInfoAssembler(props.deckGlRef.current, { multiPicking: props.multiPicking, pickDepth: props.pickDepth });
        const unsubscribe = assembler.current.subscribe(function onPickingInfo(info, activeViewportId) {
            setInfo({
                pickingInfoPerView: info,
                activeViewportId,
            });
        });
        return function onPropsChangeUnmountEffect() {
            assembler.current = null;
            unsubscribe();
        };
    }, [props.deckGlRef, props.multiPicking, props.pickDepth]);
    const getPickingInfo = React.useCallback(function getPickingInfo(event) {
        if (assembler.current) {
            assembler.current.getMultiViewPickingInfo(event);
        }
    }, []);
    return Object.assign({ getPickingInfo }, info);
}
//# sourceMappingURL=useMultiViewPicking.js.map