ViewManager Class

The ViewManager holds the list of opened views, plus the selected view. It also provides notifications of view open/close and suspend/resume. Applications must call ViewManager.addViewport when new Viewports that should be associated with user events are created.

A single ViewManager is created when IModelApp.startup is called. It can be accessed via the static member IModelApp.viewManager.

The ViewManager controls the render loop, which causes the contents of each registered Viewport to update on the screen.

extensions

Implements

Methods

Name Description
constructor(): ViewManager    
[iterator](): Iterator<ScreenViewport, any, undefined> Iterate over the viewports registered with the view manager.  
addDecorator(decorator: Decorator): () => void Add a new Decorator to display decorations into the active views.  
addViewport(newVp: ScreenViewport): BentleyStatus Add a new Viewport to the list of opened views and create an EventController for it.  
clearSelectedView(): void Set the selected Viewport to undefined.  
dropDecorator(decorator: Decorator): boolean Drop (remove) a Decorator so it is no longer active.  
dropViewport(vp: ScreenViewport, disposeOfViewport: boolean = true): BentleyStatus Remove a Viewport from the list of opened views, and optionally dispose of it.  
getElementToolTip(hit: HitDetail): Promise<string | HTMLElement> Get the tooltip for a persistent element. Beta  
getFirstOpenView(): undefined | ScreenViewport Get the first opened view.  
hasViewport(viewport: ScreenViewport): boolean Returns true if the specified viewport is currently being managed by this ViewManager.  
invalidateCachedDecorationsAllViews(decorator: ViewportDecorator): void Force each registered Viewport to regenerate all of its cached Decorations on the next frame. Beta  
invalidateDecorationsAllViews(): void Force each registered Viewport to regenerate its Decorations on the next frame.  
setAntialiasingAllViews(numSamples: number): void Sets the number of MSAA samples for all currently- and subsequently-opened ScreenViewports.  
setSelectedView(vp: undefined | ScreenViewport): Promise<BentleyStatus> Sets the selected Viewport.  
setViewCursor(cursor: string = "default"): void Change the cursor shown in all Viewports.  

Properties

Name Type Description
crossHairCursor Accessor ReadOnly string    
cursor string    
decorators Readonly Decorator[]    
dynamicsCursor Accessor ReadOnly string    
grabbingCursor Accessor ReadOnly string    
grabCursor Accessor ReadOnly string    
inDynamicsMode boolean    
lookCursor Accessor ReadOnly string    
onBeginRender Readonly BeEvent<() => void> Called at the beginning of each tick of the render loop, before any viewports have been updated.  
onFinishRender Readonly BeEvent<() => void> Called at the end of each tick of the render loop, after all viewports have been updated.  
onSelectedViewportChanged Readonly BeUiEvent<SelectedViewportChangedArgs> Called after the selected view changes.  
onViewClose Readonly BeUiEvent<ScreenViewport> Called after a view is closed.  
onViewOpen Readonly BeUiEvent<ScreenViewport> Called after a view is opened.  
onViewResume Readonly BeUiEvent<ScreenViewport> Called after a suspended view is resumed.  
onViewSuspend Readonly BeUiEvent<ScreenViewport> Called after a view is suspended.  
rotateCursor Accessor ReadOnly string    
selectedView Accessor ReadOnly undefined | ScreenViewport The "selected view" is the default for certain operations.  
walkCursor Accessor ReadOnly string    
zoomCursor Accessor ReadOnly string    

Defined in

Last Updated: 20 June, 2023