@univerjs/engine-render 0.2.6 → 0.2.8
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 +4 -2
- package/lib/es/index.js +6581 -5298
- package/lib/types/base-object.d.ts +4 -1
- package/lib/types/basics/cell-data.d.ts +0 -1
- package/lib/types/basics/document-node-tools.d.ts +7 -2
- package/lib/types/basics/draw.d.ts +0 -1
- package/lib/types/basics/group-transform.d.ts +0 -1
- package/lib/types/basics/i-document-skeleton-cached.d.ts +30 -4
- package/lib/types/basics/i-events.d.ts +0 -1
- package/lib/types/basics/interfaces.d.ts +8 -2
- package/lib/types/basics/offset-rotation-axis.d.ts +0 -1
- package/lib/types/basics/path2.d.ts +0 -1
- package/lib/types/basics/position.d.ts +0 -1
- package/lib/types/basics/quick-event.d.ts +0 -1
- package/lib/types/basics/range.d.ts +4 -2
- package/lib/types/basics/text-rotation.d.ts +0 -1
- package/lib/types/basics/tools.d.ts +0 -1
- package/lib/types/basics/transform.d.ts +0 -1
- package/lib/types/basics/transformer-config.d.ts +0 -1
- package/lib/types/basics/vector2.d.ts +0 -1
- package/lib/types/basics/viewport-subtract.d.ts +0 -1
- package/lib/types/canvas.d.ts +0 -1
- package/lib/types/components/component.d.ts +0 -1
- package/lib/types/components/docs/doc-background.d.ts +0 -1
- package/lib/types/components/docs/doc-component.d.ts +0 -1
- package/lib/types/components/docs/doc-extension.d.ts +0 -1
- package/lib/types/components/docs/document.d.ts +3 -1
- package/lib/types/components/docs/extensions/background.d.ts +0 -1
- package/lib/types/components/docs/extensions/border.d.ts +0 -1
- package/lib/types/components/docs/extensions/font-and-base-line.d.ts +0 -1
- package/lib/types/components/docs/extensions/line.d.ts +0 -1
- package/lib/types/components/docs/layout/block/paragraph/bullet-ruler.d.ts +0 -1
- package/lib/types/components/docs/layout/block/paragraph/bullet.d.ts +0 -1
- package/lib/types/components/docs/layout/block/paragraph/language-ruler.d.ts +0 -1
- package/lib/types/components/docs/layout/block/paragraph/layout-ruler.d.ts +0 -1
- package/lib/types/components/docs/layout/block/paragraph/line-adjustment.d.ts +0 -1
- package/lib/types/components/docs/layout/block/paragraph/linebreaking.d.ts +3 -3
- package/lib/types/components/docs/layout/block/paragraph/{layout.d.ts → paragraph-layout.d.ts} +0 -1
- package/lib/types/components/docs/layout/block/paragraph/shaping.d.ts +0 -1
- package/lib/types/components/docs/layout/block/section.d.ts +0 -1
- package/lib/types/components/docs/layout/block/table.d.ts +12 -0
- package/lib/types/components/docs/layout/doc-skeleton.d.ts +1 -1
- package/lib/types/components/docs/layout/hyphenation/hyphen.d.ts +0 -1
- package/lib/types/components/docs/layout/hyphenation/language-detector.d.ts +0 -1
- package/lib/types/components/docs/layout/line-breaker/enhancers/hyphen-enhancer.d.ts +0 -1
- package/lib/types/components/docs/layout/line-breaker/extensions/custom-block-linebreak-extension.d.ts +0 -1
- package/lib/types/components/docs/layout/line-breaker/extensions/tab-linebreak-extension.d.ts +0 -1
- package/lib/types/components/docs/layout/line-breaker/line-breaker.d.ts +0 -1
- package/lib/types/components/docs/layout/line-breaker/rule.d.ts +0 -1
- package/lib/types/components/docs/layout/model/column.d.ts +0 -1
- package/lib/types/components/docs/layout/model/glyph.d.ts +0 -1
- package/lib/types/components/docs/layout/model/line.d.ts +3 -3
- package/lib/types/components/docs/layout/model/page.d.ts +4 -1
- package/lib/types/components/docs/layout/model/section.d.ts +0 -1
- package/lib/types/components/docs/layout/model/table.d.ts +15 -0
- package/lib/types/components/docs/layout/shaping-engine/font-cache.d.ts +0 -1
- package/lib/types/components/docs/layout/shaping-engine/font-library.d.ts +0 -1
- package/lib/types/components/docs/layout/shaping-engine/text-shaping.d.ts +0 -1
- package/lib/types/components/docs/layout/shaping-engine/utils.d.ts +0 -1
- package/lib/types/components/docs/layout/style/custom-decoration.d.ts +0 -1
- package/lib/types/components/docs/layout/style/custom-range.d.ts +0 -1
- package/lib/types/components/docs/layout/tools.d.ts +2 -2
- package/lib/types/components/docs/liquid.d.ts +0 -1
- package/lib/types/components/docs/text-selection/convert-rect-range.d.ts +29 -0
- package/lib/types/components/docs/text-selection/{convert-cursor.d.ts → convert-text-range.d.ts} +7 -3
- package/lib/types/components/docs/text-selection/range-interface.d.ts +21 -0
- package/lib/types/components/docs/text-selection/rect-range.d.ts +48 -0
- package/lib/types/components/docs/text-selection/selection-utils.d.ts +27 -0
- package/lib/types/components/docs/text-selection/text-range.d.ts +8 -5
- package/lib/types/components/docs/text-selection/text-selection-render-manager.d.ts +28 -21
- package/lib/types/components/docs/view-model/data-stream-tree-node.d.ts +0 -1
- package/lib/types/components/docs/view-model/document-view-model.d.ts +4 -6
- package/lib/types/components/extension.d.ts +0 -1
- package/lib/types/components/sheets/column-header.d.ts +0 -1
- package/lib/types/components/sheets/extensions/background.d.ts +0 -1
- package/lib/types/components/sheets/extensions/border.d.ts +0 -1
- package/lib/types/components/sheets/extensions/column-header-layout.d.ts +0 -1
- package/lib/types/components/sheets/extensions/custom.d.ts +0 -1
- package/lib/types/components/sheets/extensions/font.d.ts +0 -1
- package/lib/types/components/sheets/extensions/marker.d.ts +0 -1
- package/lib/types/components/sheets/extensions/row-header-layout.d.ts +0 -1
- package/lib/types/components/sheets/extensions/sheet-extension.d.ts +0 -1
- package/lib/types/components/sheets/interfaces.d.ts +0 -1
- package/lib/types/components/sheets/row-header.d.ts +0 -1
- package/lib/types/components/sheets/sheet-component.d.ts +0 -1
- package/lib/types/components/sheets/sheet-skeleton.d.ts +1 -1
- package/lib/types/components/sheets/spreadsheet.d.ts +0 -1
- package/lib/types/components/skeleton.d.ts +0 -1
- package/lib/types/components/slides/slide.d.ts +6 -2
- package/lib/types/custom/custom-object.d.ts +0 -1
- package/lib/types/engine.d.ts +5 -1
- package/lib/types/floating/util.d.ts +0 -1
- package/lib/types/group.d.ts +0 -1
- package/lib/types/index.d.ts +11 -3
- package/lib/types/layer.d.ts +4 -1
- package/lib/types/render-engine.d.ts +0 -1
- package/lib/types/render-manager/render-manager.service.d.ts +49 -3
- package/lib/types/render-manager/render-unit.d.ts +4 -3
- package/lib/types/scene-viewer.d.ts +0 -1
- package/lib/types/scene.d.ts +13 -1
- package/lib/types/scene.input-manager.d.ts +0 -1
- package/lib/types/scene.transformer.d.ts +5 -1
- package/lib/types/scroll-timer.d.ts +0 -1
- package/lib/types/shape/base-scroll-bar.d.ts +0 -1
- package/lib/types/shape/checkbox.d.ts +0 -1
- package/lib/types/shape/circle.d.ts +0 -1
- package/lib/types/shape/dashedrect.d.ts +0 -1
- package/lib/types/shape/dropdown-item.d.ts +0 -1
- package/lib/types/shape/image.d.ts +0 -1
- package/lib/types/shape/path.d.ts +0 -1
- package/lib/types/shape/rect.d.ts +0 -1
- package/lib/types/shape/regular-polygon.d.ts +0 -1
- package/lib/types/shape/rich-text.d.ts +67 -6
- package/lib/types/shape/scroll-bar.d.ts +0 -1
- package/lib/types/shape/shape.d.ts +0 -1
- package/lib/types/shape/text.d.ts +0 -1
- package/lib/types/thin-engine.d.ts +0 -1
- package/lib/types/thin-scene.d.ts +0 -1
- package/lib/types/viewport.d.ts +0 -1
- package/lib/umd/index.js +4 -2
- package/package.json +6 -6
package/lib/types/engine.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { CURSOR_TYPE } from './basics/const';
|
|
|
3
3
|
import { Canvas, CanvasRenderMode } from './canvas';
|
|
4
4
|
import { Scene } from './scene';
|
|
5
5
|
import { ThinEngine } from './thin-engine';
|
|
6
|
-
|
|
7
6
|
export declare class Engine extends ThinEngine<Scene> {
|
|
8
7
|
renderEvenInBackground: boolean;
|
|
9
8
|
private readonly _beginFrame$;
|
|
@@ -64,6 +63,11 @@ export declare class Engine extends ThinEngine<Scene> {
|
|
|
64
63
|
getPixelRatio(): number;
|
|
65
64
|
setContainer(elem: HTMLElement, resize?: boolean): void;
|
|
66
65
|
resize(): void;
|
|
66
|
+
/**
|
|
67
|
+
* set canvas element size
|
|
68
|
+
* @param width
|
|
69
|
+
* @param height
|
|
70
|
+
*/
|
|
67
71
|
resizeBySize(width: number, height: number): void;
|
|
68
72
|
dispose(): void;
|
|
69
73
|
/**
|
package/lib/types/group.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { BaseObject } from './base-object';
|
|
|
2
2
|
import { CURSOR_TYPE, RENDER_CLASS_TYPE } from './basics/const';
|
|
3
3
|
import { IViewportInfo, Vector2 } from './basics/vector2';
|
|
4
4
|
import { UniverRenderingContext } from './context';
|
|
5
|
-
|
|
6
5
|
export declare class Group extends BaseObject {
|
|
7
6
|
private _objects;
|
|
8
7
|
private _selfSizeMode;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -32,9 +32,11 @@ export * from './shape';
|
|
|
32
32
|
export * from './viewport';
|
|
33
33
|
export { DocumentViewModel } from './components/docs/view-model/document-view-model';
|
|
34
34
|
export { getAnchorBounding, TEXT_RANGE_LAYER_INDEX, TextRange, getLineBounding } from './components/docs/text-selection/text-range';
|
|
35
|
-
export {
|
|
35
|
+
export { RectRange, convertPositionsToRectRanges } from './components/docs/text-selection/rect-range';
|
|
36
|
+
export { NodePositionConvertToCursor } from './components/docs/text-selection/convert-text-range';
|
|
36
37
|
export { Liquid } from './components/docs/liquid';
|
|
37
|
-
export {
|
|
38
|
+
export { getCanvasOffsetByEngine } from './components/docs/text-selection/selection-utils';
|
|
39
|
+
export { ITextSelectionRenderManager, TextSelectionRenderManager, } from './components/docs/text-selection/text-selection-render-manager';
|
|
38
40
|
export type { IActiveTextRange, IEditorInputConfig, ITextSelectionInnerParam } from './components/docs/text-selection/text-selection-render-manager';
|
|
39
41
|
export { Documents } from './components/docs/document';
|
|
40
42
|
export { DocBackground } from './components/docs/doc-background';
|
|
@@ -46,4 +48,10 @@ export { type IChangeObserverConfig } from './scene.transformer';
|
|
|
46
48
|
export { DEFAULT_PADDING_DATA } from './components/sheets/sheet-skeleton';
|
|
47
49
|
export { DocumentEditArea } from './components/docs/view-model/document-view-model';
|
|
48
50
|
export { lineIterator, glyphIterator } from './components/docs/layout/tools';
|
|
49
|
-
export { getOneTextSelectionRange } from './components/docs/text-selection/convert-
|
|
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';
|
package/lib/types/layer.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Disposable } from '@univerjs/core';
|
|
|
2
2
|
import { BaseObject } from './base-object';
|
|
3
3
|
import { UniverRenderingContext } from './context';
|
|
4
4
|
import { Scene } from './scene';
|
|
5
|
-
|
|
6
5
|
export declare class Layer extends Disposable {
|
|
7
6
|
private _scene;
|
|
8
7
|
private _zIndex;
|
|
@@ -17,6 +16,10 @@ export declare class Layer extends Disposable {
|
|
|
17
16
|
enableCache(): void;
|
|
18
17
|
disableCache(): void;
|
|
19
18
|
isAllowCache(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* get objects which is visible and not in a group.
|
|
21
|
+
* @returns BaseObject[]
|
|
22
|
+
*/
|
|
20
23
|
getObjectsByOrder(): BaseObject[];
|
|
21
24
|
getObjectsByOrderForPick(): BaseObject[];
|
|
22
25
|
getObjects(): BaseObject[];
|
|
@@ -6,15 +6,23 @@ import { SheetComponent } from '../components/sheets/sheet-component';
|
|
|
6
6
|
import { Slide } from '../components/slides/slide';
|
|
7
7
|
import { Engine } from '../engine';
|
|
8
8
|
import { IRender, RenderUnit } from './render-unit';
|
|
9
|
-
|
|
10
9
|
export type RenderComponentType = SheetComponent | DocComponent | Slide | BaseObject;
|
|
11
10
|
export interface IRenderManagerService extends IDisposable {
|
|
12
11
|
/** @deprecated */
|
|
13
12
|
currentRender$: Observable<Nullable<string>>;
|
|
14
13
|
addRender(unitId: string, renderer: IRender): void;
|
|
14
|
+
/**
|
|
15
|
+
* create renderUnit & init deps from renderDependencies by renderUnit's type.
|
|
16
|
+
* @param unitId
|
|
17
|
+
* @returns renderUnit:IRender
|
|
18
|
+
*/
|
|
15
19
|
createRender(unitId: string): IRender;
|
|
16
20
|
removeRender(unitId: string): void;
|
|
17
21
|
setCurrent(unitId: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* get RenderUnit By Id, RenderUnit implements IRender
|
|
24
|
+
* @param unitId
|
|
25
|
+
*/
|
|
18
26
|
getRenderById(unitId: string): Nullable<IRender>;
|
|
19
27
|
getAllRenderersOfType(type: UniverInstanceType): RenderUnit[];
|
|
20
28
|
getCurrentTypeOfRenderer(type: UniverInstanceType): Nullable<RenderUnit>;
|
|
@@ -32,6 +40,11 @@ export interface IRenderManagerService extends IDisposable {
|
|
|
32
40
|
getFirst(): Nullable<IRender>;
|
|
33
41
|
has(unitId: string): boolean;
|
|
34
42
|
withCurrentTypeOfUnit<T>(type: UniverInstanceType, id: DependencyIdentifier<T>): Nullable<T>;
|
|
43
|
+
/**
|
|
44
|
+
* add dep to _renderDependencies(type, dep)
|
|
45
|
+
* @param type
|
|
46
|
+
* @param depCtor
|
|
47
|
+
*/
|
|
35
48
|
registerRenderModule<T extends UnitModel>(type: UnitType, dep: Dependency<T>): IDisposable;
|
|
36
49
|
}
|
|
37
50
|
export declare class RenderManagerService extends Disposable implements IRenderManagerService {
|
|
@@ -54,13 +67,41 @@ export declare class RenderManagerService extends Disposable implements IRenderM
|
|
|
54
67
|
constructor(_injector: Injector, _univerInstanceService: IUniverInstanceService);
|
|
55
68
|
dispose(): void;
|
|
56
69
|
registerRenderModules(type: UnitType, deps: Dependency[]): IDisposable;
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
/**
|
|
71
|
+
* add dep to _renderDependencies(type, dep)
|
|
72
|
+
* @param type
|
|
73
|
+
* @param depCtor
|
|
74
|
+
*/
|
|
75
|
+
registerRenderModule(type: UnitType, depCtor: Dependency): IDisposable;
|
|
76
|
+
/**
|
|
77
|
+
* get render dependencies from _renderDependencies
|
|
78
|
+
* @param type
|
|
79
|
+
* @returns Dependency[]
|
|
80
|
+
*/
|
|
81
|
+
private _getRenderDepsByType;
|
|
59
82
|
create(unitId: string): void;
|
|
83
|
+
/**
|
|
84
|
+
* create renderUnit & init deps from renderDependencies
|
|
85
|
+
* @param unitId
|
|
86
|
+
* @returns renderUnit:IRender
|
|
87
|
+
*/
|
|
60
88
|
createRender(unitId: string): IRender;
|
|
61
89
|
getAllRenderersOfType(type: UniverInstanceType): RenderUnit[];
|
|
62
90
|
getCurrentTypeOfRenderer(type: UniverInstanceType): Nullable<RenderUnit>;
|
|
63
91
|
withCurrentTypeOfUnit<T>(type: UniverInstanceType, id: DependencyIdentifier<T>): Nullable<T>;
|
|
92
|
+
/**
|
|
93
|
+
* init deps by injector.get(dep), and injector derives from renderer.
|
|
94
|
+
* @param renderer
|
|
95
|
+
* @param deps
|
|
96
|
+
*/
|
|
97
|
+
private _tryAddRenderDependencies;
|
|
98
|
+
/**
|
|
99
|
+
* create renderUnit & init deps from renderDependencies by renderUnit's type
|
|
100
|
+
* @param unitId
|
|
101
|
+
* @param engine
|
|
102
|
+
* @param isMainScene
|
|
103
|
+
* @returns renderUnit:IRender
|
|
104
|
+
*/
|
|
64
105
|
private _createRender;
|
|
65
106
|
addRender(unitId: string, item: IRender): void;
|
|
66
107
|
private _addRenderUnit;
|
|
@@ -69,6 +110,11 @@ export declare class RenderManagerService extends Disposable implements IRenderM
|
|
|
69
110
|
setCurrent(unitId: string): void;
|
|
70
111
|
getCurrent(): IRender | undefined;
|
|
71
112
|
getFirst(): IRender;
|
|
113
|
+
/**
|
|
114
|
+
* get RenderUnit from this._renderMap
|
|
115
|
+
* @param unitId
|
|
116
|
+
* @returns RenderUnit, aka IRender
|
|
117
|
+
*/
|
|
72
118
|
getRenderById(unitId: string): Nullable<IRender>;
|
|
73
119
|
getRenderAll(): Map<string, IRender>;
|
|
74
120
|
private _disposeItem;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { Dependency, DependencyIdentifier, IDisposable, Nullable, UnitModel, UnitType, Disposable, Injector } from '@univerjs/core';
|
|
1
|
+
import { Dependency, DependencyIdentifier, IDisposable, Nullable, UnitModel, UnitType, UniverInstanceType, Disposable, Injector } from '@univerjs/core';
|
|
2
2
|
import { Engine } from '../engine';
|
|
3
3
|
import { Scene } from '../scene';
|
|
4
4
|
import { RenderComponentType } from './render-manager.service';
|
|
5
|
-
|
|
6
5
|
export interface IRender {
|
|
7
6
|
unitId: string;
|
|
7
|
+
type: UniverInstanceType;
|
|
8
8
|
engine: Engine;
|
|
9
9
|
scene: Scene;
|
|
10
10
|
mainComponent: Nullable<RenderComponentType>;
|
|
11
11
|
components: Map<string, RenderComponentType>;
|
|
12
12
|
isMainScene: boolean;
|
|
13
|
+
isThumbNail?: boolean;
|
|
13
14
|
with<T>(dependency: DependencyIdentifier<T>): T;
|
|
14
15
|
}
|
|
15
16
|
export interface IRenderModule extends IDisposable {
|
|
@@ -22,7 +23,7 @@ export interface IRenderContext<T extends UnitModel = UnitModel> extends Omit<IR
|
|
|
22
23
|
type: UnitType;
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
|
-
*
|
|
26
|
+
* RenderUnit impl IRender
|
|
26
27
|
*/
|
|
27
28
|
export declare class RenderUnit extends Disposable implements IRender {
|
|
28
29
|
readonly isRenderUnit: boolean;
|
|
@@ -5,7 +5,6 @@ import { IObjectFullState } from './basics/interfaces';
|
|
|
5
5
|
import { IViewportInfo, Vector2 } from './basics/vector2';
|
|
6
6
|
import { UniverRenderingContext } from './context';
|
|
7
7
|
import { ThinScene } from './thin-scene';
|
|
8
|
-
|
|
9
8
|
export declare class SceneViewer extends BaseObject {
|
|
10
9
|
private _subScenes;
|
|
11
10
|
private _activeSubScene;
|
package/lib/types/scene.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ import { ThinEngine } from './thin-engine';
|
|
|
12
12
|
import { ThinScene } from './thin-scene';
|
|
13
13
|
import { Viewport } from './viewport';
|
|
14
14
|
import { ITransformerConfig } from './basics/transformer-config';
|
|
15
|
-
|
|
16
15
|
export declare class Scene extends ThinScene {
|
|
17
16
|
private _parent;
|
|
18
17
|
private _layers;
|
|
@@ -80,7 +79,16 @@ export declare class Scene extends ThinScene {
|
|
|
80
79
|
removeObject(object?: BaseObject | string): this | undefined;
|
|
81
80
|
removeObjects(objects?: BaseObject[] | string[]): this | undefined;
|
|
82
81
|
getObjectsByLayer(zIndex: number): BaseObject[];
|
|
82
|
+
/**
|
|
83
|
+
* get objects which is visible and not in a group in each layer.
|
|
84
|
+
* @returns BaseObject[]
|
|
85
|
+
*/
|
|
83
86
|
getAllObjects(): BaseObject[];
|
|
87
|
+
/**
|
|
88
|
+
* get objects which is visible and not in a group.
|
|
89
|
+
* @param isDesc
|
|
90
|
+
* @returns BaseObject[]
|
|
91
|
+
*/
|
|
84
92
|
getAllObjectsByOrder(isDesc?: boolean): BaseObject[];
|
|
85
93
|
getAllObjectsByOrderForPick(isDesc?: boolean): BaseObject[];
|
|
86
94
|
getObject(oKey: string): BaseObject | undefined;
|
|
@@ -92,6 +100,10 @@ export declare class Scene extends ThinScene {
|
|
|
92
100
|
getViewport(key: string): Viewport | undefined;
|
|
93
101
|
render(parentCtx?: UniverRenderingContext): void;
|
|
94
102
|
requestRender(parentCtx?: UniverRenderingContext): Promise<unknown>;
|
|
103
|
+
/**
|
|
104
|
+
* create transformer if not exist, and then transformer attach to object that passed in by parameter.
|
|
105
|
+
* @param o
|
|
106
|
+
*/
|
|
95
107
|
attachTransformerTo(o: BaseObject): void;
|
|
96
108
|
detachTransformerFrom(o: BaseObject): void;
|
|
97
109
|
initTransformer(config?: ITransformerConfig): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Disposable } from '@univerjs/core';
|
|
2
2
|
import { IMouseEvent } from './basics/i-events';
|
|
3
3
|
import { ThinScene } from './thin-scene';
|
|
4
|
-
|
|
5
4
|
export declare class InputManager extends Disposable {
|
|
6
5
|
/** The distance in pixel that you have to move to prevent some events */
|
|
7
6
|
static DragMovementThreshold: number;
|
|
@@ -4,13 +4,13 @@ import { IMouseEvent, IPointerEvent } from './basics/i-events';
|
|
|
4
4
|
import { Group } from './group';
|
|
5
5
|
import { Scene } from './scene';
|
|
6
6
|
import { ITransformerConfig } from './basics/transformer-config';
|
|
7
|
-
|
|
8
7
|
declare enum MoveObserverType {
|
|
9
8
|
MOVE_START = 0,
|
|
10
9
|
MOVING = 1,
|
|
11
10
|
MOVE_END = 2
|
|
12
11
|
}
|
|
13
12
|
export interface IChangeObserverConfig {
|
|
13
|
+
target?: BaseObject;
|
|
14
14
|
objects: Map<string, BaseObject>;
|
|
15
15
|
type: MoveObserverType;
|
|
16
16
|
moveX?: number;
|
|
@@ -63,6 +63,10 @@ export declare class Transformer extends Disposable implements ITransformerConfi
|
|
|
63
63
|
useSingleNodeRotation: boolean;
|
|
64
64
|
shouldOverdrawWholeArea: boolean;
|
|
65
65
|
private readonly _changeStart$;
|
|
66
|
+
/**
|
|
67
|
+
* actually pointer down on a object,
|
|
68
|
+
* trigger when pick an object even object not change.
|
|
69
|
+
*/
|
|
66
70
|
readonly changeStart$: import('rxjs').Observable<IChangeObserverConfig>;
|
|
67
71
|
private readonly _changing$;
|
|
68
72
|
readonly changing$: import('rxjs').Observable<IChangeObserverConfig>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { IViewportInfo } from '../basics/vector2';
|
|
2
2
|
import { UniverRenderingContext } from '../context';
|
|
3
3
|
import { IRectProps, Rect } from './rect';
|
|
4
|
-
|
|
5
4
|
export declare class DashedRect extends Rect {
|
|
6
5
|
static drawWith(ctx: UniverRenderingContext, props: IRectProps | Rect): void;
|
|
7
6
|
protected _draw(ctx: UniverRenderingContext, viewportInfo?: IViewportInfo): void;
|
|
@@ -3,7 +3,6 @@ import { UniverRenderingContext } from '../context';
|
|
|
3
3
|
import { IObjectFullState, IViewportInfo, RENDER_CLASS_TYPE } from '../basics';
|
|
4
4
|
import { ObjectType } from '../base-object';
|
|
5
5
|
import { IShapeProps, Shape } from './shape';
|
|
6
|
-
|
|
7
6
|
export interface IImageProps extends IShapeProps {
|
|
8
7
|
image?: HTMLImageElement;
|
|
9
8
|
url?: string;
|
|
@@ -2,7 +2,6 @@ import { UniverRenderingContext } from '../context';
|
|
|
2
2
|
import { IViewportInfo } from '../basics/vector2';
|
|
3
3
|
import { ObjectType } from '../base-object';
|
|
4
4
|
import { IShapeProps, Shape } from './shape';
|
|
5
|
-
|
|
6
5
|
export interface IRectProps extends IShapeProps {
|
|
7
6
|
radius?: number;
|
|
8
7
|
}
|
|
@@ -2,7 +2,6 @@ import { IObjectFullState } from '../basics/interfaces';
|
|
|
2
2
|
import { IPoint, Vector2 } from '../basics/vector2';
|
|
3
3
|
import { UniverRenderingContext } from '../context';
|
|
4
4
|
import { IShapeProps, Shape } from './shape';
|
|
5
|
-
|
|
6
5
|
export interface IRegularPolygonProps extends IShapeProps {
|
|
7
6
|
pointsGroup: IPoint[][];
|
|
8
7
|
}
|
|
@@ -1,43 +1,104 @@
|
|
|
1
|
-
import { IDocumentData, IStyleBase, ITransformState, LocaleService } from '@univerjs/core';
|
|
2
|
-
import { BaseObject, ObjectType } from '../base-object';
|
|
1
|
+
import { IDocumentData, IStyleBase, ITransformState, LocaleService, DocumentDataModel } from '@univerjs/core';
|
|
2
|
+
import { BASE_OBJECT_ARRAY, BaseObject, ObjectType } from '../base-object';
|
|
3
3
|
import { IViewportInfo } from '../basics/vector2';
|
|
4
4
|
import { UniverRenderingContext } from '../context';
|
|
5
|
-
|
|
6
5
|
export interface IRichTextProps extends ITransformState, IStyleBase {
|
|
7
6
|
text?: string;
|
|
8
7
|
richText?: IDocumentData;
|
|
9
8
|
zIndex: number;
|
|
10
9
|
forceRender?: boolean;
|
|
11
10
|
}
|
|
11
|
+
export type RichtextObjectJSONType = {
|
|
12
|
+
[key in typeof BASE_OBJECT_ARRAY[number]]: number;
|
|
13
|
+
} & {
|
|
14
|
+
text: string;
|
|
15
|
+
fs: number;
|
|
16
|
+
richText?: unknown;
|
|
17
|
+
};
|
|
12
18
|
export declare const RICHTEXT_OBJECT_ARRAY: string[];
|
|
13
19
|
export declare class RichText extends BaseObject {
|
|
14
20
|
private _localeService;
|
|
15
21
|
private _documentData;
|
|
16
22
|
private _documentSkeleton;
|
|
17
23
|
private _documents;
|
|
24
|
+
documentModel: DocumentDataModel;
|
|
25
|
+
/**
|
|
26
|
+
* fontFamily
|
|
27
|
+
*/
|
|
18
28
|
private _ff?;
|
|
29
|
+
/**
|
|
30
|
+
* fontSize
|
|
31
|
+
* pt
|
|
32
|
+
*/
|
|
19
33
|
private _fs?;
|
|
34
|
+
/**
|
|
35
|
+
* italic
|
|
36
|
+
* 0: false
|
|
37
|
+
* 1: true
|
|
38
|
+
*/
|
|
20
39
|
private _it?;
|
|
40
|
+
/**
|
|
41
|
+
* bold
|
|
42
|
+
* 0: false
|
|
43
|
+
* 1: true
|
|
44
|
+
*/
|
|
21
45
|
private _bl?;
|
|
46
|
+
/**
|
|
47
|
+
* underline
|
|
48
|
+
*/
|
|
22
49
|
private _ul?;
|
|
50
|
+
/**
|
|
51
|
+
* strikethrough
|
|
52
|
+
*/
|
|
23
53
|
private _st?;
|
|
54
|
+
/**
|
|
55
|
+
* overline
|
|
56
|
+
*/
|
|
24
57
|
private _ol?;
|
|
58
|
+
/**
|
|
59
|
+
* background
|
|
60
|
+
*/
|
|
25
61
|
private _bg?;
|
|
62
|
+
/**
|
|
63
|
+
* border
|
|
64
|
+
*/
|
|
26
65
|
private _bd?;
|
|
66
|
+
/**
|
|
67
|
+
* foreground
|
|
68
|
+
*/
|
|
27
69
|
private _cl?;
|
|
28
70
|
objectType: ObjectType;
|
|
29
71
|
constructor(_localeService: LocaleService, key?: string, props?: IRichTextProps);
|
|
72
|
+
get fs(): number;
|
|
73
|
+
get text(): string;
|
|
30
74
|
get documentData(): IDocumentData;
|
|
75
|
+
/**
|
|
76
|
+
* get last page size
|
|
77
|
+
*/
|
|
31
78
|
getDocsSkeletonPageSize(): {
|
|
32
79
|
width: number;
|
|
33
80
|
height: number;
|
|
34
81
|
} | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* this[`_${key}`] = props[key];
|
|
84
|
+
* @param props
|
|
85
|
+
*/
|
|
35
86
|
setProps(props?: IRichTextProps): this | undefined;
|
|
36
87
|
render(mainCtx: UniverRenderingContext, bounds?: IViewportInfo): this;
|
|
37
|
-
toJson():
|
|
38
|
-
[x: string]: any;
|
|
39
|
-
};
|
|
88
|
+
toJson(): RichtextObjectJSONType;
|
|
40
89
|
protected _draw(ctx: UniverRenderingContext): void;
|
|
41
90
|
private _convertToDocumentData;
|
|
42
91
|
private _initialProps;
|
|
92
|
+
/**
|
|
93
|
+
*
|
|
94
|
+
* it should be invoked when _documentData changed.
|
|
95
|
+
* _documentData changed ---> update _documentSkeleton & _documentSkeleton
|
|
96
|
+
*
|
|
97
|
+
* now it is invoked when transformByState(change editor size) & end of editing
|
|
98
|
+
*/
|
|
99
|
+
refreshDocumentByDocData(): void;
|
|
100
|
+
/**
|
|
101
|
+
* invoked when end editing.
|
|
102
|
+
*/
|
|
103
|
+
resizeToContentSize(): void;
|
|
43
104
|
}
|
|
@@ -3,7 +3,6 @@ import { UniverRenderingContext } from '../context';
|
|
|
3
3
|
import { Viewport } from '../viewport';
|
|
4
4
|
import { IScrollBarProps, BaseScrollBar } from './base-scroll-bar';
|
|
5
5
|
import { Rect } from './rect';
|
|
6
|
-
|
|
7
6
|
export declare class ScrollBar extends BaseScrollBar {
|
|
8
7
|
protected _view: Viewport;
|
|
9
8
|
private _mainScene;
|
|
@@ -3,7 +3,6 @@ import { BaseObject, ObjectType } from '../base-object';
|
|
|
3
3
|
import { IObjectFullState } from '../basics/interfaces';
|
|
4
4
|
import { IViewportInfo, Vector2 } from '../basics/vector2';
|
|
5
5
|
import { UniverRenderingContext } from '../context';
|
|
6
|
-
|
|
7
6
|
export type LineJoin = 'round' | 'bevel' | 'miter';
|
|
8
7
|
export type LineCap = 'butt' | 'round' | 'square';
|
|
9
8
|
export type PaintFirst = 'fill' | 'stroke';
|
|
@@ -3,7 +3,6 @@ import { CURSOR_TYPE, RENDER_CLASS_TYPE } from './basics/const';
|
|
|
3
3
|
import { IEvent } from './basics/i-events';
|
|
4
4
|
import { ITransformChangeState } from './basics/interfaces';
|
|
5
5
|
import { Canvas } from './canvas';
|
|
6
|
-
|
|
7
6
|
export declare abstract class ThinEngine<T extends IDisposable> extends Disposable {
|
|
8
7
|
onInputChanged$: EventSubject<IEvent>;
|
|
9
8
|
onTransformChange$: EventSubject<ITransformChangeState>;
|
|
@@ -8,7 +8,6 @@ import { Vector2 } from './basics/vector2';
|
|
|
8
8
|
import { UniverRenderingContext } from './context';
|
|
9
9
|
import { ThinEngine } from './thin-engine';
|
|
10
10
|
import { Scene } from './scene';
|
|
11
|
-
|
|
12
11
|
export declare abstract class ThinScene extends Disposable {
|
|
13
12
|
onTransformChange$: EventSubject<ITransformChangeState>;
|
|
14
13
|
onFileLoaded$: EventSubject<string>;
|
package/lib/types/viewport.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { IBoundRectNoAngle, IViewportInfo, Vector2 } from './basics/vector2';
|
|
|
6
6
|
import { UniverRenderingContext } from './context';
|
|
7
7
|
import { BaseScrollBar } from './shape/base-scroll-bar';
|
|
8
8
|
import { ThinScene } from './thin-scene';
|
|
9
|
-
|
|
10
9
|
interface IViewPosition {
|
|
11
10
|
top?: number;
|
|
12
11
|
left?: number;
|