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.

Methods

Name Description
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): void 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.  
forEachViewport(func: (vp: ScreenViewport) => void): void Call the specified function on each Viewport registered with the ViewManager.  
getElementToolTip(hit: HitDetail): Promise<HTMLElement | string> Get the tooltip for a persistent element. Beta
getFirstOpenView(): ScreenViewport | undefined Get the first opened view.  
invalidateDecorationsAllViews(): void Force each registered Viewport to regenerate its Decorations on the next frame.  
setSelectedView(vp: ScreenViewport | undefined): 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 Decorator[]    
dynamicsCursor Accessor ReadOnly string    
grabbingCursor Accessor ReadOnly string    
grabCursor Accessor ReadOnly string    
inDynamicsMode boolean    
lookCursor Accessor ReadOnly string    
onBeginRender BeEvent<() => void> Called at the beginning of each tick of the render loop, before any viewports have been updated.  
onFinishRender BeEvent<() => void> Called at the end of each tick of the render loop, after all viewports have been updated.  
onSelectedViewportChanged BeUiEvent<SelectedViewportChangedArgs> Called after the selected view changes.  
onViewClose BeUiEvent<ScreenViewport> Called after a view is closed.  
onViewOpen BeUiEvent<ScreenViewport> Called after a view is opened.  
onViewResume BeUiEvent<ScreenViewport> Called after a suspended view is resumed.  
onViewSuspend BeUiEvent<ScreenViewport> Called after a view is suspended.  
rotateCursor Accessor ReadOnly string    
selectedView Accessor ReadOnly ScreenViewport | undefined The "selected view" is the default for certain operations.  
walkCursor Accessor ReadOnly string    
zoomCursor Accessor ReadOnly string    

Defined in

Last Updated: 05 June, 2020