@univerjs/engine-render 0.1.12 → 0.1.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 +2 -2
- package/lib/es/index.js +8801 -7567
- package/lib/types/base-object.d.ts +21 -21
- package/lib/types/basics/const.d.ts +7 -2
- package/lib/types/basics/group-transform.d.ts +16 -0
- package/lib/types/basics/i-document-skeleton-cached.d.ts +5 -4
- package/lib/types/basics/index.d.ts +1 -0
- package/lib/types/basics/interfaces.d.ts +4 -9
- package/lib/types/basics/offset-rotation-axis.d.ts +3 -0
- package/lib/types/basics/tools.d.ts +34 -0
- package/lib/types/basics/transform.d.ts +8 -0
- package/lib/types/basics/transformer-config.d.ts +37 -0
- package/lib/types/basics/vector2.d.ts +44 -2
- package/lib/types/components/component.d.ts +2 -2
- package/lib/types/components/docs/doc-background.d.ts +3 -3
- package/lib/types/components/docs/doc-component.d.ts +4 -4
- package/lib/types/components/docs/document.d.ts +3 -4
- package/lib/types/components/docs/extensions/line.d.ts +1 -1
- package/lib/types/components/docs/layout/doc-skeleton.d.ts +2 -2
- package/lib/types/components/docs/layout/model/glyph.d.ts +1 -1
- package/lib/types/components/docs/text-selection/text-range.d.ts +6 -0
- package/lib/types/components/docs/text-selection/text-selection-render-manager.d.ts +1 -0
- package/lib/types/components/extension.d.ts +7 -2
- package/lib/types/components/sheets/column-header.d.ts +2 -2
- package/lib/types/components/sheets/extensions/background.d.ts +2 -1
- package/lib/types/components/sheets/extensions/font.d.ts +3 -2
- package/lib/types/components/sheets/extensions/marker.d.ts +1 -1
- package/lib/types/components/sheets/extensions/sheet-extension.d.ts +8 -1
- package/lib/types/components/sheets/interfaces.d.ts +47 -0
- package/lib/types/components/sheets/row-header.d.ts +2 -2
- package/lib/types/components/sheets/sheet-component.d.ts +4 -4
- package/lib/types/components/sheets/sheet-skeleton.d.ts +10 -22
- package/lib/types/components/sheets/spreadsheet.d.ts +52 -11
- package/lib/types/custom/custom-object.d.ts +2 -2
- package/lib/types/group.d.ts +22 -2
- package/lib/types/index.d.ts +1 -0
- package/lib/types/layer.d.ts +3 -3
- package/lib/types/scene-viewer.d.ts +3 -3
- package/lib/types/scene.d.ts +9 -5
- package/lib/types/scene.transformer.d.ts +59 -40
- package/lib/types/shape/image.d.ts +54 -0
- package/lib/types/shape/index.d.ts +1 -1
- package/lib/types/shape/regular-polygon.d.ts +4 -1
- package/lib/types/shape/rich-text.d.ts +2 -3
- package/lib/types/shape/shape.d.ts +4 -3
- package/lib/types/thin-engine.d.ts +1 -0
- package/lib/types/thin-scene.d.ts +2 -1
- package/lib/types/viewport.d.ts +134 -16
- package/lib/umd/index.js +2 -2
- package/package.json +5 -5
- package/lib/types/services/object-transform-manager.service.d.ts +0 -41
- package/lib/types/shape/picture.d.ts +0 -24
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { EventState, IKeyValue, Nullable, Observer, Disposable, Observable } from '@univerjs/core';
|
|
1
|
+
import { EventState, IKeyValue, ITransformState, Nullable, Observer, Disposable, Observable } from '@univerjs/core';
|
|
2
2
|
import { EVENT_TYPE, CURSOR_TYPE, RENDER_CLASS_TYPE } from './basics/const';
|
|
3
3
|
import { IDragEvent, IMouseEvent, IPointerEvent, IWheelEvent } from './basics/i-events';
|
|
4
4
|
import { IObjectFullState, ITransformChangeState } from './basics/interfaces';
|
|
5
5
|
import { Transform } from './basics/transform';
|
|
6
|
-
import {
|
|
6
|
+
import { IViewportInfo, Vector2 } from './basics/vector2';
|
|
7
7
|
import { UniverRenderingContext } from './context';
|
|
8
8
|
import { Layer } from './layer';
|
|
9
|
+
import { ITransformerConfig } from './basics/transformer-config';
|
|
9
10
|
|
|
10
11
|
export declare const BASE_OBJECT_ARRAY: string[];
|
|
11
12
|
export declare abstract class BaseObject extends Disposable {
|
|
@@ -30,6 +31,7 @@ export declare abstract class BaseObject extends Disposable {
|
|
|
30
31
|
onDisposeObserver: Observable<BaseObject>;
|
|
31
32
|
protected _oKey: string;
|
|
32
33
|
protected _dirty: boolean;
|
|
34
|
+
protected _forceDirty: boolean;
|
|
33
35
|
private _top;
|
|
34
36
|
private _topOrigin;
|
|
35
37
|
private _left;
|
|
@@ -53,11 +55,12 @@ export declare abstract class BaseObject extends Disposable {
|
|
|
53
55
|
private _debounceParentDirty;
|
|
54
56
|
private _transform;
|
|
55
57
|
private _cursor;
|
|
56
|
-
private
|
|
58
|
+
private _transformerConfig;
|
|
57
59
|
private _forceRender;
|
|
58
60
|
private _layer;
|
|
59
61
|
constructor(key?: string);
|
|
60
62
|
get transform(): Transform;
|
|
63
|
+
transformForAngle(transform: Transform): Transform;
|
|
61
64
|
get topOrigin(): string | number;
|
|
62
65
|
get leftOrigin(): string | number;
|
|
63
66
|
get widthOrigin(): string | number;
|
|
@@ -73,6 +76,10 @@ export declare abstract class BaseObject extends Disposable {
|
|
|
73
76
|
get scaleY(): number;
|
|
74
77
|
get ancestorScaleX(): number;
|
|
75
78
|
get ancestorScaleY(): number;
|
|
79
|
+
get ancestorLeft(): any;
|
|
80
|
+
get ancestorTop(): any;
|
|
81
|
+
get ancestorTransform(): any;
|
|
82
|
+
get ancestorGroup(): Nullable<BaseObject>;
|
|
76
83
|
get skewX(): number;
|
|
77
84
|
get skewY(): number;
|
|
78
85
|
get flipX(): boolean;
|
|
@@ -83,7 +90,6 @@ export declare abstract class BaseObject extends Disposable {
|
|
|
83
90
|
get evented(): boolean;
|
|
84
91
|
get visible(): boolean;
|
|
85
92
|
get debounceParentDirty(): boolean;
|
|
86
|
-
get isTransformer(): boolean;
|
|
87
93
|
get cursor(): CURSOR_TYPE;
|
|
88
94
|
get layer(): Nullable<Layer>;
|
|
89
95
|
set transform(trans: Transform);
|
|
@@ -91,7 +97,6 @@ export declare abstract class BaseObject extends Disposable {
|
|
|
91
97
|
set parent(o: any);
|
|
92
98
|
set evented(state: boolean);
|
|
93
99
|
set debounceParentDirty(state: boolean);
|
|
94
|
-
set isTransformer(state: boolean);
|
|
95
100
|
set cursor(val: CURSOR_TYPE);
|
|
96
101
|
set layer(layer: Layer);
|
|
97
102
|
protected set top(num: number | string);
|
|
@@ -106,7 +111,11 @@ export declare abstract class BaseObject extends Disposable {
|
|
|
106
111
|
protected set flipY(flipY: boolean);
|
|
107
112
|
protected set flipX(flipX: boolean);
|
|
108
113
|
protected set skewY(skewY: number);
|
|
114
|
+
get transformerConfig(): ITransformerConfig;
|
|
115
|
+
set transformerConfig(config: ITransformerConfig);
|
|
116
|
+
get maxZIndex(): number;
|
|
109
117
|
makeDirty(state?: boolean): this | undefined;
|
|
118
|
+
makeForceDirty(state?: boolean): void;
|
|
110
119
|
makeDirtyNoDebounce(state?: boolean): this;
|
|
111
120
|
isDirty(): boolean;
|
|
112
121
|
translate(x?: number | string, y?: number | string): this;
|
|
@@ -115,24 +124,12 @@ export declare abstract class BaseObject extends Disposable {
|
|
|
115
124
|
skew(skewX?: number, skewY?: number): this;
|
|
116
125
|
flip(flipX?: boolean, flipY?: boolean): this;
|
|
117
126
|
transformByState(option: IObjectFullState): this | undefined;
|
|
118
|
-
isRender(bounds?:
|
|
127
|
+
isRender(bounds?: IViewportInfo): boolean | undefined;
|
|
119
128
|
getParent(): any;
|
|
120
|
-
getState():
|
|
121
|
-
left: number;
|
|
122
|
-
top: number;
|
|
123
|
-
width: number;
|
|
124
|
-
height: number;
|
|
125
|
-
scaleX: number;
|
|
126
|
-
scaleY: number;
|
|
127
|
-
angle: number;
|
|
128
|
-
skewX: number;
|
|
129
|
-
skewY: number;
|
|
130
|
-
flipX: boolean;
|
|
131
|
-
flipY: boolean;
|
|
132
|
-
};
|
|
129
|
+
getState(): ITransformState;
|
|
133
130
|
hide(): void;
|
|
134
131
|
show(): void;
|
|
135
|
-
render(ctx: UniverRenderingContext, bounds?:
|
|
132
|
+
render(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
|
|
136
133
|
isHit(coord: Vector2): boolean;
|
|
137
134
|
on(eventType: EVENT_TYPE, func: (evt: unknown, state: EventState) => void): Nullable<Observer<unknown>>;
|
|
138
135
|
off(eventType: EVENT_TYPE, observer: Nullable<Observer<unknown>>): void;
|
|
@@ -158,7 +155,10 @@ export declare abstract class BaseObject extends Disposable {
|
|
|
158
155
|
setCursor(val: CURSOR_TYPE): void;
|
|
159
156
|
getEngine(): any;
|
|
160
157
|
getObjects(): BaseObject[];
|
|
161
|
-
|
|
158
|
+
getLayerIndex(): number;
|
|
159
|
+
applyTransform(): void;
|
|
160
|
+
removeTransform(): void;
|
|
161
|
+
getInverseCoord(coord: Vector2): Vector2;
|
|
162
162
|
protected _setTransForm(): void;
|
|
163
163
|
private _makeDirtyMix;
|
|
164
164
|
}
|
|
@@ -123,8 +123,13 @@ export declare enum RENDER_CLASS_TYPE {
|
|
|
123
123
|
CANVAS = "Canvas",
|
|
124
124
|
VIEWPORT = "Viewport",
|
|
125
125
|
LAYER = "Layer",
|
|
126
|
-
GROUP = "Group"
|
|
126
|
+
GROUP = "Group",
|
|
127
|
+
IMAGE = "Image",
|
|
128
|
+
SHAPE = "Shape",
|
|
129
|
+
TEXT = "Text"
|
|
127
130
|
}
|
|
128
|
-
export declare const DEFAULT_SELECTION_LAYER_INDEX = 1000;
|
|
129
131
|
export declare const MAXIMUM_ROW_HEIGHT = 2000;
|
|
130
132
|
export declare const FIX_ONE_PIXEL_BLUR_OFFSET = 0.5;
|
|
133
|
+
export declare const DRAWING_OBJECT_LOWER_LAYER_INDEX = 3;
|
|
134
|
+
export declare const DRAWING_OBJECT_LAYER_INDEX = 4;
|
|
135
|
+
export declare const DRAWING_OBJECT_UPPER_LAYER_INDEX = 5;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ITransformState } from '@univerjs/core';
|
|
2
|
+
|
|
3
|
+
export declare function getGroupState(parentLeft: number, parentTop: number, objectStates: ITransformState[]): {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
angle: number;
|
|
9
|
+
scaleX: number;
|
|
10
|
+
scaleY: number;
|
|
11
|
+
};
|
|
12
|
+
export declare function transformObjectOutOfGroup(child: ITransformState, parent: ITransformState, groupOriginWidth: number, groupOriginHeight: number): {
|
|
13
|
+
left: number;
|
|
14
|
+
top: number;
|
|
15
|
+
angle: number;
|
|
16
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BulletAlignment, ColumnSeparatorType, DataStreamTreeTokenType,
|
|
1
|
+
import { BulletAlignment, ColumnSeparatorType, DataStreamTreeTokenType, IDocDrawingBase, IDocumentRenderConfig, IIndentStart, INestingLevel, ITextStyle, PageOrientType } from '@univerjs/core';
|
|
2
2
|
import { BreakPointType } from '../components/docs/layout/line-breaker/break';
|
|
3
3
|
|
|
4
4
|
export interface IDocumentSkeletonCached extends ISkeletonResourceReference {
|
|
@@ -88,6 +88,7 @@ export interface IDocumentSkeletonLine {
|
|
|
88
88
|
contentHeight: number;
|
|
89
89
|
top: number;
|
|
90
90
|
asc: number;
|
|
91
|
+
dsc: number;
|
|
91
92
|
paddingTop: number;
|
|
92
93
|
paddingBottom: number;
|
|
93
94
|
marginTop: number;
|
|
@@ -133,7 +134,7 @@ export interface IDocumentSkeletonGlyph {
|
|
|
133
134
|
parent?: IDocumentSkeletonDivide;
|
|
134
135
|
url?: string;
|
|
135
136
|
featureId?: string;
|
|
136
|
-
|
|
137
|
+
drawingId?: string;
|
|
137
138
|
}
|
|
138
139
|
export interface IDocumentSkeletonBullet extends IIndentStart {
|
|
139
140
|
listId: string;
|
|
@@ -147,14 +148,14 @@ export interface IDocumentSkeletonBullet extends IIndentStart {
|
|
|
147
148
|
bulletType?: boolean;
|
|
148
149
|
}
|
|
149
150
|
export interface IDocumentSkeletonDrawing {
|
|
150
|
-
|
|
151
|
+
drawingId: string;
|
|
151
152
|
aLeft: number;
|
|
152
153
|
aTop: number;
|
|
153
154
|
width: number;
|
|
154
155
|
height: number;
|
|
155
156
|
angle: number;
|
|
156
157
|
initialState: boolean;
|
|
157
|
-
drawingOrigin:
|
|
158
|
+
drawingOrigin: IDocDrawingBase;
|
|
158
159
|
}
|
|
159
160
|
export interface IDocumentSkeletonFontStyle {
|
|
160
161
|
fontString: string;
|
|
@@ -2,13 +2,14 @@ import { BooleanNumber, GridType, IDocStyleBase, IDocumentLayout, IOffset, IPara
|
|
|
2
2
|
import { DocumentViewModel } from '../components/docs/view-model/document-view-model';
|
|
3
3
|
import { IDocumentSkeletonBullet, IDocumentSkeletonDrawing, IDocumentSkeletonDrawingAnchor, IDocumentSkeletonFontStyle, IDocumentSkeletonFooter, IDocumentSkeletonGlyph, IDocumentSkeletonHeader } from './i-document-skeleton-cached';
|
|
4
4
|
import { Vector2 } from './vector2';
|
|
5
|
+
import { ITransformerConfig } from './transformer-config';
|
|
5
6
|
|
|
6
7
|
export interface IObjectFullState extends ITransformState {
|
|
7
8
|
strokeWidth?: number;
|
|
8
9
|
zIndex?: number;
|
|
9
|
-
isTransformer?: boolean;
|
|
10
10
|
forceRender?: boolean;
|
|
11
11
|
debounceParentDirty?: boolean;
|
|
12
|
+
transformerConfig?: ITransformerConfig;
|
|
12
13
|
}
|
|
13
14
|
export interface IRect extends ISize, IOffset {
|
|
14
15
|
points: Vector2[];
|
|
@@ -25,14 +26,8 @@ export declare enum TRANSFORM_CHANGE_OBSERVABLE_TYPE {
|
|
|
25
26
|
}
|
|
26
27
|
export interface ITransformChangeState {
|
|
27
28
|
type: TRANSFORM_CHANGE_OBSERVABLE_TYPE;
|
|
28
|
-
value:
|
|
29
|
-
|
|
30
|
-
y: number | string | boolean;
|
|
31
|
-
} | IObjectFullState | ISceneTransformState;
|
|
32
|
-
preValue: number | string | boolean | {
|
|
33
|
-
x: number | string | boolean;
|
|
34
|
-
y: number | string | boolean;
|
|
35
|
-
} | IObjectFullState | ISceneTransformState;
|
|
29
|
+
value: IObjectFullState | ISceneTransformState;
|
|
30
|
+
preValue: IObjectFullState | ISceneTransformState;
|
|
36
31
|
}
|
|
37
32
|
export interface IFontLocale {
|
|
38
33
|
fontList: string[];
|
|
@@ -108,3 +108,37 @@ export declare function getSizeForDom(dom: HTMLElement): {
|
|
|
108
108
|
};
|
|
109
109
|
export declare function ptToPixel(pt: number): number;
|
|
110
110
|
export declare function pixelToPt(px: number): number;
|
|
111
|
+
/**
|
|
112
|
+
* 当前单元格在任意一个 viewRanges 中
|
|
113
|
+
* @param ranges
|
|
114
|
+
* @param rowIndex
|
|
115
|
+
* @param colIndex
|
|
116
|
+
* @returns
|
|
117
|
+
*/
|
|
118
|
+
export declare function inViewRanges(ranges: IRange[], rowIndex: number, colIndex: number): boolean;
|
|
119
|
+
/**
|
|
120
|
+
* 在非下方区域中
|
|
121
|
+
* @param ranges
|
|
122
|
+
* @param rowIndex
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
125
|
+
export declare function inCurrentAndAboveViewRanges(ranges: IRange[], rowIndex: number): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* row 在任意一个 Range 中
|
|
128
|
+
* @param ranges
|
|
129
|
+
* @param rowIndex
|
|
130
|
+
* @returns
|
|
131
|
+
*/
|
|
132
|
+
export declare function inRowViewRanges(ranges: IRange[], rowIndex: number): boolean;
|
|
133
|
+
/**
|
|
134
|
+
* 如果 range 有相交, 那么扩展到第一组 range 中.
|
|
135
|
+
* @param ranges
|
|
136
|
+
*/
|
|
137
|
+
export declare function mergeRangeIfIntersects(mainRanges: IRange[], ranges: IRange[]): IRange[];
|
|
138
|
+
export declare function clampRanges(range: IRange): {
|
|
139
|
+
startRow: number;
|
|
140
|
+
startColumn: number;
|
|
141
|
+
endRow: number;
|
|
142
|
+
endColumn: number;
|
|
143
|
+
};
|
|
144
|
+
export declare function getSystemHighlightColor(): import('@univerjs/core').IRgbColor;
|
|
@@ -140,4 +140,12 @@ export declare class Transform {
|
|
|
140
140
|
* @return {number[]} transform matrix
|
|
141
141
|
*/
|
|
142
142
|
private _calcDimensionsMatrix;
|
|
143
|
+
convert2DOMMatrix2D(): {
|
|
144
|
+
a: number;
|
|
145
|
+
b: number;
|
|
146
|
+
c: number;
|
|
147
|
+
d: number;
|
|
148
|
+
e: number;
|
|
149
|
+
f: number;
|
|
150
|
+
};
|
|
143
151
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Nullable } from '@univerjs/core';
|
|
2
|
+
import { BaseObject } from '../base-object';
|
|
3
|
+
import { IMouseEvent, IPointerEvent } from './i-events';
|
|
4
|
+
|
|
5
|
+
export interface ITransformerConfig {
|
|
6
|
+
isCropper?: boolean;
|
|
7
|
+
hoverEnabled?: boolean;
|
|
8
|
+
hoverEnterFunc?: Nullable<(e: IPointerEvent | IMouseEvent) => void>;
|
|
9
|
+
hoverLeaveFunc?: Nullable<(e: IPointerEvent | IMouseEvent) => void>;
|
|
10
|
+
rotateEnabled?: boolean;
|
|
11
|
+
rotationSnaps?: number[];
|
|
12
|
+
rotationSnapTolerance?: number;
|
|
13
|
+
rotateAnchorOffset?: number;
|
|
14
|
+
rotateSize?: number;
|
|
15
|
+
rotateCornerRadius?: number;
|
|
16
|
+
borderEnabled?: boolean;
|
|
17
|
+
borderStroke?: string;
|
|
18
|
+
borderStrokeWidth?: number;
|
|
19
|
+
borderDash?: number[];
|
|
20
|
+
borderSpacing?: number;
|
|
21
|
+
resizeEnabled?: boolean;
|
|
22
|
+
enabledAnchors?: number[];
|
|
23
|
+
anchorFill?: string;
|
|
24
|
+
anchorStroke?: string;
|
|
25
|
+
anchorStrokeWidth?: number;
|
|
26
|
+
anchorSize?: number;
|
|
27
|
+
anchorCornerRadius?: number;
|
|
28
|
+
keepRatio?: boolean;
|
|
29
|
+
centeredScaling?: boolean;
|
|
30
|
+
flipEnabled?: boolean;
|
|
31
|
+
ignoreStroke?: boolean;
|
|
32
|
+
boundBoxFunc?: Nullable<(oldBox: BaseObject, newBox: BaseObject) => BaseObject>;
|
|
33
|
+
useSingleNodeRotation?: boolean;
|
|
34
|
+
shouldOverdrawWholeArea?: boolean;
|
|
35
|
+
zeroLeft?: number;
|
|
36
|
+
zeroTop?: number;
|
|
37
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Canvas } from '../canvas';
|
|
2
|
+
import { SHEET_VIEWPORT_KEY } from '../components/sheets/interfaces';
|
|
1
3
|
import { DeepImmutable, FloatArray } from './i-events';
|
|
4
|
+
import { Transform } from './transform';
|
|
2
5
|
|
|
3
6
|
export interface IPoint {
|
|
4
7
|
x: number;
|
|
@@ -431,16 +434,55 @@ export interface IBoundRect {
|
|
|
431
434
|
dy: number;
|
|
432
435
|
}
|
|
433
436
|
export interface IBoundRectNoAngle {
|
|
437
|
+
/**
|
|
438
|
+
* 冻结区域相对 MainCanvas 的物理位置,
|
|
439
|
+
* left = n * colWidth + rowHeaderWidth
|
|
440
|
+
*/
|
|
434
441
|
left: number;
|
|
435
442
|
top: number;
|
|
436
443
|
right: number;
|
|
437
444
|
bottom: number;
|
|
438
445
|
}
|
|
439
|
-
export interface
|
|
446
|
+
export interface IViewportInfo {
|
|
440
447
|
viewBound: IBoundRectNoAngle;
|
|
441
448
|
diffBounds: IBoundRectNoAngle[];
|
|
449
|
+
/**
|
|
450
|
+
* scroll right further diffX < 0
|
|
451
|
+
* previewBound.x - viewbound.x
|
|
452
|
+
*/
|
|
442
453
|
diffX: number;
|
|
443
454
|
diffY: number;
|
|
455
|
+
/**
|
|
456
|
+
* The physical position of the frozen rows and columns on the canvas, used for drawImage.
|
|
457
|
+
* For example, if the freezing starts from the fourth column, the left position would be 4 * column + rowHeaderWidth.
|
|
458
|
+
* The physical position means the top and left values have already considered the scaling factor.
|
|
459
|
+
*/
|
|
444
460
|
viewPortPosition: IBoundRectNoAngle;
|
|
445
|
-
|
|
461
|
+
viewportKey: string | SHEET_VIEWPORT_KEY;
|
|
462
|
+
/**
|
|
463
|
+
* In the future, a number will be used to indicate the reason for the "dirty" status
|
|
464
|
+
* Here, a binary value is used to facilitate computation.
|
|
465
|
+
*/
|
|
466
|
+
isDirty?: number;
|
|
467
|
+
isForceDirty?: boolean;
|
|
468
|
+
allowCache?: boolean;
|
|
469
|
+
cacheBound: IBoundRectNoAngle;
|
|
470
|
+
diffCacheBounds: IBoundRectNoAngle[];
|
|
471
|
+
cacheViewPortPosition: IBoundRectNoAngle;
|
|
472
|
+
shouldCacheUpdate: number;
|
|
473
|
+
sceneTrans: Transform;
|
|
474
|
+
cacheCanvas?: Canvas;
|
|
475
|
+
leftOrigin: number;
|
|
476
|
+
topOrigin: number;
|
|
477
|
+
bufferEdgeX: number;
|
|
478
|
+
bufferEdgeY: number;
|
|
479
|
+
updatePrevCacheBounds?: (viewbound: IBoundRectNoAngle) => void;
|
|
480
|
+
}
|
|
481
|
+
export interface IViewportInfos {
|
|
482
|
+
left: number;
|
|
483
|
+
right: number;
|
|
484
|
+
top: number;
|
|
485
|
+
bottom: number;
|
|
486
|
+
width: number;
|
|
487
|
+
height: number;
|
|
446
488
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IDisposable } from '@wendellhu/redi';
|
|
2
2
|
import { BaseObject } from '../base-object';
|
|
3
|
-
import {
|
|
3
|
+
import { IViewportInfo } from '../basics/vector2';
|
|
4
4
|
import { UniverRenderingContext } from '../context';
|
|
5
5
|
import { ComponentExtension } from './extension';
|
|
6
6
|
|
|
@@ -10,6 +10,6 @@ export declare class RenderComponent<T, U, V> extends BaseObject {
|
|
|
10
10
|
register(...extensions: Array<ComponentExtension<T, U, V>>): IDisposable;
|
|
11
11
|
getExtensionsByOrder(): ComponentExtension<T, U, V>[];
|
|
12
12
|
getExtensionByKey(uKey: string): ComponentExtension<T, U, V> | undefined;
|
|
13
|
-
draw(ctx: UniverRenderingContext, bounds?:
|
|
13
|
+
draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
|
|
14
14
|
dispose(): void;
|
|
15
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IViewportInfo } from '../../basics/vector2';
|
|
2
2
|
import { UniverRenderingContext } from '../../context';
|
|
3
3
|
import { IDocumentsConfig, DocComponent } from './doc-component';
|
|
4
4
|
import { DocumentSkeleton } from './layout/doc-skeleton';
|
|
@@ -7,7 +7,7 @@ export declare class DocBackground extends DocComponent {
|
|
|
7
7
|
private _drawLiquid;
|
|
8
8
|
constructor(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig);
|
|
9
9
|
static create(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig): DocBackground;
|
|
10
|
-
draw(ctx: UniverRenderingContext, bounds?:
|
|
10
|
+
draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
|
|
11
11
|
changeSkeleton(newSkeleton: DocumentSkeleton): this;
|
|
12
|
-
protected _draw(ctx: UniverRenderingContext, bounds?:
|
|
12
|
+
protected _draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
|
|
13
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IDocumentSkeletonGlyph, IDocumentSkeletonLine, IDocumentSkeletonPage, PageLayoutType } from '../../basics/i-document-skeleton-cached';
|
|
2
|
-
import { IBoundRectNoAngle,
|
|
2
|
+
import { IBoundRectNoAngle, IViewportInfo } from '../../basics/vector2';
|
|
3
3
|
import { UniverRenderingContext } from '../../context';
|
|
4
4
|
import { RenderComponent } from '../component';
|
|
5
5
|
import { DOCS_EXTENSION_TYPE } from './doc-extension';
|
|
@@ -22,11 +22,11 @@ export declare abstract class DocComponent extends RenderComponent<IDocumentSkel
|
|
|
22
22
|
getSkeleton(): DocumentSkeleton | undefined;
|
|
23
23
|
setSkeleton(skeleton: DocumentSkeleton): void;
|
|
24
24
|
private _setConfig;
|
|
25
|
-
render(mainCtx: UniverRenderingContext, bounds?:
|
|
25
|
+
render(mainCtx: UniverRenderingContext, bounds?: IViewportInfo): this | undefined;
|
|
26
26
|
getParentScale(): {
|
|
27
27
|
scaleX: any;
|
|
28
28
|
scaleY: any;
|
|
29
29
|
};
|
|
30
|
-
isSkipByDiffBounds(page: IDocumentSkeletonPage, pageTop: number, pageLeft: number, bounds?:
|
|
31
|
-
protected abstract _draw(ctx: UniverRenderingContext, bounds?:
|
|
30
|
+
isSkipByDiffBounds(page: IDocumentSkeletonPage, pageTop: number, pageLeft: number, bounds?: IViewportInfo): boolean;
|
|
31
|
+
protected abstract _draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
|
|
32
32
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Nullable, Observable } from '@univerjs/core';
|
|
2
2
|
import { IDocumentSkeletonPage } from '../../basics/i-document-skeleton-cached';
|
|
3
3
|
import { Transform } from '../../basics/transform';
|
|
4
|
-
import {
|
|
4
|
+
import { IViewportInfo } from '../../basics/vector2';
|
|
5
5
|
import { UniverRenderingContext } from '../../context';
|
|
6
6
|
import { Scene } from '../../scene';
|
|
7
7
|
import { IDocumentsConfig, IPageMarginLayout, DocComponent } from './doc-component';
|
|
@@ -23,16 +23,15 @@ export declare class Documents extends DocComponent {
|
|
|
23
23
|
docsLeft: number;
|
|
24
24
|
docsTop: number;
|
|
25
25
|
private _drawLiquid;
|
|
26
|
-
private _findLiquid;
|
|
27
26
|
private _skeletonObserver;
|
|
28
27
|
constructor(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig);
|
|
29
28
|
static create(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig): Documents;
|
|
30
29
|
dispose(): void;
|
|
31
30
|
getOffsetConfig(): IDocumentOffsetConfig;
|
|
32
31
|
getEngine(): Nullable<import('../..').ThinEngine<Scene>>;
|
|
33
|
-
draw(ctx: UniverRenderingContext, bounds?:
|
|
32
|
+
draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
|
|
34
33
|
changeSkeleton(newSkeleton: DocumentSkeleton): this;
|
|
35
|
-
protected _draw(ctx: UniverRenderingContext, bounds?:
|
|
34
|
+
protected _draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
|
|
36
35
|
private _horizontalHandler;
|
|
37
36
|
private _verticalHandler;
|
|
38
37
|
private _startRotation;
|
|
@@ -7,7 +7,7 @@ export declare class Line extends docExtension {
|
|
|
7
7
|
uKey: string;
|
|
8
8
|
Z_INDEX: number;
|
|
9
9
|
private _preBackgroundColor;
|
|
10
|
-
draw(ctx: UniverRenderingContext, parentScale: IScale,
|
|
10
|
+
draw(ctx: UniverRenderingContext, parentScale: IScale, glyph: IDocumentSkeletonGlyph): void;
|
|
11
11
|
clearCache(): void;
|
|
12
12
|
private _drawLine;
|
|
13
13
|
private _setLineType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LocaleService, Nullable } from '@univerjs/core';
|
|
2
2
|
import { IDocumentSkeletonCached, IDocumentSkeletonGlyph, PageLayoutType } from '../../../basics/i-document-skeleton-cached';
|
|
3
3
|
import { INodeInfo, INodePosition, INodeSearch } from '../../../basics/interfaces';
|
|
4
|
-
import {
|
|
4
|
+
import { IViewportInfo, Vector2 } from '../../../basics/vector2';
|
|
5
5
|
import { Skeleton } from '../../skeleton';
|
|
6
6
|
import { DocumentViewModel } from '../view-model/document-view-model';
|
|
7
7
|
|
|
@@ -22,7 +22,7 @@ export declare class DocumentSkeleton extends Skeleton {
|
|
|
22
22
|
static create(docViewModel: DocumentViewModel, localeService: LocaleService): DocumentSkeleton;
|
|
23
23
|
dispose(): void;
|
|
24
24
|
getViewModel(): DocumentViewModel;
|
|
25
|
-
calculate(bounds?:
|
|
25
|
+
calculate(bounds?: IViewportInfo): void;
|
|
26
26
|
getSkeletonData(): Nullable<IDocumentSkeletonCached>;
|
|
27
27
|
getActualSize(): {
|
|
28
28
|
actualWidth: number;
|
|
@@ -9,7 +9,7 @@ export declare function createSkeletonWordGlyph(content: string, config: IFontCr
|
|
|
9
9
|
export declare function createSkeletonLetterGlyph(content: string, config: IFontCreateConfig, glyphWidth?: number, glyphInfo?: IOpenTypeGlyphInfo): IDocumentSkeletonGlyph;
|
|
10
10
|
export declare function createSkeletonTabGlyph(config: IFontCreateConfig, glyphWidth?: number): IDocumentSkeletonGlyph;
|
|
11
11
|
export declare function createHyphenDashGlyph(config: IFontCreateConfig): IDocumentSkeletonGlyph;
|
|
12
|
-
export declare function createSkeletonCustomBlockGlyph(config: IFontCreateConfig, glyphWidth?: number, glyphHeight?: number,
|
|
12
|
+
export declare function createSkeletonCustomBlockGlyph(config: IFontCreateConfig, glyphWidth?: number, glyphHeight?: number, drawingId?: string): IDocumentSkeletonGlyph;
|
|
13
13
|
export declare function _createSkeletonWordOrLetter(glyphType: GlyphType, content: string, config: IFontCreateConfig, glyphWidth?: number, glyphInfo?: IOpenTypeGlyphInfo): IDocumentSkeletonGlyph;
|
|
14
14
|
export declare function createSkeletonBulletGlyph(glyph: IDocumentSkeletonGlyph, bulletSkeleton: IDocumentSkeletonBullet, charSpaceApply: number): IDocumentSkeletonGlyph;
|
|
15
15
|
export declare function setGlyphGroupLeft(glyphGroup: IDocumentSkeletonGlyph[], left?: number): void;
|
|
@@ -36,6 +36,12 @@ export declare class TextRange {
|
|
|
36
36
|
get startNodePosition(): INodePosition | null;
|
|
37
37
|
get endNodePosition(): Nullable<INodePosition>;
|
|
38
38
|
get direction(): RANGE_DIRECTION;
|
|
39
|
+
getAbsolutePosition(): {
|
|
40
|
+
left: number;
|
|
41
|
+
top: number;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
} | undefined;
|
|
39
45
|
getAnchor(): Nullable<Rect<import('../../../shape/rect').IRectProps>>;
|
|
40
46
|
activeStatic(): void;
|
|
41
47
|
deactivateStatic(): void;
|
|
@@ -133,6 +133,7 @@ export declare class TextSelectionRenderManager extends RxDisposable implements
|
|
|
133
133
|
setCursorManually(evtOffsetX: number, evtOffsetY: number): void;
|
|
134
134
|
eventTrigger(evt: IPointerEvent | IMouseEvent): void;
|
|
135
135
|
removeAllTextRanges(): void;
|
|
136
|
+
private _setSystemHighlightColorToStyle;
|
|
136
137
|
private _getAllTextRanges;
|
|
137
138
|
private _getActiveRange;
|
|
138
139
|
private _add;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IDocumentRenderConfig, IScale, Nullable, Registry } from '@univerjs/core';
|
|
1
|
+
import { IDocumentRenderConfig, IRange, IScale, Nullable, Registry } from '@univerjs/core';
|
|
2
2
|
import { BaseObject } from '../base-object';
|
|
3
3
|
import { Vector2 } from '../basics/vector2';
|
|
4
4
|
import { UniverRenderingContext } from '../context';
|
|
@@ -11,6 +11,11 @@ export interface IExtensionConfig {
|
|
|
11
11
|
alignOffset?: Vector2;
|
|
12
12
|
renderConfig?: IDocumentRenderConfig;
|
|
13
13
|
}
|
|
14
|
+
export interface IDrawInfo {
|
|
15
|
+
viewRanges: IRange[];
|
|
16
|
+
viewportKey: string;
|
|
17
|
+
checkOutOfViewBound?: boolean;
|
|
18
|
+
}
|
|
14
19
|
export declare class ComponentExtension<T, U, V> {
|
|
15
20
|
uKey: string;
|
|
16
21
|
type: U;
|
|
@@ -20,7 +25,7 @@ export declare class ComponentExtension<T, U, V> {
|
|
|
20
25
|
translateY: number;
|
|
21
26
|
extensionOffset: IExtensionConfig;
|
|
22
27
|
get zIndex(): number;
|
|
23
|
-
draw(ctx: UniverRenderingContext, parentScale: IScale, skeleton: T, diffBounds?: V): void;
|
|
28
|
+
draw(ctx: UniverRenderingContext, parentScale: IScale, skeleton: T, diffBounds?: V, more?: IDrawInfo): void;
|
|
24
29
|
clearCache(): void;
|
|
25
30
|
protected _getScale(parentScale: IScale): number;
|
|
26
31
|
dispose(): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Nullable } from '@univerjs/core';
|
|
2
|
-
import {
|
|
2
|
+
import { IViewportInfo, Vector2 } from '../../basics/vector2';
|
|
3
3
|
import { UniverRenderingContext } from '../../context';
|
|
4
4
|
import { ColumnHeaderLayout } from './extensions/column-header-layout';
|
|
5
5
|
import { SpreadsheetHeader } from './sheet-component';
|
|
@@ -22,7 +22,7 @@ export declare class SpreadsheetColumnHeader extends SpreadsheetHeader {
|
|
|
22
22
|
private _columnHeaderLayoutExtension;
|
|
23
23
|
constructor(oKey: string, spreadsheetSkeleton?: SpreadsheetSkeleton);
|
|
24
24
|
get columnHeaderLayoutExtension(): ColumnHeaderLayout;
|
|
25
|
-
draw(ctx: UniverRenderingContext, bounds?:
|
|
25
|
+
draw(ctx: UniverRenderingContext, bounds?: IViewportInfo): void;
|
|
26
26
|
isHit(coord: Vector2): boolean;
|
|
27
27
|
private _initialDefaultExtension;
|
|
28
28
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IRange, IScale } from '@univerjs/core';
|
|
2
2
|
import { UniverRenderingContext } from '../../../context';
|
|
3
|
+
import { IDrawInfo } from '../../extension';
|
|
3
4
|
import { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
4
5
|
import { SheetExtension } from './sheet-extension';
|
|
5
6
|
|
|
@@ -8,5 +9,5 @@ export declare class Background extends SheetExtension {
|
|
|
8
9
|
Z_INDEX: number;
|
|
9
10
|
PRINTING_Z_INDEX: number;
|
|
10
11
|
get zIndex(): number;
|
|
11
|
-
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges
|
|
12
|
+
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[], { viewRanges, checkOutOfViewBound }: IDrawInfo): void;
|
|
12
13
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IRange, IScale } from '@univerjs/core';
|
|
2
2
|
import { UniverRenderingContext } from '../../../context';
|
|
3
|
+
import { IDrawInfo } from '../../extension';
|
|
3
4
|
import { SpreadsheetSkeleton } from '../sheet-skeleton';
|
|
4
5
|
import { SheetExtension } from './sheet-extension';
|
|
5
6
|
|
|
@@ -16,7 +17,7 @@ export declare class Font extends SheetExtension {
|
|
|
16
17
|
uKey: string;
|
|
17
18
|
Z_INDEX: number;
|
|
18
19
|
getDocuments(): any;
|
|
19
|
-
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges
|
|
20
|
+
draw(ctx: UniverRenderingContext, parentScale: IScale, spreadsheetSkeleton: SpreadsheetSkeleton, diffRanges: IRange[], moreBoundsInfo: IDrawInfo): void;
|
|
20
21
|
private _renderDocuments;
|
|
21
|
-
private
|
|
22
|
+
private _clipRectangleForOverflow;
|
|
22
23
|
}
|
|
@@ -6,5 +6,5 @@ import { SheetExtension } from './sheet-extension';
|
|
|
6
6
|
export declare class Marker extends SheetExtension {
|
|
7
7
|
protected Z_INDEX: number;
|
|
8
8
|
uKey: string;
|
|
9
|
-
draw(ctx: UniverRenderingContext, parentScale: IScale, skeleton: SpreadsheetSkeleton, diffRanges
|
|
9
|
+
draw(ctx: UniverRenderingContext, parentScale: IScale, skeleton: SpreadsheetSkeleton, diffRanges: IRange[]): void;
|
|
10
10
|
}
|
|
@@ -8,7 +8,14 @@ export declare enum SHEET_EXTENSION_TYPE {
|
|
|
8
8
|
export declare class SheetExtension extends ComponentExtension<SpreadsheetSkeleton, SHEET_EXTENSION_TYPE, IRange[]> {
|
|
9
9
|
type: SHEET_EXTENSION_TYPE;
|
|
10
10
|
getCellIndex(rowIndex: number, columnIndex: number, rowHeightAccumulation: number[], columnWidthAccumulation: number[], dataMergeCache: IRange[]): import('@univerjs/core').ISelectionCellWithCoord;
|
|
11
|
-
isRenderDiffRangesByCell(
|
|
11
|
+
isRenderDiffRangesByCell(rangeP: IRange, diffRanges?: IRange[]): boolean;
|
|
12
12
|
isRenderDiffRangesByColumn(curStartColumn: number, curEndColumn: number, diffRanges?: IRange[]): boolean;
|
|
13
13
|
isRenderDiffRangesByRow(curStartRow: number, curEndRow: number, diffRanges?: IRange[]): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 传入的 row 范围和 diffRanges 有相交, 返回 true
|
|
16
|
+
* @param curStartRow
|
|
17
|
+
* @param curEndRow
|
|
18
|
+
* @param viewranges
|
|
19
|
+
*/
|
|
20
|
+
isRowInRanges(curStartRow: number, curEndRow: number, viewranges?: IRange[]): boolean;
|
|
14
21
|
}
|