@netless/appliance-plugin 1.0.0 → 1.0.2
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 -10
- package/cdn/cdn.js +1 -1
- package/cdn/fullWorker-6Cu08P.js +438 -0
- package/cdn/subWorker-B3CHpe.js +438 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +12 -11
- package/dist/collector/base.d.ts +3 -1
- package/dist/collector/collector.d.ts +5 -4
- package/dist/collector/eventCollector.d.ts +2 -1
- package/dist/collector/magixEventCollector.d.ts +30 -0
- package/dist/collector/types.d.ts +27 -7
- package/dist/component/textEditor/manager.d.ts +2 -2
- package/dist/component/textEditor/types.d.ts +0 -1
- package/dist/component/textEditor/view.d.ts +4 -1
- package/dist/core/const.d.ts +2 -0
- package/dist/core/enum.d.ts +12 -5
- package/dist/core/mainEngine.d.ts +31 -10
- package/dist/core/mainThread/base.d.ts +6 -2
- package/dist/core/mainThread/snapshotThread.d.ts +3 -3
- package/dist/core/mainThread/subLocalThread.d.ts +18 -10
- package/dist/core/mainThread/subServiceThread.d.ts +2 -1
- package/dist/core/mainThread/subTopThread.d.ts +15 -8
- package/dist/core/msgEvent/deleteNode/forMainThread.d.ts +1 -5
- package/dist/core/msgEvent/deleteNode/forWorker.d.ts +1 -5
- package/dist/core/msgEvent/scaleNode/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setFont/forMain.d.ts +2 -1
- package/dist/core/tools/arrow.d.ts +36 -7
- package/dist/core/tools/base.d.ts +22 -8
- package/dist/core/tools/ellipse.d.ts +36 -7
- package/dist/core/tools/eraser.d.ts +40 -4
- package/dist/core/tools/image.d.ts +9 -5
- package/dist/core/tools/laserPen.d.ts +34 -4
- package/dist/core/tools/pencil.d.ts +37 -4
- package/dist/core/tools/polygon.d.ts +36 -7
- package/dist/core/tools/rectangle.d.ts +36 -7
- package/dist/core/tools/selector.d.ts +52 -4
- package/dist/core/tools/speechBalloon.d.ts +36 -8
- package/dist/core/tools/star.d.ts +36 -7
- package/dist/core/tools/straight.d.ts +36 -7
- package/dist/core/tools/text.d.ts +20 -10
- package/dist/core/tools/utils.d.ts +6 -5
- package/dist/core/types.d.ts +1 -1
- package/dist/core/utils/index.d.ts +10 -0
- package/dist/core/utils/math.d.ts +1 -0
- package/dist/core/{mainThread/vNodeManager.d.ts → vNodeManager.d.ts} +9 -3
- package/dist/core/worker/base.d.ts +18 -16
- package/dist/core/worker/fullWorkerLocal.d.ts +18 -9
- package/dist/core/worker/fullWorkerService.d.ts +10 -9
- package/dist/core/worker/subWorkerLocal.d.ts +5 -8
- package/dist/core/worker/subWorkerTopLayer.d.ts +13 -9
- package/dist/core/worker/workerManager.d.ts +18 -10
- package/dist/cursors/index.d.ts +44 -18
- package/dist/fullWorker.js +131 -146
- package/dist/index-CeTiLZdq.mjs +5619 -0
- package/dist/index-DHkeFixk.js +1 -0
- package/dist/index-DmkMw23K.mjs +9486 -0
- package/dist/index-Dmq7rqSP.js +1 -0
- package/dist/plugin/applianceSinglePlugin.d.ts +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +7 -1
- package/dist/plugin/baseViewContainerManager.d.ts +0 -3
- package/dist/plugin/const.d.ts +11 -1
- package/dist/plugin/displayerView.d.ts +1 -3
- package/dist/plugin/multi/containerManager.d.ts +2 -1
- package/dist/style.css +1 -1
- package/dist/subWorker.js +131 -146
- package/package.json +3 -4
- package/cdn/fullWorker-CIvt1j.js +0 -453
- package/cdn/subWorker-BE-0dg.js +0 -453
- package/dist/core/worker/vNodeManager.d.ts +0 -34
- package/dist/index-BcIJbozZ.js +0 -1
- package/dist/index-C1YKkWHE.mjs +0 -9090
- package/dist/index-ClJPZxV-.mjs +0 -5462
- package/dist/index-SsMz_ohn.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IWorkerMessage,
|
|
2
|
-
import { EScaleType, EToolsKey } from "../enum";
|
|
1
|
+
import { IWorkerMessage, IRectType, IUpdateNodeOpt } from "../types";
|
|
2
|
+
import { EDataType, EPostMessageType, EScaleType, EToolsKey } from "../enum";
|
|
3
3
|
import { Point2d } from "../utils/primitives/Point2d";
|
|
4
4
|
import { BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
|
|
5
|
-
import { VNodeManager } from "../
|
|
5
|
+
import { VNodeManager } from "../vNodeManager";
|
|
6
6
|
import type { SpeechBalloonPlacement } from "../../plugin/types";
|
|
7
7
|
import { ShapeNodes } from "./utils";
|
|
8
8
|
export interface SpeechBalloonOptions extends BaseShapeOptions {
|
|
@@ -27,11 +27,39 @@ export declare class SpeechBalloonShape extends BaseShapeTool {
|
|
|
27
27
|
isClearAll?: boolean;
|
|
28
28
|
isSubWorker?: boolean;
|
|
29
29
|
isMainThread?: boolean;
|
|
30
|
-
}):
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
}): {
|
|
31
|
+
type: EPostMessageType;
|
|
32
|
+
} | {
|
|
33
|
+
workId: string;
|
|
34
|
+
toolsType: EToolsKey;
|
|
35
|
+
opt: import("./utils").ShapeOptions;
|
|
36
|
+
type: EPostMessageType;
|
|
37
|
+
dataType: EDataType;
|
|
38
|
+
op: number[];
|
|
39
|
+
isSync: boolean;
|
|
40
|
+
index: number;
|
|
41
|
+
} | {
|
|
42
|
+
workId: string;
|
|
43
|
+
toolsType: EToolsKey;
|
|
44
|
+
opt: import("./utils").ShapeOptions;
|
|
45
|
+
rect: IRectType | undefined;
|
|
46
|
+
type: EPostMessageType;
|
|
47
|
+
dataType: EDataType;
|
|
48
|
+
};
|
|
49
|
+
consumeAll(): {
|
|
50
|
+
type: EPostMessageType;
|
|
51
|
+
removeIds: string[];
|
|
52
|
+
} | {
|
|
53
|
+
workId: string;
|
|
54
|
+
toolsType: EToolsKey;
|
|
55
|
+
opt: import("./utils").ShapeOptions;
|
|
56
|
+
rect: IRectType;
|
|
57
|
+
type: EPostMessageType;
|
|
58
|
+
dataType: EDataType;
|
|
59
|
+
ops: string;
|
|
60
|
+
isSync: boolean;
|
|
61
|
+
removeIds?: undefined;
|
|
62
|
+
};
|
|
35
63
|
private draw;
|
|
36
64
|
private transformControlPoints;
|
|
37
65
|
private computDrawPoints;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IWorkerMessage,
|
|
2
|
-
import { EScaleType, EToolsKey } from "../enum";
|
|
1
|
+
import { IWorkerMessage, IRectType, IUpdateNodeOpt } from "../types";
|
|
2
|
+
import { EDataType, EPostMessageType, EScaleType, EToolsKey } from "../enum";
|
|
3
3
|
import { Point2d } from "../utils/primitives/Point2d";
|
|
4
4
|
import { BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
|
|
5
|
-
import { VNodeManager } from "../
|
|
5
|
+
import { VNodeManager } from "../vNodeManager";
|
|
6
6
|
import { ShapeNodes } from "./utils";
|
|
7
7
|
export interface StarOptions extends BaseShapeOptions {
|
|
8
8
|
thickness: number;
|
|
@@ -26,10 +26,39 @@ export declare class StarShape extends BaseShapeTool {
|
|
|
26
26
|
isFullWork?: boolean;
|
|
27
27
|
isSubWorker?: boolean;
|
|
28
28
|
isMainThread?: boolean;
|
|
29
|
-
}):
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
}): {
|
|
30
|
+
type: EPostMessageType;
|
|
31
|
+
} | {
|
|
32
|
+
workId: string;
|
|
33
|
+
toolsType: EToolsKey;
|
|
34
|
+
opt: import("./utils").ShapeOptions;
|
|
35
|
+
type: EPostMessageType;
|
|
36
|
+
dataType: EDataType;
|
|
37
|
+
op: number[];
|
|
38
|
+
isSync: boolean;
|
|
39
|
+
index: number;
|
|
40
|
+
} | {
|
|
41
|
+
workId: string;
|
|
42
|
+
toolsType: EToolsKey;
|
|
43
|
+
opt: import("./utils").ShapeOptions;
|
|
44
|
+
rect: IRectType | undefined;
|
|
45
|
+
type: EPostMessageType;
|
|
46
|
+
dataType: EDataType;
|
|
47
|
+
};
|
|
48
|
+
consumeAll(): {
|
|
49
|
+
type: EPostMessageType;
|
|
50
|
+
removeIds: string[];
|
|
51
|
+
} | {
|
|
52
|
+
workId: string;
|
|
53
|
+
toolsType: EToolsKey;
|
|
54
|
+
opt: import("./utils").ShapeOptions;
|
|
55
|
+
rect: IRectType;
|
|
56
|
+
type: EPostMessageType;
|
|
57
|
+
dataType: EDataType;
|
|
58
|
+
ops: string;
|
|
59
|
+
isSync: boolean;
|
|
60
|
+
removeIds?: undefined;
|
|
61
|
+
};
|
|
33
62
|
private draw;
|
|
34
63
|
private computDrawPoints;
|
|
35
64
|
private updateTempPoints;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { IWorkerMessage,
|
|
2
|
-
import { EScaleType, EToolsKey } from "../enum";
|
|
1
|
+
import { IWorkerMessage, IRectType, IUpdateNodeOpt } from "../types";
|
|
2
|
+
import { EDataType, EPostMessageType, EScaleType, EToolsKey } from "../enum";
|
|
3
3
|
import { Point2d } from "../utils/primitives/Point2d";
|
|
4
4
|
import { BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
|
|
5
|
-
import { VNodeManager } from "../
|
|
5
|
+
import { VNodeManager } from "../vNodeManager";
|
|
6
6
|
import { ShapeNodes } from "./utils";
|
|
7
7
|
export interface StraightOptions extends BaseShapeOptions {
|
|
8
8
|
thickness: number;
|
|
@@ -24,10 +24,39 @@ export declare class StraightShape extends BaseShapeTool {
|
|
|
24
24
|
isClearAll?: boolean;
|
|
25
25
|
isSubWorker?: boolean;
|
|
26
26
|
isMainThread?: boolean;
|
|
27
|
-
}):
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
}): {
|
|
28
|
+
type: EPostMessageType;
|
|
29
|
+
} | {
|
|
30
|
+
workId: string;
|
|
31
|
+
toolsType: EToolsKey;
|
|
32
|
+
opt: import("./utils").ShapeOptions;
|
|
33
|
+
type: EPostMessageType;
|
|
34
|
+
dataType: EDataType;
|
|
35
|
+
op: number[];
|
|
36
|
+
isSync: boolean;
|
|
37
|
+
index: number;
|
|
38
|
+
} | {
|
|
39
|
+
workId: string;
|
|
40
|
+
toolsType: EToolsKey;
|
|
41
|
+
opt: import("./utils").ShapeOptions;
|
|
42
|
+
rect: IRectType | undefined;
|
|
43
|
+
type: EPostMessageType;
|
|
44
|
+
dataType: EDataType;
|
|
45
|
+
};
|
|
46
|
+
consumeAll(): {
|
|
47
|
+
type: EPostMessageType;
|
|
48
|
+
removeIds: string[];
|
|
49
|
+
} | {
|
|
50
|
+
workId: string;
|
|
51
|
+
toolsType: EToolsKey;
|
|
52
|
+
opt: import("./utils").ShapeOptions;
|
|
53
|
+
rect: IRectType;
|
|
54
|
+
type: EPostMessageType;
|
|
55
|
+
dataType: EDataType;
|
|
56
|
+
ops: string;
|
|
57
|
+
isSync: boolean;
|
|
58
|
+
removeIds?: undefined;
|
|
59
|
+
};
|
|
31
60
|
private draw;
|
|
32
61
|
private computDrawPoints;
|
|
33
62
|
private computFullPoints;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Group, Label, Polyline } from "spritejs";
|
|
2
|
-
import { BaseNodeMapItem,
|
|
3
|
-
import { EScaleType, EToolsKey } from "../enum";
|
|
1
|
+
import { Group, Label, Polyline, Sprite } from "spritejs";
|
|
2
|
+
import { BaseNodeMapItem, IRectType, IUpdateNodeOpt } from "../types";
|
|
3
|
+
import { EPostMessageType, EScaleType, EToolsKey } from "../enum";
|
|
4
4
|
import { Point2d } from "../utils/primitives/Point2d";
|
|
5
5
|
import { BaseShapeTool, BaseShapeToolProps } from "./base";
|
|
6
6
|
import { TextOptions } from "../../component/textEditor";
|
|
7
7
|
import { ShapeNodes } from "./utils";
|
|
8
|
-
import { VNodeManager } from "../
|
|
8
|
+
import { VNodeManager } from "../vNodeManager";
|
|
9
9
|
export declare class TextShape extends BaseShapeTool {
|
|
10
|
+
static textImageSnippetSize: number;
|
|
11
|
+
static SafeBorderPadding: number;
|
|
10
12
|
readonly canRotate: boolean;
|
|
11
13
|
readonly scaleType: EScaleType;
|
|
12
14
|
readonly toolsType: EToolsKey;
|
|
@@ -14,20 +16,28 @@ export declare class TextShape extends BaseShapeTool {
|
|
|
14
16
|
protected workOptions: TextOptions;
|
|
15
17
|
oldRect?: IRectType;
|
|
16
18
|
constructor(props: BaseShapeToolProps);
|
|
17
|
-
consume():
|
|
18
|
-
|
|
19
|
+
consume(): {
|
|
20
|
+
type: EPostMessageType;
|
|
21
|
+
};
|
|
22
|
+
consumeAll(): {
|
|
23
|
+
type: EPostMessageType;
|
|
24
|
+
};
|
|
19
25
|
consumeService(): IRectType | undefined;
|
|
20
26
|
private draw;
|
|
21
27
|
consumeServiceAsync(props: {
|
|
22
28
|
isFullWork: boolean;
|
|
23
29
|
replaceId?: string;
|
|
24
|
-
isDrawLabel?:
|
|
30
|
+
isDrawLabel?: boolean;
|
|
25
31
|
}): Promise<IRectType | undefined>;
|
|
26
32
|
updataOptService(): IRectType | undefined;
|
|
27
|
-
updataOptServiceAsync(updateNodeOpt: IUpdateNodeOpt): Promise<IRectType | undefined>;
|
|
33
|
+
updataOptServiceAsync(updateNodeOpt: IUpdateNodeOpt, isDrawLabel?: boolean): Promise<IRectType | undefined>;
|
|
28
34
|
clearTmpPoints(): void;
|
|
29
|
-
static
|
|
30
|
-
static
|
|
35
|
+
static getSafetySnippetRatio(layer: Group): number;
|
|
36
|
+
static getSafetySnippetFontLength(fontSize: number): number;
|
|
37
|
+
static createLabels(textOpt: TextOptions, layer: Group, groupRect: IRectType): Promise<{
|
|
38
|
+
labels: (Group | Polyline | Sprite | Label)[];
|
|
39
|
+
maxWidth: number;
|
|
40
|
+
}>;
|
|
31
41
|
static updateNodeOpt(param: {
|
|
32
42
|
node: ShapeNodes;
|
|
33
43
|
opt: IUpdateNodeOpt;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EPostMessageType, EToolsKey } from "../enum";
|
|
2
2
|
import { IRectType } from "../types";
|
|
3
|
-
import type { Ellipse, Group, Path, Polyline, Rect, Sprite } from "spritejs";
|
|
3
|
+
import type { Ellipse, Group, Label, Path, Polyline, Rect, Sprite } from "spritejs";
|
|
4
4
|
import { PencilOptions, PencilShape } from "./pencil";
|
|
5
5
|
import { LaserPenOptions, LaserPenShape } from "./laserPen";
|
|
6
6
|
import { EraserOptions, EraserShape } from "./eraser";
|
|
@@ -11,7 +11,7 @@ import { StraightOptions, StraightShape } from "./straight";
|
|
|
11
11
|
import { EllipseOptions, EllipseShape } from "./ellipse";
|
|
12
12
|
import { PolygonOptions, PolygonShape } from "./polygon";
|
|
13
13
|
import { RectangleOptions, RectangleShape } from "./rectangle";
|
|
14
|
-
import { VNodeManager } from "../
|
|
14
|
+
import { VNodeManager } from "../vNodeManager";
|
|
15
15
|
import { SpeechBalloonOptions, SpeechBalloonShape } from "./speechBalloon";
|
|
16
16
|
import { TextShape } from "./text";
|
|
17
17
|
import { TextOptions } from "../../component/textEditor";
|
|
@@ -22,7 +22,7 @@ import { BaseShapeTool } from "./base";
|
|
|
22
22
|
export type ShapeTools = typeof PencilShape | typeof LaserPenShape | typeof EraserShape | typeof StarShape | typeof SelectorShape | typeof ArrowShape | typeof EllipseShape | typeof RectangleShape | typeof StarShape | typeof PolygonShape | typeof TextShape | typeof SpeechBalloonShape | typeof ImageShape;
|
|
23
23
|
export type ShapeToolsClass = BaseShapeTool | PencilShape | LaserPenShape | EraserShape | StarShape | SelectorShape | ArrowShape | EllipseShape | RectangleShape | StarShape | PolygonShape | TextShape | SpeechBalloonShape | ImageShape;
|
|
24
24
|
export type ShapeOptions = PencilOptions | LaserPenOptions | EraserOptions | StarOptions | SelectorOptions | ArrowOptions | EllipseOptions | RectangleOptions | StarOptions | PolygonOptions | StraightOptions | TextOptions | SpeechBalloonOptions | ImageOptions;
|
|
25
|
-
export type ShapeNodes = Group | Path | Polyline | Rect | Ellipse | Sprite;
|
|
25
|
+
export type ShapeNodes = Group | Path | Polyline | Rect | Ellipse | Sprite | Label;
|
|
26
26
|
export type ServiceThreadSubWork = SubServiceThread | ServiceWorkForFullWorker;
|
|
27
27
|
export interface CombineConsumeResult {
|
|
28
28
|
type: EPostMessageType;
|
|
@@ -32,12 +32,13 @@ export interface CombineConsumeResult {
|
|
|
32
32
|
export interface ShapeStateInfo {
|
|
33
33
|
willClear: boolean;
|
|
34
34
|
}
|
|
35
|
-
export declare function getShapeTools(toolsType: EToolsKey): typeof
|
|
35
|
+
export declare function getShapeTools(toolsType: EToolsKey): typeof PencilShape | typeof LaserPenShape | typeof EraserShape | typeof StarShape | typeof TextShape | typeof SelectorShape | typeof ArrowShape | typeof StraightShape | typeof EllipseShape | typeof PolygonShape | typeof RectangleShape | typeof SpeechBalloonShape | typeof ImageShape | undefined;
|
|
36
36
|
export declare function getShapeInstance(param: {
|
|
37
|
+
workId: string;
|
|
37
38
|
toolsType: EToolsKey;
|
|
38
39
|
toolsOpt: ShapeOptions;
|
|
39
40
|
vNodes?: VNodeManager;
|
|
40
41
|
fullLayer: Group;
|
|
41
42
|
drawLayer?: Group;
|
|
42
|
-
}, serviceWork?: ServiceThreadSubWork):
|
|
43
|
+
}, serviceWork?: ServiceThreadSubWork): PencilShape | LaserPenShape | EraserShape | StarShape | TextShape | SelectorShape | ImageShape | ArrowShape | StraightShape | EllipseShape | PolygonShape | RectangleShape | SpeechBalloonShape | undefined;
|
|
43
44
|
export declare function findShapeBody(nodes: ShapeNodes[]): ShapeNodes[];
|
package/dist/core/types.d.ts
CHANGED
|
@@ -177,7 +177,7 @@ export interface IMainMessage extends INormalPushMsg {
|
|
|
177
177
|
isLocked?: boolean;
|
|
178
178
|
shapeOpt?: ShapeOptType;
|
|
179
179
|
toolsTypes?: EToolsKey[];
|
|
180
|
-
|
|
180
|
+
isLockSentEventCursor?: boolean;
|
|
181
181
|
}
|
|
182
182
|
export interface IMainMessageRenderData {
|
|
183
183
|
viewId: string;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EMatrixrRelationType } from '../enum';
|
|
2
|
+
import { IRectType } from '../types';
|
|
1
3
|
import { Box2d } from './primitives/Box2d';
|
|
2
4
|
import { Vec2d, VecLike } from './primitives/Vec2d';
|
|
3
5
|
export * from "./math";
|
|
@@ -362,3 +364,11 @@ export declare function toFixed(v: number): number;
|
|
|
362
364
|
export declare const isSafeFloat: (n: number) => boolean;
|
|
363
365
|
export declare const requestAsyncCallBack: (callBack: () => void, timeout: number) => Promise<void>;
|
|
364
366
|
export declare const getRatioWithContext: (context?: CanvasRenderingContext2D) => number;
|
|
367
|
+
export declare const getRectMatrixrRelation: (rect: IRectType, BoxRect: IRectType) => EMatrixrRelationType;
|
|
368
|
+
export declare function strlen(str: string): number;
|
|
369
|
+
export declare const getInSertRect: (rect: IRectType, boxRect: IRectType) => {
|
|
370
|
+
x: number;
|
|
371
|
+
y: number;
|
|
372
|
+
w: number;
|
|
373
|
+
h: number;
|
|
374
|
+
} | undefined;
|
|
@@ -58,3 +58,4 @@ export declare function getNodeRect(key: string, layer?: Group, safeBorderPaddin
|
|
|
58
58
|
export declare function isIntersectForPoint(point: [number, number], rect: IRectType): boolean;
|
|
59
59
|
export declare const getLineSegIntersection: (p1: [number, number], p2: [number, number], p3: [number, number], p4: [number, number]) => [number, number] | null;
|
|
60
60
|
export declare function getWHRatio(w: number, h: number): [number, number];
|
|
61
|
+
export declare function checkOp(op: number[]): boolean;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { Group, Scene } from "spritejs";
|
|
2
|
-
import { BaseNodeMapItem, IRectType } from "
|
|
2
|
+
import { BaseNodeMapItem, IRectType } from "./types";
|
|
3
|
+
import { EToolsKey } from ".";
|
|
3
4
|
export declare class VNodeManager {
|
|
4
5
|
viewId: string;
|
|
5
6
|
scene: Scene;
|
|
6
7
|
fullLayer?: Group;
|
|
7
8
|
curNodeMap: Map<string, BaseNodeMapItem>;
|
|
8
9
|
targetNodeMap: Map<string, BaseNodeMapItem>[];
|
|
10
|
+
private highLevelIds?;
|
|
9
11
|
constructor(viewId: string, scene: Scene);
|
|
10
12
|
init(fullLayer: Group): void;
|
|
11
13
|
get(name: string): BaseNodeMapItem | undefined;
|
|
14
|
+
getNodesByType(type: EToolsKey): Map<string, BaseNodeMapItem>;
|
|
12
15
|
hasRenderNodes(): boolean;
|
|
13
16
|
has(name: string): boolean;
|
|
14
17
|
setInfo(name: string, info: Partial<BaseNodeMapItem>): void;
|
|
@@ -17,12 +20,15 @@ export declare class VNodeManager {
|
|
|
17
20
|
delete(name: string): void;
|
|
18
21
|
clear(): void;
|
|
19
22
|
hasRectIntersectRange(rect: IRectType, filterLock?: boolean): boolean;
|
|
20
|
-
getRectIntersectRange(rect: IRectType, filterLock?: boolean): {
|
|
23
|
+
getRectIntersectRange(rect: IRectType, filterLock?: boolean, filterEditor?: boolean): {
|
|
21
24
|
rectRange: IRectType | undefined;
|
|
22
25
|
nodeRange: Map<string, BaseNodeMapItem>;
|
|
23
26
|
};
|
|
24
27
|
getNodeRectFormShape(name: string, value: BaseNodeMapItem): IRectType | undefined;
|
|
25
|
-
|
|
28
|
+
updateNodeRect(key: string): void;
|
|
29
|
+
updateHighLevelNodesRect(highLevelIds: Set<string>): void;
|
|
30
|
+
updateLowLevelNodesRect(): void;
|
|
31
|
+
clearHighLevelIds(): void;
|
|
26
32
|
combineIntersectRect(rect: IRectType): IRectType;
|
|
27
33
|
setTarget(): number;
|
|
28
34
|
getLastTarget(): Map<string, BaseNodeMapItem>;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Group, Scene } from "spritejs";
|
|
2
2
|
import { IActiveToolsDataType, IActiveWorkDataType, IBatchMainMessage, ICameraOpt, ILayerOptionType, IOffscreenCanvasOptionType, IRectType, IWorkerMessage } from "../types";
|
|
3
|
-
import { VNodeManager } from "
|
|
3
|
+
import { VNodeManager } from "../vNodeManager";
|
|
4
4
|
import { ECanvasContextType, ECanvasShowType, EDataType, EvevtWorkState } from "../enum";
|
|
5
|
-
import { ShapeStateInfo } from "../tools/utils";
|
|
6
5
|
import { BaseShapeOptions, BaseShapeTool } from "../tools/base";
|
|
7
6
|
import { ServiceWorkForFullWorker } from "./fullWorkerService";
|
|
8
7
|
import { LocalWorkForFullWorker } from "./fullWorkerLocal";
|
|
9
8
|
import { LocalWorkForSubWorker } from "./subWorkerLocal";
|
|
10
|
-
import { WorkThreadEngineForFullWorker, WorkThreadEngineForSubWorker } from "./workerManager";
|
|
9
|
+
import { EWorkThreadType, WorkThreadEngineForFullWorker, WorkThreadEngineForSubWorker } from "./workerManager";
|
|
11
10
|
import { EmitEventType } from "../../plugin/types";
|
|
12
11
|
export interface IWorkerInitOption {
|
|
13
12
|
dpr: number;
|
|
@@ -28,6 +27,7 @@ export declare abstract class WorkThreadEngineBase {
|
|
|
28
27
|
readonly vNodes: VNodeManager;
|
|
29
28
|
readonly dpr: number;
|
|
30
29
|
readonly contextType?: ECanvasContextType;
|
|
30
|
+
abstract readonly type: EWorkThreadType;
|
|
31
31
|
protected opt: IWorkerInitOption;
|
|
32
32
|
protected cameraOpt?: ICameraOpt;
|
|
33
33
|
protected scene: Scene;
|
|
@@ -42,19 +42,21 @@ export declare abstract class WorkThreadEngineBase {
|
|
|
42
42
|
workName: EmitEventType;
|
|
43
43
|
workState: EvevtWorkState;
|
|
44
44
|
};
|
|
45
|
-
|
|
45
|
+
protected delayPostDoneResolve?: (bol: boolean) => void;
|
|
46
|
+
constructor(viewId: string, opt: IWorkerInitOption, workerType: EWorkThreadType);
|
|
46
47
|
setIsSafari(isSafari: boolean): void;
|
|
47
48
|
on(msg: IWorkerMessage): Promise<void>;
|
|
49
|
+
protected createLocalWork(data: IWorkerMessage): void;
|
|
48
50
|
protected updateScene(offscreenCanvasOpt: IOffscreenCanvasOptionType): void;
|
|
49
51
|
protected updateLayer(layerOpt: ILayerOptionType): void;
|
|
50
52
|
private getSupportContextType;
|
|
51
53
|
protected createScene(opt: IOffscreenCanvasOptionType): Scene;
|
|
52
54
|
protected createLayer(name: string, scene: Scene, opt: ILayerOptionType): Group;
|
|
53
|
-
protected clearAll(): void
|
|
55
|
+
protected clearAll(): Promise<void>;
|
|
54
56
|
protected setToolsOpt(opt: IActiveToolsDataType): void;
|
|
55
57
|
protected setWorkOpt(opt: Partial<IActiveWorkDataType>): void;
|
|
56
58
|
protected destroy(): void;
|
|
57
|
-
post(msg: IBatchMainMessage): void
|
|
59
|
+
post(msg: IBatchMainMessage): Promise<void>;
|
|
58
60
|
private runBatchPostData;
|
|
59
61
|
protected combinePostData(): IBatchMainMessage;
|
|
60
62
|
protected safariFixRect(rect: IRectType): IRectType | undefined;
|
|
@@ -62,8 +64,9 @@ export declare abstract class WorkThreadEngineBase {
|
|
|
62
64
|
abstract combinePost(): Promise<void>;
|
|
63
65
|
protected abstract getLayer(workLayer: ECanvasShowType): Group | undefined;
|
|
64
66
|
abstract setCameraOpt(cameraOpt: ICameraOpt): void;
|
|
65
|
-
abstract consumeDraw(type: EDataType, data: IWorkerMessage): void
|
|
66
|
-
abstract consumeDrawAll(type: EDataType, data: IWorkerMessage): void
|
|
67
|
+
abstract consumeDraw(type: EDataType, data: IWorkerMessage): Promise<void>;
|
|
68
|
+
abstract consumeDrawAll(type: EDataType, data: IWorkerMessage): Promise<void>;
|
|
69
|
+
abstract updateCamera(msg: IWorkerMessage): Promise<void>;
|
|
67
70
|
}
|
|
68
71
|
export declare abstract class LocalWork {
|
|
69
72
|
readonly viewId: string;
|
|
@@ -71,24 +74,23 @@ export declare abstract class LocalWork {
|
|
|
71
74
|
readonly thread: WorkThreadEngineForFullWorker | WorkThreadEngineForSubWorker;
|
|
72
75
|
fullLayer: Group;
|
|
73
76
|
drawLayer?: Group;
|
|
74
|
-
readonly _post: (msg: IBatchMainMessage) => void
|
|
75
|
-
protected tmpWorkShapeNode?: BaseShapeTool;
|
|
77
|
+
readonly _post: (msg: IBatchMainMessage) => Promise<void>;
|
|
76
78
|
protected tmpOpt?: IActiveToolsDataType;
|
|
77
79
|
workShapes: Map<string, BaseShapeTool>;
|
|
78
|
-
workShapeState: Map<string, ShapeStateInfo>;
|
|
79
80
|
protected drawCount: number;
|
|
81
|
+
protected syncUnitTime: number;
|
|
80
82
|
constructor(opt: ISubWorkerInitOption);
|
|
81
83
|
destroy(): void;
|
|
82
84
|
getWorkShapes(): Map<string, BaseShapeTool>;
|
|
83
85
|
getWorkShape(workId: string): BaseShapeTool | undefined;
|
|
84
|
-
|
|
85
|
-
setTmpWorkId(workId: string | undefined): void;
|
|
86
|
+
createWorkShape(workId: string, opt?: BaseShapeOptions): void;
|
|
86
87
|
setWorkOptions(workId: string, opt: BaseShapeOptions): void;
|
|
87
88
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
88
|
-
workId
|
|
89
|
-
}): import("../tools
|
|
89
|
+
workId: string;
|
|
90
|
+
}): import("../tools").PencilShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").StarShape | import("../tools/text").TextShape | import("../tools").SelectorShape | import("../tools").ImageShape | import("../tools").ArrowShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | undefined;
|
|
90
91
|
setToolsOpt(opt: IActiveToolsDataType): void;
|
|
92
|
+
getToolsOpt(): IActiveToolsDataType | undefined;
|
|
91
93
|
clearWorkShapeNodeCache(workId: string): void;
|
|
92
94
|
clearAllWorkShapesCache(): void;
|
|
93
|
-
setFullWork(data: Pick<IWorkerMessage, 'workId' | 'opt' | 'toolsType'>): BaseShapeTool |
|
|
95
|
+
setFullWork(data: Pick<IWorkerMessage, 'workId' | 'opt' | 'toolsType'>): BaseShapeTool | undefined;
|
|
94
96
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IWorkerMessage, IMainMessage,
|
|
1
|
+
import { IWorkerMessage, IMainMessage, EToolsKey, IBatchMainMessage, IUpdateSelectorPropsType } from "..";
|
|
2
2
|
import { BaseShapeOptions, SelectorShape } from "../tools";
|
|
3
3
|
import { ISubWorkerInitOption, LocalWork } from "./base";
|
|
4
4
|
import { ServiceWorkForFullWorker } from "./fullWorkerService";
|
|
@@ -6,16 +6,22 @@ import { Scene } from "spritejs";
|
|
|
6
6
|
export declare class LocalWorkForFullWorker extends LocalWork {
|
|
7
7
|
private combineUnitTime;
|
|
8
8
|
private combineTimerId?;
|
|
9
|
+
private combineDrawResolve?;
|
|
10
|
+
private combineDrawActiveId?;
|
|
11
|
+
protected drawWorkActiveId?: string;
|
|
9
12
|
private effectSelectNodeData;
|
|
10
13
|
private batchEraserWorks;
|
|
11
14
|
private batchEraserRemoveNodes;
|
|
12
15
|
constructor(opt: ISubWorkerInitOption);
|
|
13
|
-
consumeDraw(data: IWorkerMessage, serviceWork: ServiceWorkForFullWorker):
|
|
14
|
-
consumeDrawAll(data: IWorkerMessage, serviceWork: ServiceWorkForFullWorker):
|
|
15
|
-
workShapesDone(scenePath: string, serviceWork: ServiceWorkForFullWorker): void
|
|
16
|
+
consumeDraw(data: IWorkerMessage, serviceWork: ServiceWorkForFullWorker): Promise<void>;
|
|
17
|
+
consumeDrawAll(data: IWorkerMessage, serviceWork: ServiceWorkForFullWorker): Promise<void>;
|
|
18
|
+
workShapesDone(scenePath: string, serviceWork: ServiceWorkForFullWorker): Promise<void>;
|
|
16
19
|
consumeFull(data: IWorkerMessage, scene?: Scene): Promise<void>;
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
private commandDeleteText;
|
|
21
|
+
removeSelector(data: IWorkerMessage): Promise<void>;
|
|
22
|
+
removeWork(data: IWorkerMessage): Promise<void>;
|
|
23
|
+
private removeNode;
|
|
24
|
+
private _removeWork;
|
|
19
25
|
checkTextActive(data: IWorkerMessage): Promise<void>;
|
|
20
26
|
colloctEffectSelectWork(data: IWorkerMessage): Promise<IWorkerMessage | undefined>;
|
|
21
27
|
updateSelector(params: IUpdateSelectorPropsType & {
|
|
@@ -32,8 +38,10 @@ export declare class LocalWorkForFullWorker extends LocalWork {
|
|
|
32
38
|
}) => void;
|
|
33
39
|
}): Promise<IMainMessage | undefined>;
|
|
34
40
|
blurSelector(data?: IWorkerMessage): Promise<void>;
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
hasSelector(): boolean;
|
|
42
|
+
getSelector(): SelectorShape;
|
|
43
|
+
reRenderSelector(willSyncService?: boolean): Promise<void>;
|
|
44
|
+
updateFullSelectWork(data: IWorkerMessage): Promise<void>;
|
|
37
45
|
destroy(): void;
|
|
38
46
|
private drawPencilCombine;
|
|
39
47
|
private drawSelector;
|
|
@@ -43,5 +51,6 @@ export declare class LocalWorkForFullWorker extends LocalWork {
|
|
|
43
51
|
private drawPencilFull;
|
|
44
52
|
private updateBatchEraserCombineNode;
|
|
45
53
|
private runEffectSelectWork;
|
|
46
|
-
cursorHover(msg: IWorkerMessage): void
|
|
54
|
+
cursorHover(msg: IWorkerMessage): Promise<void>;
|
|
55
|
+
cursorBlur(): Promise<void>;
|
|
47
56
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Group } from "spritejs";
|
|
2
2
|
import { ISubWorkerInitOption } from "./base";
|
|
3
|
-
import { VNodeManager } from "
|
|
3
|
+
import { VNodeManager } from "../vNodeManager";
|
|
4
4
|
import { IBatchMainMessage, IServiceWorkItem, IWorkerMessage } from "../types";
|
|
5
5
|
import { EToolsKey } from "../enum";
|
|
6
6
|
import { BaseShapeOptions } from "../tools";
|
|
7
|
+
import { WorkThreadEngineForFullWorker } from "./workerManager";
|
|
7
8
|
export interface ServiceWork {
|
|
8
9
|
readonly viewId: string;
|
|
9
10
|
readonly vNodes: VNodeManager;
|
|
@@ -11,12 +12,11 @@ export interface ServiceWork {
|
|
|
11
12
|
readonly drawLayer: Group;
|
|
12
13
|
readonly post: (msg: IBatchMainMessage) => void;
|
|
13
14
|
selectorWorkShapes: Map<string, IServiceWorkItem>;
|
|
14
|
-
clearAllWorkShapesCache(): void;
|
|
15
15
|
runSelectWork(data: IWorkerMessage): void;
|
|
16
16
|
consumeDraw(data: IWorkerMessage): void;
|
|
17
|
-
setNodeKey(workShape: IServiceWorkItem, tools: EToolsKey, opt: BaseShapeOptions): IServiceWorkItem;
|
|
17
|
+
setNodeKey(workId: string, workShape: IServiceWorkItem, tools: EToolsKey, opt: BaseShapeOptions): IServiceWorkItem;
|
|
18
18
|
runReverseSelectWork(selectIds: string[]): void;
|
|
19
|
-
removeWork(data: IWorkerMessage): void
|
|
19
|
+
removeWork(data: IWorkerMessage): Promise<void>;
|
|
20
20
|
removeSelectWork(data: IWorkerMessage): void;
|
|
21
21
|
runSelectWork(data: IWorkerMessage): void;
|
|
22
22
|
consumeFull(data: IWorkerMessage): void;
|
|
@@ -30,20 +30,21 @@ export declare class ServiceWorkForFullWorker implements ServiceWork {
|
|
|
30
30
|
drawLayer: Group;
|
|
31
31
|
workShapes: Map<string, IServiceWorkItem>;
|
|
32
32
|
selectorWorkShapes: Map<string, IServiceWorkItem>;
|
|
33
|
+
thread: WorkThreadEngineForFullWorker;
|
|
33
34
|
protected animationId?: number | undefined;
|
|
34
35
|
private willRunEffectSelectorIds;
|
|
35
36
|
private runEffectId?;
|
|
36
37
|
private noAnimationRect;
|
|
37
|
-
|
|
38
|
+
private syncUnitTime;
|
|
39
|
+
post: (msg: IBatchMainMessage) => Promise<void>;
|
|
38
40
|
constructor(opt: ISubWorkerInitOption);
|
|
39
41
|
destroy(): void;
|
|
40
|
-
consumeDraw(data: IWorkerMessage): void
|
|
42
|
+
consumeDraw(data: IWorkerMessage): Promise<void>;
|
|
41
43
|
consumeFull(data: IWorkerMessage): void;
|
|
42
|
-
clearAllWorkShapesCache(): void;
|
|
43
44
|
runSelectWork(data: IWorkerMessage): void;
|
|
44
|
-
setNodeKey(workShape: IServiceWorkItem, tools: EToolsKey, opt: BaseShapeOptions): IServiceWorkItem;
|
|
45
|
+
setNodeKey(workId: string, workShape: IServiceWorkItem, tools: EToolsKey, opt: BaseShapeOptions): IServiceWorkItem;
|
|
45
46
|
runReverseSelectWork(selectIds: string[]): void;
|
|
46
|
-
removeWork(data: IWorkerMessage): void
|
|
47
|
+
removeWork(data: IWorkerMessage): Promise<void>;
|
|
47
48
|
removeSelectWork(data: IWorkerMessage): void;
|
|
48
49
|
private removeNode;
|
|
49
50
|
private activeWorkShape;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IWorkerMessage, IRectType, IMainMessage } from "..";
|
|
3
|
-
import { BaseCollectorReducerAction } from "../../collector/types";
|
|
1
|
+
import { IWorkerMessage, IRectType } from "..";
|
|
4
2
|
import { LocalWork, ISubWorkerInitOption } from "./base";
|
|
5
3
|
export declare class LocalWorkForSubWorker extends LocalWork {
|
|
6
|
-
|
|
4
|
+
private drawWorkActiveId?;
|
|
7
5
|
constructor(opt: ISubWorkerInitOption);
|
|
8
6
|
runFullWork(data: IWorkerMessage): Promise<IRectType | undefined>;
|
|
9
7
|
runSelectWork(data: IWorkerMessage): undefined;
|
|
10
8
|
workShapesDone(): void;
|
|
11
|
-
consumeDraw(data: IWorkerMessage):
|
|
12
|
-
consumeDrawAll(data: IWorkerMessage):
|
|
13
|
-
|
|
14
|
-
removeWork(data: IWorkerMessage): void;
|
|
9
|
+
consumeDraw(data: IWorkerMessage): Promise<void>;
|
|
10
|
+
consumeDrawAll(data: IWorkerMessage): Promise<void>;
|
|
11
|
+
removeWork(data: IWorkerMessage): Promise<void>;
|
|
15
12
|
private removeNode;
|
|
16
13
|
private drawPencil;
|
|
17
14
|
private drawArrow;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Group } from "spritejs";
|
|
2
|
-
import { BaseShapeOptions
|
|
2
|
+
import { BaseShapeOptions } from "../tools";
|
|
3
3
|
import { ISubWorkerInitOption } from "./base";
|
|
4
|
-
import { VNodeManager } from "
|
|
4
|
+
import { VNodeManager } from "../vNodeManager";
|
|
5
5
|
import { IActiveToolsDataType, IBatchMainMessage, ILocalWorkItem, IServiceWorkItem, IWorkerMessage } from "../types";
|
|
6
|
+
import { EToolsKey } from "../enum";
|
|
7
|
+
import { WorkThreadEngineForSubWorker } from "./workerManager";
|
|
6
8
|
export interface TopLayerWork {
|
|
7
9
|
readonly viewId: string;
|
|
8
10
|
readonly vNodes: VNodeManager;
|
|
9
11
|
readonly topLayer: Group;
|
|
10
|
-
readonly post: (msg: IBatchMainMessage) => void
|
|
12
|
+
readonly post: (msg: IBatchMainMessage) => Promise<void>;
|
|
11
13
|
consumeDraw(data: IWorkerMessage): void;
|
|
12
14
|
consumeDrawAll(data: IWorkerMessage): void;
|
|
13
15
|
destroy(): void;
|
|
@@ -16,22 +18,24 @@ export declare class TopLayerWorkForSubWorker implements TopLayerWork {
|
|
|
16
18
|
viewId: string;
|
|
17
19
|
vNodes: VNodeManager;
|
|
18
20
|
topLayer: Group;
|
|
19
|
-
|
|
21
|
+
readonly thread: WorkThreadEngineForSubWorker;
|
|
22
|
+
post: (msg: IBatchMainMessage) => Promise<void>;
|
|
20
23
|
serviceWorkShapes: Map<string, IServiceWorkItem>;
|
|
21
24
|
localWorkShapes: Map<string, ILocalWorkItem>;
|
|
22
25
|
protected tmpOpt?: IActiveToolsDataType;
|
|
23
|
-
|
|
26
|
+
private syncUnitTime;
|
|
24
27
|
protected animationId?: number | undefined;
|
|
25
28
|
constructor(opt: ISubWorkerInitOption);
|
|
29
|
+
canUseTopLayer(toolsType: EToolsKey): boolean;
|
|
26
30
|
getWorkShape(workId: string): ILocalWorkItem | undefined;
|
|
27
|
-
|
|
28
|
-
setTmpWorkId(workId: string | undefined): void;
|
|
31
|
+
createWorkShape(workId: string, opt?: BaseShapeOptions): import("../tools").PencilShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").StarShape | import("../tools/text").TextShape | import("../tools").SelectorShape | import("../tools").ImageShape | import("../tools").ArrowShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | undefined;
|
|
29
32
|
setWorkOptions(workId: string, opt: BaseShapeOptions): void;
|
|
30
33
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
31
|
-
workId
|
|
32
|
-
}): import("../tools
|
|
34
|
+
workId: string;
|
|
35
|
+
}): import("../tools").PencilShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").StarShape | import("../tools/text").TextShape | import("../tools").SelectorShape | import("../tools").ImageShape | import("../tools").ArrowShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | undefined;
|
|
33
36
|
clearAllWorkShapesCache(): void;
|
|
34
37
|
setToolsOpt(opt: IActiveToolsDataType): void;
|
|
38
|
+
getToolsOpt(): IActiveToolsDataType | undefined;
|
|
35
39
|
consumeDraw(data: IWorkerMessage): void;
|
|
36
40
|
consumeDrawAll(data: IWorkerMessage): void;
|
|
37
41
|
destroy(): void;
|