@univerjs/engine-render v0.4.2 • Docs
Class: Viewport
Constructors
new Viewport()
new Viewport(
viewportKey,
scene,
props?): Viewport
Parameters
Parameter | Type |
---|---|
viewportKey | string |
scene | ThinScene |
props ? | IViewProps |
Returns
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:245 (opens in a new tab)
Properties
Accessors
_deltaScrollX
get _deltaScrollX(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:451 (opens in a new tab)
_deltaScrollY
get _deltaScrollY(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:455 (opens in a new tab)
_deltaViewportScrollX
get _deltaViewportScrollX(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:459 (opens in a new tab)
_deltaViewportScrollY
get _deltaViewportScrollY(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:463 (opens in a new tab)
bottom
get bottom(): number
set bottom(num): void
Parameters
Parameter | Type |
---|---|
num | number |
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:354 (opens in a new tab)
bottomOrigin
get bottomOrigin(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:338 (opens in a new tab)
cacheBound
get cacheBound(): null | IBoundRectNoAngle
set cacheBound(val): void
Parameters
Parameter | Type |
---|---|
val | null | IBoundRectNoAngle |
Returns
null
| IBoundRectNoAngle
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:434 (opens in a new tab)
canvas
get canvas(): null | Canvas
Returns
null
| Canvas
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:467 (opens in a new tab)
height
get height(): Nullable<number>
set height(height): void
Parameters
Parameter | Type |
---|---|
height | Nullable <number > |
Returns
Nullable
<number
>
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:322 (opens in a new tab)
isActive
get isActive(): boolean
Returns
boolean
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:383 (opens in a new tab)
isDirty
get isDirty(): boolean
Returns
boolean
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1187 (opens in a new tab)
isForceDirty
get isForceDirty(): boolean
Returns
boolean
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1203 (opens in a new tab)
isWheelPreventDefaultX
get isWheelPreventDefaultX(): boolean
Returns
boolean
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:362 (opens in a new tab)
isWheelPreventDefaultY
get isWheelPreventDefaultY(): boolean
Returns
boolean
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:366 (opens in a new tab)
left
get left(): number
set left(num): void
Parameters
Parameter | Type |
---|---|
num | number |
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:350 (opens in a new tab)
leftOrigin
get leftOrigin(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:334 (opens in a new tab)
preCacheBound
get preCacheBound(): null | IBoundRectNoAngle
set preCacheBound(val): void
Parameters
Parameter | Type |
---|---|
val | null | IBoundRectNoAngle |
Returns
null
| IBoundRectNoAngle
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:442 (opens in a new tab)
right
get right(): number
set right(num): void
Parameters
Parameter | Type |
---|---|
num | number |
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:358 (opens in a new tab)
rightOrigin
get rightOrigin(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:342 (opens in a new tab)
scene
get scene(): ThinScene
Returns
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:314 (opens in a new tab)
top
get top(): number
set top(num): void
Parameters
Parameter | Type |
---|---|
num | number |
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:346 (opens in a new tab)
topOrigin
get topOrigin(): number
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:330 (opens in a new tab)
viewBound
get viewBound(): IBoundRectNoAngle
Returns
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:430 (opens in a new tab)
viewportKey
get viewportKey(): string
Returns
string
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:326 (opens in a new tab)
viewportScrollX
get viewportScrollX(): number
set viewportScrollX(val): void
Parameters
Parameter | Type |
---|---|
val | number |
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:398 (opens in a new tab)
viewportScrollY
get viewportScrollY(): number
set viewportScrollY(val): void
Parameters
Parameter | Type |
---|---|
val | number |
Returns
number
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:406 (opens in a new tab)
width
get width(): Nullable<number>
set width(w): void
Parameters
Parameter | Type |
---|---|
w | Nullable <number > |
Returns
Nullable
<number
>
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:318 (opens in a new tab)
Methods
_limitViewportScroll()
_limitViewportScroll(viewportScrollX, viewportScrollY): {
isLimitedX: boolean;
isLimitedY: boolean;
viewportScrollX: number;
viewportScrollY: number;
}
Still in working progress, do not use it now.
Parameters
Parameter | Type |
---|---|
viewportScrollX | number |
viewportScrollY | number |
Returns
{
isLimitedX: boolean;
isLimitedY: boolean;
viewportScrollX: number;
viewportScrollY: number;
}
Name | Type | Defined in |
---|---|---|
isLimitedX | boolean | submodules/univer/packages/engine-render/src/viewport.ts:1175 (opens in a new tab) |
isLimitedY | boolean | submodules/univer/packages/engine-render/src/viewport.ts:1176 (opens in a new tab) |
viewportScrollX | number | submodules/univer/packages/engine-render/src/viewport.ts:1173 (opens in a new tab) |
viewportScrollY | number | submodules/univer/packages/engine-render/src/viewport.ts:1174 (opens in a new tab) |
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1163 (opens in a new tab)
_testDisplayCache()
_testDisplayCache(): void
test
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:282 (opens in a new tab)
closeClip()
closeClip(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1099 (opens in a new tab)
disable()
disable(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:473 (opens in a new tab)
dispose()
dispose(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1103 (opens in a new tab)
enable()
enable(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:469 (opens in a new tab)
expandBounds()
expandBounds(value): IBoundRectNoAngle
Parameters
Parameter | Type |
---|---|
value | object |
value.bottom | number |
value.left | number |
value.right | number |
value.top | number |
Returns
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1433 (opens in a new tab)
getAbsoluteVector()
getAbsoluteVector(coord): Vector2
Parameters
Parameter | Type |
---|---|
coord | Vector2 |
Returns
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:961 (opens in a new tab)
getBounding()
getBounding(): IViewportInfo
Returns
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:944 (opens in a new tab)
getScrollBar()
getScrollBar(): Nullable<BaseScrollBar>
Returns
Nullable
<BaseScrollBar
>
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:679 (opens in a new tab)
getScrollBarTransForm()
getScrollBarTransForm(): Transform
Returns
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:715 (opens in a new tab)
getViewportScrollByScrollXY()
getViewportScrollByScrollXY(): {
x: number;
y: number;
}
get actual scroll value by scrollXY
Returns
{
x: number;
y: number;
}
Name | Type | Defined in |
---|---|---|
x | number | submodules/univer/packages/engine-render/src/viewport.ts:664 (opens in a new tab) |
y | number | submodules/univer/packages/engine-render/src/viewport.ts:665 (opens in a new tab) |
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:672 (opens in a new tab)
initCacheCanvas()
initCacheCanvas(props?): void
Parameters
Parameter | Type |
---|---|
props ? | IViewProps |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:269 (opens in a new tab)
isHit()
isHit(coord): undefined | boolean
Parameters
Parameter | Type |
---|---|
coord | Vector2 |
Returns
undefined
| boolean
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1065 (opens in a new tab)
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 | submodules/univer/packages/engine-render/src/viewport.ts:1118 (opens in a new tab) |
isLimitedY | boolean | false | submodules/univer/packages/engine-render/src/viewport.ts:1119 (opens in a new tab) |
scrollX | number | 0 | submodules/univer/packages/engine-render/src/viewport.ts:1116 (opens in a new tab) |
scrollY | number | 0 | submodules/univer/packages/engine-render/src/viewport.ts:1117 (opens in a new tab) |
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1113 (opens in a new tab)
markDirty()
markDirty(state?): void
Parameters
Parameter | Type |
---|---|
state ? | boolean |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1180 (opens in a new tab)
markForceDirty()
markForceDirty(state?): void
Parameters
Parameter | Type |
---|---|
state ? | boolean |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1192 (opens in a new tab)
onMouseWheel()
onMouseWheel(evt, state): void
At f7140a7c11, only doc need this method. In sheet, wheel event is handled by scroll-manager.service@setScrollInfo
Parameters
Parameter | Type |
---|---|
evt | IWheelEvent |
state | EventState |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:976 (opens in a new tab)
openClip()
openClip(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1095 (opens in a new tab)
pickScrollBar()
pickScrollBar(coord): undefined | null | Rect<IRectProps>
Parameters
Parameter | Type |
---|---|
coord | Vector2 |
Returns
undefined
| null
| Rect
<IRectProps
>
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1085 (opens in a new tab)
removeScrollBar()
removeScrollBar(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:487 (opens in a new tab)
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
submodules/univer/packages/engine-render/src/viewport.ts:742 (opens in a new tab)
resetCanvasSizeAndUpdateScroll()
resetCanvasSizeAndUpdateScroll(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:477 (opens in a new tab)
resetPadding()
resetPadding(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:527 (opens in a new tab)
resetPrevCacheBounds()
resetPrevCacheBounds(): void
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1199 (opens in a new tab)
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
submodules/univer/packages/engine-render/src/viewport.ts:501 (opens in a new tab)
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
submodules/univer/packages/engine-render/src/viewport.ts:559 (opens in a new tab)
scrollByViewportDeltaVal()
scrollByViewportDeltaVal(delta, isTrigger): undefined | {
isLimitedX: boolean;
isLimitedY: boolean;
viewportScrollX: number;
viewportScrollY: number;
}
Parameters
Parameter | Type | Default value |
---|---|---|
delta | IViewportScrollPosition | undefined |
isTrigger | boolean | true |
Returns
undefined
| {
isLimitedX
: boolean
;
isLimitedY
: boolean
;
viewportScrollX
: number
;
viewportScrollY
: number
;
}
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:586 (opens in a new tab)
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
submodules/univer/packages/engine-render/src/viewport.ts:549 (opens in a new tab)
scrollToViewportPos()
scrollToViewportPos(pos, isTrigger): undefined | {
isLimitedX: boolean;
isLimitedY: boolean;
viewportScrollX: number;
viewportScrollY: number;
}
Viewport scroll to certain position.
Parameters
Parameter | Type | Default value |
---|---|---|
pos | Partial <IViewportScrollPosition > | undefined |
isTrigger | boolean | true |
Returns
undefined
| {
isLimitedX
: boolean
;
isLimitedY
: boolean
;
viewportScrollX
: number
;
viewportScrollY
: number
;
}
IViewportScrollPosition
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:571 (opens in a new tab)
setPadding()
setPadding(param): void
Parameters
Parameter | Type |
---|---|
param | IPosition |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:517 (opens in a new tab)
setScrollBar()
setScrollBar(instance): void
Parameters
Parameter | Type |
---|---|
instance | BaseScrollBar |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:482 (opens in a new tab)
shouldIntoRender()
shouldIntoRender(): boolean
Returns
boolean
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:723 (opens in a new tab)
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 | submodules/univer/packages/engine-render/src/viewport.ts:664 (opens in a new tab) |
y | number | submodules/univer/packages/engine-render/src/viewport.ts:665 (opens in a new tab) |
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:621 (opens in a new tab)
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 | submodules/univer/packages/engine-render/src/viewport.ts:616 (opens in a new tab) |
y | number | submodules/univer/packages/engine-render/src/viewport.ts:617 (opens in a new tab) |
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:595 (opens in a new tab)
transformVector2SceneCoord()
transformVector2SceneCoord(vec): Vector2
convert vector to scene coordinate, include row & col
Parameters
Parameter | Type |
---|---|
vec | Vector2 |
Returns
Vector2
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:953 (opens in a new tab)
updatePrevCacheBounds()
updatePrevCacheBounds(viewBound?): void
Parameters
Parameter | Type |
---|---|
viewBound ? | IBoundRectNoAngle |
Returns
void
Defined in
submodules/univer/packages/engine-render/src/viewport.ts:1445 (opens in a new tab)
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
submodules/univer/packages/engine-render/src/viewport.ts:689 (opens in a new tab)