@netless/appliance-plugin 1.1.17-beta.7 → 1.1.17-beta.9
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-p8Ghqw.js +502 -0
- package/cdn/subWorker-C1Gs0N.js +502 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +16 -15
- package/dist/core/mainEngine.d.ts +4 -0
- package/dist/core/mainThread/subLocalThread.d.ts +3 -5
- package/dist/core/tools/pencil.d.ts +5 -0
- package/dist/core/tools/pencilEraser.d.ts +63 -38
- package/dist/core/utils/clipper.d.ts +8 -0
- package/dist/core/utils/polygonUtils.d.ts +8 -0
- package/dist/core/worker/fullWorkerLocal.d.ts +2 -2
- package/dist/displayer/floatBtns/index.d.ts +2 -0
- package/dist/fullWorker.js +211 -150
- package/dist/index-BSGcWUci.js +1 -0
- package/dist/{index-AUJ4rWCY.mjs → index-BianYC4r.mjs} +208 -202
- package/dist/{index-C2u2Hwgc.mjs → index-CZ7SSEYU.mjs} +5225 -4878
- package/dist/index-DDtbIS6S.js +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +3 -0
- package/dist/plugin/baseViewContainerManager.d.ts +13 -1
- package/dist/plugin/const.d.ts +1 -0
- package/dist/plugin/displayerView.d.ts +3 -0
- package/dist/plugin/types.d.ts +33 -3
- package/dist/style.css +1 -1
- package/dist/subWorker.js +211 -150
- package/package.json +2 -1
- package/cdn/fullWorker-RBFpuv.js +0 -441
- package/cdn/subWorker-CCsxSe.js +0 -441
- package/dist/index-htTQ80kq.js +0 -1
- package/dist/index-l0t4gpnL.js +0 -1
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-DDtbIS6S.js");exports.ActiveContainerType=e.ActiveContainerType;exports.ApplianceMultiPlugin=e.ApplianceMultiPlugin;exports.ApplianceNames=e.ApplianceNames;exports.ApplianceSigleWrapper=e.ApplianceSigleWrapper;exports.ApplianceSinglePlugin=e.ApplianceSinglePlugin;exports.AutoDrawPlugin=e.AutoDrawPlugin;exports.ECanvasShowType=e.ECanvasShowType;exports.EDataType=e.EDataType;exports.EForceStopReason=e.EForceStopReason;exports.EImageType=e.EImageType;exports.EMatrixrRelationType=e.EMatrixrRelationType;exports.EOperationType=e.EOperationType;exports.EPostMessageType=e.EPostMessageType;exports.ERenderFilterType=e.ERenderFilterType;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.Plugin=e.Plugin;exports.ShapeType=e.ShapeType;exports.fullWorkerUrl=e.fullWorker;exports.subWorkerUrl=e.subWorker;
|
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as s, A as p, x as r, w as t, v as l, Q as n, G as i, b as y, F as E, j as o, l as T, N as g, c as u, O as v, K as c, y as S, a as A, J as P, h as k, H as m, E as M, L as W, I as h, P as w, z as x, s as F, u as I } from "./index-CZ7SSEYU.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ActiveContainerType,
|
|
4
4
|
p as ApplianceMultiPlugin,
|
|
5
5
|
r as ApplianceNames,
|
|
6
6
|
t as ApplianceSigleWrapper,
|
|
7
7
|
l as ApplianceSinglePlugin,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
n as AutoDrawPlugin,
|
|
9
|
+
i as ECanvasShowType,
|
|
10
10
|
y as EDataType,
|
|
11
|
-
E as
|
|
11
|
+
E as EForceStopReason,
|
|
12
|
+
o as EImageType,
|
|
12
13
|
T as EMatrixrRelationType,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
g as EOperationType,
|
|
15
|
+
u as EPostMessageType,
|
|
16
|
+
v as ERenderFilterType,
|
|
17
|
+
c as EScaleType,
|
|
18
|
+
S as EStrokeType,
|
|
18
19
|
A as EToolsKey,
|
|
19
|
-
|
|
20
|
+
P as ElayerType,
|
|
20
21
|
k as EmitEventType,
|
|
21
22
|
m as EventMessageType,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
M as EvevtWorkState,
|
|
24
|
+
W as EvevtWorkType,
|
|
25
|
+
h as InternalMsgEmitterType,
|
|
25
26
|
w as Plugin,
|
|
26
27
|
x as ShapeType,
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
F as fullWorkerUrl,
|
|
29
|
+
I as subWorkerUrl
|
|
29
30
|
};
|
|
@@ -13,6 +13,7 @@ export declare abstract class MasterController {
|
|
|
13
13
|
/** 插件管理器 */
|
|
14
14
|
readonly abstract control: BaseApplianceManager;
|
|
15
15
|
readonly abstract internalMsgEmitter: EventEmitter2;
|
|
16
|
+
readonly abstract publicMsgEmitter: EventEmitter2;
|
|
16
17
|
/** worker线程管理器 */
|
|
17
18
|
/** 本地原始点数据批任务数据池 */
|
|
18
19
|
protected abstract localPointsBatchData: Map<IworkId, {
|
|
@@ -96,6 +97,7 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
96
97
|
protected currentLocalWorkData: IActiveWorkDataType;
|
|
97
98
|
control: BaseApplianceManager;
|
|
98
99
|
internalMsgEmitter: EventEmitter2;
|
|
100
|
+
publicMsgEmitter: EventEmitter2;
|
|
99
101
|
taskBatchData: Set<IWorkerMessage>;
|
|
100
102
|
protected fullWorker: Worker;
|
|
101
103
|
protected subWorker: Worker;
|
|
@@ -138,6 +140,7 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
138
140
|
private isLockSentEventCursor;
|
|
139
141
|
private subMainThreadWorker?;
|
|
140
142
|
private getVNodeInfoResolveMap;
|
|
143
|
+
private isLocalWorkActive;
|
|
141
144
|
constructor(props: BaseSubWorkModuleProps);
|
|
142
145
|
destroy(): void;
|
|
143
146
|
private get consumeCount();
|
|
@@ -167,6 +170,7 @@ export declare class MasterControlForWorker extends MasterController {
|
|
|
167
170
|
getMaxDrawCount(): number;
|
|
168
171
|
setSubWorkerDrawCount(num: number): void;
|
|
169
172
|
setConsumeCount(num: number): void;
|
|
173
|
+
getConsumeCount(): number;
|
|
170
174
|
setWorkerTasksqueueCount(num: number): void;
|
|
171
175
|
collectorSyncData(sp: IMainMessage[]): void;
|
|
172
176
|
private collectorAsyncData;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IActiveToolsDataType, IWorkerMessage, IMainMessage, IUpdateSelectorPropsType, IBatchMainMessage } from "../types";
|
|
2
|
-
import type { BaseShapeTool, BaseShapeOptions, SelectorShape, ImageShape, ShapeToolsClass
|
|
2
|
+
import type { BaseShapeTool, BaseShapeOptions, SelectorShape, ImageShape, ShapeToolsClass } from "../tools";
|
|
3
3
|
import { MainThreadEngineImpl, ISubThreadInitOption } from "./base";
|
|
4
4
|
import { VNodeManager } from "../vNodeManager";
|
|
5
5
|
import { EToolsKey } from "../enum";
|
|
@@ -101,10 +101,8 @@ export declare class SubLocalMainThreadImpl implements SubLocalThread {
|
|
|
101
101
|
blurSelector(data?: IWorkerMessage): Promise<void>;
|
|
102
102
|
clearWorkShapeNodeCache(workId: string): void;
|
|
103
103
|
private drawBitMapEraserFull;
|
|
104
|
-
private
|
|
104
|
+
private drawPencilEraserFull;
|
|
105
105
|
private drawEraser;
|
|
106
|
-
private updateBatchEraserCombineNode;
|
|
107
|
-
private batchEraserCombine;
|
|
108
106
|
getWorkShape(workId: string): BaseShapeTool | undefined;
|
|
109
107
|
getWorkShapes(): Map<string, BaseShapeTool>;
|
|
110
108
|
consumeDraw(data: IWorkerMessage, serviceWork: SubServiceThread): void;
|
|
@@ -114,5 +112,5 @@ export declare class SubLocalMainThreadImpl implements SubLocalThread {
|
|
|
114
112
|
setWorkOptions(workId: string, opt: BaseShapeOptions): void;
|
|
115
113
|
createWorkShapeNode(opt: IActiveToolsDataType & {
|
|
116
114
|
workId: string;
|
|
117
|
-
}): import("../tools").ArrowShape | PencilShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").StarShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | TextShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools/pencilEraser").PencilEraserShape | BitMapEraserShape | SelectorShape | ImageShape | undefined;
|
|
115
|
+
}): 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 | TextShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools/pencilEraser").PencilEraserShape | BitMapEraserShape | SelectorShape | ImageShape | undefined;
|
|
118
116
|
}
|
|
@@ -77,6 +77,11 @@ export declare class PencilShape extends BaseShapeTool {
|
|
|
77
77
|
replaceId?: string;
|
|
78
78
|
workState?: EvevtWorkState;
|
|
79
79
|
}): IRectType | undefined;
|
|
80
|
+
computPencilPoints(params: {
|
|
81
|
+
op: number[];
|
|
82
|
+
eraserPolylines: number[][];
|
|
83
|
+
eraserThickness: number;
|
|
84
|
+
}): number[][] | undefined;
|
|
80
85
|
private transformDataAll;
|
|
81
86
|
private draw;
|
|
82
87
|
private computDrawPoints;
|
|
@@ -1,74 +1,99 @@
|
|
|
1
1
|
import { BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
|
|
2
|
-
import { EPostMessageType, EScaleType, EToolsKey } from "../enum";
|
|
3
|
-
import { IWorkerMessage, IRectType,
|
|
4
|
-
import type {
|
|
2
|
+
import { EDataType, EPostMessageType, EScaleType, EToolsKey } from "../enum";
|
|
3
|
+
import { IWorkerMessage, IRectType, BaseNodeMapItem } from "../types";
|
|
4
|
+
import type { IMainMessage } from "../types";
|
|
5
|
+
import { Point2d } from "../utils/primitives/Point2d";
|
|
6
|
+
import type { LocalWorkForFullWorker } from "../worker/fullWorkerLocal";
|
|
7
|
+
import type { SubLocalMainThreadImpl } from "../mainThread/subLocalThread";
|
|
8
|
+
export type SerializerEraserLines = Array<SerializerEraserItem>;
|
|
9
|
+
export interface SerializerEraserItem {
|
|
10
|
+
op: number[][];
|
|
11
|
+
thickness: number;
|
|
12
|
+
}
|
|
5
13
|
export interface PencilEraserOptions extends BaseShapeOptions {
|
|
6
14
|
thickness: number;
|
|
15
|
+
eraserColor: string;
|
|
7
16
|
}
|
|
8
17
|
export declare class PencilEraserShape extends BaseShapeTool {
|
|
9
18
|
readonly canRotate: boolean;
|
|
10
19
|
readonly scaleType: EScaleType;
|
|
11
20
|
readonly toolsType: EToolsKey;
|
|
12
|
-
readonly serviceWork?: ServiceThreadSubWork;
|
|
13
21
|
private static readonly eraserSizes;
|
|
14
|
-
protected tmpPoints: Array<
|
|
22
|
+
protected tmpPoints: Array<Point2d>;
|
|
15
23
|
protected workOptions: PencilEraserOptions;
|
|
16
24
|
worldPosition: [number, number];
|
|
17
25
|
worldScaling: [number, number];
|
|
18
26
|
eraserRect: IRectType | undefined;
|
|
19
27
|
eraserPolyline?: [number, number, number, number];
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
syncUnitTime: number;
|
|
29
|
+
private syncIndex;
|
|
30
|
+
private syncTimestamp;
|
|
31
|
+
constructor(props: BaseShapeToolProps);
|
|
32
|
+
/** 批量合并消费本地数据,返回绘制结果 */
|
|
33
|
+
combineConsume(): IMainMessage | undefined;
|
|
34
|
+
consumeService(params: {
|
|
35
|
+
op: number[];
|
|
36
|
+
isFullWork?: boolean;
|
|
37
|
+
replaceId?: string;
|
|
38
|
+
}): IRectType | undefined;
|
|
39
|
+
private updateTempPoints;
|
|
40
|
+
private getChangeNodes;
|
|
30
41
|
consume(props: {
|
|
31
42
|
data: IWorkerMessage;
|
|
43
|
+
isFullWork: boolean;
|
|
44
|
+
isSubWorker?: boolean;
|
|
45
|
+
isMainThread?: boolean;
|
|
46
|
+
drawCount?: number;
|
|
47
|
+
removeDrawCount?: number;
|
|
32
48
|
}): {
|
|
33
49
|
workId: string;
|
|
34
50
|
toolsType: EToolsKey;
|
|
35
51
|
opt: import("./utils").ShapeOptions;
|
|
36
52
|
type: EPostMessageType;
|
|
37
53
|
rect?: undefined;
|
|
38
|
-
|
|
39
|
-
newWorkDatas?: undefined;
|
|
54
|
+
dataType?: undefined;
|
|
40
55
|
} | {
|
|
56
|
+
rect: IRectType | undefined;
|
|
41
57
|
type: EPostMessageType;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
dataType: EDataType;
|
|
59
|
+
} | {
|
|
60
|
+
type: EPostMessageType;
|
|
61
|
+
dataType: EDataType;
|
|
62
|
+
rect: IRectType | undefined;
|
|
63
|
+
op: number[] | undefined;
|
|
64
|
+
index: number | undefined;
|
|
65
|
+
updateNodeOpt: {
|
|
66
|
+
useAnimation: boolean;
|
|
67
|
+
};
|
|
68
|
+
workId: string;
|
|
69
|
+
toolsType: EToolsKey;
|
|
70
|
+
opt: import("./utils").ShapeOptions;
|
|
50
71
|
};
|
|
72
|
+
private draw;
|
|
73
|
+
private computEraserPointLines;
|
|
51
74
|
consumeAll(props: {
|
|
52
|
-
|
|
75
|
+
workerEngine?: LocalWorkForFullWorker | SubLocalMainThreadImpl;
|
|
53
76
|
}): {
|
|
54
77
|
workId: string;
|
|
55
78
|
toolsType: EToolsKey;
|
|
56
79
|
opt: import("./utils").ShapeOptions;
|
|
57
80
|
type: EPostMessageType;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
81
|
+
} | {
|
|
82
|
+
rect: IRectType | undefined;
|
|
83
|
+
workId: string;
|
|
84
|
+
toolsType: EToolsKey;
|
|
85
|
+
opt: import("./utils").ShapeOptions;
|
|
86
|
+
type: EPostMessageType;
|
|
61
87
|
} | {
|
|
62
88
|
type: EPostMessageType;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
89
|
+
dataType: EDataType;
|
|
90
|
+
rect: IRectType | undefined;
|
|
91
|
+
ops: string;
|
|
92
|
+
willNewNodes: Map<string, BaseNodeMapItem>;
|
|
93
|
+
willDeleteNodes: Set<string>;
|
|
94
|
+
workId: string;
|
|
95
|
+
toolsType: EToolsKey;
|
|
96
|
+
opt: import("./utils").ShapeOptions;
|
|
71
97
|
};
|
|
72
98
|
clearTmpPoints(): void;
|
|
73
|
-
private getCanEraserNodeMap;
|
|
74
99
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Point2d } from './primitives/Point2d';
|
|
2
|
+
/**
|
|
3
|
+
* 折线减去多个多边形,返回差集片段(去除冗余点、近似闭环、孤点)
|
|
4
|
+
* @param polyline 原始折线
|
|
5
|
+
* @param polygons 多个多边形数组
|
|
6
|
+
* @param epsilon 精度阈值
|
|
7
|
+
*/
|
|
8
|
+
export declare function polylineMinusPolygon(polyline: Point2d[], polygons: [number, number][][], epsilon?: number): [number, number, number][][];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 计算两条线段的交点
|
|
3
|
+
*/
|
|
4
|
+
export declare function getIntersection(p1: [number, number], p2: [number, number], p3: [number, number], p4: [number, number]): [number, number] | null;
|
|
5
|
+
/**
|
|
6
|
+
* 判断点是否在多边形内
|
|
7
|
+
*/
|
|
8
|
+
export declare function isPointInPolygon(point: [number, number], polygon: [number, number][]): boolean;
|
|
@@ -52,13 +52,13 @@ export declare class LocalWorkForFullWorker extends LocalWork {
|
|
|
52
52
|
private drawBitMapCombine;
|
|
53
53
|
private drawPencilCombine;
|
|
54
54
|
private drawSelector;
|
|
55
|
+
private drawPencilEraserCombine;
|
|
55
56
|
private drawPencilEraser;
|
|
57
|
+
private drawPencilEraserFull;
|
|
56
58
|
private drawEraser;
|
|
57
|
-
private batchEraserCombine;
|
|
58
59
|
private drawShape;
|
|
59
60
|
private drawPencil;
|
|
60
61
|
private drawPencilFull;
|
|
61
|
-
private updateBatchEraserCombineNode;
|
|
62
62
|
private runEffectSelectWork;
|
|
63
63
|
cursorHover(msg: IWorkerMessage): Promise<void>;
|
|
64
64
|
cursorBlur(): Promise<void>;
|