@univerjs/engine-render 0.2.11 → 0.2.13
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 +1 -19
- package/lib/es/index.js +27282 -28633
- package/lib/types/basics/interfaces.d.ts +7 -0
- package/lib/types/basics/performance-monitor.d.ts +56 -27
- package/lib/types/basics/range.d.ts +24 -14
- package/lib/types/basics/tools.d.ts +26 -5
- package/lib/types/basics/transform.d.ts +24 -24
- package/lib/types/components/docs/layout/doc-skeleton.d.ts +3 -3
- package/lib/types/components/docs/layout/line-breaker/break.d.ts +2 -1
- package/lib/types/components/docs/layout/line-breaker/enhancers/hyphen-enhancer.d.ts +1 -2
- package/lib/types/components/docs/layout/line-breaker/enhancers/link-enhancer.d.ts +15 -0
- package/lib/types/components/docs/layout/line-breaker/enhancers/utils.d.ts +18 -0
- package/lib/types/components/docs/layout/model/line.d.ts +1 -1
- package/lib/types/components/docs/layout/tools.d.ts +2 -1
- package/lib/types/components/docs/view-model/document-view-model.d.ts +1 -1
- package/lib/types/components/sheets/extensions/background.d.ts +2 -2
- package/lib/types/components/sheets/extensions/border.d.ts +2 -2
- package/lib/types/components/sheets/extensions/custom.d.ts +2 -2
- package/lib/types/components/sheets/extensions/font.d.ts +2 -11
- package/lib/types/components/sheets/extensions/marker.d.ts +1 -1
- package/lib/types/components/sheets/extensions/row-header-layout.d.ts +2 -2
- package/lib/types/components/sheets/extensions/sheet-extension.d.ts +6 -2
- package/lib/types/components/sheets/interfaces.d.ts +2 -6
- package/lib/types/components/sheets/row-header.d.ts +1 -1
- package/lib/types/components/sheets/sheet-skeleton.d.ts +28 -14
- package/lib/types/components/sheets/spreadsheet.d.ts +18 -10
- package/lib/types/components/slides/slide.d.ts +1 -1
- package/lib/types/context.d.ts +7 -0
- package/lib/types/controllers/config.schema.d.ts +20 -0
- package/lib/types/engine.d.ts +33 -12
- package/lib/types/index.d.ts +20 -27
- package/lib/types/render-engine.d.ts +6 -3
- package/lib/types/render-manager/render-manager.service.d.ts +5 -5
- package/lib/types/scene.d.ts +13 -7
- package/lib/types/scene.input-manager.d.ts +8 -2
- package/lib/types/scroll-timer.d.ts +4 -1
- package/lib/types/shape/rect.d.ts +15 -6
- package/lib/types/thin-scene.d.ts +8 -3
- package/lib/types/viewport.d.ts +25 -13
- package/lib/umd/index.js +1 -19
- package/package.json +7 -7
- package/lib/types/components/docs/text-selection/convert-rect-range.d.ts +0 -29
- package/lib/types/components/docs/text-selection/convert-text-range.d.ts +0 -65
- package/lib/types/components/docs/text-selection/range-interface.d.ts +0 -21
- package/lib/types/components/docs/text-selection/rect-range.d.ts +0 -48
- package/lib/types/components/docs/text-selection/selection-utils.d.ts +0 -27
- package/lib/types/components/docs/text-selection/text-range.d.ts +0 -68
- package/lib/types/components/docs/text-selection/text-selection-render-manager.d.ts +0 -193
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
import { BooleanNumber, DocumentDataModel, HorizontalAlign, IContextService, LocaleService, ObjectMatrix, VerticalAlign, WrapStrategy, ICellData, IColumnRange, IPaddingData, IPosition, IRange, IRowAutoHeightInfo, ISelectionCellWithMergeInfo, ISize, ITextRotation, IWorksheetData, Nullable, Styles, Worksheet } from '@univerjs/core';
|
|
2
|
-
import { IBoundRectNoAngle, IViewportInfo } from '../../basics/vector2';
|
|
1
|
+
import { BooleanNumber, DocumentDataModel, HorizontalAlign, IContextService, LocaleService, ObjectMatrix, VerticalAlign, WrapStrategy, ICellData, IColumnRange, IPaddingData, IPosition, IRange, IRowAutoHeightInfo, IRowRange, ISelectionCellWithMergeInfo, ISize, ITextRotation, IWorksheetData, Nullable, Styles, Worksheet } from '@univerjs/core';
|
|
3
2
|
import { DocumentSkeleton } from '../docs/layout/doc-skeleton';
|
|
4
3
|
import { Skeleton } from '../skeleton';
|
|
5
|
-
import {
|
|
4
|
+
import { IBoundRectNoAngle, IViewportInfo } from '../../basics/vector2';
|
|
5
|
+
import { IFontCacheItem, IStylesCache } from './interfaces';
|
|
6
6
|
/**
|
|
7
7
|
* Obtain the height and width of a cell's text, taking into account scenarios with rotated text.
|
|
8
8
|
* @param documentSkeleton Data of the document's ViewModel
|
|
9
9
|
* @param angleInDegree The rotation angle of an Excel cell, it's **degree**
|
|
10
10
|
*/
|
|
11
11
|
export declare function getDocsSkeletonPageSize(documentSkeleton: DocumentSkeleton, angleInDegree?: number): Nullable<Required<ISize>>;
|
|
12
|
-
interface
|
|
13
|
-
startRow: number;
|
|
14
|
-
endRow: number;
|
|
15
|
-
startColumn: number;
|
|
16
|
-
endColumn: number;
|
|
12
|
+
interface IRowColumnRange extends IRowRange, IColumnRange {
|
|
17
13
|
}
|
|
18
14
|
export interface IDocumentLayoutObject {
|
|
19
15
|
documentModel: Nullable<DocumentDataModel>;
|
|
@@ -53,14 +49,15 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
53
49
|
private _rowHeaderWidth;
|
|
54
50
|
private _columnHeaderHeight;
|
|
55
51
|
/**
|
|
56
|
-
*
|
|
52
|
+
* Range of visible area(range in viewBounds)
|
|
57
53
|
*/
|
|
58
54
|
private _rowColumnSegment;
|
|
59
55
|
private _dataMergeCache;
|
|
56
|
+
private _dataMergeCacheMap;
|
|
60
57
|
private _overflowCache;
|
|
61
58
|
private _stylesCache;
|
|
62
59
|
/** A matrix to store if a (row, column) position has render cache. */
|
|
63
|
-
private
|
|
60
|
+
private _cellBgAndBorderCache;
|
|
64
61
|
private _showGridlines;
|
|
65
62
|
private _marginTop;
|
|
66
63
|
private _marginLeft;
|
|
@@ -78,9 +75,9 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
78
75
|
get rowHeaderWidth(): number;
|
|
79
76
|
get columnHeaderHeight(): number;
|
|
80
77
|
/**
|
|
81
|
-
*
|
|
78
|
+
* Range of visible area(range in viewBounds)
|
|
82
79
|
*/
|
|
83
|
-
get rowColumnSegment():
|
|
80
|
+
get rowColumnSegment(): IRowColumnRange;
|
|
84
81
|
get dataMergeCache(): IRange[];
|
|
85
82
|
get stylesCache(): IStylesCache;
|
|
86
83
|
get overflowCache(): ObjectMatrix<IRange>;
|
|
@@ -102,6 +99,12 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
102
99
|
setOverflowCache(value: ObjectMatrix<IRange>): void;
|
|
103
100
|
setMarginLeft(left: number): void;
|
|
104
101
|
setMarginTop(top: number): void;
|
|
102
|
+
getFont(rowIndex: number, columnIndex: number): Nullable<IFontCacheItem>;
|
|
103
|
+
/**
|
|
104
|
+
* Get range in visible area (range in viewbounds) and set into this._rowColumnSegment.
|
|
105
|
+
* @param bounds
|
|
106
|
+
* @returns boolean
|
|
107
|
+
*/
|
|
105
108
|
calculateSegment(bounds?: IViewportInfo): boolean;
|
|
106
109
|
calculateWithoutClearingCache(bounds?: IViewportInfo): Nullable<SpreadsheetSkeleton>;
|
|
107
110
|
calculate(bounds?: IViewportInfo): Nullable<SpreadsheetSkeleton>;
|
|
@@ -236,10 +239,19 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
236
239
|
private _getOverflowBound;
|
|
237
240
|
intersectMergeRange(row: number, column: number): boolean;
|
|
238
241
|
private _calculateStylesCache;
|
|
242
|
+
/**
|
|
243
|
+
* Any changes to sheet model would reset cache.
|
|
244
|
+
*/
|
|
239
245
|
private _resetCache;
|
|
240
246
|
resetCache(): void;
|
|
241
247
|
private _makeDocumentSkeletonDirty;
|
|
242
|
-
|
|
248
|
+
/**
|
|
249
|
+
* Set border background and font to this._stylesCache { border font background }
|
|
250
|
+
* @param row {number}
|
|
251
|
+
* @param col {number}
|
|
252
|
+
* @param options {{ mergeRange: IRange; cacheItem: ICacheItem } | undefined}
|
|
253
|
+
*/
|
|
254
|
+
private _setStylesCache;
|
|
243
255
|
private _updateConfigAndGetDocumentModel;
|
|
244
256
|
private _getDocumentDataByStyle;
|
|
245
257
|
/**
|
|
@@ -250,10 +262,12 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
250
262
|
private _setBorderProps;
|
|
251
263
|
private _getFontFormat;
|
|
252
264
|
private _getOtherStyle;
|
|
265
|
+
private _getMergeCellsCache;
|
|
266
|
+
private _getCellMergeInfo;
|
|
253
267
|
/**
|
|
254
268
|
* Cache the merged cells on the current screen to improve computational performance.
|
|
255
269
|
* @param mergeData all marge data
|
|
256
|
-
* @param
|
|
270
|
+
* @param range current screen range, include row and column
|
|
257
271
|
*/
|
|
258
272
|
private _getMergeCells;
|
|
259
273
|
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { IRange } from '@univerjs/core';
|
|
2
|
+
import { Documents } from '../docs/document';
|
|
3
|
+
import { IPaintForRefresh, IPaintForScrolling, SHEET_VIEWPORT_KEY } from './interfaces';
|
|
4
|
+
import { SheetComponent } from './sheet-component';
|
|
2
5
|
import { IBoundRectNoAngle, IViewportInfo, Vector2 } from '../../basics/vector2';
|
|
3
6
|
import { Canvas } from '../../canvas';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
7
|
+
import { UniverRenderingContext2D } from '../../context';
|
|
8
|
+
import { Scene } from '../../scene';
|
|
6
9
|
import { Background } from './extensions/background';
|
|
7
10
|
import { Border } from './extensions/border';
|
|
8
11
|
import { Font } from './extensions/font';
|
|
9
|
-
import { SheetComponent } from './sheet-component';
|
|
10
12
|
import { SpreadsheetSkeleton } from './sheet-skeleton';
|
|
11
|
-
import { IPaintForRefresh, IPaintForScrolling, SHEET_VIEWPORT_KEY } from './interfaces';
|
|
12
13
|
export declare class Spreadsheet extends SheetComponent {
|
|
13
14
|
private _allowCache;
|
|
14
15
|
private _backgroundExtension;
|
|
@@ -35,7 +36,14 @@ export declare class Spreadsheet extends SheetComponent {
|
|
|
35
36
|
* @param ctx
|
|
36
37
|
* @param viewportInfo
|
|
37
38
|
*/
|
|
38
|
-
draw(ctx:
|
|
39
|
+
draw(ctx: UniverRenderingContext2D, viewportInfo: IViewportInfo): void;
|
|
40
|
+
addRenderFrameTimeMetricToScene(timeKey: string, val: number, scene: Scene): void;
|
|
41
|
+
addRenderTagToScene(renderKey: string, val: any, scene?: Scene): void;
|
|
42
|
+
/**
|
|
43
|
+
* override for return type as Scene.
|
|
44
|
+
* @returns Scene
|
|
45
|
+
*/
|
|
46
|
+
getScene(): Scene;
|
|
39
47
|
isHit(coord: Vector2): boolean;
|
|
40
48
|
getNoMergeCellPositionByIndex(rowIndex: number, columnIndex: number): {
|
|
41
49
|
startY: number;
|
|
@@ -61,13 +69,13 @@ export declare class Spreadsheet extends SheetComponent {
|
|
|
61
69
|
*/
|
|
62
70
|
makeDirty(state?: boolean): this;
|
|
63
71
|
setDirtyArea(dirtyBounds: IBoundRectNoAngle[]): void;
|
|
64
|
-
renderByViewport(mainCtx:
|
|
72
|
+
renderByViewport(mainCtx: UniverRenderingContext2D, viewportInfo: IViewportInfo, spreadsheetSkeleton: SpreadsheetSkeleton): void;
|
|
65
73
|
paintNewAreaForScrolling(viewportInfo: IViewportInfo, param: IPaintForScrolling): void;
|
|
66
74
|
/**
|
|
67
75
|
* Redraw the entire viewport.
|
|
68
76
|
*/
|
|
69
77
|
refreshCacheCanvas(viewportInfo: IViewportInfo, param: IPaintForRefresh): void;
|
|
70
|
-
render(mainCtx:
|
|
78
|
+
render(mainCtx: UniverRenderingContext2D, viewportInfo: IViewportInfo): this | undefined;
|
|
71
79
|
/**
|
|
72
80
|
* applyCache from cache canvas
|
|
73
81
|
* @param cacheCanvas Source Image
|
|
@@ -81,8 +89,8 @@ export declare class Spreadsheet extends SheetComponent {
|
|
|
81
89
|
* @param dw
|
|
82
90
|
* @param dh
|
|
83
91
|
*/
|
|
84
|
-
protected _applyCache(cacheCanvas: Canvas, ctx:
|
|
85
|
-
protected _draw(ctx:
|
|
92
|
+
protected _applyCache(cacheCanvas: Canvas, ctx: UniverRenderingContext2D, sx?: number, sy?: number, sw?: number, sh?: number, dx?: number, dy?: number, dw?: number, dh?: number): void;
|
|
93
|
+
protected _draw(ctx: UniverRenderingContext2D, bounds?: IViewportInfo): void;
|
|
86
94
|
private _getAncestorSize;
|
|
87
95
|
private _getAncestorParent;
|
|
88
96
|
private _initialDefaultExtension;
|
|
@@ -98,6 +106,6 @@ export declare class Spreadsheet extends SheetComponent {
|
|
|
98
106
|
private _clearBackground;
|
|
99
107
|
sheetContentViewport(): SHEET_VIEWPORT_KEY[];
|
|
100
108
|
sheetHeaderViewport(): SHEET_VIEWPORT_KEY[];
|
|
101
|
-
testShowRuler(cacheCtx:
|
|
109
|
+
testShowRuler(cacheCtx: UniverRenderingContext2D, viewportInfo: IViewportInfo): void;
|
|
102
110
|
testGetRandomLightColor(): string;
|
|
103
111
|
}
|
|
@@ -17,7 +17,7 @@ export declare class Slide extends SceneViewer {
|
|
|
17
17
|
*/
|
|
18
18
|
addPageScene(pageScene: Scene): void;
|
|
19
19
|
changePage(id?: string): void;
|
|
20
|
-
hasPage(key: string): import('
|
|
20
|
+
hasPage(key: string): import('../..').ThinScene | undefined;
|
|
21
21
|
addNavigation(): void;
|
|
22
22
|
removeNavigation(): void;
|
|
23
23
|
enableNav(): void;
|
package/lib/types/context.d.ts
CHANGED
|
@@ -15,9 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class UniverRenderingContext2D implements CanvasRenderingContext2D {
|
|
17
17
|
__mode: string;
|
|
18
|
+
private _system;
|
|
19
|
+
private _browser;
|
|
18
20
|
readonly canvas: HTMLCanvasElement;
|
|
19
21
|
_context: CanvasRenderingContext2D;
|
|
22
|
+
private _systemType;
|
|
23
|
+
private _browserType;
|
|
20
24
|
constructor(context: CanvasRenderingContext2D);
|
|
25
|
+
isContextLost(): boolean;
|
|
21
26
|
get globalAlpha(): number;
|
|
22
27
|
set globalAlpha(val: number);
|
|
23
28
|
get globalCompositeOperation(): GlobalCompositeOperation;
|
|
@@ -151,6 +156,8 @@ export declare class UniverRenderingContext2D implements CanvasRenderingContext2
|
|
|
151
156
|
* @method
|
|
152
157
|
*/
|
|
153
158
|
closePath(): void;
|
|
159
|
+
getSystemType(): string;
|
|
160
|
+
getBrowserType(): string;
|
|
154
161
|
/**
|
|
155
162
|
* Chrome hardware acceleration causes canvas stroke to fail to draw lines on Mac.
|
|
156
163
|
*/
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Inc.
|
|
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
|
+
*/
|
|
16
|
+
export declare const PLUGIN_CONFIG_KEY = "engine-render.config";
|
|
17
|
+
export declare const configSymbol: unique symbol;
|
|
18
|
+
export interface IUniverEngineRenderConfig {
|
|
19
|
+
}
|
|
20
|
+
export declare const defaultPluginConfig: IUniverEngineRenderConfig;
|
package/lib/types/engine.d.ts
CHANGED
|
@@ -1,22 +1,33 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { CURSOR_TYPE } from './basics/const';
|
|
1
|
+
import { Observable, Subject } from 'rxjs';
|
|
3
2
|
import { Canvas, CanvasRenderMode } from './canvas';
|
|
4
|
-
import { Scene } from './scene';
|
|
5
3
|
import { ThinEngine } from './thin-engine';
|
|
4
|
+
import { CURSOR_TYPE } from './basics/const';
|
|
5
|
+
import { ITimeMetric } from './basics/interfaces';
|
|
6
|
+
import { IBasicFrameInfo } from './basics/performance-monitor';
|
|
7
|
+
import { Scene } from './scene';
|
|
6
8
|
export declare class Engine extends ThinEngine<Scene> {
|
|
7
9
|
renderEvenInBackground: boolean;
|
|
8
10
|
private readonly _beginFrame$;
|
|
9
|
-
readonly beginFrame$: Observable<
|
|
11
|
+
readonly beginFrame$: Observable<number>;
|
|
10
12
|
private readonly _endFrame$;
|
|
11
|
-
readonly endFrame$: Observable<
|
|
13
|
+
readonly endFrame$: Observable<IBasicFrameInfo>;
|
|
14
|
+
readonly renderFrameTimeMetric$: Subject<ITimeMetric>;
|
|
15
|
+
readonly renderFrameTags$: Subject<[string, any]>;
|
|
16
|
+
/**
|
|
17
|
+
* time when render start, for elapsedTime
|
|
18
|
+
*/
|
|
19
|
+
private _renderStartTime;
|
|
12
20
|
private _rect$;
|
|
13
21
|
get clientRect$(): Observable<void>;
|
|
14
22
|
private _container;
|
|
15
23
|
private _canvas;
|
|
16
24
|
private _renderingQueueLaunched;
|
|
17
|
-
private
|
|
25
|
+
private _renderFrameTasks;
|
|
18
26
|
private _renderFunction;
|
|
19
27
|
private _requestNewFrameHandler;
|
|
28
|
+
/**
|
|
29
|
+
* frameCount
|
|
30
|
+
*/
|
|
20
31
|
private _frameId;
|
|
21
32
|
private _usingSafari;
|
|
22
33
|
private _resizeObserver;
|
|
@@ -44,6 +55,8 @@ export declare class Engine extends ThinEngine<Scene> {
|
|
|
44
55
|
private _previousWidth;
|
|
45
56
|
private _previousHeight;
|
|
46
57
|
constructor(elemWidth?: number, elemHeight?: number, pixelRatio?: number, mode?: CanvasRenderMode);
|
|
58
|
+
_init(): void;
|
|
59
|
+
get elapsedTime(): number;
|
|
47
60
|
get width(): number;
|
|
48
61
|
get height(): number;
|
|
49
62
|
get requestNewFrameHandler(): number;
|
|
@@ -70,8 +83,10 @@ export declare class Engine extends ThinEngine<Scene> {
|
|
|
70
83
|
*/
|
|
71
84
|
resizeBySize(width: number, height: number): void;
|
|
72
85
|
dispose(): void;
|
|
86
|
+
addFunction2RenderLoop(renderFunction: () => void): void;
|
|
87
|
+
startRenderLoop(): void;
|
|
73
88
|
/**
|
|
74
|
-
* Register and execute a render loop. The engine
|
|
89
|
+
* Register and execute a render loop. The engine could manage more than one render function
|
|
75
90
|
* @param renderFunction defines the function to continuously execute
|
|
76
91
|
*/
|
|
77
92
|
runRenderLoop(renderFunction: () => void): void;
|
|
@@ -83,11 +98,11 @@ export declare class Engine extends ThinEngine<Scene> {
|
|
|
83
98
|
/**
|
|
84
99
|
* Begin a new frame
|
|
85
100
|
*/
|
|
86
|
-
|
|
101
|
+
_beginFrame(_timestamp: number): void;
|
|
87
102
|
/**
|
|
88
103
|
* End the current frame
|
|
89
104
|
*/
|
|
90
|
-
|
|
105
|
+
_endFrame(timestamp: number): void;
|
|
91
106
|
/**
|
|
92
107
|
* Gets the current framerate
|
|
93
108
|
* @returns a number representing the framerate
|
|
@@ -98,11 +113,17 @@ export declare class Engine extends ThinEngine<Scene> {
|
|
|
98
113
|
* @returns a number representing the delta time in ms
|
|
99
114
|
*/
|
|
100
115
|
getDeltaTime(): number;
|
|
101
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Exec all function in _renderFrameTasks
|
|
118
|
+
*/
|
|
119
|
+
private _renderFrame;
|
|
102
120
|
private _cancelFrame;
|
|
103
121
|
private _getHostWindow;
|
|
104
|
-
|
|
105
|
-
|
|
122
|
+
/**
|
|
123
|
+
* call itself by raf
|
|
124
|
+
* Exec all function in _renderFrameTasks in _renderFrame()
|
|
125
|
+
*/
|
|
126
|
+
private _renderFunctionCore;
|
|
106
127
|
private _handleKeyboardAction;
|
|
107
128
|
private _handlePointerAction;
|
|
108
129
|
private _handleDragAction;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -15,43 +15,36 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export * from './base-object';
|
|
17
17
|
export * from './basics';
|
|
18
|
+
export { getOffsetRectForDom } from './basics/position';
|
|
18
19
|
export * from './canvas';
|
|
19
20
|
export * from './components';
|
|
21
|
+
export { DocBackground } from './components/docs/doc-background';
|
|
22
|
+
export { Documents } from './components/docs/document';
|
|
23
|
+
export type { IPageRenderConfig } from './components/docs/document';
|
|
24
|
+
export type { IDocumentOffsetConfig } from './components/docs/document';
|
|
25
|
+
export { getTableIdAndSliceIndex } from './components/docs/layout/block/table';
|
|
26
|
+
export { DocumentSkeleton } from './components/docs/layout/doc-skeleton';
|
|
27
|
+
export type { IFindNodeRestrictions } from './components/docs/layout/doc-skeleton';
|
|
28
|
+
export { getCharSpaceApply, getLastLine, getNumberUnitValue, getPageFromPath, glyphIterator, lineIterator } from './components/docs/layout/tools';
|
|
29
|
+
export { Liquid } from './components/docs/liquid';
|
|
30
|
+
export { DataStreamTreeNode } from './components/docs/view-model/data-stream-tree-node';
|
|
31
|
+
export { DocumentViewModel } from './components/docs/view-model/document-view-model';
|
|
32
|
+
export { DocumentEditArea } from './components/docs/view-model/document-view-model';
|
|
33
|
+
export { parseDataStreamToTree } from './components/docs/view-model/document-view-model';
|
|
34
|
+
export { DEFAULT_PADDING_DATA } from './components/sheets/sheet-skeleton';
|
|
20
35
|
export * from './context';
|
|
21
36
|
export * from './custom';
|
|
22
37
|
export * from './engine';
|
|
23
38
|
export * from './group';
|
|
24
39
|
export * from './layer';
|
|
25
40
|
export { IRenderingEngine, UniverRenderEnginePlugin } from './render-engine';
|
|
26
|
-
export { type RenderComponentType,
|
|
27
|
-
export {
|
|
41
|
+
export { IRenderManagerService, type RenderComponentType, RenderManagerService } from './render-manager/render-manager.service';
|
|
42
|
+
export { type IRender, type IRenderContext, type IRenderModule, RenderUnit } from './render-manager/render-unit';
|
|
28
43
|
export * from './scene';
|
|
44
|
+
export { type IChangeObserverConfig } from './scene.transformer';
|
|
29
45
|
export * from './scene-viewer';
|
|
30
46
|
export * from './scroll-timer';
|
|
31
47
|
export * from './shape';
|
|
32
|
-
export * from './viewport';
|
|
33
|
-
export { DocumentViewModel } from './components/docs/view-model/document-view-model';
|
|
34
|
-
export { getAnchorBounding, TEXT_RANGE_LAYER_INDEX, TextRange, getLineBounding } from './components/docs/text-selection/text-range';
|
|
35
|
-
export { RectRange, convertPositionsToRectRanges } from './components/docs/text-selection/rect-range';
|
|
36
|
-
export { NodePositionConvertToCursor } from './components/docs/text-selection/convert-text-range';
|
|
37
|
-
export { Liquid } from './components/docs/liquid';
|
|
38
|
-
export { getCanvasOffsetByEngine } from './components/docs/text-selection/selection-utils';
|
|
39
|
-
export { ITextSelectionRenderManager, TextSelectionRenderManager, } from './components/docs/text-selection/text-selection-render-manager';
|
|
40
|
-
export type { IActiveTextRange, IEditorInputConfig, ITextSelectionInnerParam } from './components/docs/text-selection/text-selection-render-manager';
|
|
41
|
-
export { Documents } from './components/docs/document';
|
|
42
|
-
export { DocBackground } from './components/docs/doc-background';
|
|
43
|
-
export type { IPageRenderConfig } from './components/docs/document';
|
|
44
|
-
export { DocumentSkeleton } from './components/docs/layout/doc-skeleton';
|
|
45
48
|
export { ThinEngine } from './thin-engine';
|
|
46
|
-
export {
|
|
47
|
-
export
|
|
48
|
-
export { DEFAULT_PADDING_DATA } from './components/sheets/sheet-skeleton';
|
|
49
|
-
export { DocumentEditArea } from './components/docs/view-model/document-view-model';
|
|
50
|
-
export { lineIterator, glyphIterator } from './components/docs/layout/tools';
|
|
51
|
-
export { getOneTextSelectionRange } from './components/docs/text-selection/convert-text-range';
|
|
52
|
-
export { getLastLine } from './components/docs/layout/tools';
|
|
53
|
-
export { DataStreamTreeNode } from './components/docs/view-model/data-stream-tree-node';
|
|
54
|
-
export type { IDocRange } from './components/docs/text-selection/range-interface';
|
|
55
|
-
export { isInSameTableCell, isValidRectRange, NodePositionConvertToRectRange } from './components/docs/text-selection/convert-rect-range';
|
|
56
|
-
export { parseDataStreamToTree } from './components/docs/view-model/document-view-model';
|
|
57
|
-
export { DOC_RANGE_TYPE } from './components/docs/text-selection/range-interface';
|
|
49
|
+
export { ThinScene } from './thin-scene';
|
|
50
|
+
export * from './viewport';
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { Injector, Plugin } from '@univerjs/core';
|
|
1
|
+
import { IConfigService, Injector, Plugin } from '@univerjs/core';
|
|
2
2
|
import { Engine } from './engine';
|
|
3
|
+
import { IUniverEngineRenderConfig } from './controllers/config.schema';
|
|
3
4
|
/**
|
|
4
5
|
* The global rendering engine.
|
|
5
6
|
*/
|
|
6
|
-
export declare const IRenderingEngine: import('@
|
|
7
|
+
export declare const IRenderingEngine: import('@wendellhu/redi').IdentifierDecorator<Engine>;
|
|
7
8
|
export declare class UniverRenderEnginePlugin extends Plugin {
|
|
9
|
+
private readonly _config;
|
|
8
10
|
readonly _injector: Injector;
|
|
11
|
+
private readonly _configService;
|
|
9
12
|
static pluginName: string;
|
|
10
|
-
constructor(_config: undefined, _injector: Injector);
|
|
13
|
+
constructor(_config: Partial<IUniverEngineRenderConfig> | undefined, _injector: Injector, _configService: IConfigService);
|
|
11
14
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Disposable, Injector, IUniverInstanceService, UniverInstanceType, Dependency, DependencyIdentifier, IDisposable, Nullable, UnitModel, UnitType } from '@univerjs/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { Engine } from '../engine';
|
|
4
|
+
import { IRender, RenderUnit } from './render-unit';
|
|
3
5
|
import { BaseObject } from '../base-object';
|
|
4
6
|
import { DocComponent } from '../components/docs/doc-component';
|
|
5
7
|
import { SheetComponent } from '../components/sheets/sheet-component';
|
|
6
8
|
import { Slide } from '../components/slides/slide';
|
|
7
|
-
import { Engine } from '../engine';
|
|
8
|
-
import { IRender, RenderUnit } from './render-unit';
|
|
9
9
|
export type RenderComponentType = SheetComponent | DocComponent | Slide | BaseObject;
|
|
10
10
|
export interface IRenderManagerService extends IDisposable {
|
|
11
11
|
/** @deprecated */
|
|
@@ -102,7 +102,7 @@ export declare class RenderManagerService extends Disposable implements IRenderM
|
|
|
102
102
|
* @param isMainScene
|
|
103
103
|
* @returns renderUnit:IRender
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
protected _createRender(unitId: string, engine: Engine, isMainScene?: boolean): IRender;
|
|
106
106
|
addRender(unitId: string, renderUnit: IRender): void;
|
|
107
107
|
private _addRenderUnit;
|
|
108
108
|
removeRender(unitId: string): void;
|
|
@@ -119,5 +119,5 @@ export declare class RenderManagerService extends Disposable implements IRenderM
|
|
|
119
119
|
getRenderAll(): Map<string, IRender>;
|
|
120
120
|
private _disposeItem;
|
|
121
121
|
}
|
|
122
|
-
export declare const IRenderManagerService: import('@
|
|
122
|
+
export declare const IRenderManagerService: import('@wendellhu/redi').IdentifierDecorator<IRenderManagerService>;
|
|
123
123
|
export declare function isDisposable(thing: unknown): thing is IDisposable;
|
package/lib/types/scene.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Nullable } from '@univerjs/core';
|
|
2
|
-
import { BaseObject } from './base-object';
|
|
3
2
|
import { CURSOR_TYPE } from './basics/const';
|
|
3
|
+
import { Layer } from './layer';
|
|
4
|
+
import { Transformer } from './scene.transformer';
|
|
5
|
+
import { ThinScene } from './thin-scene';
|
|
6
|
+
import { BaseObject } from './base-object';
|
|
4
7
|
import { IDragEvent, IKeyboardEvent, IMouseEvent, IPointerEvent, IWheelEvent } from './basics/i-events';
|
|
5
8
|
import { ISceneTransformState } from './basics/interfaces';
|
|
9
|
+
import { ITransformerConfig } from './basics/transformer-config';
|
|
6
10
|
import { Vector2 } from './basics/vector2';
|
|
7
11
|
import { UniverRenderingContext } from './context';
|
|
8
|
-
import {
|
|
9
|
-
import { Transformer } from './scene.transformer';
|
|
12
|
+
import { Engine } from './engine';
|
|
10
13
|
import { SceneViewer } from './scene-viewer';
|
|
11
14
|
import { ThinEngine } from './thin-engine';
|
|
12
|
-
import { ThinScene } from './thin-scene';
|
|
13
15
|
import { Viewport } from './viewport';
|
|
14
|
-
import { ITransformerConfig } from './basics/transformer-config';
|
|
15
|
-
import { Engine } from './engine';
|
|
16
16
|
export declare class Scene extends ThinScene {
|
|
17
17
|
private _parent;
|
|
18
18
|
private _layers;
|
|
@@ -68,6 +68,7 @@ export declare class Scene extends ThinScene {
|
|
|
68
68
|
getEngine(): Nullable<Engine>;
|
|
69
69
|
getLayers(): Layer[];
|
|
70
70
|
getLayer(zIndex?: number): Layer;
|
|
71
|
+
findLayerByZIndex(zIndex?: number): Nullable<Layer>;
|
|
71
72
|
getLayerMaxZIndex(): number;
|
|
72
73
|
addLayer(...argument: Layer[]): void;
|
|
73
74
|
/**
|
|
@@ -173,7 +174,12 @@ export declare class Scene extends ThinScene {
|
|
|
173
174
|
scaleY: number;
|
|
174
175
|
};
|
|
175
176
|
dispose(): void;
|
|
176
|
-
|
|
177
|
+
/**
|
|
178
|
+
* Get the object under the pointer, if scene.event is disabled, the object is null.
|
|
179
|
+
* @param {Vector2} coord
|
|
180
|
+
* @return {Nullable<BaseObject | Scene | ThinScene>} object under the pointer
|
|
181
|
+
*/
|
|
182
|
+
pick(coord: Vector2): Nullable<BaseObject | Scene | ThinScene>;
|
|
177
183
|
triggerKeyDown(evt: IKeyboardEvent): void;
|
|
178
184
|
triggerKeyUp(evt: IKeyboardEvent): void;
|
|
179
185
|
triggerPointerUp(evt: IPointerEvent | IMouseEvent): boolean;
|
|
@@ -11,6 +11,7 @@ export declare class InputManager extends Disposable {
|
|
|
11
11
|
static TripleClickDelay: number;
|
|
12
12
|
/** If you need to check double click without raising a single click at first click, enable this flag */
|
|
13
13
|
static ExclusiveDoubleClickMode: boolean;
|
|
14
|
+
private _scene;
|
|
14
15
|
/** This is a defensive check to not allow control attachment prior to an already active one. If already attached, previous control is unattached before attaching the new one. */
|
|
15
16
|
private _alreadyAttached;
|
|
16
17
|
private _onInput$;
|
|
@@ -28,7 +29,6 @@ export declare class InputManager extends Disposable {
|
|
|
28
29
|
private _onDragLeave;
|
|
29
30
|
private _onDragOver;
|
|
30
31
|
private _onDrop;
|
|
31
|
-
private _scene;
|
|
32
32
|
private _currentMouseEnterPicked;
|
|
33
33
|
private _startingPosition;
|
|
34
34
|
private _delayedTimeout;
|
|
@@ -48,7 +48,13 @@ export declare class InputManager extends Disposable {
|
|
|
48
48
|
* Detaches all event handlers
|
|
49
49
|
*/
|
|
50
50
|
detachControl(): void;
|
|
51
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Just call this._scene?.pick, nothing special.
|
|
53
|
+
* @param offsetX
|
|
54
|
+
* @param offsetY
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
private _getObjectAtPos;
|
|
52
58
|
private _checkDirectSceneEventTrigger;
|
|
53
59
|
/**
|
|
54
60
|
* @hidden
|
|
@@ -19,6 +19,9 @@ export declare class ScrollTimer {
|
|
|
19
19
|
private _moveY;
|
|
20
20
|
private _scrollX;
|
|
21
21
|
private _scrollY;
|
|
22
|
+
/**
|
|
23
|
+
* Custmize scroll function.
|
|
24
|
+
*/
|
|
22
25
|
private _scrollFunction;
|
|
23
26
|
constructor(_scene: Scene, _scrollTimerType?: ScrollTimerType, _padding?: IPaddingData | undefined);
|
|
24
27
|
static create(scene: any, scrollTimerType?: ScrollTimerType, padding?: IPaddingData): ScrollTimer;
|
|
@@ -27,7 +30,7 @@ export declare class ScrollTimer {
|
|
|
27
30
|
setActiveViewport(viewport: Viewport): void;
|
|
28
31
|
getActiveViewport(): any;
|
|
29
32
|
startScroll(offsetX: number, offsetY: number, targetViewport?: any): void;
|
|
30
|
-
private
|
|
33
|
+
private _autoScroll;
|
|
31
34
|
scrolling(offsetX: number, offsetY: number, scrollFunction: (x?: number, y?: number) => void): void;
|
|
32
35
|
stopScroll(): void;
|
|
33
36
|
dispose(): void;
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IViewportInfo } from '../basics/vector2';
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
3
2
|
import { ObjectType } from '../base-object';
|
|
4
|
-
import {
|
|
3
|
+
import { Shape, IShapeProps } from './shape';
|
|
4
|
+
import { UniverRenderingContext } from '../context';
|
|
5
5
|
export interface IRectProps extends IShapeProps {
|
|
6
6
|
radius?: number;
|
|
7
|
+
visualHeight?: number;
|
|
8
|
+
visualWidth?: number;
|
|
7
9
|
}
|
|
8
10
|
export declare const RECT_OBJECT_ARRAY: string[];
|
|
9
11
|
export declare class Rect<T extends IRectProps = IRectProps> extends Shape<T> {
|
|
10
|
-
private _radius;
|
|
11
12
|
objectType: ObjectType;
|
|
13
|
+
private _radius;
|
|
14
|
+
/**
|
|
15
|
+
* For rendering, in many case object size is bigger than visual size for better user interaction.
|
|
16
|
+
*/
|
|
17
|
+
private _visualHeight;
|
|
18
|
+
private _visualWidth;
|
|
12
19
|
constructor(key?: string, props?: T);
|
|
20
|
+
get visualHeight(): Nullable<number>;
|
|
21
|
+
get visualWidth(): Nullable<number>;
|
|
13
22
|
get radius(): number;
|
|
14
|
-
static drawWith(ctx: UniverRenderingContext, props: IRectProps
|
|
23
|
+
static drawWith(ctx: UniverRenderingContext, props: IRectProps): void;
|
|
15
24
|
toJson(): {
|
|
16
25
|
[x: string]: any;
|
|
17
26
|
};
|
|
18
|
-
protected _draw(ctx: UniverRenderingContext
|
|
27
|
+
protected _draw(ctx: UniverRenderingContext): void;
|
|
19
28
|
}
|
|
@@ -43,14 +43,19 @@ export declare abstract class ThinScene extends Disposable {
|
|
|
43
43
|
get scaleX(): number;
|
|
44
44
|
get scaleY(): number;
|
|
45
45
|
get sceneKey(): string;
|
|
46
|
-
get
|
|
46
|
+
get objectsEvented(): boolean;
|
|
47
47
|
set transform(trans: Transform);
|
|
48
48
|
set width(num: number);
|
|
49
49
|
set height(num: number);
|
|
50
50
|
set scaleX(scaleX: number);
|
|
51
51
|
set scaleY(scaleY: number);
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
enableObjectsEvent(): void;
|
|
53
|
+
/**
|
|
54
|
+
* If scene.event is disabled, scene.pick(curosrPos) return null.
|
|
55
|
+
* Then only scene itself can response to pointer event, all objects under the scene would not.
|
|
56
|
+
* see sceneInputManager@_onPointerMove
|
|
57
|
+
*/
|
|
58
|
+
disableObjectsEvent(): void;
|
|
54
59
|
triggerKeyDown(evt: IKeyboardEvent): void;
|
|
55
60
|
triggerKeyUp(evt: IKeyboardEvent): void;
|
|
56
61
|
abstract triggerPointerUp(evt: IPointerEvent | IMouseEvent): void;
|