ScreenViewport Class
An interactive Viewport that exists within an HTMLDivElement. ScreenViewports can receive HTML events. To render the contents of a ScreenViewport, it must be added to the ViewManager via ViewManager.addViewport(). Every frame, the ViewManager will update the Viewport's state and re-render its contents if anything has changed. To halt this loop, use ViewManager.dropViewport() to remove the viewport from the ViewManager.
A ScreenViewport internally owns significant WebGL resources which must be explicitly disposed of when the viewport is no longer needed. This is achieved by invoking the viewport's dispose() method. ViewManager.dropViewport() invokes dispose() on the viewport by default.
The lifetime of a ScreenViewport typically follows a pattern:
1. Application creates the viewport via ScreenViewport.create()
2. The viewport is added to the render loop via ViewManager.addViewport()
3. When the application is finished with the viewport, it removes it from the render loop and disposes of it via ViewManager.dropViewport().
In some cases it may be useful to temporarily suspend a viewport's render loop. In this case the lifetime of the viewport proceeds as follows:
1. Application creates the viewport via ScreenViewport.create()
2. The viewport is added to the render loop via ViewManager.addViewport()
3. At some point the render loop is suspended via ViewManager.dropViewport(viewport, false), indicating the viewport should not be disposed.
4. Optionally, resume rendering by returning to step 2.
5. When the application is finished with the viewport:
5a. If it is currently registered with the ViewManager, it is dropped and disposed of via ViewManager.dropViewport()
5b. Otherwise, it is disposed of by invoking its dispose() method directly.
@see ScreenViewport.create to create a ScreenViewport.
Extends
Methods
Name | Description | |
---|---|---|
constructor(canvas: HTMLCanvasElement, parentDiv: HTMLDivElement, target: RenderTarget): ScreenViewport Protected | ||
addDecorations(decorations: Decorations): void Protected | Populate a set of decoration graphics to be displayed in this viewport. | |
addNewDiv(className: string, overflowHidden: boolean, z: number): HTMLDivElement | Add a new HTMLDivElement as a child of this viewport's div. |
|
animateFlyoverToGlobalLocation(destination: GlobalLocation): Promise<void> | Animate the view frustum to a destination location the earth from the current frustum. | |
animateFrustumChange(options?: ViewAnimationOptions): void | Queue an animation that interpolates between this viewport's previous Frustum and its current frustum. | |
changeView(view: ViewState, opts?: ViewChangeOptions): void | Change the ViewState of this Viewport | |
clearViewUndo(): void | Clear the undo buffers of this Viewport. | |
doRedo(animationTime?: BeDuration): void | Re-applies the most recently un-done change to the Viewport from the redo stack. | |
doUndo(animationTime?: BeDuration): void | Reverses the most recent change to the Viewport from the undo stack. | |
getClientRect(): DOMRect | Get the DOMRect of the canvas for this Viewport. | |
invalidateCachedDecorations(decorator: ViewportDecorator): void | Forces removal of a specific decorator's cached decorations from this viewport, if they exist. | |
openToolTip(message: string | HTMLElement, location?: Readonly<WritableXAndY>, options?: ToolTipOptions): void | Open the toolTip window in this ScreenViewport with the supplied message and location. | |
pickDepthPoint(pickPoint: Point3d, radius?: number, options?: DepthPointOptions): { plane: Plane3dByOriginAndUnitNormal, source: DepthPointSource, sourceId?: string } | Find a point on geometry visible in this Viewport, within a radius of supplied pick point. | |
pickNearestVisibleGeometry(pickPoint: Point3d, radius?: number, allowNonLocatable: booleantrue, out?: Point3d): undefined | Point3d | Find a point on geometry visible in this Viewport, within a radius of supplied pick point. | |
resetUndo(): void | Clear the view undo buffer and establish the current ViewState as the new baseline. | |
saveViewUndo(): void | Saves the current state of this viewport's ViewState in the undo stack, such that it can be restored by a call to ScreenViewport.doUndo. | |
setCursor(cursor: string"default"): void | Change the cursor for this Viewport | |
setEventController(controller?: EventController): void | Set the event controller for this Viewport. | Deprecated |
synchWithView(options?: ViewChangeOptions): void | See synchWithView. | |
waitForSceneCompletion(): Promise<void> | Overrides waitForSceneCompletion to allow the render loop to load graphics until the scene is complete. | |
create(parentDiv: HTMLDivElement, view: ViewState): ScreenViewport Static | Create a new ScreenViewport that shows a View of an iModel into an HTMLDivElement. |
Inherited methods
Name | Inherited from | Description |
---|---|---|
addFeatureOverrideProvider(provider: FeatureOverrideProvider): boolean Inherited | Viewport | Add a FeatureOverrideProvider to customize the appearance of Features within the viewport. |
addOnAnalysisStyleChangedListener(listener: (newStyle: AnalysisStyle) => void): () => void Inherited | Viewport | Add an event listener to be invoked whenever the AnalysisStyle associated with this viewport changes. |
addScreenSpaceEffect(effectName: string): void Inherited | Viewport | Append a screen-space effect to the list of effects applied to this Viewport. |
addTiledGraphicsProvider(provider: TiledGraphicsProvider): void Inherited | Viewport | Register a provider of tile graphics to be drawn in this viewport. |
addViewedModels(models: Id64Arg): Promise<void> Inherited | Viewport | Adds a set of models to the set of those currently displayed in this viewport. |
applyViewState(val: ViewState): void Inherited | Viewport | Replace this viewport's ViewState without triggering events like onChangeView. |
changeBackgroundMapProps(props: BackgroundMapProps): void Inherited | Viewport | See changeBackgroundMapProps |
changeBackgroundMapProvider(props: BackgroundMapProviderProps): void Inherited | Viewport | See changeBackgroundMapProvider |
changeCategoryDisplay(categories: Id64Arg, display: boolean, enableAllSubCategories: booleanfalse): void Inherited | Viewport | Enable or disable display of elements belonging to a set of categories specified by Id. |
changeModelDisplay(models: Id64Arg, display: boolean): boolean Inherited | Viewport | Add or remove a set of models from those models currently displayed in this viewport. |
changeSubCategoryDisplay(subCategoryId: string, display: boolean): void Inherited | Viewport | Change the visibility of geometry belonging to the specified subcategory when displayed in this viewport. |
changeViewedModel2d(baseModelId: string, options?: ChangeViewedModel2dOptions & ViewChangeOptions & MarginOptions): Promise<void> Inherited | Viewport | Attempt to change the 2d Model this Viewport is displaying, if its ViewState is a ViewState2d. |
changeViewedModels(modelIds: Id64Arg): boolean Inherited | Viewport | Attempt to replace the set of models currently viewed by this viewport, if it is displaying a SpatialView |
clearAlwaysDrawn(): void Inherited | Viewport | Clear the set of always-drawn elements. |
clearNeverDrawn(): void Inherited | Viewport | Clear the set of never-drawn elements. |
collectStatistics(stats: RenderMemory.Statistics): void Inherited | Viewport | Record graphics memory consumed by this viewport. |
computeViewRange(): Range3d Inherited | Viewport | Compute the range of all geometry to be displayed in this viewport. |
createScene(context: SceneContext): void Inherited | Viewport | Populate the context with the scene to be rendered by this viewport. |
createSceneContext(): SceneContext Inherited | Viewport | Create a context appropriate for producing the scene to be rendered by this viewport, e.g., by createScene. |
cssPixelsToDevicePixels(cssPixels: number): number Inherited | Viewport | Convert a number in CSS pixels to device pixels using this Viewport's device pixel ratio. |
determineVisibleDepthRange(rect?: ViewRect, result?: DepthRangeNpc): undefined | DepthRangeNpc Inherited | Viewport | Computes the range of npc depth values for a region of the screen |
dropFeatureOverrideProvider(provider: FeatureOverrideProvider): boolean Inherited | Viewport | Removes the specified FeatureOverrideProvider from the viewport. |
dropModelAppearanceOverride(id: string): void Inherited | Viewport | Remove any model appearance override for the specified model. |
dropSubCategoryOverride(id: string): void Inherited | Viewport | Remove any SubCategoryOverride for the specified subcategory. |
dropTiledGraphicsProvider(provider: TiledGraphicsProvider): void Inherited | Viewport | Remove a previously-registered provider of tile graphics. |
findFeatureOverrideProvider(predicate: (provider: FeatureOverrideProvider) => boolean): undefined | FeatureOverrideProvider Inherited | Viewport | Locate the first registered FeatureOverrideProvider matching the supplied criterion. |
findFeatureOverrideProviderOfType<T>(type: Constructor<T>): undefined | T Inherited | Viewport | Locate the first registered FeatureOverrideProvider of the specified class. |
forEachMapTreeRef(func: (ref: TileTreeReference) => void): void Inherited | Viewport | Apply a function to every tile tree reference associated with the map layers displayed by this viewport. |
forEachTileTreeRef(func: (ref: TileTreeReference) => void): void Inherited | Viewport | Apply a function to every TileTreeReference displayed by this viewport. |
getAuxCoordOrigin(result?: Point3d): Point3d Inherited | Viewport | |
getAuxCoordRotation(result?: Matrix3d): Matrix3d Inherited | Viewport | |
getContrastToBackgroundColor(): ColorDef Inherited | Viewport | Get a color that will contrast to the current background color of this Viewport. |
getFrustum(sys: CoordSystemCoordSystem.World, adjustedBox: booleantrue, box?: Frustum): Frustum Inherited | Viewport | Get an 8-point Frustum corresponding to the 8 corners of the Viewport in the specified coordinate system. |
getMapFeatureInfo(hit: HitDetail, options?: MapFeatureInfoOptions): Promise<MapFeatureInfo> Inherited | Viewport | Obtain feature information from a map layer model, if any, identified by the specified HitDetail. |
getMapLayerImageryProvider(mapLayerIndex: MapLayerIndex): undefined | MapLayerImageryProvider Inherited | Viewport | Return the imagery provider for the provided map-layer index. |
getMapLayerRange(mapLayerIndex: MapLayerIndex): Promise<undefined | MapCartoRectangle> Inherited | Viewport | Returns the cartographic range of a map layer. |
getMapLayerScaleRangeVisibility(mapLayerIndex: MapLayerIndex): MapTileTreeScaleRangeVisibility Inherited | Viewport | Return the map-layer scale range visibility for the provided map-layer index. |
getPixelDataNpcPoint(pixels: Pixel.Buffer, x: number, y: number, out?: Point3d): undefined | Point3d Inherited | Viewport | Get the point at the specified x and y location in the pixel buffer in npc coordinates. |
getPixelDataWorldPoint(args: GetPixelDataWorldPointArgs): undefined | Point3d Inherited | Viewport | Get the point at the specified x and y location in the pixel buffer in world coordinates. |
getPixelSizeAtPoint(point?: Point3d): number Inherited | Viewport | Get the width of a pixel (a unit vector in the x direction in view coordinates) at a given point in world coordinates, returning the result in meters (world units). |
getSubCategoryAppearance(id: string): SubCategoryAppearance Inherited | Viewport | Query the symbology with which geometry belonging to a specific subcategory is rendered within this viewport. |
getSubCategoryOverride(id: string): undefined | SubCategoryOverride Inherited | Viewport | Query the symbology overrides applied to geometry belonging to a specific subcategory when rendered within this viewport. |
getToolTip(hit: HitDetail): Promise<string | HTMLElement> Inherited | Viewport | Obtain a tooltip from the map layer or reality model, if any, identified by the specified HitDetail. |
getWorldFrustum(box?: Frustum): Frustum Inherited | Viewport | Get a copy of the current (unadjusted) frustum of this viewport, in world coordinates. |
hasTiledGraphicsProvider(provider: TiledGraphicsProvider): boolean Inherited | Viewport | Returns true if the specified provider has been registered with this viewport via addTiledGraphicsProvider. |
initialize(): void Protected Inherited | Viewport | A function invoked once, after the constructor, to initialize the viewport's state. |
invalidateController(): void Inherited | Viewport | Mark the viewport's ViewState as having changed, so that the next call to renderFrame will invoke setupFromView to synchronize with the view. |
invalidateDecorations(): void Inherited | Viewport | Mark the current set of decorations invalid, so that they will be recreated on the next render frame. |
invalidateRenderPlan(): void Inherited | Viewport | Mark the viewport's "render plan" as having changed, so that the next call to renderFrame will recreate it. |
invalidateSymbologyOverrides(): void Inherited | Viewport | Notifies this viewport that a change in application state requires its Overrides to be recomputed. |
isPointVisibleXY(point: Point3d, coordSys: CoordSystemCoordSystem.World, borderPaddingFactor: number0.0): boolean Inherited | Viewport | Determine whether the supplied point is visible in the viewport rectangle. |
isSubCategoryVisible(id: string): boolean Inherited | Viewport | Determine whether geometry belonging to a specific SubCategory is visible in this viewport, assuming the containing Category is displayed. |
npcToView(pt: Point3d, out?: Point3d): Point3d Inherited | Viewport | Convert a point from CoordSystem.Npc to CoordSystem.View |
npcToViewArray(pts: Point3d[]): void Inherited | Viewport | Convert an array of points from CoordSystem.Npc to CoordSystem.View |
npcToWorld(pt: Readonly<WritableXYAndZ>, out?: Point3d): Point3d Inherited | Viewport | Convert a point from CoordSystem.Npc to CoordSystem.World |
npcToWorldArray(pts: Point3d[]): void Inherited | Viewport | Convert an array of points from CoordSystem.Npc to CoordSystem.World |
overrideDisplayStyle(overrides: DisplayStyleSettingsProps): void Inherited | Viewport | Selectively override aspects of this viewport's display style. |
overrideModelAppearance(id: string, ovr: FeatureAppearance): void Inherited | Viewport | Override the appearance of a model when rendered within this viewport. |
overrideSubCategory(id: string, ovr: SubCategoryOverride): void Inherited | Viewport | Override the symbology of geometry belonging to a specific subcategory when rendered within this viewport. |
pixelsFromInches(inches: number): number Inherited | Viewport | Converts inches to pixels based on screen DPI. |
queryVisibleFeatures(options: QueryVisibleFeaturesOptions, callback: QueryVisibleFeaturesCallback): void Inherited | Viewport | Query which Features are currently visible within the viewport. |
readImage(rect: ViewRect..., targetSize: Point2d..., flipVertically: booleanfalse): undefined | ImageBuffer Inherited | Viewport | Read the current image from this viewport from the rendering system. |
readImageBuffer(args?: ReadImageBufferArgs): undefined | ImageBuffer Inherited | Viewport | Capture the image currently rendered in this viewport, or a subset thereof. |
readImageToCanvas(): HTMLCanvasElement Inherited | Viewport | Reads the current image from this viewport into an HTMLCanvasElement with a Canvas2dRenderingContext such that additional 2d graphics can be drawn onto it. |
readPixels(rect: ViewRect, selector: Pixel.Selector, receiver: Pixel.Receiver, excludeNonLocatable?: boolean): void Inherited | Viewport | Capture selected data about each pixel within a rectangular region of this Viewport. |
readPixels(args: ReadPixelsArgs): void Inherited | Viewport | Capture selected data about each pixel within a rectangular region of this viewport. |
removeScreenSpaceEffects(): void Inherited | Viewport | Remove all screen-space effects from this Viewport. |
renderFrame(): void Inherited | Viewport | Renders the contents of this viewport. |
replaceViewedModels(modelIds: Id64Arg): Promise<void> Inherited | Viewport | Attempt to replace the set of models currently viewed by this viewport, if it is displaying a SpatialView |
requestRedraw(): void Inherited | Viewport | Request that the Viewport redraw its contents on the next frame. |
resetMapLayer(mapLayerIndex: MapLayerIndex): void Inherited | Viewport | Fully reset a map-layer tile tree; by calling this, the map-layer will to go through initialize process again, and all previously fetched tile will be lost. |
scroll(screenDist: Readonly<WritableXAndY>, options?: ViewChangeOptions): void Inherited | Viewport | Scroll the view by a given number of pixels. |
setAlwaysDrawn(ids: Id64Set, exclusive: booleanfalse): void Inherited | Viewport | Specify the Ids of a set of elements which should always be rendered within this view, regardless of category and subcategory visibility. |
setAnimator(animator?: Animator): void Inherited | Viewport | Set or clear the animator for this Viewport. |
setFeatureOverrideProviderChanged(): void Inherited | Viewport | Notifies this viewport that the internal state of its FeatureOverrideProvider has changed such that its |
setLightSettings(settings: LightSettings): void Inherited | Viewport | |
setNeverDrawn(ids: Id64Set): void Inherited | Viewport | Specify the Ids of a set of elements which should never be rendered within this view. |
setSolarShadowSettings(settings: SolarShadowSettings): void Inherited | Viewport | |
setStandardRotation(id: StandardViewId): void Inherited | Viewport | Orient this viewport to one of the StandardView rotations. |
setupFromView(pose?: ViewPose): ViewStatus Inherited | Viewport | Establish the parameters of this Viewport from the current information in its ViewState |
setupViewFromFrustum(inFrustum: Frustum): boolean Inherited | Viewport | Shortcut to call view.setupFromFrustum and then setupFromView |
turnCameraOff(): void Inherited | Viewport | Turn the camera off it is currently on. |
turnCameraOn(lensAngle?: Angle): ViewStatus Inherited | Viewport | Turn the camera on if it is currently off. |
updateChangeFlags(newView: ViewState): void Protected Inherited | Viewport | Invoked from finishUndoRedo, applyViewState, and changeView to potentially recompute change flags based on differences between current and new ViewState. |
view4dToWorld(input: Point4d, out?: Point3d): Point3d Inherited | Viewport | Convert a point from CoordSystem.View as a Point4d to CoordSystem.View |
view4dToWorldArray(viewPts: Point4d[], worldPts: Point3d[]): void Inherited | Viewport | Convert an array of points from CoordSystem.View as Point4ds to CoordSystem.World |
viewMapLayerRange(mapLayerIndex: MapLayerIndex, vp: ScreenViewport): Promise<boolean> Inherited | Viewport | Changes viewport to include range of a map layer. |
viewsModel(modelId: string): boolean Inherited | Viewport | Returns true if this Viewport is currently displaying the model with the specified Id. |
viewToNpc(pt: Point3d, out?: Point3d): Point3d Inherited | Viewport | Convert a point from CoordSystem.View to CoordSystem.Npc |
viewToNpcArray(pts: Point3d[]): void Inherited | Viewport | Convert an array of points from CoordSystem.View to CoordSystem.Npc |
viewToWorld(input: Readonly<WritableXYAndZ>, out?: Point3d): Point3d Inherited | Viewport | Convert a point from CoordSystem.View to CoordSystem.World |
viewToWorldArray(pts: Point3d[]): void Inherited | Viewport | Convert an array of points from CoordSystem.View to CoordSystem.World |
worldToNpc(pt: Readonly<WritableXYAndZ>, out?: Point3d): Point3d Inherited | Viewport | Convert a point from CoordSystem.World to CoordSystem.Npc |
worldToNpcArray(pts: Point3d[]): void Inherited | Viewport | Convert an array of points from CoordSystem.World to CoordSystem.Npc |
worldToView(input: Readonly<WritableXYAndZ>, out?: Point3d): Point3d Inherited | Viewport | Convert a point from CoordSystem.World to CoordSystem.View |
worldToView4d(input: Readonly<WritableXYAndZ>, out?: Point4d): Point4d Inherited | Viewport | Convert a point from CoordSystem.World to CoordSystem.View as Point4d |
worldToView4dArray(worldPts: Point3d[], viewPts: Point4d[]): void Inherited | Viewport | Convert an array of points from CoordSystem.World to CoordSystem.View, as Point4ds |
worldToViewArray(pts: Point3d[]): void Inherited | Viewport | Convert an array of points from CoordSystem.World to CoordSystem.View |
zoom(newCenter: Point3d, factor: number, options?: ViewChangeOptions & MarginOptions & OnViewExtentsError): ViewStatus Inherited | Viewport | Zoom the view by a scale factor, placing the new center at the given point (world coordinates). |
zoomToElementProps(elementProps: ElementProps[], options?: ViewChangeOptions & MarginOptions & ZoomToOptions): void Inherited | Viewport | Zoom the view to a show the tightest box around a given set of ElementProps. |
zoomToElements(ids: Id64Arg, options?: ViewChangeOptions & MarginOptions & ZoomToOptions): Promise<void> Inherited | Viewport | Zoom the view to a show the tightest box around a given set of elements. |
zoomToPlacementProps(placementProps: PlacementProps[], options?: ViewChangeOptions & MarginOptions & ZoomToOptions): void Inherited | Viewport | See zoomToPlacements. |
zoomToPlacements(placements: Placement[], options?: ViewChangeOptions & MarginOptions & ZoomToOptions): void Inherited | Viewport | Zoom the view in or out to a fit to the tightest volume enclosing a given set of placements, optionally also changing the view rotation. |
zoomToVolume(volume: Readonly<WritableLowAndHighXYZ> | Readonly<WritableLowAndHighXY>, options?: ViewChangeOptions & MarginOptions): void Inherited | Viewport | Zoom the view to a volume of space in world coordinates. |
Properties
Name | Type | Description | |
---|---|---|---|
animation Static | { easing: (k: number) => number, time: { fast: BeDuration, normal: BeDuration, slow: BeDuration, wheel: BeDuration }, zoomOut: { durationFactor: number, enable: boolean, heights: number[], interpolation: (v: any, k: number) => number, margin: number, positions: number[] } } | Settings that may be adjusted to control the way animations are applied to a ScreenViewport by methods like | |
canvas Readonly | HTMLCanvasElement | The canvas to display the view contents. | |
isRedoPossible Accessor ReadOnly | boolean | True if a redoable viewing operation exists on the stack | |
isUndoPossible Accessor ReadOnly | boolean | True if an undoable viewing operation exists on the stack | |
logo Accessor ReadOnly | HTMLImageElement | The HTMLImageElement of the iTwin.js logo displayed in this ScreenViewport. | |
maxUndoSteps | number | The number of entries in the view undo/redo buffer. | |
parentDiv Readonly | HTMLDivElement | The parent HTMLDivElement of the canvas. | |
toolTipDiv Readonly | HTMLDivElement | The HTMLDivElement used for toolTips. | |
viewCmdTargetCenter Accessor | undefined | Point3d | A point in world coordinates describing an appropriate default point for a ViewTool when no more specific point is provided by the user. | |
viewRect Accessor ReadOnly | ViewRect | The ViewRect for this ScreenViewport. | |
vpDiv Readonly | HTMLDivElement | The div created to hold all viewport elements. |
Inherited properties
Name | Type | Inherited from | Description |
---|---|---|---|
_decorationsValid Protected Inherited | boolean | Viewport | If false, indicates that Decorations should be recreated when rendering the next frame. |
alwaysDrawn Accessor Inherited ReadOnly | undefined | Id64Set | Viewport | Ids of a set of elements which should always be rendered within this view, regardless of category and subcategory visibility. If the isAlwaysDrawnExclusive flag is also set, only those elements in this set will be drawn. |
analysisFraction Accessor Inherited | number | Viewport | See DisplayStyleSettings.analysisFraction. |
antialiasSamples Accessor Inherited | number | Viewport | Sets the number of MSAA samples for this viewport. The number of samples is a power of two. Values of 1 or less indicates anti-aliasing should be disabled. Non-power-of-two values are rounded down to the nearest power of two. The maximum number of samples supported depends upon the client's graphics hardware capabilities. Higher values produce a higher-quality image but also may also reduce framerate. |
areAllTileTreesLoaded Accessor Inherited ReadOnly | boolean | Viewport | Returns true if all TileTrees required by this viewport have been loaded. |
auxCoordSystem Accessor Inherited ReadOnly | AuxCoordSystemState | Viewport | |
backgroundMapSettings Accessor Inherited | BackgroundMapSettings | Viewport | The settings controlling how a background map is displayed within a view. |
clipStyle Accessor Inherited | ClipStyle | Viewport | See DisplayStyleSettings.clipStyle |
continuousRendering Accessor Inherited | boolean | Viewport | Enables or disables continuous rendering. Ideally, during each render frame a Viewport will do as little work as possible. To make that possible, the viewport keeps track of what has changed about its internal state from one frame to the next. For example, if the view frustum has not changed since the previous frame, it is likely that the viewport does not need to be re-rendered at all. In some circumstances, it is desirable to bypass the logic that limits the amount of work performed each frame. A primary example is a viewport that has some animations applied to it, or when diagnostic information like frames-per-second is being monitored. |
debugBoundingBoxes Accessor Inherited | TileBoundingBoxes | Viewport | Determines what type (if any) of debug graphics will be displayed to visualize Tile volumes. Chiefly for debugging. |
devicePixelRatio Accessor Inherited ReadOnly | number | Viewport | The device pixel ratio used by this Viewport. This value is not necessarily equal to window.devicePixelRatio .See: https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio |
displayStyle Accessor Inherited | DisplayStyleState | Viewport | See displayStyle |
emphasisSettings Accessor Inherited | Hilite.Settings | Viewport | The settings that control how emphasized elements are displayed in this Viewport. The default settings apply a thick black silhouette to the emphasized elements. |
featureOverrideProviders Accessor Inherited ReadOnly | Iterable<FeatureOverrideProvider, any, any> | Viewport | The list of FeatureOverrideProviders registered with this viewport. |
flashedId Accessor Inherited | undefined | string | Viewport | The Id of the currently-flashed object. The "flashed" visual effect is typically applied to the object in the viewport currently under the mouse cursor, to indicate it is ready to be interacted with by a tool. ToolAdmin is responsible for updating it when the mouse cursor moves. The object is usually an Element but could also be a Model or pickable decoration produced by a Decorator. The setter ignores any string that is not a well-formed Id64String. Passing Id64.invalid to the setter is equivalent to passing undefined - both mean "nothing is flashed". |
flashSettings Accessor Inherited | FlashSettings | Viewport | The settings that control how elements are flashed in this viewport. |
hilite Accessor Inherited | Hilite.Settings | Viewport | The settings that control how elements are hilited in this Viewport. |
iModel Accessor Inherited ReadOnly | IModelConnection | Viewport | The iModel of this Viewport |
isAlwaysDrawnExclusive Accessor Inherited ReadOnly | boolean | Viewport | Returns true if the set of elements in the alwaysDrawn set are the only elements rendered within this view. |
isCameraOn Accessor Inherited ReadOnly | boolean | Viewport | True if this is a 3d view with the camera turned on. |
isDisposed Accessor Inherited ReadOnly | boolean | Viewport | Returns true if this Viewport's dispose method has been invoked. It is an error to attempt to interact with a disposed Viewport. Typically a ScreenViewport becomes disposed as a result of a call to dropViewport, often indirectly through the unmounting of a nine-zone UI's ViewportComponent when, e.g., switching front-stages. |
isFadeOutActive Accessor Inherited | boolean | Viewport | Enables or disables "fade-out" mode. When this mode is enabled, transparent graphics are rendered with a flat alpha weight, causing them to appear de-emphasized. This is typically used in contexts in which a handful of elements are to be emphasized in the view, while the rest of the graphics are drawn transparently. |
isGridOn Accessor Inherited ReadOnly | boolean | Viewport | Determine whether the Grid display is currently enabled in this Viewport. |
lastFlashedElementId Accessor Inherited ReadOnly | undefined | string | Viewport | The Id of the most recently flashed element, if any. |
lightSettings Accessor Inherited ReadOnly | undefined | LightSettings | Viewport | See DisplayStyle3dSettings.lights |
neverDrawn Accessor Inherited ReadOnly | undefined | Id64Set | Viewport | Ids of a set of elements which should not be rendered within this view. |
numReadyTiles Accessor Inherited ReadOnly | number | Viewport | The number of tiles which were ready and met the desired level-of-detail for display in the view as of the most recently-drawn frame. These tiles may not have been selected because some other (probably sibling) tiles were not ready for display. This is a useful metric for determining how "complete" the view is - e.g., one indicator of progress toward view completion can be expressed as: (numReadyTiles) / (numReadyTiles + numRequestedTiles) |
numRequestedTiles Accessor Inherited ReadOnly | number | Viewport | The number of outstanding requests for tiles to be displayed in this viewport. |
numSelectedTiles Accessor Inherited ReadOnly | number | Viewport | The number of tiles selected for display in the view as of the most recently-drawn frame. The tiles selected may not meet the desired level-of-detail for the view, instead being temporarily drawn while tiles of more appropriate level-of-detail are loaded asynchronously. |
onAlwaysDrawnChanged Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event called on the next frame after this viewport's set of always-drawn elements changes. |
onChangeView Readonly Inherited | BeEvent<(vp: Viewport, previousViewState: ViewState) => void> | Viewport | Event invoked immediately when changeView is called to replace the current ViewState with a different one. |
onDisplayStyleChanged Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event called on the next frame after this viewport's DisplayStyleState or its members change. |
onDisposed Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event invoked immediately when the viewport is disposed. |
onFeatureOverrideProviderChanged Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event called on the next frame after this viewport's FeatureOverrideProvider changes, |
onFeatureOverridesChanged Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event called on the next frame after this viewport's Overrides change. |
onFlashedIdChanged Readonly Inherited | BeEvent<(vp: Viewport, args: OnFlashedIdChangedEventArgs) => void> | Viewport | Event dispatched immediately after flashedId changes, supplying the Ids of the previously and/or currently-flashed objects. |
onMapLayerScaleRangeVisibilityChanged Readonly Inherited | BeEvent<(layerIndexes: MapLayerScaleRangeVisibility[]) => void> | Viewport | Event indicating when a map-layer scale range visibility change for the current viewport scale. |
onNeverDrawnChanged Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event called on the next frame after this viewport's set of never-drawn elements changes. |
onRender Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Called when the visible contents of the viewport are redrawn. |
onResized Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event invoked after renderFrame detects that the dimensions of the viewport's ViewRect have changed. |
onSceneInvalidated Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event invoked every time invalidateScene is called. |
onViewChanged Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event called whenever this viewport is synchronized with its ViewState. |
onViewedCategoriesChanged Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event called on the next frame after this viewport's set of displayed categories changes. |
onViewedCategoriesPerModelChanged Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event called on the next frame after this viewport's set of Overrides changes. |
onViewedModelsChanged Readonly Inherited | BeEvent<(vp: Viewport) => void> | Viewport | Event called on the next frame after this viewport's set of displayed models changes. |
onViewportChanged Readonly Inherited | BeEvent<(vp: Viewport, changed: ChangeFlags) => void> | Viewport | Event called on the next frame after any of the viewport's ChangeFlags changes. |
onViewUndoRedo Readonly Inherited | BeEvent<(vp: Viewport, event: ViewUndoEvent) => void> | Viewport | Event called after reversing the most recent change to the Viewport from the undo stack or reapplying the |
perModelCategoryVisibility Accessor Inherited ReadOnly | PerModelCategoryVisibility.Overrides | Viewport | Allows visibility of categories within this viewport to be overridden on a per-model basis. |
rotation Accessor Inherited ReadOnly | Matrix3d | Viewport | This viewport's rotation matrix. |
screenSpaceEffects Accessor Inherited | Iterable<string, any, any> | Viewport | An ordered list of names of screen-space post-processing effects to be applied to the image rendered by the Viewport. The effects are applied to the image in the order in which they appear in the list. Any names not corresponding to a registered effect are ignored. This may have no effect if the Viewport's RenderTarget does not support screen-space effects. |
solarShadowSettings Accessor Inherited ReadOnly | undefined | SolarShadowSettings | Viewport | See DisplayStyle3dSettings.solarShadows |
tiledGraphicsProviders Accessor Inherited ReadOnly | Iterable<TiledGraphicsProvider, any, any> | Viewport | The TiledGraphicsProviders currently registered with this viewport. |
timePoint Accessor Inherited | undefined | number | Viewport | See DisplayStyleSettings.timePoint |
undoDelay Static Inherited | BeDuration | Viewport | Don't allow entries in the view undo buffer unless they're separated by more than this amount of time. |
view Accessor Inherited ReadOnly | ViewState | Viewport | The ViewState for this Viewport |
viewDelta Accessor Inherited ReadOnly | Vector3d | Viewport | The vector between the opposite corners of this viewport's extents. |
viewFlags Accessor Inherited | ViewFlags | Viewport | Flags controlling aspects of how the contents of this viewport are rendered. |
viewingSpace Accessor Inherited ReadOnly | ViewingSpace | Viewport | |
viewportId Accessor Inherited ReadOnly | number | Viewport | A unique integer Id assigned to this Viewport upon construction. It can be useful for comparing and sorting Viewport objects inside of collections like SortedArray. |
worldToNpcMap Accessor Inherited ReadOnly | Map4d | Viewport | Provides conversions between world and Npc (non-dimensional perspective) coordinates. |
worldToViewMap Accessor Inherited ReadOnly | Map4d | Viewport | Provides conversions between world and view coordinates. |
Defined in
- core/frontend/src/Viewport.ts Line 3001
Last Updated: 17 December, 2024