UNPKG

@pmndrs/uikit

Version:

Build performant 3D user interfaces with Three.js and yoga.

24 lines (23 loc) 1.44 kB
import { Signal } from '@preact/signals-core'; import { Vector2Tuple } from 'three'; import { ThreeMouseEvent, ThreePointerEvent } from './events.js'; export type Listeners = ScrollListeners & LayoutListeners & ClippedListeners; export type ScrollListeners = { /** * scroll listener called right before the new scroll position is set when a scroll event is caused * @param scrollX the new scroll x position * @param scrollY the new scroll y position * @param scrollPosition the current/old scroll position * @param event the event that caused the scrolling * @returns false to prevent the new scroll x and scroll y position from beeing applied */ onScroll?: (scrollX: number, scrollY: number, scrollPosition: Signal<Vector2Tuple | undefined>, event?: ThreePointerEvent | ThreeMouseEvent) => boolean | void; }; export type LayoutListeners = { onSizeChange?: (width: number, height: number) => void; }; export type ClippedListeners = { onIsClippedChange?: (isClipped: boolean) => void; }; export declare function setupLayoutListeners(l1: Signal<LayoutListeners | undefined>, l2: Signal<LayoutListeners | undefined>, size: Signal<Vector2Tuple | undefined>, abortSignal: AbortSignal): void; export declare function setupClippedListeners(l1: Signal<ClippedListeners | undefined>, l2: Signal<ClippedListeners | undefined>, isClippedSignal: Signal<boolean>, abortSignal: AbortSignal): void;