API Reference
@univerjs
@univerjs/engine-render
classes
Engine

@univerjs/engine-render v0.4.2Docs


Class: Engine

Extends

Constructors

new Engine()

new Engine(
   elemWidth, 
   elemHeight, 
   pixelRatio?, 
   mode?): Engine

Parameters

ParameterTypeDefault value
elemWidthnumber1
elemHeightnumber1
pixelRatio?numberundefined
mode?CanvasRenderModeundefined

Returns

Engine

Overrides

ThinEngine.constructor

Defined in

submodules/univer/packages/engine-render/src/engine.ts:138 (opens in a new tab)

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_disposedprotectedbooleanfalseThinEngine._disposedsubmodules/univer/packages/core/src/shared/lifecycle.ts:93 (opens in a new tab)
beginFrame$readonlyObservable<number>undefined-submodules/univer/packages/engine-render/src/engine.ts:38 (opens in a new tab)
endFrame$readonlyObservable<IBasicFrameInfo>undefined-submodules/univer/packages/engine-render/src/engine.ts:41 (opens in a new tab)
onInputChanged$publicEventSubject<IEvent>undefinedThinEngine.onInputChanged$submodules/univer/packages/engine-render/src/thin-engine.ts:29 (opens in a new tab)
onTransformChange$publicEventSubject<ITransformChangeState>undefinedThinEngine.onTransformChange$submodules/univer/packages/engine-render/src/thin-engine.ts:31 (opens in a new tab)
renderEvenInBackgroundpublicbooleantrue-submodules/univer/packages/engine-render/src/engine.ts:35 (opens in a new tab)
renderFrameTags$readonlySubject<[string, any]>undefined-submodules/univer/packages/engine-render/src/engine.ts:45 (opens in a new tab)
renderFrameTimeMetric$readonlySubject<ITimeMetric>undefined-submodules/univer/packages/engine-render/src/engine.ts:43 (opens in a new tab)

Accessors

activeScene

get activeScene(): null | T

Returns

null | T

Inherited from

ThinEngine.activeScene

Defined in

submodules/univer/packages/engine-render/src/thin-engine.ts:41 (opens in a new tab)


classType

get classType(): RENDER_CLASS_TYPE

Returns

RENDER_CLASS_TYPE

Inherited from

ThinEngine.classType

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

ThinEngine.height

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

ThinEngine.width

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

ParameterType
_timestampnumber

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

ParameterType
timestampnumber

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

ParameterType
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

ParameterType
sceneInstanceScene

Returns

Scene

Inherited from

ThinEngine.addScene

Defined in

submodules/univer/packages/engine-render/src/thin-engine.ts:65 (opens in a new tab)


clearCanvas()

clearCanvas(): void

Returns

void

Overrides

ThinEngine.clearCanvas

Defined in

submodules/univer/packages/engine-render/src/engine.ts:188 (opens in a new tab)


dispose()

dispose(): void

Returns

void

Overrides

ThinEngine.dispose

Defined in

submodules/univer/packages/engine-render/src/engine.ts:288 (opens in a new tab)


disposeWithMe()

disposeWithMe(disposable): IDisposable

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

ThinEngine.disposeWithMe

Defined in

submodules/univer/packages/core/src/shared/lifecycle.ts:96 (opens in a new tab)


ensureNotDisposed()

protected ensureNotDisposed(): void

Returns

void

Inherited from

ThinEngine.ensureNotDisposed

Defined in

submodules/univer/packages/core/src/shared/lifecycle.ts:100 (opens in a new tab)


getCanvas()

getCanvas(): Canvas

Returns

Canvas

Overrides

ThinEngine.getCanvas

Defined in

submodules/univer/packages/engine-render/src/engine.ts:192 (opens in a new tab)


getCanvasElement()

getCanvasElement(): HTMLCanvasElement

Returns

HTMLCanvasElement

Overrides

ThinEngine.getCanvasElement

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

ThinEngine.getParent

Defined in

submodules/univer/packages/engine-render/src/thin-engine.ts:100 (opens in a new tab)


getPixelRatio()

getPixelRatio(): number

Returns

number

Overrides

ThinEngine.getPixelRatio

Defined in

submodules/univer/packages/engine-render/src/engine.ts:212 (opens in a new tab)


getScene()

getScene(sceneKey): null | Scene

Parameters

ParameterType
sceneKeystring

Returns

null | Scene

Inherited from

ThinEngine.getScene

Defined in

submodules/univer/packages/engine-render/src/thin-engine.ts:57 (opens in a new tab)


getScenes()

getScenes(): {}

Returns

{}

Inherited from

ThinEngine.getScenes

Defined in

submodules/univer/packages/engine-render/src/thin-engine.ts:53 (opens in a new tab)


hasActiveScene()

hasActiveScene(): boolean

Returns

boolean

Inherited from

ThinEngine.hasActiveScene

Defined in

submodules/univer/packages/engine-render/src/thin-engine.ts:85 (opens in a new tab)


hasScene()

hasScene(sceneKey): boolean

Parameters

ParameterType
sceneKeystring

Returns

boolean

Inherited from

ThinEngine.hasScene

Defined in

submodules/univer/packages/engine-render/src/thin-engine.ts:61 (opens in a new tab)


remainScene()

remainScene(key): undefined | Scene

Parameters

ParameterType
keystring

Returns

undefined | Scene

Inherited from

ThinEngine.remainScene

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

ParameterType
widthnumber
heightnumber

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

ParameterTypeDescription
renderFunction() => voiddefines 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

ParameterType
sceneKeystring

Returns

null | Scene

Inherited from

ThinEngine.setActiveScene

Defined in

submodules/univer/packages/engine-render/src/thin-engine.ts:75 (opens in a new tab)


setCanvasCursor()

setCanvasCursor(val): void

Parameters

ParameterType
valCURSOR_TYPE

Returns

void

Overrides

ThinEngine.setCanvasCursor

Defined in

submodules/univer/packages/engine-render/src/engine.ts:183 (opens in a new tab)


setContainer()

setContainer(elem, resize): void

Parameters

ParameterTypeDefault value
elemHTMLElementundefined
resizebooleantrue

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

ThinEngine.setRemainCapture

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

ParameterTypeDescription
renderFunction?() => voiddefines 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)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.