@univerjs/engine-render v0.4.2 • Docs
Class: Scene
Extends
Constructors
new Scene()
new Scene(
sceneKey,
_parent,
state?): Scene
Parameters
Parameter | Type |
---|---|
sceneKey | string |
_parent | ThinEngine <Scene > | SceneViewer |
state ? | ISceneTransformState |
Returns
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:70 (opens in a new tab)
Properties
Accessors
ancestorLeft
get ancestorLeft(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/scene.ts:120 (opens in a new tab)
ancestorScaleX
get ancestorScaleX(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/scene.ts:102 (opens in a new tab)
ancestorScaleY
get ancestorScaleY(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/scene.ts:111 (opens in a new tab)
ancestorTop
get ancestorTop(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/scene.ts:129 (opens in a new tab)
classType
get classType(): RENDER_CLASS_TYPE
Returns
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-scene.ts:89 (opens in a new tab)
cursor
set cursor(val): void
Parameters
Parameter | Type |
---|---|
val | CURSOR_TYPE |
Defined in
submodules/univer/packages/engine-render/src/scene.ts:138 (opens in a new tab)
height
get height(): number
set height(num): void
Parameters
Parameter | Type |
---|---|
num | number |
Returns
number
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-scene.ts:101 (opens in a new tab)
objectsEvented
get objectsEvented(): boolean
Returns
boolean
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-scene.ts:117 (opens in a new tab)
scaleX
get scaleX(): number
set scaleX(scaleX): void
Parameters
Parameter | Type |
---|---|
scaleX | number |
Returns
number
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-scene.ts:105 (opens in a new tab)
scaleY
get scaleY(): number
set scaleY(scaleY): void
Parameters
Parameter | Type |
---|---|
scaleY | number |
Returns
number
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-scene.ts:109 (opens in a new tab)
sceneKey
get sceneKey(): string
Returns
string
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-scene.ts:113 (opens in a new tab)
transform
get transform(): Transform
set transform(trans): void
Parameters
Parameter | Type |
---|---|
trans | Transform |
Returns
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-scene.ts:93 (opens in a new tab)
width
get width(): number
set width(num): void
Parameters
Parameter | Type |
---|---|
num | number |
Returns
number
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-scene.ts:97 (opens in a new tab)
Methods
addLayer()
addLayer(...argument): void
Parameters
Parameter | Type |
---|---|
...argument | Layer [] |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/scene.ts:387 (opens in a new tab)
addObject()
addObject(o, zIndex): Scene
Add object to Layer (Layer is specified by zIndex). If object is a group, insert all its children and group itself to _objects[].
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
o | BaseObject | undefined | - |
zIndex | number | 1 | layer index |
Returns
scene
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:411 (opens in a new tab)
addObjects()
addObjects(objects, zIndex): Scene
Add objects to Layer( Layer is specfied by zIndex) If object is a group, insert all its children and group itself to _objects[].
Parameters
Parameter | Type | Default value |
---|---|---|
objects | BaseObject [] | undefined |
zIndex | number | 1 |
Returns
this
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:398 (opens in a new tab)
addViewport()
addViewport(...viewport): Scene
Parameters
Parameter | Type |
---|---|
...viewport | Viewport [] |
Returns
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:572 (opens in a new tab)
attachControl()
attachControl(
hasDown,
hasUp,
hasMove,
hasWheel): undefined | Scene
Parameters
Parameter | Type | Default value |
---|---|---|
hasDown | boolean | true |
hasUp | boolean | true |
hasMove | boolean | true |
hasWheel | boolean | true |
Returns
undefined
| Scene
Defined in
submodules/univer/packages/engine-render/src/scene.ts:142 (opens in a new tab)
attachTransformerTo()
attachTransformerTo(o): void
create transformer if not exist, and then transformer attach to object that passed in by parameter.
Parameters
Parameter | Type |
---|---|
o | BaseObject |
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:626 (opens in a new tab)
clearLayer()
clearLayer(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/scene.ts:756 (opens in a new tab)
clearViewports()
clearViewports(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/scene.ts:760 (opens in a new tab)
detachControl()
detachControl(): Scene
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:152 (opens in a new tab)
detachTransformerFrom()
detachTransformerFrom(o): void
Parameters
Parameter | Type |
---|---|
o | BaseObject |
Returns
void
Overrides
ThinScene
.detachTransformerFrom
Defined in
submodules/univer/packages/engine-render/src/scene.ts:633 (opens in a new tab)
disableLayerCache()
disableLayerCache(...layerIndexes): void
Parameters
Parameter | Type |
---|---|
...layerIndexes | number [] |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/scene.ts:180 (opens in a new tab)
disableObjectsEvent()
disableObjectsEvent(): void
If scene.event is disabled, scene.pick(curosrPos) return null. Then only scene itself can response to pointer event, all objects under the scene would not. see sceneInputManager@_onPointerMove
Returns
void
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-scene.ts:150 (opens in a new tab)
dispose()
dispose(): void
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:788 (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)
enableLayerCache()
enableLayerCache(...layerIndexes): void
Parameters
Parameter | Type |
---|---|
...layerIndexes | number [] |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/scene.ts:174 (opens in a new tab)
enableObjectsEvent()
enableObjectsEvent(): void
Returns
void
Inherited from
Defined in
submodules/univer/packages/engine-render/src/thin-scene.ts:141 (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)
findLayerByZIndex()
findLayerByZIndex(zIndex): Nullable<Layer>
Parameters
Parameter | Type | Default value |
---|---|---|
zIndex | number | 1 |
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:368 (opens in a new tab)
findViewportByPosToViewport()
findViewportByPosToViewport(coord): undefined | Viewport
prev getActiveViewportByRelativeCoord
Parameters
Parameter | Type |
---|---|
coord | Vector2 |
Returns
undefined
| Viewport
Defined in
submodules/univer/packages/engine-render/src/scene.ts:661 (opens in a new tab)
fuzzyMathObjects()
fuzzyMathObjects(oKey, matchStart): BaseObject[]
Parameters
Parameter | Type | Default value |
---|---|---|
oKey | string | undefined |
matchStart | boolean | false |
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:558 (opens in a new tab)
getActiveViewportByCoord()
getActiveViewportByCoord(coord): undefined | Viewport
Parameters
Parameter | Type |
---|---|
coord | Vector2 |
Returns
undefined
| Viewport
Defined in
submodules/univer/packages/engine-render/src/scene.ts:665 (opens in a new tab)
getAllObjects()
getAllObjects(): BaseObject[]
Get all objects of each Layer.
Returns
objects
Defined in
submodules/univer/packages/engine-render/src/scene.ts:484 (opens in a new tab)
getAllObjectsByDescOrder()
getAllObjectsByDescOrder(isDesc): BaseObject[]
get objects which is visible and not in a group.
Parameters
Parameter | Type | Default value |
---|---|---|
isDesc | boolean | false |
Returns
BaseObject[]
Defined in
submodules/univer/packages/engine-render/src/scene.ts:511 (opens in a new tab)
getAllObjectsByOrder()
getAllObjectsByOrder(): BaseObject[]
Get objects which is visible and not in a group in each layer.
Returns
BaseObject[]
Defined in
submodules/univer/packages/engine-render/src/scene.ts:497 (opens in a new tab)
getAllObjectsByOrderForPick()
getAllObjectsByOrderForPick(isDesc): BaseObject[]
Get visible and evented objects.
Parameters
Parameter | Type | Default value |
---|---|---|
isDesc | boolean | false |
Returns
objects
Defined in
submodules/univer/packages/engine-render/src/scene.ts:526 (opens in a new tab)
getAncestorScale()
getAncestorScale(): {
scaleX: number;
scaleY: number;
}
Returns
{
scaleX: number;
scaleY: number;
}
Name | Type | Defined in |
---|---|---|
scaleX | number | submodules/univer/packages/engine-render/src/scene.ts:773 (opens in a new tab) |
scaleY | number | submodules/univer/packages/engine-render/src/scene.ts:774 (opens in a new tab) |
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:764 (opens in a new tab)
getCursor()
getCursor(): CURSOR_TYPE
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:196 (opens in a new tab)
getEngine()
getEngine(): Nullable<Engine>
Returns
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:340 (opens in a new tab)
getLayer()
getLayer(zIndex): Layer
Parameters
Parameter | Type | Default value |
---|---|---|
zIndex | number | 1 |
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:359 (opens in a new tab)
getLayerMaxZIndex()
getLayerMaxZIndex(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/scene.ts:376 (opens in a new tab)
getLayers()
getLayers(): Layer[]
Returns
Layer
[]
Defined in
submodules/univer/packages/engine-render/src/scene.ts:355 (opens in a new tab)
getObject()
getObject(oKey): Nullable<BaseObject>
Parameters
Parameter | Type |
---|---|
oKey | string |
Returns
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:536 (opens in a new tab)
getObjectIncludeInGroup()
getObjectIncludeInGroup(oKey): Nullable<BaseObject>
Parameters
Parameter | Type |
---|---|
oKey | string |
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:547 (opens in a new tab)
getObjectsByLayer()
getObjectsByLayer(zIndex): BaseObject[]
Parameters
Parameter | Type |
---|---|
zIndex | number |
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:469 (opens in a new tab)
getParent()
getParent(): ThinEngine<Scene> | SceneViewer
Returns
ThinEngine
<Scene
> | SceneViewer
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:336 (opens in a new tab)
getPrecisionScale()
getPrecisionScale(): {
scaleX: number;
scaleY: number;
}
Returns
{
scaleX: number;
scaleY: number;
}
Name | Type | Defined in |
---|---|---|
scaleX | number | submodules/univer/packages/engine-render/src/scene.ts:783 (opens in a new tab) |
scaleY | number | submodules/univer/packages/engine-render/src/scene.ts:784 (opens in a new tab) |
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:778 (opens in a new tab)
getRelativeToViewportCoord()
getRelativeToViewportCoord(coord): Vector2
In a nested scene scenario, it is necessary to obtain the relative offsets layer by layer.
Parameters
Parameter | Type | Description |
---|---|---|
coord | Vector2 | Coordinates to be converted. |
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:718 (opens in a new tab)
getTransformer()
getTransformer(): Nullable<Transformer>
Returns
Nullable
<Transformer
>
Defined in
submodules/univer/packages/engine-render/src/scene.ts:652 (opens in a new tab)
getTransformerByCreate()
getTransformerByCreate(): Transformer
Returns
Transformer
Defined in
submodules/univer/packages/engine-render/src/scene.ts:645 (opens in a new tab)
getViewport()
getViewport(key): undefined | Viewport
Parameters
Parameter | Type |
---|---|
key | string |
Returns
undefined
| Viewport
Defined in
submodules/univer/packages/engine-render/src/scene.ts:591 (opens in a new tab)
getViewportScrollXY()
getViewportScrollXY(viewPort): {
x: number;
y: number;
}
Parameters
Parameter | Type |
---|---|
viewPort | Viewport |
Returns
{
x: number;
y: number;
}
Name | Type | Defined in |
---|---|---|
x | number | submodules/univer/packages/engine-render/src/scene.ts:708 (opens in a new tab) |
y | number | submodules/univer/packages/engine-render/src/scene.ts:709 (opens in a new tab) |
Defined in
submodules/univer/packages/engine-render/src/scene.ts:698 (opens in a new tab)
getViewports()
getViewports(): Viewport[]
Returns
Viewport
[]
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:587 (opens in a new tab)
getVpScrollXYInfoByPosToVp()
getVpScrollXYInfoByPosToVp(pos, viewPort?): {
x: 0;
y: 0;
}
getViewportScrollXYInfo by viewport under cursor position prev getScrollXYByRelativeCoords
Parameters
Parameter | Type |
---|---|
pos | Vector2 |
viewPort ? | Viewport |
Returns
{
x: 0;
y: 0;
}
Name | Type | Default value | Defined in |
---|---|---|---|
x | number | 0 | submodules/univer/packages/engine-render/src/scene.ts:691 (opens in a new tab) |
y | number | 0 | submodules/univer/packages/engine-render/src/scene.ts:692 (opens in a new tab) |
Defined in
submodules/univer/packages/engine-render/src/scene.ts:685 (opens in a new tab)
initTransformer()
initTransformer(config?): void
Parameters
Parameter | Type |
---|---|
config ? | ITransformerConfig |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/scene.ts:637 (opens in a new tab)
isDirty()
isDirty(): boolean
Returns
boolean
Defined in
submodules/univer/packages/engine-render/src/scene.ts:186 (opens in a new tab)
makeDirty()
makeDirty(state): Scene
Parameters
Parameter | Type | Default value |
---|---|---|
state | boolean | true |
Returns
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:157 (opens in a new tab)
makeDirtyNoParent()
makeDirtyNoParent(state): Scene
Parameters
Parameter | Type | Default value |
---|---|---|
state | boolean | true |
Returns
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:167 (opens in a new tab)
pick()
pick(coord): Nullable<BaseObject | Scene | ThinScene>
Get the object under the pointer, if scene.event is disabled, the object is null.
Parameters
Parameter | Type |
---|---|
coord | Vector2 |
Returns
Nullable
<BaseObject
| Scene
| ThinScene
>
object under the pointer
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:828 (opens in a new tab)
removeObject()
removeObject(object?): Nullable<Scene>
Parameters
Parameter | Type |
---|---|
object ? | string | BaseObject |
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:433 (opens in a new tab)
removeObjects()
removeObjects(objects?): Nullable<Scene>
Parameters
Parameter | Type |
---|---|
objects ? | string [] | BaseObject [] |
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:444 (opens in a new tab)
removeViewport()
removeViewport(key): undefined | Viewport
Parameters
Parameter | Type |
---|---|
key | string |
Returns
undefined
| Viewport
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:577 (opens in a new tab)
render()
render(parentCtx?): void
Parameters
Parameter | Type |
---|---|
parentCtx ? | UniverRenderingContext |
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:599 (opens in a new tab)
requestRender()
requestRender(parentCtx?): Promise<unknown>
Parameters
Parameter | Type |
---|---|
parentCtx ? | UniverRenderingContext |
Returns
Promise
<unknown
>
Defined in
submodules/univer/packages/engine-render/src/scene.ts:615 (opens in a new tab)
resetCursor()
resetCursor(): void
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:200 (opens in a new tab)
resize()
resize(width?, height?): Scene
Parameters
Parameter | Type |
---|---|
width ? | number |
height ? | number |
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:218 (opens in a new tab)
scale()
scale(scaleX?, scaleY?): Scene
Set scale, and then emit event to update Viewport scroll state.
Parameters
Parameter | Type |
---|---|
scaleX ? | number |
scaleY ? | number |
Returns
Scene
Defined in
submodules/univer/packages/engine-render/src/scene.ts:258 (opens in a new tab)
scaleBy()
scaleBy(scaleX?, scaleY?): Scene
current scale plus offset, relative
Parameters
Parameter | Type |
---|---|
scaleX ? | number |
scaleY ? | number |
Returns
Defined in
submodules/univer/packages/engine-render/src/scene.ts:284 (opens in a new tab)
setCursor()
setCursor(val): void
Parameters
Parameter | Type |
---|---|
val | CURSOR_TYPE |
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:204 (opens in a new tab)
setDefaultCursor()
setDefaultCursor(val): void
Parameters
Parameter | Type |
---|---|
val | CURSOR_TYPE |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/scene.ts:213 (opens in a new tab)
setObjectBehavior()
setObjectBehavior(o): void
Set Scene as object parent, if object has no parent.
Parameters
Parameter | Type |
---|---|
o | BaseObject |
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:422 (opens in a new tab)
setScaleValue()
setScaleValue(scaleX, scaleY): void
Parameters
Parameter | Type |
---|---|
scaleX | number |
scaleY | number |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/scene.ts:242 (opens in a new tab)
transformByState()
transformByState(state): void
Reset canvas size and update scroll
Parameters
Parameter | Type |
---|---|
state | ISceneTransformState |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/scene.ts:313 (opens in a new tab)
triggerDblclick()
triggerDblclick(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IMouseEvent | IPointerEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:940 (opens in a new tab)
triggerDragEnter()
triggerDragEnter(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IDragEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:1038 (opens in a new tab)
triggerDragLeave()
triggerDragLeave(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IDragEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:1016 (opens in a new tab)
triggerDragOver()
triggerDragOver(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IDragEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:1027 (opens in a new tab)
triggerDrop()
triggerDrop(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IDragEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:1049 (opens in a new tab)
triggerKeyDown()
triggerKeyDown(evt): void
Parameters
Parameter | Type |
---|---|
evt | IKeyboardEvent |
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:893 (opens in a new tab)
triggerKeyUp()
triggerKeyUp(evt): void
Parameters
Parameter | Type |
---|---|
evt | IKeyboardEvent |
Returns
void
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:900 (opens in a new tab)
triggerMouseWheel()
triggerMouseWheel(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IWheelEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:918 (opens in a new tab)
triggerPointerDown()
triggerPointerDown(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IMouseEvent | IPointerEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:962 (opens in a new tab)
triggerPointerEnter()
triggerPointerEnter(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IMouseEvent | IPointerEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:1004 (opens in a new tab)
triggerPointerLeave()
triggerPointerLeave(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IMouseEvent | IPointerEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:983 (opens in a new tab)
triggerPointerMove()
triggerPointerMove(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IMouseEvent | IPointerEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:929 (opens in a new tab)
triggerPointerOut()
triggerPointerOut(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IMouseEvent | IPointerEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:974 (opens in a new tab)
triggerPointerOver()
triggerPointerOver(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IMouseEvent | IPointerEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:995 (opens in a new tab)
triggerPointerUp()
triggerPointerUp(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IMouseEvent | IPointerEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:907 (opens in a new tab)
triggerTripleClick()
triggerTripleClick(evt): boolean
Parameters
Parameter | Type |
---|---|
evt | IMouseEvent | IPointerEvent |
Returns
boolean
Overrides
Defined in
submodules/univer/packages/engine-render/src/scene.ts:951 (opens in a new tab)