@univerjs/engine-render v0.5.0-beta.1 • Docs


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

Disposable.constructor

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:143

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_disposedprotectedbooleanfalseDisposable._disposedpackages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:93
beginFrame$readonlyObservable<number>undefined-packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:37
endFrame$readonlyObservable<IBasicFrameInfo>undefined-packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:39
onInputChanged$publicEventSubject<IEvent>undefined-packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:44
onTransformChange$publicEventSubject<ITransformChangeState>undefined-packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:46
renderEvenInBackgroundpublicbooleantrue-packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:34
renderFrameTags$readonlySubject<[string, any]>undefined-packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:42
renderFrameTimeMetric$readonlySubject<ITimeMetric>undefined-packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:41

Accessors

activeScene

Get Signature

get activeScene(): null | Scene
Returns

null | Scene

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:181


classType

Get Signature

get classType(): RENDER_CLASS_TYPE
Returns

RENDER_CLASS_TYPE

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:177


clientRect$

Get Signature

get clientRect$(): Observable<void>
Returns

Observable<void>

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:59


elapsedTime

Get Signature

get elapsedTime(): number
Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:165


frameId

Get Signature

get frameId(): number

Gets the current frame id

Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:225


height

Get Signature

get height(): number
Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:173


requestNewFrameHandler

Get Signature

get requestNewFrameHandler(): number
Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:218


width

Get Signature

get width(): number
Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:169

Methods

_beginFrame()

_beginFrame(_timestamp): void

Begin a new frame

Parameters

ParameterType
_timestampnumber

Returns

void

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:421


_endFrame()

_endFrame(timestamp): void

End the current frame

Parameters

ParameterType
timestampnumber

Returns

void

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:429


_init()

_init(): void

Returns

void

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:161


addFunction2RenderLoop()

addFunction2RenderLoop(renderFunction): void

Parameters

ParameterType
renderFunction() => void

Returns

void

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:373


addScene()

addScene(sceneInstance): Scene

Parameters

ParameterType
sceneInstanceScene

Returns

Scene

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:197


clearCanvas()

clearCanvas(): void

Returns

void

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:234


dispose()

dispose(): void

Returns

void

Overrides

Disposable.dispose

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:334


disposeWithMe()

disposeWithMe(disposable): IDisposable

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

Disposable.disposeWithMe

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:96


ensureNotDisposed()

protected ensureNotDisposed(): void

Returns

void

Inherited from

Disposable.ensureNotDisposed

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:100


getCanvas()

getCanvas(): Canvas

Returns

Canvas

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:238


getCanvasElement()

getCanvasElement(): HTMLCanvasElement

Returns

HTMLCanvasElement

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:242


getDeltaTime()

getDeltaTime(): number

Gets the time spent between current and previous frame

Returns

number

a number representing the delta time in ms

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:452


getFps()

getFps(): number

Gets the current framerate

Returns

number

a number representing the framerate

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:444


getPixelRatio()

getPixelRatio(): number

Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:258


getScene()

getScene(sceneKey): null | Scene

Parameters

ParameterType
sceneKeystring

Returns

null | Scene

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:189


getScenes()

getScenes(): {}

Returns

{}

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:185


hasActiveScene()

hasActiveScene(): boolean

Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:214


hasScene()

hasScene(sceneKey): boolean

Parameters

ParameterType
sceneKeystring

Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:193


resize()

resize(): void

Returns

void

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:294


resizeBySize()

resizeBySize(width, height): void

set canvas element size

Parameters

ParameterType
widthnumber
heightnumber

Returns

void

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:317


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

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:392


setActiveScene()

setActiveScene(sceneKey): null | Scene

Parameters

ParameterType
sceneKeystring

Returns

null | Scene

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:206


setCanvasCursor()

setCanvasCursor(val): void

Parameters

ParameterType
valCURSOR_TYPE

Returns

void

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:229


setContainer()

setContainer(elem, resize): void

Parameters

ParameterTypeDefault value
elemHTMLElementundefined
resizebooleantrue

Returns

void

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:262


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

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:250


startRenderLoop()

startRenderLoop(): void

Returns

void

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:379


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

packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/engine.ts:401