@univerjs/engine-render v0.5.0-beta.1 • Docs
Class: Viewport
Constructors
new Viewport()
new Viewport(
viewportKey,
scene,
props?): Viewport
Parameters
Parameter | Type |
---|---|
viewportKey | string |
scene | Scene |
props ? | IViewProps |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:251
Properties
Property | Type | Default value | Description | Defined in |
---|---|---|---|---|
bufferEdgeX | number | 0 | Buffer Area size, default is zero | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:248 |
bufferEdgeY | number | 0 | - | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:249 |
onMouseWheel$ | EventSubject <IWheelEvent > | undefined | - | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:133 |
onScrollAfter$ | EventSubject <IScrollObserverParam > | undefined | - | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:135 |
onScrollByBar$ | EventSubject <IScrollObserverParam > | undefined | - | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:141 |
onScrollEnd$ | EventSubject <IScrollObserverParam > | undefined | - | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:139 |
scrollX | number | 0 | scrollX means scroll x value for scrollbar in viewMain use getBarScroll to get scrolling value(scrollX, scrollY) for scrollbar | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:105 |
scrollY | number | 0 | - | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:106 |
Accessors
_deltaScrollX
Get Signature
get _deltaScrollX(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:421
_deltaScrollY
Get Signature
get _deltaScrollY(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:425
_deltaViewportScrollX
Get Signature
get _deltaViewportScrollX(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:429
_deltaViewportScrollY
Get Signature
get _deltaViewportScrollY(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:433
bottom
Get Signature
get bottom(): number
Returns
number
Set Signature
set bottom(num): void
Parameters
Parameter | Type |
---|---|
num | number |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:324
bottomOrigin
Get Signature
get bottomOrigin(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:308
cacheBound
Get Signature
get cacheBound(): null | IBoundRectNoAngle
Returns
null
| IBoundRectNoAngle
Set Signature
set cacheBound(val): void
Parameters
Parameter | Type |
---|---|
val | null | IBoundRectNoAngle |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:404
canvas
Get Signature
get canvas(): null | Canvas
Returns
null
| Canvas
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:437
height
Get Signature
get height(): Nullable<number>
Returns
Nullable
<number
>
Set Signature
set height(height): void
Parameters
Parameter | Type |
---|---|
height | Nullable <number > |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:292
isActive
Get Signature
get isActive(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:353
isDirty
Get Signature
get isDirty(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1111
isForceDirty
Get Signature
get isForceDirty(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1127
isWheelPreventDefaultX
Get Signature
get isWheelPreventDefaultX(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:332
isWheelPreventDefaultY
Get Signature
get isWheelPreventDefaultY(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:336
left
Get Signature
get left(): number
Returns
number
Set Signature
set left(num): void
Parameters
Parameter | Type |
---|---|
num | number |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:320
leftOrigin
Get Signature
get leftOrigin(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:304
preCacheBound
Get Signature
get preCacheBound(): null | IBoundRectNoAngle
Returns
null
| IBoundRectNoAngle
Set Signature
set preCacheBound(val): void
Parameters
Parameter | Type |
---|---|
val | null | IBoundRectNoAngle |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:412
right
Get Signature
get right(): number
Returns
number
Set Signature
set right(num): void
Parameters
Parameter | Type |
---|---|
num | number |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:328
rightOrigin
Get Signature
get rightOrigin(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:312
scene
Get Signature
get scene(): Scene
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:284
top
Get Signature
get top(): number
Returns
number
Set Signature
set top(num): void
Parameters
Parameter | Type |
---|---|
num | number |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:316
topOrigin
Get Signature
get topOrigin(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:300
viewBound
Get Signature
get viewBound(): IBoundRectNoAngle
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:400
viewportKey
Get Signature
get viewportKey(): string
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:296
viewportScrollX
Get Signature
get viewportScrollX(): number
Returns
number
Set Signature
set viewportScrollX(val): void
Parameters
Parameter | Type |
---|---|
val | number |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:368
viewportScrollY
Get Signature
get viewportScrollY(): number
Returns
number
Set Signature
set viewportScrollY(val): void
Parameters
Parameter | Type |
---|---|
val | number |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:376
width
Get Signature
get width(): Nullable<number>
Returns
Nullable
<number
>
Set Signature
set width(w): void
Parameters
Parameter | Type |
---|---|
w | Nullable <number > |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:288
Methods
_limitViewportScroll()
_limitViewportScroll(viewportScrollX, viewportScrollY): ILimitedScrollResult
Still in working progress, do not use it now.
Parameters
Parameter | Type |
---|---|
viewportScrollX | number |
viewportScrollY | number |
Returns
ILimitedScrollResult
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1087
closeClip()
closeClip(): void
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1024
disable()
disable(): void
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:443
dispose()
dispose(): void
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1028
enable()
enable(): void
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:439
expandBounds()
expandBounds(value): IBoundRectNoAngle
Parameters
Parameter | Type |
---|---|
value | object |
value.bottom | number |
value.left | number |
value.right | number |
value.top | number |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1356
getAbsoluteVector()
getAbsoluteVector(coord): Vector2
Parameters
Parameter | Type |
---|---|
coord | Vector2 |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:930
getBounding()
getBounding(): IViewportInfo
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:913
getScrollBar()
getScrollBar(): Nullable<BaseScrollBar>
Returns
Nullable
<BaseScrollBar
>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:648
getScrollBarTransForm()
getScrollBarTransForm(): Transform
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:684
getViewportScrollByScrollXY()
getViewportScrollByScrollXY(): {
x: number;
y: number;
}
get actual scroll value by scrollXY
Returns
{
x: number;
y: number;
}
Name | Type | Defined in |
---|---|---|
x | number | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:633 |
y | number | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:634 |
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:641
initCacheCanvas()
initCacheCanvas(props?): void
Parameters
Parameter | Type |
---|---|
props ? | IViewProps |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:275
isHit()
isHit(coord): boolean
Check if coord is in viewport. Coord is relative to canvas (scale is handled in isHit, Just pass in the original coord from event)
Parameters
Parameter | Type |
---|---|
coord | Vector2 |
Returns
boolean
is in viewport
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:990
limitedScroll()
limitedScroll(scrollX, scrollY): {
isLimitedX: false;
isLimitedY: false;
scrollX: 0;
scrollY: 0;
}
Parameters
Parameter | Type |
---|---|
scrollX | Nullable <number > |
scrollY | Nullable <number > |
Returns
{
isLimitedX: false;
isLimitedY: false;
scrollX: 0;
scrollY: 0;
}
Name | Type | Default value | Defined in |
---|---|---|---|
isLimitedX | boolean | false | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1043 |
isLimitedY | boolean | false | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1044 |
scrollX | number | 0 | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1041 |
scrollY | number | 0 | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1042 |
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1038
markDirty()
markDirty(state?): void
Parameters
Parameter | Type |
---|---|
state ? | boolean |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1104
markForceDirty()
markForceDirty(state?): void
Parameters
Parameter | Type |
---|---|
state ? | boolean |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1116
onMouseWheel()
onMouseWheel(evt, state): void
At f7140a7c11, only doc need this method. In sheet, wheel event is handled by scroll.render-controller@scene.onMouseWheel$
Parameters
Parameter | Type |
---|---|
evt | IWheelEvent |
state | EventState |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:945
openClip()
openClip(): void
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1020
pickScrollBar()
pickScrollBar(coord): undefined | null | Rect<IRectProps>
Parameters
Parameter | Type |
---|---|
coord | Vector2 |
Returns
undefined
| null
| Rect
<IRectProps
>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1010
removeScrollBar()
removeScrollBar(): void
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:457
render()
render(
parentCtx?,
objects?,
isMaxLayer?): void
Render function in each render loop.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
parentCtx ? | UniverRenderingContext | undefined | parentCtx is cacheCtx from layer when layer._allowCache is true |
objects ? | BaseObject [] | [] | - |
isMaxLayer ? | boolean | false | - |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:711
resetCanvasSizeAndUpdateScroll()
resetCanvasSizeAndUpdateScroll(): void
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:447
resetPadding()
resetPadding(): void
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:490
resetPrevCacheBounds()
resetPrevCacheBounds(): void
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1123
resizeWhenFreezeChange()
resizeWhenFreezeChange(position): void
NOT same as resetCanvasSizeAndScrollbar This method is triggered when adjusting the frozen row & col settings, and during initialization, it is not triggered when resizing the window.
Note that the ‘position’ parameter may not always have ‘height’ and ‘width’ properties. For the ‘viewMain’ element, it only has ‘left’, ‘top’, ‘bottom’, and ‘right’ properties. Additionally, ‘this.width’ and ‘this.height’ may also be ‘undefined’. Therefore, you should use the ‘_getViewPortSize’ method to retrieve the width and height.
Parameters
Parameter | Type |
---|---|
position | IViewPosition |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:471
scrollByBarDeltaValue()
scrollByBarDeltaValue(delta, isTrigger): undefined | {
isLimitedX: false;
isLimitedY: false;
scrollX: 0;
scrollY: 0;
}
Srolling by current position plus delta. the most common case is triggered by scroll-timer(in sheet)
Parameters
Parameter | Type | Default value |
---|---|---|
delta | Partial <IScrollBarPosition > | undefined |
isTrigger | boolean | true |
Returns
undefined
| {
isLimitedX
: false
;
isLimitedY
: false
;
scrollX
: 0
;
scrollY
: 0
;
}
isLimited
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:522
scrollByViewportDeltaVal()
scrollByViewportDeltaVal(delta, isTrigger): Nullable<ILimitedScrollResult>
Scrolling by current position plus delta. if viewport can not scroll(e.g. viewport size is bigger than content size), then return null.
Parameters
Parameter | Type | Default value |
---|---|---|
delta | IViewportScrollPosition | undefined |
isTrigger | boolean | true |
Returns
Nullable
<ILimitedScrollResult
>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:555
scrollToBarPos()
scrollToBarPos(pos): undefined | {
isLimitedX: false;
isLimitedY: false;
scrollX: 0;
scrollY: 0;
}
ScrollBar scroll to certain position.
Parameters
Parameter | Type | Description |
---|---|---|
pos | Partial <IScrollBarPosition > | position of scrollBar |
Returns
undefined
| {
isLimitedX
: false
;
isLimitedY
: false
;
scrollX
: 0
;
scrollY
: 0
;
}
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:512
scrollToViewportPos()
scrollToViewportPos(pos, isTrigger): Nullable<ILimitedScrollResult>
Viewport scroll to certain position.
Parameters
Parameter | Type | Default value |
---|---|---|
pos | Partial <IViewportScrollPosition > | undefined |
isTrigger | boolean | true |
Returns
Nullable
<ILimitedScrollResult
>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:534
setPadding()
setPadding(param): void
Parameters
Parameter | Type |
---|---|
param | IPosition |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:480
setScrollBar()
setScrollBar(instance): void
Parameters
Parameter | Type |
---|---|
instance | BaseScrollBar |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:452
shouldIntoRender()
shouldIntoRender(): boolean
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:692
transformVector2SceneCoord()
transformVector2SceneCoord(vec): Vector2
convert vector to scene coordinate, include row & col
Parameters
Parameter | Type |
---|---|
vec | Vector2 |
Returns
Vector2
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:922
transScroll2ViewportScrollValue()
transScroll2ViewportScrollValue(scrollX, scrollY): {
x: number;
y: number;
}
Parameters
Parameter | Type |
---|---|
scrollX | number |
scrollY | number |
Returns
{
x: number;
y: number;
}
Name | Type | Defined in |
---|---|---|
x | number | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:633 |
y | number | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:634 |
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:590
transViewportScroll2ScrollValue()
transViewportScroll2ScrollValue(viewportScrollX, viewportScrollY): {
x: number;
y: number;
}
Parameters
Parameter | Type |
---|---|
viewportScrollX | number |
viewportScrollY | number |
Returns
{
x: number;
y: number;
}
Name | Type | Defined in |
---|---|---|
x | number | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:585 |
y | number | packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:586 |
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:564
updatePrevCacheBounds()
updatePrevCacheBounds(viewBound?): void
Parameters
Parameter | Type |
---|---|
viewBound ? | IBoundRectNoAngle |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:1368
updateScrollVal()
updateScrollVal(current): Viewport
Just record state of scroll. This method won’t scroll viewport and scrollbar. TODO:
Parameters
Parameter | Type |
---|---|
current | Partial <IScrollObserverParam > |
Returns
Viewport
Lumixraku
this method is so wierd, viewportMain did not call it, now only called in freeze situation.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/engine-render/src/viewport.ts:658