Interface ViewportInterface

A viewport is a sub-area of the entire rendering surface, see https://threejs.org/docs/#api/renderers/WebGLRenderer.setViewport

interface ViewportInterface {
    bottom: number;
    camera: Camera;
    height: number;
    left: number;
    name: string;
    width: number;
    contains(x: number, y: number): boolean;
    setDimensions(left: number, bottom: number, width: number, height: number): void;
}

Hierarchy (view full)

Properties

bottom: number

Bottom edge of viewport [0..1], where 0 is bottom

camera: Camera

Camera used for rendering

height: number

Height of viewport [0..1]

left: number

Left edge of viewport [0…1], where 0 is left

name: string

Name of the viewport

width: number

Width of viewport [0..1]

Methods

  • Check if provided screen coordinate is within the viewport

    Parameters

    • x: number

      Screen-space coordinate relative to top-left corner of viewport [px]

    • y: number

      Screen-space coordinate relative to top-left corner of viewport [px]

    Returns boolean

  • Set viewport offset and size on screen

    Parameters

    • left: number

      Left edge of viewport [0..1], where 0 is left

    • bottom: number

      Bottom edge of viewport [0..1], where 0 is bottom

    • width: number

      Width of viewport [0..1]

    • height: number

      Height of viewport [0..1]

    Returns void