@netless/appliance-plugin 1.0.0-beta.8 → 1.0.1
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/cdn/cdn.js +1 -1
- package/cdn/fullWorker-CIvt1j.js +453 -0
- package/cdn/subWorker-BE-0dg.js +453 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +13 -13
- package/dist/core/enum.d.ts +8 -1
- package/dist/core/mainEngine.d.ts +9 -2
- package/dist/core/mainThread/base.d.ts +2 -2
- package/dist/core/mainThread/index.d.ts +2 -2
- package/dist/core/mainThread/snapshotThread.d.ts +4 -4
- package/dist/core/mainThread/subLocalThread.d.ts +17 -13
- package/dist/core/mainThread/subTopThread.d.ts +7 -7
- package/dist/core/mainThread/vNodeManager.d.ts +2 -1
- package/dist/core/msgEvent/base.d.ts +6 -2
- package/dist/core/msgEvent/copyNode/forMain.d.ts +1 -0
- package/dist/core/msgEvent/deleteNode/forMain.d.ts +1 -0
- package/dist/core/msgEvent/deleteNode/forMainThread.d.ts +1 -4
- package/dist/core/msgEvent/deleteNode/forWorker.d.ts +1 -4
- package/dist/core/msgEvent/index.d.ts +4 -0
- package/dist/core/msgEvent/rotateNode/forMain.d.ts +2 -1
- package/dist/core/msgEvent/scaleNode/forMain.d.ts +2 -1
- package/dist/core/msgEvent/setColor/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setFont/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setLock/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setPoint/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setShape/forMain.d.ts +1 -0
- package/dist/core/msgEvent/setZIndex/forMain.d.ts +1 -0
- package/dist/core/msgEvent/translateNode/forMain.d.ts +2 -1
- package/dist/core/tools/base.d.ts +1 -1
- package/dist/core/tools/text.d.ts +2 -8
- package/dist/core/tools/utils.d.ts +2 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/core/worker/base.d.ts +21 -13
- package/dist/core/worker/fullWorkerLocal.d.ts +1 -0
- package/dist/core/worker/subWorkerLocal.d.ts +3 -0
- package/dist/core/worker/subWorkerTopLayer.d.ts +7 -7
- package/dist/core/worker/vNodeManager.d.ts +2 -1
- package/dist/core/worker/workerManager.d.ts +2 -1
- package/dist/fullWorker.js +453 -566
- package/dist/index-BcIJbozZ.js +1 -0
- package/dist/index-C1YKkWHE.mjs +9090 -0
- package/dist/{index-Bt9t1FKB.mjs → index-ClJPZxV-.mjs} +1195 -1151
- package/dist/index-SsMz_ohn.js +1 -0
- package/dist/plugin/single/applianceDisplayer.d.ts +0 -1
- package/dist/plugin/types.d.ts +6 -14
- package/dist/style.css +1 -1
- package/dist/subWorker.js +453 -566
- package/package.json +5 -2
- package/cdn/fullWorker-BlZ1Wa.js +0 -566
- package/cdn/subWorker-BKoiIW.js +0 -566
- package/dist/index-BUCsfWH1.js +0 -1
- package/dist/index-Bz3L5rvA.js +0 -1
- package/dist/index-CTYUQm0L.mjs +0 -8859
package/dist/appliance-plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-SsMz_ohn.js");exports.ActiveContainerType=e.ActiveContainerType;exports.ApplianceMultiPlugin=e.ApplianceMultiPlugin;exports.ApplianceNames=e.ApplianceNames;exports.ApplianceSigleWrapper=e.ApplianceSigleWrapper;exports.ApplianceSinglePlugin=e.ApplianceSinglePlugin;exports.ECanvasContextType=e.ECanvasContextType;exports.ECanvasShowType=e.ECanvasShowType;exports.EDataType=e.EDataType;exports.EPostMessageType=e.EPostMessageType;exports.EScaleType=e.EScaleType;exports.EStrokeType=e.EStrokeType;exports.EToolsKey=e.EToolsKey;exports.ElayerType=e.ElayerType;exports.EmitEventType=e.EmitEventType;exports.EventMessageType=e.EventMessageType;exports.EvevtWorkState=e.EvevtWorkState;exports.EvevtWorkType=e.EvevtWorkType;exports.InternalMsgEmitterType=e.InternalMsgEmitterType;exports.ShapeType=e.ShapeType;exports.fullWorkerUrl=e.fullWorker;exports.subWorkerUrl=e.subWorker;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { O as s, I as p, L as t, K as l, J as r, Q as n, R as y, j as E, h as T, E as i, l as o, f as v, U as g, C as S, T as c, k, W, N as u, M as A, G as C, H as M } from "./index-C1YKkWHE.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ActiveContainerType,
|
|
4
4
|
p as ApplianceMultiPlugin,
|
|
5
5
|
t as ApplianceNames,
|
|
6
6
|
l as ApplianceSigleWrapper,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
y as
|
|
10
|
-
E as
|
|
11
|
-
i as EDataType,
|
|
7
|
+
r as ApplianceSinglePlugin,
|
|
8
|
+
n as ECanvasContextType,
|
|
9
|
+
y as ECanvasShowType,
|
|
10
|
+
E as EDataType,
|
|
12
11
|
T as EPostMessageType,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
i as EScaleType,
|
|
13
|
+
o as EStrokeType,
|
|
14
|
+
v as EToolsKey,
|
|
15
|
+
g as ElayerType,
|
|
16
|
+
S as EmitEventType,
|
|
17
|
+
c as EventMessageType,
|
|
19
18
|
k as EvevtWorkState,
|
|
20
|
-
|
|
19
|
+
W as EvevtWorkType,
|
|
20
|
+
u as InternalMsgEmitterType,
|
|
21
21
|
A as ShapeType,
|
|
22
22
|
C as fullWorkerUrl,
|
|
23
23
|
M as subWorkerUrl
|
package/dist/core/enum.d.ts
CHANGED
|
@@ -47,7 +47,6 @@ export declare enum EvevtWorkState {
|
|
|
47
47
|
Start = 1,
|
|
48
48
|
Doing = 2,
|
|
49
49
|
Done = 3,
|
|
50
|
-
/** 冻结,不能本地输入事件,camera、clear等任务还是可以执行 */
|
|
51
50
|
/** 只读状态 */
|
|
52
51
|
Unwritable = 4
|
|
53
52
|
}
|
|
@@ -132,3 +131,11 @@ export declare enum EScaleType {
|
|
|
132
131
|
/** 等比例 */
|
|
133
132
|
proportional = 4
|
|
134
133
|
}
|
|
134
|
+
export declare enum EvevtWorkType {
|
|
135
|
+
Pending = 0,
|
|
136
|
+
Start = 1,
|
|
137
|
+
Doing = 2,
|
|
138
|
+
Done = 3,
|
|
139
|
+
/** 只读状态 */
|
|
140
|
+
Unwritable = 4
|
|
141
|
+
}
|
|
@@ -18,6 +18,7 @@ export declare abstract class MasterController {
|
|
|
18
18
|
state: EvevtWorkState;
|
|
19
19
|
points: number[];
|
|
20
20
|
isFullWork: boolean;
|
|
21
|
+
viewId: string;
|
|
21
22
|
}>;
|
|
22
23
|
/** 事件任务处理批量池 */
|
|
23
24
|
abstract taskBatchData: Set<IWorkerMessage>;
|
|
@@ -103,13 +104,14 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
103
104
|
state: EvevtWorkState;
|
|
104
105
|
points: number[];
|
|
105
106
|
isFullWork: boolean;
|
|
107
|
+
viewId: string;
|
|
106
108
|
}>;
|
|
107
109
|
/** end */
|
|
108
110
|
/** 是否任务队列化参数 */
|
|
109
111
|
private tasksqueue;
|
|
110
112
|
private useTasksqueue;
|
|
111
113
|
private useTasksClockId?;
|
|
112
|
-
private
|
|
114
|
+
private mainTasksqueueCount?;
|
|
113
115
|
private workerTasksqueueCount?;
|
|
114
116
|
/** end */
|
|
115
117
|
private snapshotMap;
|
|
@@ -130,6 +132,8 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
130
132
|
init(): Promise<void>;
|
|
131
133
|
on(): Promise<void>;
|
|
132
134
|
private clearReRenders;
|
|
135
|
+
get isBusy(): boolean;
|
|
136
|
+
getTasksqueueState(): EvevtWorkState.Doing | EvevtWorkState.Done;
|
|
133
137
|
setMaxDrawCount(num: number): void;
|
|
134
138
|
setWorkerTasksqueueCount(num: number): void;
|
|
135
139
|
collectorSyncData(sp: IMainMessage[]): void;
|
|
@@ -145,6 +149,7 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
145
149
|
state: EvevtWorkState;
|
|
146
150
|
points: number[];
|
|
147
151
|
isFullWork: boolean;
|
|
152
|
+
viewId: string;
|
|
148
153
|
}>;
|
|
149
154
|
private correctStorage;
|
|
150
155
|
originalEventLintener(workState: EvevtWorkState, point: [number, number], viewId: string): Promise<void>;
|
|
@@ -165,11 +170,13 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
165
170
|
destroy(): void;
|
|
166
171
|
updateNode(workId: IworkId, updateNodeOpt: IUpdateNodeOpt, viewId: string, scenePath: string): void;
|
|
167
172
|
updateCamera(viewId: string, cameraOpt: ICameraOpt): void;
|
|
173
|
+
private updateCameraDone;
|
|
168
174
|
private consumeQueue;
|
|
169
175
|
clearViewScenePath(viewId: string, justLocal?: boolean | undefined): Promise<void>;
|
|
170
176
|
private internalMsgEmitterListener;
|
|
171
177
|
private setZIndex;
|
|
172
|
-
removeDrawingWork(
|
|
178
|
+
removeDrawingWork(vId: string): void;
|
|
179
|
+
closeDrawingWork(vId: string): void;
|
|
173
180
|
hoverCursor(point: [number, number], viewId: string): void;
|
|
174
181
|
sendCursorEvent(p: [number | undefined, number | undefined], viewId: string): void;
|
|
175
182
|
getBoundingRect(scenePath: string): Promise<IRectType> | undefined;
|
|
@@ -38,7 +38,7 @@ export interface MainThreadEngine {
|
|
|
38
38
|
readonly vNodes: VNodeManager;
|
|
39
39
|
readonly master: MasterControlForWorker;
|
|
40
40
|
setCameraOpt(cameraOpt: ICameraOpt): void;
|
|
41
|
-
on(msg: IWorkerMessage
|
|
41
|
+
on(msg: IWorkerMessage): Promise<void>;
|
|
42
42
|
post(sp: IMainMessage): void;
|
|
43
43
|
destroy(): void;
|
|
44
44
|
}
|
|
@@ -62,7 +62,7 @@ export declare class MainThreadEngineImpl implements MainThreadEngine {
|
|
|
62
62
|
private methodBuilder;
|
|
63
63
|
constructor(viewId: string, opt: IMainThreadInitOption);
|
|
64
64
|
post(msg: Omit<IBatchMainMessage, 'render'>): void;
|
|
65
|
-
on(msg: IWorkerMessage
|
|
65
|
+
on(msg: IWorkerMessage): Promise<void>;
|
|
66
66
|
private removeNode;
|
|
67
67
|
consumeFull(type: EDataType, data: IWorkerMessage): Promise<void>;
|
|
68
68
|
setCameraOpt(cameraOpt: ICameraOpt): void;
|
|
@@ -6,7 +6,7 @@ export interface MainThreadManager {
|
|
|
6
6
|
master: MasterControlForWorker;
|
|
7
7
|
mainThreadMap: Map<string, MainThreadEngineImpl>;
|
|
8
8
|
createMainThread(viewId: string, opt: IMainThreadInitOption): MainThreadEngineImpl;
|
|
9
|
-
consume(msg: Set<IWorkerMessage>): void
|
|
9
|
+
consume(msg: Set<IWorkerMessage>): Promise<void>;
|
|
10
10
|
post(sp: Omit<IBatchMainMessage, 'render'>): void;
|
|
11
11
|
destroy(): void;
|
|
12
12
|
}
|
|
@@ -19,5 +19,5 @@ export declare class MainThreadManagerImpl implements MainThreadManager {
|
|
|
19
19
|
destroy(): void;
|
|
20
20
|
createMainThread(viewId: string, opt: IMainThreadInitOption): MainThreadEngineImpl;
|
|
21
21
|
createSnapshotThread(viewId: string, opt: IMainThreadInitOption): SnapshotThreadImpl;
|
|
22
|
-
consume(msg: Set<IWorkerMessage>): void
|
|
22
|
+
consume(msg: Set<IWorkerMessage>): Promise<void>;
|
|
23
23
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Group } from "spritejs";
|
|
2
2
|
import { IMainThreadInitOption } from "./base";
|
|
3
3
|
import { MasterControlForWorker } from "../mainEngine";
|
|
4
|
-
import { IActiveToolsDataType, IBatchMainMessage, ICameraOpt, IRectType, IWorkerMessage
|
|
4
|
+
import { IActiveToolsDataType, IBatchMainMessage, ICameraOpt, IRectType, IWorkerMessage } from "../types";
|
|
5
5
|
import type { BaseShapeTool } from "../tools/base";
|
|
6
6
|
import type { ImageShape } from "../tools/image";
|
|
7
7
|
import { TextShape } from "../tools/text";
|
|
@@ -13,13 +13,13 @@ export declare class SnapshotThreadImpl {
|
|
|
13
13
|
private scene;
|
|
14
14
|
private mainThreadPostId?;
|
|
15
15
|
private combinePostMsg;
|
|
16
|
-
workShapes: Map<
|
|
16
|
+
workShapes: Map<string, BaseShapeTool>;
|
|
17
17
|
constructor(viewId: string, opt: IMainThreadInitOption);
|
|
18
18
|
post(msg: Omit<IBatchMainMessage, 'render'>): void;
|
|
19
19
|
on(msg: IWorkerMessage): Promise<void>;
|
|
20
20
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
21
|
-
workId?:
|
|
22
|
-
}): import("../tools").ArrowShape | import("../tools").PencilShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").StarShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape |
|
|
21
|
+
workId?: string;
|
|
22
|
+
}): TextShape | import("../tools").ArrowShape | import("../tools").PencilShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").StarShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").SelectorShape | ImageShape | undefined;
|
|
23
23
|
setFullWork(data: Pick<IWorkerMessage, 'workId' | 'opt' | 'toolsType'>): BaseShapeTool | import("../tools/straight").StraightShape | import("../tools").PolygonShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | import("../tools").LaserPenShape | undefined;
|
|
24
24
|
runFullWork(data: IWorkerMessage): Promise<IRectType | undefined>;
|
|
25
25
|
private getSnapshot;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IActiveToolsDataType, IWorkerMessage, IMainMessage, IUpdateSelectorPropsType, IBatchMainMessage } from "../types";
|
|
2
2
|
import type { BaseShapeTool, BaseShapeOptions, SelectorShape, ImageShape, ShapeToolsClass, PencilShape } from "../tools";
|
|
3
3
|
import { MainThreadEngineImpl, ISubThreadInitOption } from "./base";
|
|
4
4
|
import { VNodeManager } from "./vNodeManager";
|
|
@@ -9,23 +9,24 @@ import { TextShape } from "../tools/text";
|
|
|
9
9
|
export interface SubLocalThread {
|
|
10
10
|
readonly vNodes: VNodeManager;
|
|
11
11
|
readonly thread: MainThreadEngineImpl;
|
|
12
|
-
workShapes: Map<
|
|
12
|
+
workShapes: Map<string, BaseShapeTool>;
|
|
13
13
|
effectSelectNodeData: Set<IWorkerMessage>;
|
|
14
14
|
destroy(): void;
|
|
15
15
|
clearAll(): void;
|
|
16
|
-
clearWorkShapeNodeCache(workId:
|
|
16
|
+
clearWorkShapeNodeCache(workId: string): void;
|
|
17
17
|
setToolsOpt(opt: IActiveToolsDataType): void;
|
|
18
18
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
19
|
-
workId?:
|
|
19
|
+
workId?: string;
|
|
20
20
|
}): void;
|
|
21
21
|
getTmpWorkShapeNode(): BaseShapeTool | undefined;
|
|
22
|
-
setWorkOptions(workId:
|
|
22
|
+
setWorkOptions(workId: string, opt: BaseShapeOptions): void;
|
|
23
23
|
consumeDrawAll(data: IWorkerMessage, serviceWork: SubServiceThread): void;
|
|
24
24
|
consumeDraw(data: IWorkerMessage, serviceWork: SubServiceThread): void;
|
|
25
25
|
colloctEffectSelectWork(data: IWorkerMessage): Promise<IWorkerMessage | undefined>;
|
|
26
26
|
reRenderSelector(willSyncService?: boolean): void;
|
|
27
27
|
blurSelector(data?: IWorkerMessage): Promise<void>;
|
|
28
|
-
getWorkShape(workId:
|
|
28
|
+
getWorkShape(workId: string): BaseShapeTool | undefined;
|
|
29
|
+
getWorkShapes(): Map<string, BaseShapeTool>;
|
|
29
30
|
setFullWork(data: Pick<IWorkerMessage, 'workId' | 'opt' | 'toolsType'>): ShapeToolsClass | undefined;
|
|
30
31
|
consumeFull(data: IWorkerMessage, scene?: Scene): Promise<void>;
|
|
31
32
|
removeWork(data: IWorkerMessage): void;
|
|
@@ -46,11 +47,12 @@ export interface SubLocalThread {
|
|
|
46
47
|
}>;
|
|
47
48
|
}) => void;
|
|
48
49
|
}): Promise<IMainMessage | undefined>;
|
|
50
|
+
workShapesDone(scenePath: string, serviceWork: SubServiceThread): void;
|
|
49
51
|
}
|
|
50
52
|
export declare class SubLocalThreadImpl implements SubLocalThread {
|
|
51
53
|
readonly vNodes: VNodeManager;
|
|
52
54
|
readonly thread: MainThreadEngineImpl;
|
|
53
|
-
workShapes: Map<
|
|
55
|
+
workShapes: Map<string, BaseShapeTool>;
|
|
54
56
|
effectSelectNodeData: Set<IWorkerMessage>;
|
|
55
57
|
private batchEraserRemoveNodes;
|
|
56
58
|
private batchEraserWorks;
|
|
@@ -58,6 +60,7 @@ export declare class SubLocalThreadImpl implements SubLocalThread {
|
|
|
58
60
|
private tmpWorkShapeNode?;
|
|
59
61
|
private drawCount;
|
|
60
62
|
constructor(opt: ISubThreadInitOption);
|
|
63
|
+
workShapesDone(scenePath: string, serviceWork: SubServiceThread): void;
|
|
61
64
|
updateSelector(params: IUpdateSelectorPropsType & {
|
|
62
65
|
callback?: ((props: {
|
|
63
66
|
res?: IMainMessage | undefined;
|
|
@@ -85,18 +88,19 @@ export declare class SubLocalThreadImpl implements SubLocalThread {
|
|
|
85
88
|
private runEffectSelectWork;
|
|
86
89
|
reRenderSelector(willSyncService?: boolean): Promise<void> | undefined;
|
|
87
90
|
blurSelector(data?: IWorkerMessage): Promise<void>;
|
|
88
|
-
clearWorkShapeNodeCache(workId:
|
|
91
|
+
clearWorkShapeNodeCache(workId: string): void;
|
|
89
92
|
private drawEraser;
|
|
90
93
|
private updateBatchEraserCombineNode;
|
|
91
94
|
private batchEraserCombine;
|
|
92
|
-
getWorkShape(workId:
|
|
95
|
+
getWorkShape(workId: string): BaseShapeTool | undefined;
|
|
96
|
+
getWorkShapes(): Map<string, BaseShapeTool>;
|
|
93
97
|
consumeDraw(data: IWorkerMessage, serviceWork: SubServiceThread): void;
|
|
94
98
|
consumeDrawAll(data: IWorkerMessage, serviceWork: SubServiceThread): void;
|
|
95
99
|
getTmpWorkShapeNode(): BaseShapeTool | undefined;
|
|
96
100
|
setToolsOpt(opt: IActiveToolsDataType): void;
|
|
97
|
-
setTmpWorkId(workId:
|
|
98
|
-
setWorkOptions(workId:
|
|
101
|
+
setTmpWorkId(workId: string | undefined): void;
|
|
102
|
+
setWorkOptions(workId: string, opt: BaseShapeOptions): void;
|
|
99
103
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
100
|
-
workId?:
|
|
101
|
-
}): import("../tools").ArrowShape | PencilShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").StarShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape |
|
|
104
|
+
workId?: string;
|
|
105
|
+
}): TextShape | import("../tools").ArrowShape | PencilShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").StarShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | import("../tools").LaserPenShape | import("../tools").EraserShape | SelectorShape | ImageShape | undefined;
|
|
102
106
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IServiceWorkItem,
|
|
1
|
+
import { IServiceWorkItem, ILocalWorkItem, IActiveToolsDataType, IWorkerMessage } from "../types";
|
|
2
2
|
import { BaseShapeTool, BaseShapeOptions } from "../tools";
|
|
3
3
|
import { MainThreadEngineImpl, ISubThreadInitOption } from "./base";
|
|
4
4
|
import { VNodeManager } from "./vNodeManager";
|
|
@@ -6,15 +6,15 @@ export interface SubTopThread {
|
|
|
6
6
|
readonly vNodes: VNodeManager;
|
|
7
7
|
readonly thread: MainThreadEngineImpl;
|
|
8
8
|
serviceWorkShapes: Map<string, IServiceWorkItem>;
|
|
9
|
-
localWorkShapes: Map<
|
|
9
|
+
localWorkShapes: Map<string, ILocalWorkItem>;
|
|
10
10
|
destroy(): void;
|
|
11
11
|
clearAll(): void;
|
|
12
12
|
setToolsOpt(opt: IActiveToolsDataType): void;
|
|
13
13
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
14
|
-
workId?:
|
|
14
|
+
workId?: string;
|
|
15
15
|
}): BaseShapeTool | undefined;
|
|
16
16
|
getTmpWorkShapeNode(): BaseShapeTool | undefined;
|
|
17
|
-
setWorkOptions(workId:
|
|
17
|
+
setWorkOptions(workId: string, opt: BaseShapeOptions): void;
|
|
18
18
|
consumeDrawAll(data: IWorkerMessage): void;
|
|
19
19
|
consumeDraw(data: IWorkerMessage): void;
|
|
20
20
|
}
|
|
@@ -22,7 +22,7 @@ export declare class SubTopThreadImpl implements SubTopThread {
|
|
|
22
22
|
readonly vNodes: VNodeManager;
|
|
23
23
|
readonly thread: MainThreadEngineImpl;
|
|
24
24
|
serviceWorkShapes: Map<string, IServiceWorkItem>;
|
|
25
|
-
localWorkShapes: Map<
|
|
25
|
+
localWorkShapes: Map<string, ILocalWorkItem>;
|
|
26
26
|
private tmpOpt?;
|
|
27
27
|
private tmpWorkShapeNode?;
|
|
28
28
|
private animationId?;
|
|
@@ -32,7 +32,7 @@ export declare class SubTopThreadImpl implements SubTopThread {
|
|
|
32
32
|
consumeDraw(data: IWorkerMessage): void;
|
|
33
33
|
setToolsOpt(opt: IActiveToolsDataType): void;
|
|
34
34
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
35
|
-
workId?:
|
|
35
|
+
workId?: string | undefined;
|
|
36
36
|
}): BaseShapeTool | undefined;
|
|
37
37
|
getTmpWorkShapeNode(): BaseShapeTool | undefined;
|
|
38
38
|
private setTmpWorkId;
|
|
@@ -41,6 +41,6 @@ export declare class SubTopThreadImpl implements SubTopThread {
|
|
|
41
41
|
private computNextAnimationIndex;
|
|
42
42
|
private animationDraw;
|
|
43
43
|
private runAnimation;
|
|
44
|
-
setWorkOptions(workId:
|
|
44
|
+
setWorkOptions(workId: string, opt: BaseShapeOptions): void;
|
|
45
45
|
consumeDrawAll(data: IWorkerMessage): void;
|
|
46
46
|
}
|
|
@@ -10,7 +10,7 @@ export declare class VNodeManager {
|
|
|
10
10
|
init(fullLayer: Group): void;
|
|
11
11
|
get(name: string): BaseNodeMapItem | undefined;
|
|
12
12
|
hasRenderNodes(): boolean;
|
|
13
|
-
has(name: string):
|
|
13
|
+
has(name: string): boolean;
|
|
14
14
|
setInfo(name: string, info: Partial<BaseNodeMapItem>): void;
|
|
15
15
|
selected(name: string): void;
|
|
16
16
|
unSelected(name: string): void;
|
|
@@ -29,4 +29,5 @@ export declare class VNodeManager {
|
|
|
29
29
|
deleteLastTarget(): void;
|
|
30
30
|
getTarget(i: number): Map<string, BaseNodeMapItem>;
|
|
31
31
|
deleteTarget(i: number): void;
|
|
32
|
+
clearTarget(): void;
|
|
32
33
|
}
|
|
@@ -6,13 +6,17 @@ import { MasterController } from "../mainEngine";
|
|
|
6
6
|
export declare abstract class BaseMsgMethod {
|
|
7
7
|
static dispatch(emtType: InternalMsgEmitterType, emitEventType: EmitEventType, value: unknown): void;
|
|
8
8
|
abstract readonly emitEventType: EmitEventType;
|
|
9
|
+
protected abstract lastEmtData?: unknown;
|
|
10
|
+
private useEmtMsg?;
|
|
9
11
|
emtType: InternalMsgEmitterType;
|
|
10
12
|
control: BaseApplianceManager;
|
|
11
13
|
mainEngine: MasterController;
|
|
12
14
|
get serviceColloctor(): import("../../collector").Collector | undefined;
|
|
13
15
|
registerForMainEngine(emtType: InternalMsgEmitterType, control: BaseApplianceManager): this;
|
|
14
16
|
destroy(): void;
|
|
15
|
-
collectForLocalWorker(data: [IWorkerMessage, IqueryTask][]): void;
|
|
17
|
+
collectForLocalWorker(data: [IWorkerMessage, IqueryTask][], isSync?: boolean): void;
|
|
16
18
|
collectForServiceWorker(actions: BaseCollectorReducerAction[]): void;
|
|
17
|
-
abstract collect(data: unknown): void;
|
|
19
|
+
abstract collect(data: unknown, isSync?: boolean): void;
|
|
20
|
+
pause(): void;
|
|
21
|
+
recover(): void;
|
|
18
22
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { EmitEventType } from "../../../plugin/types";
|
|
2
2
|
import { BaseMsgMethodForMainThread } from "../baseForMainThread";
|
|
3
|
-
import { IWorkerMessage
|
|
4
|
-
export type DeleteNodeEmtData = {
|
|
5
|
-
workIds: IworkId[];
|
|
6
|
-
};
|
|
3
|
+
import { IWorkerMessage } from "../../types";
|
|
7
4
|
export declare class DeleteNodeMethodForMainThread extends BaseMsgMethodForMainThread {
|
|
8
5
|
readonly emitEventType: EmitEventType;
|
|
9
6
|
consume(data: IWorkerMessage): Promise<boolean | undefined>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { EmitEventType } from "../../../plugin/types";
|
|
2
2
|
import { BaseMsgMethodForWorker } from "../baseForWorker";
|
|
3
|
-
import { IWorkerMessage
|
|
4
|
-
export type DeleteNodeEmtData = {
|
|
5
|
-
workIds: IworkId[];
|
|
6
|
-
};
|
|
3
|
+
import { IWorkerMessage } from "../../types";
|
|
7
4
|
export declare class DeleteNodeMethodForWorker extends BaseMsgMethodForWorker {
|
|
8
5
|
readonly emitEventType: EmitEventType;
|
|
9
6
|
consume(data: IWorkerMessage): boolean | undefined;
|
|
@@ -11,5 +11,9 @@ export declare class MethodBuilderMain {
|
|
|
11
11
|
getBuilder(type: EmitEventType): BaseMsgMethod | undefined;
|
|
12
12
|
registerForMainEngine(emtType: InternalMsgEmitterType, control: BaseApplianceManager): this;
|
|
13
13
|
destroy(): void;
|
|
14
|
+
pause(): this;
|
|
15
|
+
recover(): this;
|
|
14
16
|
static emitMethod(emtType: InternalMsgEmitterType, type: EmitEventType, data: unknown): undefined;
|
|
17
|
+
static activeListener(callback: (isActive: boolean) => void): void;
|
|
18
|
+
static unmountActiveListener(callback: (isActive: boolean) => void): void;
|
|
15
19
|
}
|
|
@@ -9,7 +9,8 @@ export type RotateNodeEmtData = {
|
|
|
9
9
|
viewId: string;
|
|
10
10
|
};
|
|
11
11
|
export declare class RotateNodeMethod extends BaseMsgMethod {
|
|
12
|
+
protected lastEmtData?: RotateNodeEmtData;
|
|
12
13
|
readonly emitEventType: EmitEventType;
|
|
13
14
|
private cacheOriginRotate;
|
|
14
|
-
collect(data: RotateNodeEmtData): void;
|
|
15
|
+
collect(data: RotateNodeEmtData, isSync?: boolean): void;
|
|
15
16
|
}
|
|
@@ -13,9 +13,10 @@ export type ScaleNodeEmtData = {
|
|
|
13
13
|
reverseX?: boolean;
|
|
14
14
|
};
|
|
15
15
|
export declare class ScaleNodeMethod extends BaseMsgMethod {
|
|
16
|
+
protected lastEmtData?: ScaleNodeEmtData;
|
|
16
17
|
readonly emitEventType: EmitEventType;
|
|
17
18
|
private targetBox;
|
|
18
19
|
private targetText;
|
|
19
20
|
private cacheTextInfo;
|
|
20
|
-
collect(data: ScaleNodeEmtData): Promise<void>;
|
|
21
|
+
collect(data: ScaleNodeEmtData, isSync?: boolean): Promise<void>;
|
|
21
22
|
}
|
|
@@ -12,6 +12,7 @@ export type SetFontEmtData = {
|
|
|
12
12
|
viewId: string;
|
|
13
13
|
};
|
|
14
14
|
export declare class SetFontStyleMethod extends BaseMsgMethod {
|
|
15
|
+
protected lastEmtData?: unknown;
|
|
15
16
|
readonly emitEventType: EmitEventType;
|
|
16
17
|
private setTextStyle;
|
|
17
18
|
collect(data: SetFontEmtData): void;
|
|
@@ -13,6 +13,7 @@ export type SetShapeEmtData = {
|
|
|
13
13
|
placement?: SpeechBalloonPlacement;
|
|
14
14
|
};
|
|
15
15
|
export declare class SetShapeOptMethod extends BaseMsgMethod {
|
|
16
|
+
protected lastEmtData?: unknown;
|
|
16
17
|
readonly emitEventType: EmitEventType;
|
|
17
18
|
collect(data: SetShapeEmtData): void;
|
|
18
19
|
}
|
|
@@ -12,8 +12,9 @@ export type TranslateNodeEmtData = {
|
|
|
12
12
|
viewId: string;
|
|
13
13
|
};
|
|
14
14
|
export declare class TranslateNodeMethod extends BaseMsgMethod {
|
|
15
|
+
protected lastEmtData?: TranslateNodeEmtData;
|
|
15
16
|
readonly emitEventType: EmitEventType;
|
|
16
17
|
private undoTickerId?;
|
|
17
18
|
private cachePosition;
|
|
18
|
-
collect(data: TranslateNodeEmtData): void;
|
|
19
|
+
collect(data: TranslateNodeEmtData, isSync?: boolean): void;
|
|
19
20
|
}
|
|
@@ -61,7 +61,7 @@ export declare abstract class BaseShapeTool {
|
|
|
61
61
|
/** 清除临时数据 */
|
|
62
62
|
abstract clearTmpPoints(): void;
|
|
63
63
|
/** 设置工作id */
|
|
64
|
-
setWorkId(id:
|
|
64
|
+
setWorkId(id: string | undefined): void;
|
|
65
65
|
getWorkId(): string | number | undefined;
|
|
66
66
|
/** 获取工作选项配置 */
|
|
67
67
|
getWorkOptions(): ShapeOptions;
|
|
@@ -23,17 +23,11 @@ export declare class TextShape extends BaseShapeTool {
|
|
|
23
23
|
replaceId?: string;
|
|
24
24
|
isDrawLabel?: true;
|
|
25
25
|
}): Promise<IRectType | undefined>;
|
|
26
|
-
updateLabelsWidth(node: Group): void;
|
|
27
26
|
updataOptService(): IRectType | undefined;
|
|
28
27
|
updataOptServiceAsync(updateNodeOpt: IUpdateNodeOpt): Promise<IRectType | undefined>;
|
|
29
28
|
clearTmpPoints(): void;
|
|
30
|
-
static
|
|
31
|
-
|
|
32
|
-
ctx: OffscreenCanvasRenderingContext2D;
|
|
33
|
-
opt: TextOptions;
|
|
34
|
-
worldScaling: number[];
|
|
35
|
-
}): number;
|
|
36
|
-
static createLabels(textOpt: TextOptions, layer: Group): (Polyline | Label)[];
|
|
29
|
+
static createLabels(textOpt: TextOptions, group: Group, layer?: Group): Promise<(Polyline | Label)[]>;
|
|
30
|
+
static updateLabels(vNode: BaseNodeMapItem, group: Group, layer?: Group): Promise<void>;
|
|
37
31
|
static updateNodeOpt(param: {
|
|
38
32
|
node: ShapeNodes;
|
|
39
33
|
opt: IUpdateNodeOpt;
|
|
@@ -32,12 +32,12 @@ export interface CombineConsumeResult {
|
|
|
32
32
|
export interface ShapeStateInfo {
|
|
33
33
|
willClear: boolean;
|
|
34
34
|
}
|
|
35
|
-
export declare function getShapeTools(toolsType: EToolsKey): typeof ArrowShape | typeof PencilShape | typeof StraightShape | typeof EllipseShape | typeof PolygonShape | typeof StarShape | typeof RectangleShape | typeof SpeechBalloonShape | typeof
|
|
35
|
+
export declare function getShapeTools(toolsType: EToolsKey): typeof TextShape | typeof ArrowShape | typeof PencilShape | typeof StraightShape | typeof EllipseShape | typeof PolygonShape | typeof StarShape | typeof RectangleShape | typeof SpeechBalloonShape | typeof LaserPenShape | typeof EraserShape | typeof SelectorShape | typeof ImageShape | undefined;
|
|
36
36
|
export declare function getShapeInstance(param: {
|
|
37
37
|
toolsType: EToolsKey;
|
|
38
38
|
toolsOpt: ShapeOptions;
|
|
39
39
|
vNodes?: VNodeManager;
|
|
40
40
|
fullLayer: Group;
|
|
41
41
|
drawLayer?: Group;
|
|
42
|
-
}, serviceWork?: ServiceThreadSubWork): ArrowShape | PencilShape | StraightShape | EllipseShape | PolygonShape | StarShape | RectangleShape | SpeechBalloonShape |
|
|
42
|
+
}, serviceWork?: ServiceThreadSubWork): TextShape | ArrowShape | PencilShape | StraightShape | EllipseShape | PolygonShape | StarShape | RectangleShape | SpeechBalloonShape | LaserPenShape | EraserShape | SelectorShape | ImageShape | undefined;
|
|
43
43
|
export declare function findShapeBody(nodes: ShapeNodes[]): ShapeNodes[];
|
package/dist/core/types.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Group, Scene } from "spritejs";
|
|
2
|
-
import { IActiveToolsDataType, IActiveWorkDataType, IBatchMainMessage, ICameraOpt, ILayerOptionType, IOffscreenCanvasOptionType, IRectType, IWorkerMessage
|
|
2
|
+
import { IActiveToolsDataType, IActiveWorkDataType, IBatchMainMessage, ICameraOpt, ILayerOptionType, IOffscreenCanvasOptionType, IRectType, IWorkerMessage } from "../types";
|
|
3
3
|
import { VNodeManager } from "./vNodeManager";
|
|
4
|
-
import { ECanvasShowType, EDataType } from "../enum";
|
|
4
|
+
import { ECanvasContextType, ECanvasShowType, EDataType, EvevtWorkState } from "../enum";
|
|
5
5
|
import { ShapeStateInfo } from "../tools/utils";
|
|
6
6
|
import { BaseShapeOptions, BaseShapeTool } from "../tools/base";
|
|
7
7
|
import { ServiceWorkForFullWorker } from "./fullWorkerService";
|
|
8
8
|
import { LocalWorkForFullWorker } from "./fullWorkerLocal";
|
|
9
9
|
import { LocalWorkForSubWorker } from "./subWorkerLocal";
|
|
10
|
-
import
|
|
10
|
+
import { WorkThreadEngineForFullWorker, WorkThreadEngineForSubWorker } from "./workerManager";
|
|
11
|
+
import { EmitEventType } from "../../plugin/types";
|
|
11
12
|
export interface IWorkerInitOption {
|
|
12
13
|
dpr: number;
|
|
13
14
|
offscreenCanvasOpt: IOffscreenCanvasOptionType;
|
|
@@ -26,6 +27,7 @@ export declare abstract class WorkThreadEngineBase {
|
|
|
26
27
|
readonly fullLayer: Group;
|
|
27
28
|
readonly vNodes: VNodeManager;
|
|
28
29
|
readonly dpr: number;
|
|
30
|
+
readonly contextType?: ECanvasContextType;
|
|
29
31
|
protected opt: IWorkerInitOption;
|
|
30
32
|
protected cameraOpt?: ICameraOpt;
|
|
31
33
|
protected scene: Scene;
|
|
@@ -35,11 +37,17 @@ export declare abstract class WorkThreadEngineBase {
|
|
|
35
37
|
protected abstract _post: (msg: IBatchMainMessage) => void;
|
|
36
38
|
combinePostMsg: Set<IBatchMainMessage>;
|
|
37
39
|
protected workerTaskId?: number | undefined;
|
|
40
|
+
protected protectedTask?: {
|
|
41
|
+
isProtected: boolean;
|
|
42
|
+
workName: EmitEventType;
|
|
43
|
+
workState: EvevtWorkState;
|
|
44
|
+
};
|
|
38
45
|
constructor(viewId: string, opt: IWorkerInitOption);
|
|
39
46
|
setIsSafari(isSafari: boolean): void;
|
|
40
|
-
on(msg: IWorkerMessage
|
|
47
|
+
on(msg: IWorkerMessage): Promise<void>;
|
|
41
48
|
protected updateScene(offscreenCanvasOpt: IOffscreenCanvasOptionType): void;
|
|
42
49
|
protected updateLayer(layerOpt: ILayerOptionType): void;
|
|
50
|
+
private getSupportContextType;
|
|
43
51
|
protected createScene(opt: IOffscreenCanvasOptionType): Scene;
|
|
44
52
|
protected createLayer(name: string, scene: Scene, opt: ILayerOptionType): Group;
|
|
45
53
|
protected clearAll(): void;
|
|
@@ -66,21 +74,21 @@ export declare abstract class LocalWork {
|
|
|
66
74
|
readonly _post: (msg: IBatchMainMessage) => void;
|
|
67
75
|
protected tmpWorkShapeNode?: BaseShapeTool;
|
|
68
76
|
protected tmpOpt?: IActiveToolsDataType;
|
|
69
|
-
workShapes: Map<
|
|
70
|
-
workShapeState: Map<
|
|
71
|
-
protected effectWorkId?: number;
|
|
77
|
+
workShapes: Map<string, BaseShapeTool>;
|
|
78
|
+
workShapeState: Map<string, ShapeStateInfo>;
|
|
72
79
|
protected drawCount: number;
|
|
73
80
|
constructor(opt: ISubWorkerInitOption);
|
|
74
81
|
destroy(): void;
|
|
75
|
-
|
|
82
|
+
getWorkShapes(): Map<string, BaseShapeTool>;
|
|
83
|
+
getWorkShape(workId: string): BaseShapeTool | undefined;
|
|
76
84
|
getTmpWorkShapeNode(): BaseShapeTool | undefined;
|
|
77
|
-
setTmpWorkId(workId:
|
|
78
|
-
setWorkOptions(workId:
|
|
85
|
+
setTmpWorkId(workId: string | undefined): void;
|
|
86
|
+
setWorkOptions(workId: string, opt: BaseShapeOptions): void;
|
|
79
87
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
80
|
-
workId?:
|
|
81
|
-
}): import("../tools").
|
|
88
|
+
workId?: string;
|
|
89
|
+
}): import("../tools/text").TextShape | import("../tools").ArrowShape | import("../tools").PencilShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").StarShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").SelectorShape | import("../tools").ImageShape | undefined;
|
|
82
90
|
setToolsOpt(opt: IActiveToolsDataType): void;
|
|
83
|
-
clearWorkShapeNodeCache(workId:
|
|
91
|
+
clearWorkShapeNodeCache(workId: string): void;
|
|
84
92
|
clearAllWorkShapesCache(): void;
|
|
85
93
|
setFullWork(data: Pick<IWorkerMessage, 'workId' | 'opt' | 'toolsType'>): BaseShapeTool | import("../tools/straight").StraightShape | import("../tools").PolygonShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | import("../tools").LaserPenShape | undefined;
|
|
86
94
|
}
|