Zoom By Rectangle Process

The process allows you to fit (zoom) the camera in a rectangular area which is specified by drawing the rectangle with the drag and drop mechanism.

Below we will consider the process.

Features

ZoomRectProcess type (TypeScript):

export type ZoomRectProcess = {
    name: "ZoomRect"
    options?: ZoomRectOptions
    events?: {
        onZoom?: (position: C3DViewPoint, target: C3DViewPoint) => void
    }
}

Important

When there’s no geometry found under the center point of specified rectangle and the perspective projection is turned on, the process does not perform fitting the camera in.

Options

Zoom Rect Options type (Typescript):

export type ZoomRectOptions = {
    duration?: number
}

Name

Description

duration

Duration of camera zooming animation. The default is -1 that means no animation

Callbacks

Available events:

  • onZoom(position, target): emitted after the process zooms the camera.

Running

Example of running the process (TypeScript):

view.runCommand({
    name: "RunProcessCommand", // name of command
    // next arguments
    process: {
        name: "ZoomRect", // process name
    }
})