@univerjs/engine-render 0.1.0-alpha.2 → 0.1.0-alpha.3
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/README.md +1 -1
- package/lib/cjs/index.js +3 -3
- package/lib/es/index.js +6453 -5083
- package/lib/types/base-object.d.ts +6 -5
- package/lib/types/basics/const.d.ts +1 -153
- package/lib/types/basics/range.d.ts +5 -0
- package/lib/types/basics/tools.d.ts +4 -3
- package/lib/types/basics/vector2.d.ts +8 -0
- package/lib/types/components/component.d.ts +7 -7
- package/lib/types/components/docs/block/paragraph/bullet.d.ts +1 -1
- package/lib/types/components/docs/block/paragraph/language-ruler.d.ts +17 -8
- package/lib/types/components/docs/common/range.d.ts +2 -2
- package/lib/types/components/docs/doc-component.d.ts +6 -10
- package/lib/types/components/docs/doc-extension.d.ts +2 -1
- package/lib/types/components/docs/doc-skeleton.d.ts +2 -2
- package/lib/types/components/docs/document.d.ts +3 -4
- package/lib/types/components/docs/text-selection-render-manager.d.ts +26 -24
- package/lib/types/components/extension.d.ts +2 -2
- package/lib/types/components/sheets/column-header.d.ts +2 -2
- 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/font.d.ts +2 -2
- package/lib/types/components/sheets/extensions/index.d.ts +0 -1
- package/lib/types/components/sheets/extensions/sheet-extension.d.ts +4 -1
- package/lib/types/components/sheets/interfaces.d.ts +2 -1
- package/lib/types/components/sheets/row-header.d.ts +2 -2
- package/lib/types/components/sheets/sheet-component.d.ts +8 -8
- package/lib/types/components/sheets/sheet-skeleton.d.ts +28 -10
- package/lib/types/components/sheets/spreadsheet.d.ts +18 -16
- package/lib/types/custom/custom-object.d.ts +2 -2
- package/lib/types/engine.d.ts +3 -3
- package/lib/types/group.d.ts +2 -2
- package/lib/types/layer.d.ts +14 -2
- package/lib/types/scene-viewer.d.ts +2 -2
- package/lib/types/scene.d.ts +3 -4
- package/lib/types/shape/rich-text.d.ts +2 -5
- package/lib/types/shape/shape.d.ts +2 -10
- package/lib/types/thin-scene.d.ts +3 -2
- package/lib/types/viewport.d.ts +11 -10
- package/lib/umd/index.js +3 -3
- package/package.json +8 -7
- package/lib/types/components/sheets/extensions/border-auxiliary.d.ts +0 -27
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { IColorStyle, IScale } from '@univerjs/core';
|
|
16
|
+
import type { IColorStyle, IRange, IScale } from '@univerjs/core';
|
|
17
17
|
import { ObjectMatrix } from '@univerjs/core';
|
|
18
18
|
import type { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
19
19
|
import { SheetExtension } from './sheet-extension';
|
|
@@ -23,7 +23,7 @@ export declare class Font extends SheetExtension {
|
|
|
23
23
|
changeFontColor: ObjectMatrix<IColorStyle>;
|
|
24
24
|
getDocuments(): any;
|
|
25
25
|
setChangeFontColor(r: number, c: number, color: IColorStyle): void;
|
|
26
|
-
draw(ctx: CanvasRenderingContext2D, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton): void;
|
|
26
|
+
draw(ctx: CanvasRenderingContext2D, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges?: IRange[]): void;
|
|
27
27
|
private _renderDocuments;
|
|
28
28
|
private _clipRectangle;
|
|
29
29
|
}
|
|
@@ -19,7 +19,10 @@ import type { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
|
19
19
|
export declare enum SHEET_EXTENSION_TYPE {
|
|
20
20
|
GRID = 0
|
|
21
21
|
}
|
|
22
|
-
export declare class SheetExtension extends ComponentExtension<SpreadsheetSkeleton, SHEET_EXTENSION_TYPE> {
|
|
22
|
+
export declare class SheetExtension extends ComponentExtension<SpreadsheetSkeleton, SHEET_EXTENSION_TYPE, IRange[]> {
|
|
23
23
|
type: SHEET_EXTENSION_TYPE;
|
|
24
24
|
getCellIndex(rowIndex: number, columnIndex: number, rowHeightAccumulation: number[], columnWidthAccumulation: number[], dataMergeCache: IRange[]): import("@univerjs/core").ISelectionCellWithCoord;
|
|
25
|
+
isRenderDiffRangesByCell(row: number, column: number, diffRanges?: IRange[]): boolean;
|
|
26
|
+
isRenderDiffRangesByColumn(column: number, diffRanges?: IRange[]): boolean;
|
|
27
|
+
isRenderDiffRangesByRow(row: number, diffRanges?: IRange[]): boolean;
|
|
25
28
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { BorderStyleTypes, HorizontalAlign, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
16
|
+
import type { BorderStyleTypes, HorizontalAlign, ISelectionCellWithCoord, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
17
17
|
import type { BORDER_TYPE } from '../../basics/const';
|
|
18
18
|
import type { DocumentSkeleton } from '../docs/doc-skeleton';
|
|
19
19
|
export interface BorderCache {
|
|
@@ -39,6 +39,7 @@ interface fontCache {
|
|
|
39
39
|
}
|
|
40
40
|
export interface IStylesCache {
|
|
41
41
|
background?: backgroundCache;
|
|
42
|
+
backgroundPositions?: ObjectMatrix<ISelectionCellWithCoord>;
|
|
42
43
|
font?: fontCache;
|
|
43
44
|
border?: ObjectMatrix<BorderCache>;
|
|
44
45
|
}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type {
|
|
16
|
+
import type { IViewportBound, Vector2 } from '../../basics/vector2';
|
|
17
17
|
import type { RowHeaderLayout } from './extensions/row-header-layout';
|
|
18
18
|
import { SpreadsheetHeader } from './sheet-component';
|
|
19
19
|
import type { SpreadsheetSkeleton } from './sheet-skeleton';
|
|
@@ -21,7 +21,7 @@ export declare class SpreadsheetRowHeader extends SpreadsheetHeader {
|
|
|
21
21
|
private _rowHeaderLayoutExtension;
|
|
22
22
|
constructor(oKey: string, spreadsheetSkeleton?: SpreadsheetSkeleton);
|
|
23
23
|
get rowHeaderLayoutExtension(): RowHeaderLayout;
|
|
24
|
-
draw(ctx: CanvasRenderingContext2D, bounds?:
|
|
24
|
+
draw(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
|
|
25
25
|
isHit(coord: Vector2): boolean;
|
|
26
26
|
private _initialDefaultExtension;
|
|
27
27
|
}
|
|
@@ -13,20 +13,20 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type { Nullable } from '@univerjs/core';
|
|
17
|
-
import type {
|
|
16
|
+
import type { IRange, Nullable } from '@univerjs/core';
|
|
17
|
+
import type { IViewportBound, Vector2 } from '../../basics/vector2';
|
|
18
18
|
import { RenderComponent } from '../component';
|
|
19
19
|
import type { SHEET_EXTENSION_TYPE } from './extensions/sheet-extension';
|
|
20
20
|
import type { SpreadsheetSkeleton } from './sheet-skeleton';
|
|
21
|
-
export declare class SheetComponent extends RenderComponent<SpreadsheetSkeleton, SHEET_EXTENSION_TYPE> {
|
|
21
|
+
export declare class SheetComponent extends RenderComponent<SpreadsheetSkeleton, SHEET_EXTENSION_TYPE, IRange[]> {
|
|
22
22
|
private _skeleton?;
|
|
23
23
|
constructor(oKey: string, _skeleton?: SpreadsheetSkeleton | undefined);
|
|
24
24
|
getSkeleton(): SpreadsheetSkeleton | undefined;
|
|
25
25
|
updateSkeleton(spreadsheetSkeleton: SpreadsheetSkeleton): void;
|
|
26
|
-
render(mainCtx: CanvasRenderingContext2D, bounds?:
|
|
26
|
+
render(mainCtx: CanvasRenderingContext2D, bounds?: IViewportBound): this | undefined;
|
|
27
27
|
getParentScale(): {
|
|
28
|
-
scaleX:
|
|
29
|
-
scaleY:
|
|
28
|
+
scaleX: number;
|
|
29
|
+
scaleY: number;
|
|
30
30
|
};
|
|
31
31
|
getDocuments(): any;
|
|
32
32
|
getNoMergeCellPositionByIndex(rowIndex: number, columnIndex: number): Nullable<{
|
|
@@ -45,8 +45,8 @@ export declare class SheetComponent extends RenderComponent<SpreadsheetSkeleton,
|
|
|
45
45
|
endRow: number;
|
|
46
46
|
endColumn: number;
|
|
47
47
|
}>;
|
|
48
|
-
protected _draw(ctx: CanvasRenderingContext2D, bounds?:
|
|
48
|
+
protected _draw(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
|
|
49
49
|
}
|
|
50
50
|
export declare class SpreadsheetHeader extends SheetComponent {
|
|
51
|
-
protected _draw(ctx: CanvasRenderingContext2D, bounds?:
|
|
51
|
+
protected _draw(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
|
|
52
52
|
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { ICellData, IPaddingData, IRange, ISelectionCellWithCoord, ITextRotation, IWorksheetData, LocaleService, Nullable, Styles, Worksheet } from '@univerjs/core';
|
|
17
17
|
import { BooleanNumber, DocumentDataModel, HorizontalAlign, ObjectMatrix, VerticalAlign, WrapStrategy } from '@univerjs/core';
|
|
18
|
-
import type {
|
|
18
|
+
import type { IBoundRectNoAngle, IViewportBound } from '../../basics/vector2';
|
|
19
19
|
import { DocumentSkeleton } from '../docs/doc-skeleton';
|
|
20
20
|
import { Skeleton } from '../skeleton';
|
|
21
21
|
import type { IStylesCache } from './interfaces';
|
|
@@ -68,7 +68,7 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
68
68
|
private _showGridlines;
|
|
69
69
|
private _marginTop;
|
|
70
70
|
private _marginLeft;
|
|
71
|
-
constructor(_worksheet: Worksheet | undefined, _config: IWorksheetData, _cellData: ObjectMatrix<ICellData
|
|
71
|
+
constructor(_worksheet: Worksheet | undefined, _config: IWorksheetData, _cellData: ObjectMatrix<Nullable<ICellData>>, _styles: Styles, _localeService: LocaleService);
|
|
72
72
|
get rowHeightAccumulation(): number[];
|
|
73
73
|
get rowTotalHeight(): number;
|
|
74
74
|
get columnWidthAccumulation(): number[];
|
|
@@ -91,7 +91,7 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
91
91
|
* @param LocaleService
|
|
92
92
|
* @returns
|
|
93
93
|
*/
|
|
94
|
-
static create(worksheet: Worksheet | undefined, config: IWorksheetData, cellData: ObjectMatrix<ICellData
|
|
94
|
+
static create(worksheet: Worksheet | undefined, config: IWorksheetData, cellData: ObjectMatrix<Nullable<ICellData>>, styles: Styles, LocaleService: LocaleService): SpreadsheetSkeleton;
|
|
95
95
|
/**
|
|
96
96
|
* @deprecated should never expose a property that is provided by another module!
|
|
97
97
|
* @returns
|
|
@@ -101,7 +101,7 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
101
101
|
* @deprecated should never expose a property that is provided by another module!
|
|
102
102
|
* @returns
|
|
103
103
|
*/
|
|
104
|
-
getCellData(): ObjectMatrix<ICellData
|
|
104
|
+
getCellData(): ObjectMatrix<Nullable<ICellData>>;
|
|
105
105
|
/**
|
|
106
106
|
* @deprecated should never expose a property that is provided by another module!
|
|
107
107
|
* @returns
|
|
@@ -110,13 +110,19 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
110
110
|
setOverflowCache(value: ObjectMatrix<IRange>): void;
|
|
111
111
|
setMarginLeft(left: number): void;
|
|
112
112
|
setMarginTop(top: number): void;
|
|
113
|
-
calculateSegment(bounds?:
|
|
114
|
-
calculateWithoutClearingCache(bounds?:
|
|
115
|
-
calculate(bounds?:
|
|
113
|
+
calculateSegment(bounds?: IViewportBound): true | undefined;
|
|
114
|
+
calculateWithoutClearingCache(bounds?: IViewportBound): this | undefined;
|
|
115
|
+
calculate(bounds?: IViewportBound): this;
|
|
116
116
|
calculateAutoHeightInRange(ranges: Nullable<IRange[]>): IRowAutoHeightInfo[];
|
|
117
117
|
private _calculateRowAutoHeight;
|
|
118
118
|
updateLayout(): this | undefined;
|
|
119
|
-
getRowColumnSegment(bounds?:
|
|
119
|
+
getRowColumnSegment(bounds?: IViewportBound): {
|
|
120
|
+
startRow: number;
|
|
121
|
+
endRow: number;
|
|
122
|
+
startColumn: number;
|
|
123
|
+
endColumn: number;
|
|
124
|
+
};
|
|
125
|
+
getRowColumnSegmentByViewBound(bound?: IBoundRectNoAngle): {
|
|
120
126
|
startRow: number;
|
|
121
127
|
endRow: number;
|
|
122
128
|
startColumn: number;
|
|
@@ -228,7 +234,19 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
228
234
|
endX: number;
|
|
229
235
|
isMerged: boolean;
|
|
230
236
|
isMergedMainCell: boolean;
|
|
231
|
-
mergeInfo:
|
|
237
|
+
mergeInfo: {
|
|
238
|
+
startX: number;
|
|
239
|
+
startY: number;
|
|
240
|
+
endX: number;
|
|
241
|
+
endY: number;
|
|
242
|
+
startColumn: number;
|
|
243
|
+
endColumn: number;
|
|
244
|
+
rangeType?: import("@univerjs/core").RANGE_TYPE | undefined;
|
|
245
|
+
startAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType | undefined;
|
|
246
|
+
endAbsoluteRefType?: import("@univerjs/core").AbsoluteRefType | undefined;
|
|
247
|
+
startRow: number;
|
|
248
|
+
endRow: number;
|
|
249
|
+
};
|
|
232
250
|
};
|
|
233
251
|
convertTransformToOffsetX(offsetX: number, scaleX: number, scrollXY: {
|
|
234
252
|
x: number;
|
|
@@ -260,7 +278,7 @@ export declare class SpreadsheetSkeleton extends Skeleton {
|
|
|
260
278
|
* @param bounds The range of the visible area of the canvas
|
|
261
279
|
* @returns The range cell index of the canvas visible area
|
|
262
280
|
*/
|
|
263
|
-
protected _getBounding(rowHeightAccumulation: number[], columnWidthAccumulation: number[],
|
|
281
|
+
protected _getBounding(rowHeightAccumulation: number[], columnWidthAccumulation: number[], viewBound?: IBoundRectNoAngle): {
|
|
264
282
|
startRow: number;
|
|
265
283
|
endRow: number;
|
|
266
284
|
startColumn: number;
|
|
@@ -13,34 +13,32 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import type {
|
|
16
|
+
import type { IViewportBound } from '../../basics/vector2';
|
|
17
17
|
import { Vector2 } from '../../basics/vector2';
|
|
18
18
|
import { Documents } from '../docs/document';
|
|
19
19
|
import type { Background } from './extensions/background';
|
|
20
20
|
import type { Border } from './extensions/border';
|
|
21
|
-
import type { BorderAuxiliary } from './extensions/border-auxiliary';
|
|
22
21
|
import type { Font } from './extensions/font';
|
|
23
22
|
import { SheetComponent } from './sheet-component';
|
|
24
23
|
import type { SpreadsheetSkeleton } from './sheet-skeleton';
|
|
25
24
|
export declare class Spreadsheet extends SheetComponent {
|
|
26
25
|
private _allowCache;
|
|
27
|
-
private _borderAuxiliaryExtension;
|
|
28
26
|
private _backgroundExtension;
|
|
29
27
|
private _borderExtension;
|
|
30
28
|
private _fontExtension;
|
|
31
29
|
private _cacheCanvas;
|
|
32
|
-
private
|
|
33
|
-
private
|
|
34
|
-
private
|
|
35
|
-
private
|
|
30
|
+
private _refreshIncrementalState;
|
|
31
|
+
private _forceDirty;
|
|
32
|
+
private _overflowCacheRuntime;
|
|
33
|
+
private _overflowCacheRuntimeRange;
|
|
34
|
+
private _overflowCacheRuntimeTimeout;
|
|
36
35
|
private _documents;
|
|
37
36
|
constructor(oKey: string, spreadsheetSkeleton?: SpreadsheetSkeleton, _allowCache?: boolean);
|
|
38
|
-
get borderAuxiliaryExtension(): BorderAuxiliary;
|
|
39
37
|
get backgroundExtension(): Background;
|
|
40
38
|
get borderExtension(): Border;
|
|
41
39
|
get fontExtension(): Font;
|
|
42
40
|
getDocuments(): Documents;
|
|
43
|
-
draw(ctx: CanvasRenderingContext2D, bounds?:
|
|
41
|
+
draw(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
|
|
44
42
|
isHit(coord: Vector2): boolean;
|
|
45
43
|
getNoMergeCellPositionByIndex(rowIndex: number, columnIndex: number): {
|
|
46
44
|
startY: number;
|
|
@@ -52,6 +50,7 @@ export declare class Spreadsheet extends SheetComponent {
|
|
|
52
50
|
x: number;
|
|
53
51
|
y: number;
|
|
54
52
|
};
|
|
53
|
+
makeForceDirty(state?: boolean): void;
|
|
55
54
|
getAncestorScrollXY(offsetX: number, offsetY: number): {
|
|
56
55
|
x: number;
|
|
57
56
|
y: number;
|
|
@@ -62,11 +61,10 @@ export declare class Spreadsheet extends SheetComponent {
|
|
|
62
61
|
endRow: number;
|
|
63
62
|
endColumn: number;
|
|
64
63
|
} | undefined;
|
|
65
|
-
render(mainCtx: CanvasRenderingContext2D, bounds?:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
protected
|
|
69
|
-
protected _draw(ctx: CanvasRenderingContext2D, bounds?: IBoundRect): void;
|
|
64
|
+
render(mainCtx: CanvasRenderingContext2D, bounds?: IViewportBound): this | undefined;
|
|
65
|
+
private _resizeCacheCanvas;
|
|
66
|
+
protected _applyCache(ctx?: CanvasRenderingContext2D, sx?: number, sy?: number, sw?: number, sh?: number, dx?: number, dy?: number, dw?: number, dh?: number): void;
|
|
67
|
+
protected _draw(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
|
|
70
68
|
private _getAncestorSize;
|
|
71
69
|
private _getAncestorParent;
|
|
72
70
|
private _initialDefaultExtension;
|
|
@@ -79,6 +77,10 @@ export declare class Spreadsheet extends SheetComponent {
|
|
|
79
77
|
* Overflow on the left or right is aligned according to the text's horizontal alignment.
|
|
80
78
|
*/
|
|
81
79
|
private _calculateOverflow;
|
|
82
|
-
private
|
|
83
|
-
|
|
80
|
+
private _drawAuxiliary;
|
|
81
|
+
/**
|
|
82
|
+
* Clear the guide lines within a range in the table, to make room for merged cells and overflow.
|
|
83
|
+
*/
|
|
84
|
+
private _clearRectangle;
|
|
85
|
+
private _clearBackground;
|
|
84
86
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { BaseObject } from '../base-object';
|
|
17
|
-
import type {
|
|
17
|
+
import type { IViewportBound, Vector2 } from '../basics/vector2';
|
|
18
18
|
export declare class CustomObject extends BaseObject {
|
|
19
19
|
private _render;
|
|
20
20
|
private _isHitCustom?;
|
|
@@ -22,6 +22,6 @@ export declare class CustomObject extends BaseObject {
|
|
|
22
22
|
toJson(): {
|
|
23
23
|
[x: string]: any;
|
|
24
24
|
};
|
|
25
|
-
render(mainCtx: CanvasRenderingContext2D, bounds?:
|
|
25
|
+
render(mainCtx: CanvasRenderingContext2D, bounds?: IViewportBound): this;
|
|
26
26
|
isHit(coord: Vector2): boolean;
|
|
27
27
|
}
|
package/lib/types/engine.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare class Engine extends ThinEngine<Scene> {
|
|
|
49
49
|
private _pointerLeaveEvent;
|
|
50
50
|
/** previous pointer position */
|
|
51
51
|
private pointer;
|
|
52
|
-
private
|
|
53
|
-
private
|
|
52
|
+
private _mouseId;
|
|
53
|
+
private _isUsingFirefox;
|
|
54
54
|
constructor(elemWidth?: number, elemHeight?: number);
|
|
55
55
|
get width(): number;
|
|
56
56
|
get height(): number;
|
|
@@ -106,5 +106,5 @@ export declare class Engine extends ThinEngine<Scene> {
|
|
|
106
106
|
private _handlePointerAction;
|
|
107
107
|
private _getWheelEventName;
|
|
108
108
|
private _getPassive;
|
|
109
|
-
private
|
|
109
|
+
private _getPointerType;
|
|
110
110
|
}
|
package/lib/types/group.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { BaseObject } from './base-object';
|
|
17
17
|
import type { CURSOR_TYPE } from './basics/const';
|
|
18
18
|
import { RENDER_CLASS_TYPE } from './basics/const';
|
|
19
|
-
import type {
|
|
19
|
+
import type { IViewportBound, Vector2 } from './basics/vector2';
|
|
20
20
|
export declare class Group extends BaseObject {
|
|
21
21
|
private _objects;
|
|
22
22
|
constructor(key?: string, ...objects: BaseObject[]);
|
|
@@ -27,7 +27,7 @@ export declare class Group extends BaseObject {
|
|
|
27
27
|
removeObject(object: BaseObject | string): void;
|
|
28
28
|
getObjectsByOrder(): BaseObject[];
|
|
29
29
|
getObjects(): BaseObject[];
|
|
30
|
-
render(ctx: CanvasRenderingContext2D, bounds?:
|
|
30
|
+
render(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
|
|
31
31
|
resize(width?: number | string, height?: number | string): this;
|
|
32
32
|
scale(scaleX?: number, scaleY?: number): this;
|
|
33
33
|
skew(skewX?: number, skewY?: number): this;
|
package/lib/types/layer.d.ts
CHANGED
|
@@ -18,11 +18,16 @@ import type { ThinScene } from './thin-scene';
|
|
|
18
18
|
export declare class Layer {
|
|
19
19
|
private _scene;
|
|
20
20
|
private _zIndex;
|
|
21
|
+
private _allowCache;
|
|
21
22
|
private _objects;
|
|
22
|
-
|
|
23
|
+
private _cacheCanvas;
|
|
24
|
+
protected _dirty: boolean;
|
|
25
|
+
constructor(_scene: ThinScene, objects?: BaseObject[], _zIndex?: number, _allowCache?: boolean);
|
|
23
26
|
get scene(): ThinScene;
|
|
24
27
|
get zIndex(): number;
|
|
25
|
-
|
|
28
|
+
enableCache(): void;
|
|
29
|
+
disableCache(): void;
|
|
30
|
+
isAllowCache(): boolean;
|
|
26
31
|
getObjectsByOrder(): BaseObject[];
|
|
27
32
|
getObjectsByOrderForPick(): BaseObject[];
|
|
28
33
|
getObjects(): BaseObject[];
|
|
@@ -30,6 +35,13 @@ export declare class Layer {
|
|
|
30
35
|
removeObject(object: BaseObject | string): void;
|
|
31
36
|
addObjects(objects: BaseObject[]): this;
|
|
32
37
|
removeObjects(objects: BaseObject[] | string[]): void;
|
|
38
|
+
makeDirty(state?: boolean): this;
|
|
39
|
+
isDirty(): boolean;
|
|
40
|
+
render(parentCtx?: CanvasRenderingContext2D, isMaxLayer?: boolean): this;
|
|
41
|
+
private _initialCacheCanvas;
|
|
42
|
+
private _draw;
|
|
43
|
+
private _applyCache;
|
|
44
|
+
private _resizeCacheCanvas;
|
|
33
45
|
clear(): void;
|
|
34
46
|
dispose(): void;
|
|
35
47
|
}
|
|
@@ -17,7 +17,7 @@ import type { Nullable } from '@univerjs/core';
|
|
|
17
17
|
import { BaseObject } from './base-object';
|
|
18
18
|
import { RENDER_CLASS_TYPE } from './basics/const';
|
|
19
19
|
import type { IObjectFullState } from './basics/interfaces';
|
|
20
|
-
import type {
|
|
20
|
+
import type { IViewportBound, Vector2 } from './basics/vector2';
|
|
21
21
|
import type { ThinScene } from './thin-scene';
|
|
22
22
|
export declare class SceneViewer extends BaseObject {
|
|
23
23
|
private _subScenes;
|
|
@@ -25,7 +25,7 @@ export declare class SceneViewer extends BaseObject {
|
|
|
25
25
|
private _allowSelectedClipElement;
|
|
26
26
|
constructor(key?: string, props?: IObjectFullState);
|
|
27
27
|
get classType(): RENDER_CLASS_TYPE;
|
|
28
|
-
render(mainCtx: CanvasRenderingContext2D, bounds?:
|
|
28
|
+
render(mainCtx: CanvasRenderingContext2D, bounds?: IViewportBound): this;
|
|
29
29
|
getSubScenes(): Map<string, ThinScene>;
|
|
30
30
|
getActiveSubScene(): Nullable<ThinScene>;
|
|
31
31
|
getSubScene(sceneKey: string): ThinScene | undefined;
|
package/lib/types/scene.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ import type { BaseObject } from './base-object';
|
|
|
18
18
|
import { CURSOR_TYPE } from './basics/const';
|
|
19
19
|
import type { IKeyboardEvent, IMouseEvent, IPointerEvent, IWheelEvent } from './basics/i-events';
|
|
20
20
|
import type { ISceneTransformState } from './basics/interfaces';
|
|
21
|
-
import type { IBoundRect } from './basics/vector2';
|
|
22
21
|
import { Vector2 } from './basics/vector2';
|
|
23
22
|
import { Layer } from './layer';
|
|
24
23
|
import type { ITransformerConfig } from './scene.-transformer';
|
|
@@ -31,8 +30,6 @@ export declare class Scene extends ThinScene {
|
|
|
31
30
|
private _parent;
|
|
32
31
|
private _layers;
|
|
33
32
|
private _viewports;
|
|
34
|
-
private _isFirstDirty;
|
|
35
|
-
private _maxZIndex;
|
|
36
33
|
private _cursor;
|
|
37
34
|
private _defaultCursor;
|
|
38
35
|
private _addObject$;
|
|
@@ -54,7 +51,10 @@ export declare class Scene extends ThinScene {
|
|
|
54
51
|
detachControl(): this;
|
|
55
52
|
makeDirty(state?: boolean): this;
|
|
56
53
|
makeDirtyNoParent(state?: boolean): this;
|
|
54
|
+
enableLayerCache(...layerIndexes: number[]): void;
|
|
55
|
+
disableLayerCache(...layerIndexes: number[]): void;
|
|
57
56
|
isDirty(): boolean;
|
|
57
|
+
getCursor(): CURSOR_TYPE;
|
|
58
58
|
resetCursor(): void;
|
|
59
59
|
setCursor(val: CURSOR_TYPE): void;
|
|
60
60
|
setDefaultCursor(val: CURSOR_TYPE): void;
|
|
@@ -89,7 +89,6 @@ export declare class Scene extends ThinScene {
|
|
|
89
89
|
getViewports(): Viewport[];
|
|
90
90
|
getViewport(key: string): Viewport | undefined;
|
|
91
91
|
changeObjectOrder(): void;
|
|
92
|
-
renderObjects(ctx: CanvasRenderingContext2D, bounds?: IBoundRect): this;
|
|
93
92
|
render(parentCtx?: CanvasRenderingContext2D): void;
|
|
94
93
|
requestRender(parentCtx?: CanvasRenderingContext2D): Promise<unknown>;
|
|
95
94
|
openTransformer(config?: ITransformerConfig): void;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { IDocumentData, IStyleBase, ITransformState, LocaleService } from '@univerjs/core';
|
|
17
17
|
import { BaseObject } from '../base-object';
|
|
18
|
-
import type {
|
|
18
|
+
import type { IViewportBound } from '../basics/vector2';
|
|
19
19
|
export interface IRichTextProps extends ITransformState, IStyleBase {
|
|
20
20
|
text?: string;
|
|
21
21
|
richText?: IDocumentData;
|
|
@@ -27,8 +27,6 @@ export declare const RICHTEXT_OBJECT_ARRAY: string[];
|
|
|
27
27
|
export declare class RichText extends BaseObject {
|
|
28
28
|
private _localeService;
|
|
29
29
|
private _documentData;
|
|
30
|
-
private _allowCache;
|
|
31
|
-
private _cacheCanvas;
|
|
32
30
|
private _documentSkeleton;
|
|
33
31
|
private _documents;
|
|
34
32
|
private _ff?;
|
|
@@ -48,12 +46,11 @@ export declare class RichText extends BaseObject {
|
|
|
48
46
|
height: number;
|
|
49
47
|
} | undefined;
|
|
50
48
|
setProps(props?: IRichTextProps): this | undefined;
|
|
51
|
-
render(mainCtx: CanvasRenderingContext2D, bounds?:
|
|
49
|
+
render(mainCtx: CanvasRenderingContext2D, bounds?: IViewportBound): this;
|
|
52
50
|
toJson(): {
|
|
53
51
|
[x: string]: any;
|
|
54
52
|
};
|
|
55
53
|
protected _draw(ctx: CanvasRenderingContext2D): void;
|
|
56
54
|
private _convertToDocumentData;
|
|
57
55
|
private _initialProps;
|
|
58
|
-
private _applyCache;
|
|
59
56
|
}
|
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
import type { IScale, Nullable } from '@univerjs/core';
|
|
17
17
|
import { BaseObject } from '../base-object';
|
|
18
18
|
import type { IObjectFullState } from '../basics/interfaces';
|
|
19
|
-
import type {
|
|
20
|
-
import { Canvas } from '../canvas';
|
|
19
|
+
import type { IViewportBound, Vector2 } from '../basics/vector2';
|
|
21
20
|
export type LineJoin = 'round' | 'bevel' | 'miter';
|
|
22
21
|
export type LineCap = 'butt' | 'round' | 'square';
|
|
23
22
|
export type PaintFirst = 'fill' | 'stroke';
|
|
@@ -28,7 +27,6 @@ export interface IShapeProps extends IObjectFullState {
|
|
|
28
27
|
globalCompositeOperation?: string;
|
|
29
28
|
evented?: boolean;
|
|
30
29
|
visible?: boolean;
|
|
31
|
-
allowCache?: boolean;
|
|
32
30
|
paintFirst?: PaintFirst;
|
|
33
31
|
stroke?: Nullable<string | CanvasGradient>;
|
|
34
32
|
strokeScaleEnabled?: boolean;
|
|
@@ -53,12 +51,10 @@ export interface IShapeProps extends IObjectFullState {
|
|
|
53
51
|
}
|
|
54
52
|
export declare const SHAPE_OBJECT_ARRAY: string[];
|
|
55
53
|
export declare abstract class Shape<T> extends BaseObject {
|
|
56
|
-
protected _cacheCanvas: Nullable<Canvas>;
|
|
57
54
|
private _hoverCursor;
|
|
58
55
|
private _moveCursor;
|
|
59
56
|
private _fillRule;
|
|
60
57
|
private _globalCompositeOperation;
|
|
61
|
-
private _allowCache;
|
|
62
58
|
private _paintFirst;
|
|
63
59
|
private _stroke;
|
|
64
60
|
private _strokeScaleEnabled;
|
|
@@ -84,7 +80,6 @@ export declare abstract class Shape<T> extends BaseObject {
|
|
|
84
80
|
get moveCursor(): string | null;
|
|
85
81
|
get fillRule(): string;
|
|
86
82
|
get globalCompositeOperation(): string;
|
|
87
|
-
get allowCache(): boolean;
|
|
88
83
|
get paintFirst(): PaintFirst;
|
|
89
84
|
get stroke(): Nullable<string | CanvasGradient>;
|
|
90
85
|
get strokeScaleEnabled(): boolean;
|
|
@@ -121,14 +116,11 @@ export declare abstract class Shape<T> extends BaseObject {
|
|
|
121
116
|
private static __setFillStyles;
|
|
122
117
|
private static __setStrokeStyles;
|
|
123
118
|
private static __setLineDash;
|
|
124
|
-
render(mainCtx: CanvasRenderingContext2D, bounds?:
|
|
119
|
+
render(mainCtx: CanvasRenderingContext2D, bounds?: IViewportBound): this;
|
|
125
120
|
setProps(props?: T): this | undefined;
|
|
126
|
-
resizeCacheCanvas(): void;
|
|
127
|
-
scaleCacheCanvas(): void;
|
|
128
121
|
toJson(): {
|
|
129
122
|
[x: string]: any;
|
|
130
123
|
};
|
|
131
|
-
protected _applyCache(ctx?: CanvasRenderingContext2D): void;
|
|
132
124
|
protected _draw(ctx: CanvasRenderingContext2D): void;
|
|
133
125
|
private _initialProps;
|
|
134
126
|
}
|
|
@@ -21,7 +21,7 @@ import { RENDER_CLASS_TYPE } from './basics/const';
|
|
|
21
21
|
import type { IKeyboardEvent, IMouseEvent, IPointerEvent, IWheelEvent } from './basics/i-events';
|
|
22
22
|
import type { ITransformChangeState } from './basics/interfaces';
|
|
23
23
|
import { Transform } from './basics/transform';
|
|
24
|
-
import type {
|
|
24
|
+
import type { IViewportBound, Vector2 } from './basics/vector2';
|
|
25
25
|
export declare abstract class ThinScene {
|
|
26
26
|
onTransformChangeObservable: Observable<ITransformChangeState>;
|
|
27
27
|
onPointerDownObserver: Observable<IMouseEvent | IPointerEvent>;
|
|
@@ -73,7 +73,7 @@ export declare abstract class ThinScene {
|
|
|
73
73
|
triggerPointerLeave(evt: IPointerEvent | IMouseEvent): void;
|
|
74
74
|
triggerPointerOver(evt: IPointerEvent | IMouseEvent): void;
|
|
75
75
|
triggerPointerEnter(evt: IPointerEvent | IMouseEvent): void;
|
|
76
|
-
renderObjects(ctx: CanvasRenderingContext2D, bounds?:
|
|
76
|
+
renderObjects(ctx: CanvasRenderingContext2D, bounds?: IViewportBound): void;
|
|
77
77
|
render(parentCtx?: CanvasRenderingContext2D): void;
|
|
78
78
|
getParent(): any;
|
|
79
79
|
dispose(): void;
|
|
@@ -84,6 +84,7 @@ export declare abstract class ThinScene {
|
|
|
84
84
|
setObjectBehavior(o: BaseObject): void;
|
|
85
85
|
applyTransformer(o: BaseObject): void;
|
|
86
86
|
makeDirtyNoParent(state?: boolean): this;
|
|
87
|
+
makeDirty(state?: boolean): this;
|
|
87
88
|
pick(coord: Vector2): Nullable<BaseObject | ThinScene>;
|
|
88
89
|
getViewports(): any[];
|
|
89
90
|
removeViewport(key: string): void;
|
package/lib/types/viewport.d.ts
CHANGED
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { EventState, IPosition, Nullable } from '@univerjs/core';
|
|
17
17
|
import { Observable } from '@univerjs/core';
|
|
18
|
+
import type { BaseObject } from './base-object';
|
|
18
19
|
import type { IWheelEvent } from './basics/i-events';
|
|
19
20
|
import { Transform } from './basics/transform';
|
|
20
|
-
import type {
|
|
21
|
+
import type { IViewportBound } from './basics/vector2';
|
|
21
22
|
import { Vector2 } from './basics/vector2';
|
|
22
23
|
import type { BaseScrollBar } from './shape/base-scroll-bar';
|
|
23
24
|
import type { ThinScene } from './thin-scene';
|
|
@@ -70,6 +71,7 @@ export declare class Viewport {
|
|
|
70
71
|
onScrollAfterObserver: Observable<IScrollObserverParam>;
|
|
71
72
|
onScrollBeforeObserver: Observable<IScrollObserverParam>;
|
|
72
73
|
onScrollStopObserver: Observable<IScrollObserverParam>;
|
|
74
|
+
onScrollByBarObserver: Observable<IScrollObserverParam>;
|
|
73
75
|
private _viewPortKey;
|
|
74
76
|
private _dirty;
|
|
75
77
|
private _topOrigin;
|
|
@@ -85,11 +87,9 @@ export declare class Viewport {
|
|
|
85
87
|
private _width;
|
|
86
88
|
private _height;
|
|
87
89
|
private _scene;
|
|
88
|
-
private _cacheCanvas;
|
|
89
90
|
private _scrollBar?;
|
|
90
91
|
private _isWheelPreventDefaultX;
|
|
91
92
|
private _isWheelPreventDefaultY;
|
|
92
|
-
private _allowCache;
|
|
93
93
|
private _scrollStopNum;
|
|
94
94
|
private _preScrollX;
|
|
95
95
|
private _preScrollY;
|
|
@@ -101,6 +101,7 @@ export declare class Viewport {
|
|
|
101
101
|
private _paddingEndY;
|
|
102
102
|
private _isRelativeX;
|
|
103
103
|
private _isRelativeY;
|
|
104
|
+
private _preViewportBound;
|
|
104
105
|
constructor(viewPortKey: string, scene: ThinScene, props?: IViewProps);
|
|
105
106
|
get scene(): ThinScene;
|
|
106
107
|
get width(): Nullable<number>;
|
|
@@ -151,6 +152,7 @@ export declare class Viewport {
|
|
|
151
152
|
isLimitedX: boolean;
|
|
152
153
|
isLimitedY: boolean;
|
|
153
154
|
} | undefined;
|
|
155
|
+
scrollByBar(pos: IScrollBarPosition, isTrigger?: boolean): void;
|
|
154
156
|
/**
|
|
155
157
|
* current position plus offset relatively
|
|
156
158
|
* the caller no need to deal with the padding when frozen
|
|
@@ -177,14 +179,14 @@ export declare class Viewport {
|
|
|
177
179
|
};
|
|
178
180
|
getScrollBar(): Nullable<BaseScrollBar>;
|
|
179
181
|
updateScroll(param: IScrollObserverParam): this;
|
|
180
|
-
getScrollBarTransForm(
|
|
181
|
-
render(parentCtx?: CanvasRenderingContext2D): void;
|
|
182
|
-
getBounding():
|
|
182
|
+
getScrollBarTransForm(): Transform;
|
|
183
|
+
render(parentCtx?: CanvasRenderingContext2D, objects?: BaseObject[], isMaxLayer?: boolean): void;
|
|
184
|
+
getBounding(): IViewportBound;
|
|
183
185
|
getRelativeVector(coord: Vector2): Vector2;
|
|
184
186
|
getAbsoluteVector(coord: Vector2): Vector2;
|
|
185
187
|
onMouseWheel(evt: IWheelEvent, state: EventState): void;
|
|
186
188
|
isHit(coord: Vector2): boolean | undefined;
|
|
187
|
-
pickScrollBar(coord: Vector2): import("
|
|
189
|
+
pickScrollBar(coord: Vector2): import("./shape").Rect<import("./shape").IRectProps> | null | undefined;
|
|
188
190
|
openClip(): void;
|
|
189
191
|
closeClip(): void;
|
|
190
192
|
dispose(): void;
|
|
@@ -194,13 +196,12 @@ export declare class Viewport {
|
|
|
194
196
|
} | undefined;
|
|
195
197
|
private _resizeCacheCanvasAndScrollBar;
|
|
196
198
|
private _getViewPortSize;
|
|
197
|
-
private _getApplyCanvasState;
|
|
198
199
|
private _scrollRendered;
|
|
199
200
|
private _triggerScrollStop;
|
|
200
201
|
private _scroll;
|
|
201
202
|
private _calViewportRelativeBounding;
|
|
202
|
-
private
|
|
203
|
-
private
|
|
203
|
+
private _diffViewBound;
|
|
204
|
+
private _drawScrollbar;
|
|
204
205
|
private _setWithAndHeight;
|
|
205
206
|
private _getBoundScale;
|
|
206
207
|
}
|