PixiThree - v0.0.16
    Preparing search index...

    Function usePixiViewContext

    • Hook to access Pixi coordinate bijection functions. Works in both PixiTexture (inside ThreeScene) and CanvasView contexts.

      When inside a PixiTexture, returns bijections for the texture dimensions. When inside a CanvasView (but not PixiTexture), returns bijections for the canvas viewport.

      Returns PixiViewContextValue

      Bijection functions for coordinate mapping

      Context value for Pixi view coordinate mapping. Works in PixiTexture (inside ThreeScene) and CanvasView.

      • height: number

        Height of the Pixi container

      • mapClientToPixi: (
            client: Point | { clientX: number; clientY: number },
            out?: Point,
        ) => Point | null

        Maps DOM client coordinates to local Pixi coordinates.

      • mapPixiToClient: (localPoint: Point, out?: Point) => Point[]

        Maps local Pixi coordinates to DOM client coordinates. When inside PixiTexture, returns array of Points (UV can map to multiple positions). When inside CanvasView directly, returns single-element array (direct mapping).

      • mapPixiToUv: (point: Point, out?: Vector2) => Vector2

        Maps Pixi coordinates to Three.js UV coordinates (0-1).

      • mapPixiToViewport: (localPoint: Point, out?: Point) => Point[]

        Maps local Pixi coordinates to CanvasView viewport coordinates. When inside PixiTexture, returns array of Points (UV can map to multiple positions). When inside CanvasView directly, returns single-element array (direct mapping).

      • mapUvToPixi: (uv: Vector2, out?: Point) => Point

        Maps Three.js UV coordinates (0-1) to Pixi coordinates.

      • mapViewportToPixi: (viewport: Point, out?: Point) => Point | null

        Maps viewport coordinates to local Pixi coordinates.

      • OptionalparentThree?: PixiViewParentThreeContextValue

        Parent Three coordinate mapping functions. Only available inside a PixiTexture context.

      • width: number

        Width of the Pixi container

      Error if called outside of a CanvasView