@univerjs/engine-render 0.2.4-alpha.0 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +2 -2
- package/lib/es/index.js +6017 -5759
- package/lib/types/basics/i-document-skeleton-cached.d.ts +8 -1
- package/lib/types/basics/interfaces.d.ts +3 -3
- package/lib/types/components/docs/layout/doc-skeleton.d.ts +7 -1
- package/lib/types/components/docs/layout/line-breaker/line-breaker.d.ts +1 -0
- package/lib/types/components/docs/layout/line-breaker/rule.d.ts +4 -17
- package/lib/types/components/docs/layout/model/line.d.ts +4 -3
- package/lib/types/components/docs/layout/tools.d.ts +3 -4
- package/lib/types/components/docs/text-selection/convert-cursor.d.ts +1 -0
- package/lib/types/components/docs/text-selection/text-selection-render-manager.d.ts +7 -0
- package/lib/types/scene.d.ts +1 -1
- package/lib/types/scroll-timer.d.ts +1 -3
- package/lib/types/viewport.d.ts +105 -64
- package/lib/umd/index.js +2 -2
- package/package.json +4 -4
|
@@ -12,13 +12,18 @@ export interface ISkeletonResourceReference {
|
|
|
12
12
|
skeHeaders: Map<string, Map<number, IDocumentSkeletonHeaderFooter>>;
|
|
13
13
|
skeFooters: Map<string, Map<number, IDocumentSkeletonHeaderFooter>>;
|
|
14
14
|
skeListLevel?: Map<string, IDocumentSkeletonBullet[]>;
|
|
15
|
-
drawingAnchor?: Map<number, IDocumentSkeletonDrawingAnchor
|
|
15
|
+
drawingAnchor?: Map<string, Map<number, IDocumentSkeletonDrawingAnchor>>;
|
|
16
16
|
}
|
|
17
17
|
export interface IDocumentSkeletonDrawingAnchor {
|
|
18
18
|
elements: IDocumentSkeletonLine[];
|
|
19
19
|
paragraphIndex: number;
|
|
20
20
|
top: number;
|
|
21
21
|
}
|
|
22
|
+
export declare enum DocumentSkeletonPageType {
|
|
23
|
+
BODY = 0,
|
|
24
|
+
HEADER = 1,
|
|
25
|
+
FOOTER = 2
|
|
26
|
+
}
|
|
22
27
|
export interface IDocumentSkeletonPage {
|
|
23
28
|
sections: IDocumentSkeletonSection[];
|
|
24
29
|
headerId: string;
|
|
@@ -42,6 +47,8 @@ export interface IDocumentSkeletonPage {
|
|
|
42
47
|
st: number;
|
|
43
48
|
ed: number;
|
|
44
49
|
skeDrawings: Map<string, IDocumentSkeletonDrawing>;
|
|
50
|
+
segmentId: string;
|
|
51
|
+
type: DocumentSkeletonPageType;
|
|
45
52
|
renderConfig?: IDocumentRenderConfig;
|
|
46
53
|
parent?: IDocumentSkeletonCached;
|
|
47
54
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BooleanNumber, GridType, IDocStyleBase, IDocumentLayout, IOffset, IParagraphStyle, IReferenceSource, IScale, ISectionBreakBase, ISize, ITextStyle, ITransformState, LocaleService } from '@univerjs/core';
|
|
2
2
|
import { DocumentViewModel } from '../components/docs/view-model/document-view-model';
|
|
3
|
-
import { IDocumentSkeletonBullet, IDocumentSkeletonDrawing, IDocumentSkeletonDrawingAnchor, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph, IDocumentSkeletonHeaderFooter } from './i-document-skeleton-cached';
|
|
3
|
+
import { DocumentSkeletonPageType, IDocumentSkeletonBullet, IDocumentSkeletonDrawing, IDocumentSkeletonDrawingAnchor, IDocumentSkeletonFontStyle, IDocumentSkeletonGlyph, IDocumentSkeletonHeaderFooter } from './i-document-skeleton-cached';
|
|
4
4
|
import { Vector2 } from './vector2';
|
|
5
5
|
import { ITransformerConfig } from './transformer-config';
|
|
6
6
|
|
|
@@ -64,7 +64,7 @@ export interface IParagraphConfig {
|
|
|
64
64
|
paragraphStyle?: IParagraphStyle;
|
|
65
65
|
skeHeaders: Map<string, Map<number, IDocumentSkeletonHeaderFooter>>;
|
|
66
66
|
skeFooters: Map<string, Map<number, IDocumentSkeletonHeaderFooter>>;
|
|
67
|
-
|
|
67
|
+
pDrawingAnchor?: Map<number, IDocumentSkeletonDrawingAnchor>;
|
|
68
68
|
}
|
|
69
69
|
export interface IFontCreateConfig {
|
|
70
70
|
fontStyle: IDocumentSkeletonFontStyle;
|
|
@@ -89,7 +89,7 @@ export interface INodeSearch {
|
|
|
89
89
|
section: number;
|
|
90
90
|
page: number;
|
|
91
91
|
segmentPage: number;
|
|
92
|
-
|
|
92
|
+
pageType: DocumentSkeletonPageType;
|
|
93
93
|
}
|
|
94
94
|
export interface INodePosition extends INodeSearch {
|
|
95
95
|
isBack: boolean;
|
|
@@ -11,6 +11,11 @@ export declare enum DocumentSkeletonState {
|
|
|
11
11
|
READY = "ready",
|
|
12
12
|
INVALID = "invalid"
|
|
13
13
|
}
|
|
14
|
+
export interface IFindNodeRestrictions {
|
|
15
|
+
strict: boolean;
|
|
16
|
+
segmentId: string;
|
|
17
|
+
segmentPage: number;
|
|
18
|
+
}
|
|
14
19
|
export declare class DocumentSkeleton extends Skeleton {
|
|
15
20
|
private _docViewModel;
|
|
16
21
|
private _skeletonData;
|
|
@@ -39,7 +44,8 @@ export declare class DocumentSkeleton extends Skeleton {
|
|
|
39
44
|
pageNumber: number;
|
|
40
45
|
page: Nullable<IDocumentSkeletonPage>;
|
|
41
46
|
};
|
|
42
|
-
findNodeByCoord(coord: Vector2, pageLayoutType: PageLayoutType, pageMarginLeft: number, pageMarginTop: number): Nullable<INodeInfo>;
|
|
47
|
+
findNodeByCoord(coord: Vector2, pageLayoutType: PageLayoutType, pageMarginLeft: number, pageMarginTop: number, restrictions?: IFindNodeRestrictions): Nullable<INodeInfo>;
|
|
48
|
+
private _collectNearestNode;
|
|
43
49
|
private _getNearestNode;
|
|
44
50
|
private _getPageBoundingBox;
|
|
45
51
|
private _translatePage;
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
2
|
+
|
|
16
3
|
export interface ILineBreakRule {
|
|
17
|
-
(codePoint: number, className: number): boolean;
|
|
4
|
+
(codePoint: number, lastCodePoint: Nullable<number>, className: number): boolean;
|
|
18
5
|
}
|
|
19
6
|
export declare class Rule {
|
|
20
7
|
private _rules;
|
|
21
8
|
add(key: string, rule: ILineBreakRule): void;
|
|
22
|
-
shouldBreak(codePoint: number, className: number): boolean;
|
|
9
|
+
shouldBreak(codePoint: number, lastCodePoint: Nullable<number>, className: number): boolean;
|
|
23
10
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
2
|
+
import { IDocumentSkeletonDivide, IDocumentSkeletonDrawing, IDocumentSkeletonDrawingAnchor, IDocumentSkeletonLine, IDocumentSkeletonPage, LineType } from '../../../../basics/i-document-skeleton-cached';
|
|
2
3
|
|
|
3
4
|
interface ILineBoundingBox {
|
|
4
5
|
lineHeight: number;
|
|
@@ -11,8 +12,8 @@ interface ILineBoundingBox {
|
|
|
11
12
|
marginTop?: number;
|
|
12
13
|
spaceBelowApply?: number;
|
|
13
14
|
}
|
|
14
|
-
export declare function createSkeletonLine(paragraphIndex: number, lineType: LineType, lineBoundingBox: ILineBoundingBox, columnWidth: number, lineIndex
|
|
15
|
-
export declare function calculateLineTopByDrawings(lineHeight
|
|
15
|
+
export declare function createSkeletonLine(paragraphIndex: number, lineType: LineType, lineBoundingBox: ILineBoundingBox, columnWidth: number, lineIndex: number | undefined, isParagraphStart: boolean | undefined, page: IDocumentSkeletonPage, headerPage: Nullable<IDocumentSkeletonPage>, footerPage: Nullable<IDocumentSkeletonPage>): IDocumentSkeletonLine;
|
|
16
|
+
export declare function calculateLineTopByDrawings(lineHeight: number | undefined, lineTop: number | undefined, page: IDocumentSkeletonPage, headerPage: Nullable<IDocumentSkeletonPage>, footerPage: Nullable<IDocumentSkeletonPage>): number;
|
|
16
17
|
export declare function updateDivideInfo(divide: IDocumentSkeletonDivide, states: Partial<IDocumentSkeletonDivide>): void;
|
|
17
18
|
export declare function setLineMarginBottom(line: IDocumentSkeletonLine, marginBottom: number): void;
|
|
18
19
|
export declare function collisionDetection(drawing: IDocumentSkeletonDrawing, lineHeight: number, lineTop: number, columnLeft: number, columnWidth: number): boolean;
|
|
@@ -81,9 +81,7 @@ export interface ILayoutContext {
|
|
|
81
81
|
dataModel: DocumentDataModel;
|
|
82
82
|
docsConfig: IDocsConfig;
|
|
83
83
|
skeleton: IDocumentSkeletonCached;
|
|
84
|
-
layoutStartPointer:
|
|
85
|
-
paragraphIndex: Nullable<number>;
|
|
86
|
-
};
|
|
84
|
+
layoutStartPointer: Record<string, Nullable<number>>;
|
|
87
85
|
isDirty: boolean;
|
|
88
86
|
skeletonResourceReference: ISkeletonResourceReference;
|
|
89
87
|
drawingsCache: Map<string, {
|
|
@@ -91,7 +89,7 @@ export interface ILayoutContext {
|
|
|
91
89
|
page: IDocumentSkeletonPage;
|
|
92
90
|
drawing: IDocumentSkeletonDrawing;
|
|
93
91
|
}>;
|
|
94
|
-
paragraphConfigCache: Map<number, IParagraphConfig
|
|
92
|
+
paragraphConfigCache: Map<string, Map<number, IParagraphConfig>>;
|
|
95
93
|
sectionBreakConfigCache: Map<number, ISectionBreakConfig>;
|
|
96
94
|
paragraphsOpenNewPage: Set<number>;
|
|
97
95
|
hyphen: Hyphen;
|
|
@@ -102,4 +100,5 @@ export declare const DEFAULT_PAGE_SIZE: {
|
|
|
102
100
|
height: number;
|
|
103
101
|
};
|
|
104
102
|
export declare function prepareSectionBreakConfig(ctx: ILayoutContext, nodeIndex: number): ISectionBreakConfig;
|
|
103
|
+
export declare function resetContext(ctx: ILayoutContext): void;
|
|
105
104
|
export {};
|
|
@@ -51,6 +51,7 @@ export declare class NodePositionConvertToCursor {
|
|
|
51
51
|
contentBoxPointGroup: IPoint[][];
|
|
52
52
|
cursorList: ITextRange[];
|
|
53
53
|
};
|
|
54
|
+
private _isValidPosition;
|
|
54
55
|
private _resetCurrentNodePositionState;
|
|
55
56
|
private _setNodePositionState;
|
|
56
57
|
private _checkPreviousNodePositionState;
|
|
@@ -53,6 +53,7 @@ export interface ITextSelectionRenderManager {
|
|
|
53
53
|
enableSelection(): void;
|
|
54
54
|
disableSelection(): void;
|
|
55
55
|
setSegment(id: string): void;
|
|
56
|
+
getSegment(): string;
|
|
56
57
|
setSegmentPage(pageIndex: number): void;
|
|
57
58
|
getSegmentPage(): number;
|
|
58
59
|
setStyle(style: ITextSelectionStyle): void;
|
|
@@ -67,6 +68,8 @@ export interface ITextSelectionRenderManager {
|
|
|
67
68
|
hasFocus(): boolean;
|
|
68
69
|
focus(): void;
|
|
69
70
|
blur(): void;
|
|
71
|
+
focusEditor(): void;
|
|
72
|
+
blurEditor(): void;
|
|
70
73
|
changeRuntime(docSkeleton: DocumentSkeleton, scene: Scene, document: Documents): void;
|
|
71
74
|
dispose(): void;
|
|
72
75
|
handleDblClick(evt: IPointerEvent | IMouseEvent): void;
|
|
@@ -125,6 +128,7 @@ export declare class TextSelectionRenderManager extends RxDisposable implements
|
|
|
125
128
|
private _document;
|
|
126
129
|
private _scenePointerMoveSubs;
|
|
127
130
|
private _scenePointerUpSubs;
|
|
131
|
+
private _editorFocusing;
|
|
128
132
|
constructor(_logService: ILogService);
|
|
129
133
|
__getEditorContainer(): HTMLElement;
|
|
130
134
|
getViewPort(): Viewport;
|
|
@@ -145,6 +149,8 @@ export declare class TextSelectionRenderManager extends RxDisposable implements
|
|
|
145
149
|
hasFocus(): boolean;
|
|
146
150
|
focus(): void;
|
|
147
151
|
blur(): void;
|
|
152
|
+
focusEditor(): void;
|
|
153
|
+
blurEditor(): void;
|
|
148
154
|
deactivate(): void;
|
|
149
155
|
changeRuntime(docSkeleton: DocumentSkeleton, scene: Scene, document: Documents): void;
|
|
150
156
|
handleDblClick(evt: IPointerEvent | IMouseEvent): void;
|
|
@@ -175,6 +181,7 @@ export declare class TextSelectionRenderManager extends RxDisposable implements
|
|
|
175
181
|
private _eventHandle;
|
|
176
182
|
private _getTransformCoordForDocumentOffset;
|
|
177
183
|
private _findNodeByCoord;
|
|
184
|
+
private _getNodeIndex;
|
|
178
185
|
private _detachEvent;
|
|
179
186
|
private _activeSelectionRefresh;
|
|
180
187
|
}
|
package/lib/types/scene.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ export declare class Scene extends ThinScene {
|
|
|
85
85
|
getAllObjectsByOrderForPick(isDesc?: boolean): BaseObject[];
|
|
86
86
|
getObject(oKey: string): BaseObject | undefined;
|
|
87
87
|
getObjectIncludeInGroup(oKey: string): BaseObject | undefined;
|
|
88
|
-
fuzzyMathObjects(oKey: string): BaseObject[];
|
|
88
|
+
fuzzyMathObjects(oKey: string, matchStart?: boolean): BaseObject[];
|
|
89
89
|
addViewport(...viewport: Viewport[]): this;
|
|
90
90
|
removeViewport(key: string): Viewport | undefined;
|
|
91
91
|
getViewports(): Viewport[];
|
|
@@ -12,8 +12,6 @@ export declare class ScrollTimer {
|
|
|
12
12
|
private _scene;
|
|
13
13
|
private _scrollTimerType;
|
|
14
14
|
private _padding?;
|
|
15
|
-
private _smoothRatioX;
|
|
16
|
-
private _smoothRatioY;
|
|
17
15
|
private _requestNewFrameNumber;
|
|
18
16
|
private _viewport;
|
|
19
17
|
private _offsetX;
|
|
@@ -23,7 +21,7 @@ export declare class ScrollTimer {
|
|
|
23
21
|
private _scrollX;
|
|
24
22
|
private _scrollY;
|
|
25
23
|
private _scrollFunction;
|
|
26
|
-
constructor(_scene: Scene, _scrollTimerType?: ScrollTimerType, _padding?: IPaddingData | undefined
|
|
24
|
+
constructor(_scene: Scene, _scrollTimerType?: ScrollTimerType, _padding?: IPaddingData | undefined);
|
|
27
25
|
static create(scene: any, scrollTimerType?: ScrollTimerType, padding?: IPaddingData): ScrollTimer;
|
|
28
26
|
set scrollTimerType(type: ScrollTimerType);
|
|
29
27
|
get scrollTimerType(): ScrollTimerType;
|
package/lib/types/viewport.d.ts
CHANGED
|
@@ -32,22 +32,30 @@ export interface IScrollObserverParam {
|
|
|
32
32
|
/**
|
|
33
33
|
* scrollX for scrollbar
|
|
34
34
|
*/
|
|
35
|
-
scrollX
|
|
36
|
-
scrollY
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
scrollX: number;
|
|
36
|
+
scrollY: number;
|
|
37
|
+
/**
|
|
38
|
+
* scrollXY before limit function
|
|
39
|
+
* why need this value?
|
|
40
|
+
*/
|
|
41
|
+
rawScrollX?: number;
|
|
42
|
+
rawScrollY?: number;
|
|
39
43
|
/**
|
|
40
44
|
* scrollX for viewport
|
|
41
45
|
*/
|
|
42
|
-
viewportScrollX
|
|
43
|
-
viewportScrollY
|
|
46
|
+
viewportScrollX: number;
|
|
47
|
+
viewportScrollY: number;
|
|
44
48
|
limitX?: number;
|
|
45
49
|
limitY?: number;
|
|
46
50
|
isTrigger?: boolean;
|
|
47
51
|
}
|
|
48
52
|
interface IScrollBarPosition {
|
|
49
|
-
x
|
|
50
|
-
y
|
|
53
|
+
x: number;
|
|
54
|
+
y: number;
|
|
55
|
+
}
|
|
56
|
+
interface IViewportScrollPosition {
|
|
57
|
+
viewportScrollX: number;
|
|
58
|
+
viewportScrollY: number;
|
|
51
59
|
}
|
|
52
60
|
export declare class Viewport {
|
|
53
61
|
/**
|
|
@@ -69,14 +77,21 @@ export declare class Viewport {
|
|
|
69
77
|
private _deltaViewportScrollX;
|
|
70
78
|
private _deltaViewportScrollY;
|
|
71
79
|
/**
|
|
72
|
-
*
|
|
80
|
+
* scene size in current viewport port with scale
|
|
81
|
+
* scene size relative to row col settings.
|
|
82
|
+
* if AB col has set to be freeze, then scene size in viewMain will be smaller compared to no freeze state.
|
|
83
|
+
*/
|
|
84
|
+
private _sceneWCurrVpAfterScale;
|
|
85
|
+
private _sceneHCurrVpAfterScale;
|
|
86
|
+
/**
|
|
87
|
+
* scene size with scale
|
|
73
88
|
*/
|
|
74
|
-
private
|
|
75
|
-
private
|
|
89
|
+
private _sceneWidthAfterScale;
|
|
90
|
+
private _sceneHeightAfterScale;
|
|
76
91
|
onMouseWheel$: EventSubject<IWheelEvent>;
|
|
77
92
|
onScrollAfter$: EventSubject<IScrollObserverParam>;
|
|
78
93
|
onScrollBefore$: EventSubject<IScrollObserverParam>;
|
|
79
|
-
|
|
94
|
+
onScrollEnd$: EventSubject<IScrollObserverParam>;
|
|
80
95
|
onScrollByBar$: EventSubject<IScrollObserverParam>;
|
|
81
96
|
private _viewportKey;
|
|
82
97
|
/**
|
|
@@ -105,7 +120,13 @@ export declare class Viewport {
|
|
|
105
120
|
private _clipViewport;
|
|
106
121
|
private _active;
|
|
107
122
|
private _paddingStartX;
|
|
123
|
+
/**
|
|
124
|
+
* after create a freeze column, there is a "padding distace" from row header to curr viewport.
|
|
125
|
+
*/
|
|
108
126
|
private _paddingEndX;
|
|
127
|
+
/**
|
|
128
|
+
* after create a freeze row, there is a "padding distace" from column header to curr viewport.
|
|
129
|
+
*/
|
|
109
130
|
private _paddingStartY;
|
|
110
131
|
private _paddingEndY;
|
|
111
132
|
private _isRelativeX;
|
|
@@ -179,7 +200,7 @@ export declare class Viewport {
|
|
|
179
200
|
* invoked when canvas element size change
|
|
180
201
|
* engineResizeObserver --> engine.resizeBySize --> scene._setTransForm
|
|
181
202
|
*/
|
|
182
|
-
|
|
203
|
+
resetCanvasSizeAndUpdateScroll(): void;
|
|
183
204
|
setScrollBar(instance: BaseScrollBar): void;
|
|
184
205
|
removeScrollBar(): void;
|
|
185
206
|
/**
|
|
@@ -196,69 +217,74 @@ export declare class Viewport {
|
|
|
196
217
|
setPadding(param: IPosition): void;
|
|
197
218
|
resetPadding(): void;
|
|
198
219
|
/**
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
220
|
+
* There are serval cases to call this method.
|
|
221
|
+
* the most common case is scrolling. Other situations include:
|
|
222
|
+
* 1. changing the frozen row & col settings
|
|
223
|
+
* 2. changing curr skeleton
|
|
224
|
+
* 3. changing selection which cross viewport
|
|
225
|
+
* 4. changing the viewport size (also include change window size)
|
|
226
|
+
* 5. changing the scroll bar position
|
|
203
227
|
*
|
|
204
228
|
* when scrolling by trackpad:
|
|
205
|
-
* scene.input-manager@_onMouseWheel --> scene@triggerMouseWheel --> sheet-render.controller@scene.
|
|
206
|
-
* scroll.
|
|
207
|
-
*
|
|
208
|
-
* viewportMain.scrollTo(config);
|
|
209
|
-
*
|
|
229
|
+
* scene.input-manager@_onMouseWheel --> scene@triggerMouseWheel --> sheet-render.controller@scene.onMouseWheel$.add -->
|
|
230
|
+
* set-scroll.command.ts --> scroll.operation.ts -->
|
|
231
|
+
* scrollManagerService.setScrollInfoAndEmitEvent
|
|
210
232
|
*
|
|
211
233
|
* when change skelenton:
|
|
212
|
-
* _currentSkeletonBefore$ ---> scroll.render-controller@_updateSceneSize --> setSearchParam --> scene@_setTransForm ---> viewport.resetCanvasSizeAndUpdateScrollBar --->
|
|
234
|
+
* _currentSkeletonBefore$ ---> scroll.render-controller@_updateSceneSize --> setSearchParam --> scene@_setTransForm ---> viewport.resetCanvasSizeAndUpdateScrollBar ---> scrollToXX
|
|
213
235
|
* --> onScrollAfterObserver.notifyObservers --> scroll.render-controller@onScrollAfterObserver ---> setScrollInfoToCurrSheetWithoutNotify ---> sms._setScrollInfo
|
|
214
236
|
*
|
|
215
237
|
* _currentSkeleton$ ---> selection.render-controller ---> formula@_autoScroll ---> viewport.resize ---> get scrollXY by viewportScrollXY ---> scrollTo
|
|
216
238
|
* _currentSkeleton$ ---> selection.render-controller ---> setCurrentSelection ---> formula@_autoScroll ---> scrollTo
|
|
217
239
|
* _currentSkeleton$ ---> freeze.render-controller@_refreshFreeze --> viewport.resize ---> scrollTo ---> _scroll
|
|
218
240
|
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
* TODO: @lumix many side effects in scrollTo, it would update scrollXY & viewportScrollXY, and notify listeners of scrollInfo$
|
|
222
|
-
*
|
|
223
|
-
* TODO: @lumix Other controller should call scrollManagerService to set scrollInfo$
|
|
224
|
-
* example in scroll.operation.ts
|
|
225
|
-
*
|
|
226
241
|
* Debug
|
|
227
242
|
* window.scene.getViewports()[0].scrollTo({x: 14.2, y: 1.8}, true)
|
|
243
|
+
*
|
|
244
|
+
* @param pos
|
|
245
|
+
*
|
|
228
246
|
*/
|
|
229
|
-
|
|
247
|
+
scrollToBarPos(pos: Partial<IScrollBarPosition>): {
|
|
248
|
+
scrollX: number;
|
|
249
|
+
scrollY: number;
|
|
230
250
|
isLimitedX: boolean;
|
|
231
251
|
isLimitedY: boolean;
|
|
232
252
|
} | undefined;
|
|
233
253
|
/**
|
|
234
|
-
* current position plus offset
|
|
235
|
-
*
|
|
236
|
-
* @param
|
|
254
|
+
* scrolling by current position plus offset
|
|
255
|
+
* the most common case is triggered by scroll-timer(in sheet)
|
|
256
|
+
* @param delta
|
|
237
257
|
* @returns isLimited
|
|
238
258
|
*/
|
|
239
|
-
|
|
259
|
+
scrollByBarDeltaValue(delta: Partial<IScrollBarPosition>, isTrigger?: boolean): {
|
|
260
|
+
scrollX: number;
|
|
261
|
+
scrollY: number;
|
|
262
|
+
isLimitedX: boolean;
|
|
263
|
+
isLimitedY: boolean;
|
|
264
|
+
} | undefined;
|
|
265
|
+
scrollByBar(delta: Partial<IScrollBarPosition>, isTrigger?: boolean): void;
|
|
266
|
+
scrollToViewportPos(pos: Partial<IViewportScrollPosition>, isTrigger?: boolean): {
|
|
267
|
+
viewportScrollX: number;
|
|
268
|
+
viewportScrollY: number;
|
|
269
|
+
isLimitedX: boolean;
|
|
270
|
+
isLimitedY: boolean;
|
|
271
|
+
} | undefined;
|
|
272
|
+
scrollByViewportDeltaVal(delta: IViewportScrollPosition, isTrigger?: boolean): {
|
|
273
|
+
viewportScrollX: number;
|
|
274
|
+
viewportScrollY: number;
|
|
240
275
|
isLimitedX: boolean;
|
|
241
276
|
isLimitedY: boolean;
|
|
242
277
|
} | undefined;
|
|
243
|
-
/**
|
|
244
|
-
*
|
|
245
|
-
* @param pos
|
|
246
|
-
* @param isTrigger
|
|
247
|
-
*/
|
|
248
|
-
scrollByBar(pos: IScrollBarPosition, isTrigger?: boolean): void;
|
|
249
|
-
scrollByViewportScroll({ deltaX, deltaY }: {
|
|
250
|
-
deltaX?: number | undefined;
|
|
251
|
-
deltaY?: number | undefined;
|
|
252
|
-
}): void;
|
|
253
278
|
/**
|
|
254
279
|
* current position plus offset relatively
|
|
255
280
|
* the caller no need to deal with the padding when frozen
|
|
256
281
|
* @param offsetX
|
|
257
282
|
* @param offsetY
|
|
258
283
|
* @param isTrigger
|
|
259
|
-
* @returns
|
|
260
284
|
*/
|
|
261
285
|
scrollByOffset(offsetX?: number, offsetY?: number, isTrigger?: boolean): {
|
|
286
|
+
scrollX: number;
|
|
287
|
+
scrollY: number;
|
|
262
288
|
isLimitedX: boolean;
|
|
263
289
|
isLimitedY: boolean;
|
|
264
290
|
} | undefined;
|
|
@@ -272,23 +298,21 @@ export declare class Viewport {
|
|
|
272
298
|
};
|
|
273
299
|
/**
|
|
274
300
|
* get actual scroll value by scrollXY
|
|
275
|
-
* @returns
|
|
276
301
|
*/
|
|
277
|
-
|
|
302
|
+
getViewportScrollByScrollXY(): {
|
|
278
303
|
x: number;
|
|
279
304
|
y: number;
|
|
280
305
|
};
|
|
281
306
|
getScrollBar(): Nullable<BaseScrollBar>;
|
|
282
|
-
|
|
307
|
+
updateScrollVal(current: Partial<IScrollObserverParam>): this;
|
|
283
308
|
getScrollBarTransForm(): Transform;
|
|
284
309
|
shouldIntoRender(): boolean;
|
|
285
310
|
/**
|
|
286
|
-
* engine.renderLoop ---> scene.render ---> layer.render ---> viewport.render
|
|
311
|
+
* call stack: engine.renderLoop ---> scene.render ---> layer.render ---> viewport.render
|
|
287
312
|
* that means each layer call all viewports to render
|
|
288
|
-
* @param parentCtx
|
|
313
|
+
* @param parentCtx parentCtx is cacheCtx from layer when layer._allowCache is true
|
|
289
314
|
* @param objects
|
|
290
315
|
* @param isMaxLayer
|
|
291
|
-
* @param isLast last viewport would
|
|
292
316
|
*/
|
|
293
317
|
render(parentCtx?: UniverRenderingContext, objects?: BaseObject[], isMaxLayer?: boolean): void;
|
|
294
318
|
private _makeDefaultViewport;
|
|
@@ -313,10 +337,24 @@ export declare class Viewport {
|
|
|
313
337
|
openClip(): void;
|
|
314
338
|
closeClip(): void;
|
|
315
339
|
dispose(): void;
|
|
316
|
-
limitedScroll(): {
|
|
340
|
+
limitedScroll(scrollX: Nullable<number>, scrollY: Nullable<number>): {
|
|
341
|
+
scrollX: number;
|
|
342
|
+
scrollY: number;
|
|
317
343
|
isLimitedX: boolean;
|
|
318
344
|
isLimitedY: boolean;
|
|
319
|
-
}
|
|
345
|
+
};
|
|
346
|
+
/**
|
|
347
|
+
* Still in working progress, do not use it now.
|
|
348
|
+
* @param viewportScrollX
|
|
349
|
+
* @param viewportScrollY
|
|
350
|
+
* @returns
|
|
351
|
+
*/
|
|
352
|
+
_limitViewportScroll(viewportScrollX: number, viewportScrollY: number): {
|
|
353
|
+
viewportScrollX: number;
|
|
354
|
+
viewportScrollY: number;
|
|
355
|
+
isLimitedX: boolean;
|
|
356
|
+
isLimitedY: boolean;
|
|
357
|
+
};
|
|
320
358
|
markDirty(state?: boolean): void;
|
|
321
359
|
get isDirty(): boolean;
|
|
322
360
|
private _isForceDirty;
|
|
@@ -328,26 +366,29 @@ export declare class Viewport {
|
|
|
328
366
|
*/
|
|
329
367
|
private _resizeCacheCanvas;
|
|
330
368
|
/**
|
|
331
|
-
* This method will be invoked
|
|
369
|
+
* This method will be invoked when viewport is resizing and removing rol & col
|
|
332
370
|
*/
|
|
333
|
-
private
|
|
371
|
+
private _updateScrollByViewportScrollValue;
|
|
334
372
|
private _getViewPortSize;
|
|
335
373
|
/**
|
|
336
374
|
* update pre scroll value has handled in updateScroll()
|
|
337
375
|
*/
|
|
338
376
|
private _afterRender;
|
|
339
|
-
private
|
|
377
|
+
private _emitScrollEnd$;
|
|
378
|
+
/**
|
|
379
|
+
*
|
|
380
|
+
* When scroll just in X direction, there is no y definition in scrollXY. So scrollXY is Partial<IScrollBarPosition>
|
|
381
|
+
* @param rawScrollXY Partial<IViewportScrollPosition>
|
|
382
|
+
* @param isTrigger
|
|
383
|
+
*/
|
|
384
|
+
private _scrollToBarPosCore;
|
|
340
385
|
/**
|
|
341
|
-
* Scroll Viewport
|
|
342
|
-
* This function called by viewMain only, other viewports will not.
|
|
343
386
|
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
346
|
-
* @param scrollType
|
|
347
|
-
* @param scrollBarPos viewMain 滚动条的位置
|
|
387
|
+
* When scroll just in X direction, there is no y definition in scrollVpPos. So scrollVpPos is Partial<IViewportScrollPosition>
|
|
388
|
+
* @param scrollVpPos Partial<IViewportScrollPosition>
|
|
348
389
|
* @param isTrigger
|
|
349
390
|
*/
|
|
350
|
-
private
|
|
391
|
+
private _scrollToViewportPosCore;
|
|
351
392
|
expandBounds(value: {
|
|
352
393
|
top: number;
|
|
353
394
|
left: number;
|