@cartridge-engine/keyboard-engine
    Preparing search index...

    Type Alias MouseRegionEntry

    A mouse region registration.

    layerId must match the ids used in the engine's synced SyncState layers so hit-testing can apply the same modal > layer > root priority as keyboard events: while any modal is open, only the topmost modal layer is hit-tested, and a miss on it is dead (no fall-through to lower modals, regular layers, or root regions). regionId is an arbitrary unique identifier for the region within that layer — it is NOT the id of a keyboard layer element; two regions in the same layer must use different ids or the later registration overwrites the earlier one.

    const unbind = engine.registerMouseRegion({
    layerId: 'board-screen',
    regionId: 'board',
    rect: { x: 1, y: 1, width: 40, height: 20 },
    callbacks: {
    onClick: (event) => selectCell(event.x, event.y),
    onWheel: (event) => {
    if (event.button === 'wheel-up') scrollUp();
    if (event.button === 'wheel-down') scrollDown();
    },
    },
    priority: 1, // child controls beat their container on overlap
    });
    type MouseRegionEntry = {
        callbacks: MouseRegionCallbacks;
        layerId: string;
        priority?: number;
        rect: MouseRegionRect;
        regionId: string;
    }
    Index

    Callbacks fired on hits.

    layerId: string

    The layer this region belongs to (must match synced layer ids).

    priority?: number

    Hit-test priority within the same layer. Higher values win when regions overlap (default 0).

    This exists because React mounts children before parents, so a child control (e.g. a button inside a panel) would otherwise register before its parent and lose overlap resolution. Give controls a higher priority than their container.

    The region geometry in 1-based terminal coordinates.

    regionId: string

    Unique identifier for this region within the layer. Callers are responsible for uniqueness — duplicate ids in the same layer overwrite each other's registration.