CanvasBreakpointsConstraint - Verge3D User Manual - Soft8Soft
Description: Learn how to use CanvasBreakpointsConstraint in your interactive 3D apps made with Verge3D

Constraint →

# CanvasBreakpointsConstraint

A constraint which shows/hides the object depending on 3D viewport width/height or orientation settings (implements the so called visibility breakpoints).

To influence some object, push a CanvasBreakpointsConstraint instance into the Object3D.constraints array.

## Constructor

### CanvasBreakpointsConstraint()

The constructor takes no arguments.

## Properties

See the base Constraint class for common properties.

### # .appInstance : App

The current application. Default is `undefined`.

### # .isCanvasBreakpointsConstraint : Boolean

Used to check whether this or derived classes are canvas breakpoints constraints. Default is `true`.

### # .maxHeight : Integer

Maximum canvas height the object stays visible. Default is `Infinity`.

### # .maxWidth : Integer

Maximum canvas width the object stays visible. Default is `Infinity`.

### # .minHeight : Integer

Minimum canvas height the object stays visible. Default is `0`.

### # .minWidth : Integer

Minimum canvas width the object stays visible. Default is `0`.

### # .orientation : String

Screen orientation the object stays visible.

- `"ALL"` — object stays visible for any screen orientation
- `"LANDSCAPE"` — object stays visible only for landscape (horizontal) screen orientation
- `"PORTRAIT"` — object stays visible only for portrait (vertical) screen orientation

Default is `"ALL"`.

### # .type : String

The constraint's type. Equals to `"CanvasBreakpointsConstraint"`.

## Methods

See the base Constraint class for common methods.

### # .findAlternativeCamera(camera : Camera, scene : Scene, width : Integer, height : Integer) → Camera

- camera — the current camera in scene.
- scene — the scene in which we are looking for the camera.
- width — the canvas width.
- height — the canvas height.

Find and return an alternative camera (with acceptable visibility breakpoints) located on the specified scene. If no alternative camera is found, returns `null`.

## Source

For more info on how to obtain the source code of this module see this page.