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

    Variable useClickConst

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

    Alternative: usePointer

    Type Declaration

    Registers a callback that runs whenever the entity is clicked (inside its bounds).

    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.

    Uses the rectangle bounds from useRect / underlying entity. Multiple useClick calls stack and run in declaration order.

    useClick((pos, type) => {
    if (type === "left") {
    score.add(1);
    playSound("collect");
    // optional: spawn particle children on click
    }
    });

    useGlobalClick — for clicks anywhere (not bound to this entity)