@univerjs/engine-render v0.4.2 • Docs
Class: Engine
Extends
Constructors
new Engine()
new Engine(
elemWidth,
elemHeight,
pixelRatio?,
mode?): Engine
Parameters
Parameter | Type | Default value |
---|---|---|
elemWidth | number | 1 |
elemHeight | number | 1 |
pixelRatio ? | number | undefined |
mode ? | CanvasRenderMode | undefined |
Returns
Overrides
Defined in
submodules/univer/packages/engine-render/src/engine.ts:138 (opens in a new tab)
Properties
Accessors
activeScene
get activeScene(): null | T
Returns
null
| T
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-engine.ts:41 (opens in a new tab)
classType
get classType(): RENDER_CLASS_TYPE
Returns
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-engine.ts:37 (opens in a new tab)
clientRect$
get clientRect$(): Observable<void>
Returns
Observable
<void
>
Defined in
submodules/univer/packages/engine-render/src/engine.ts:54 (opens in a new tab)
elapsedTime
get elapsedTime(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/engine.ts:160 (opens in a new tab)
frameId
get frameId(): number
Gets the current frame id
Returns
number
Defined in
submodules/univer/packages/engine-render/src/engine.ts:179 (opens in a new tab)
height
get height(): number
Returns
number
Overrides
Defined in
submodules/univer/packages/engine-render/src/engine.ts:168 (opens in a new tab)
requestNewFrameHandler
get requestNewFrameHandler(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/engine.ts:172 (opens in a new tab)
width
get width(): number
Returns
number
Overrides
Defined in
submodules/univer/packages/engine-render/src/engine.ts:164 (opens in a new tab)
Methods
_beginFrame()
_beginFrame(_timestamp): void
Begin a new frame
Parameters
Parameter | Type |
---|---|
_timestamp | number |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/engine.ts:368 (opens in a new tab)
_endFrame()
_endFrame(timestamp): void
End the current frame
Parameters
Parameter | Type |
---|---|
timestamp | number |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/engine.ts:376 (opens in a new tab)
_init()
_init(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/engine.ts:156 (opens in a new tab)
addFunction2RenderLoop()
addFunction2RenderLoop(renderFunction): void
Parameters
Parameter | Type |
---|---|
renderFunction | () => void |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/engine.ts:320 (opens in a new tab)
addScene()
addScene(sceneInstance): Scene
Parameters
Parameter | Type |
---|---|
sceneInstance | Scene |
Returns
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-engine.ts:65 (opens in a new tab)
clearCanvas()
clearCanvas(): void
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/engine.ts:188 (opens in a new tab)
dispose()
dispose(): void
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/engine.ts:288 (opens in a new tab)
disposeWithMe()
disposeWithMe(disposable): IDisposable
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
Defined in
submodules/univer/packages/core/src/shared/lifecycle.ts:96 (opens in a new tab)
ensureNotDisposed()
protected ensureNotDisposed(): void
Returns
void
Inherited from
Defined in
submodules/univer/packages/core/src/shared/lifecycle.ts:100 (opens in a new tab)
getCanvas()
getCanvas(): Canvas
Returns
Overrides
Defined in
submodules/univer/packages/engine-render/src/engine.ts:192 (opens in a new tab)
getCanvasElement()
getCanvasElement(): HTMLCanvasElement
Returns
HTMLCanvasElement
Overrides
Defined in
submodules/univer/packages/engine-render/src/engine.ts:196 (opens in a new tab)
getDeltaTime()
getDeltaTime(): number
Gets the time spent between current and previous frame
Returns
number
a number representing the delta time in ms
Defined in
submodules/univer/packages/engine-render/src/engine.ts:399 (opens in a new tab)
getFps()
getFps(): number
Gets the current framerate
Returns
number
a number representing the framerate
Defined in
submodules/univer/packages/engine-render/src/engine.ts:391 (opens in a new tab)
getParent()
getParent(): void
Returns
void
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-engine.ts:100 (opens in a new tab)
getPixelRatio()
getPixelRatio(): number
Returns
number
Overrides
Defined in
submodules/univer/packages/engine-render/src/engine.ts:212 (opens in a new tab)
getScene()
getScene(sceneKey): null | Scene
Parameters
Parameter | Type |
---|---|
sceneKey | string |
Returns
null
| Scene
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-engine.ts:57 (opens in a new tab)
getScenes()
getScenes(): {}
Returns
{}
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-engine.ts:53 (opens in a new tab)
hasActiveScene()
hasActiveScene(): boolean
Returns
boolean
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-engine.ts:85 (opens in a new tab)
hasScene()
hasScene(sceneKey): boolean
Parameters
Parameter | Type |
---|---|
sceneKey | string |
Returns
boolean
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-engine.ts:61 (opens in a new tab)
remainScene()
remainScene(key): undefined | Scene
Parameters
Parameter | Type |
---|---|
key | string |
Returns
undefined
| Scene
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-engine.ts:102 (opens in a new tab)
resize()
resize(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/engine.ts:248 (opens in a new tab)
resizeBySize()
resizeBySize(width, height): void
set canvas element size
Parameters
Parameter | Type |
---|---|
width | number |
height | number |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/engine.ts:271 (opens in a new tab)
runRenderLoop()
runRenderLoop(renderFunction): void
Register and execute a render loop. The engine could manage more than one render function
Parameters
Parameter | Type | Description |
---|---|---|
renderFunction | () => void | defines the function to continuously execute |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/engine.ts:339 (opens in a new tab)
setActiveScene()
setActiveScene(sceneKey): null | Scene
Parameters
Parameter | Type |
---|---|
sceneKey | string |
Returns
null
| Scene
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-engine.ts:75 (opens in a new tab)
setCanvasCursor()
setCanvasCursor(val): void
Parameters
Parameter | Type |
---|---|
val | CURSOR_TYPE |
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/engine.ts:183 (opens in a new tab)
setContainer()
setContainer(elem, resize): void
Parameters
Parameter | Type | Default value |
---|---|---|
elem | HTMLElement | undefined |
resize | boolean | true |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/engine.ts:216 (opens in a new tab)
setRemainCapture()
setRemainCapture(): void
To ensure mouse events remain bound to the host element, preventing the events from becoming ineffective once the mouse leaves the host.
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/engine.ts:204 (opens in a new tab)
startRenderLoop()
startRenderLoop(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/engine.ts:326 (opens in a new tab)
stopRenderLoop()
stopRenderLoop(renderFunction?): void
stop executing a render loop function and remove it from the execution array
Parameters
Parameter | Type | Description |
---|---|---|
renderFunction ? | () => void | defines the function to be removed. If not provided all functions will be removed. |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/engine.ts:348 (opens in a new tab)