@kayelaa/canvas API - v0.2.15
    Preparing search index...

    Variable useGlobalPointerConst

    useGlobalPointer: (
        onPointer: (
            pos: Vector2,
            type: KaylaClickType,
            action: KaylaPointerAction,
        ) => void,
        config?: KaylaClickConfig,
    ) => void = ...

    Registers a callback that runs on every pointer events anywhere in any attached renderer.

    This hook MUST be called at the top level of a component function — never inside loops, conditions, nested functions, or callbacks. The call order of all hooks is strictly fixed across every refresh; reordering calls will corrupt internal state.

    Useful for global input (pause menu toggle, debug shortcuts, drag anywhere…). Multiple useGlobalPointer calls stack and run in declaration order.

    Important – coordinate system depends on context:

    • If this component is inside a <Layer transform={…}>, you receive layer-local coordinates
    • Otherwise you receive world coordinates (same as entity positions)

    Multiple handlers stack — they are called in declaration order.

    Type Declaration

    // Global pause on right-click (anywhere)
    useGlobalPointer((pos, type) => {
    if (type === "right") isPaused.value = !isPaused.value;
    }, { type: "right", action: "down" });
    // Inside a zoomable map layer — pos is already in map-local space
    useGlobalPointer((localPos) => {
    console.log("Clicked map at:", localPos);
    });