@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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-l0t4gpnL.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.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
+ "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 { F as s, A as p, y as r, x as t, w as l, Q as i, G as n, b as y, k as E, m as T, N as o, c as g, O as u, K as v, z as c, a as A, J as S, j as k, H as m, E as P, L as M, I as W, P as w, B as x, u as I, v as b } from "./index-C2u2Hwgc.mjs";
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
- i as AutoDrawPlugin,
9
- n as ECanvasShowType,
8
+ n as AutoDrawPlugin,
9
+ i as ECanvasShowType,
10
10
  y as EDataType,
11
- E as EImageType,
11
+ E as EForceStopReason,
12
+ o as EImageType,
12
13
  T as EMatrixrRelationType,
13
- o as EOperationType,
14
- g as EPostMessageType,
15
- u as ERenderFilterType,
16
- v as EScaleType,
17
- c as EStrokeType,
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
- S as ElayerType,
20
+ P as ElayerType,
20
21
  k as EmitEventType,
21
22
  m as EventMessageType,
22
- P as EvevtWorkState,
23
- M as EvevtWorkType,
24
- W as InternalMsgEmitterType,
23
+ M as EvevtWorkState,
24
+ W as EvevtWorkType,
25
+ h as InternalMsgEmitterType,
25
26
  w as Plugin,
26
27
  x as ShapeType,
27
- I as fullWorkerUrl,
28
- b as subWorkerUrl
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, PencilShape } from "../tools";
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 drawPencilEraser;
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, IworkId } from "../types";
4
- import type { ServiceThreadSubWork } from "./utils";
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<number>;
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
- constructor(props: BaseShapeToolProps, serviceWork?: ServiceThreadSubWork);
21
- consumeService(): IRectType | undefined;
22
- private createEraserRect;
23
- private computRectCenterPoints;
24
- private isNear;
25
- private cutPolyline;
26
- private isSamePoint;
27
- private translateIntersect;
28
- private isLineEraser;
29
- private remove;
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
- removeIds?: undefined;
39
- newWorkDatas?: undefined;
54
+ dataType?: undefined;
40
55
  } | {
56
+ rect: IRectType | undefined;
41
57
  type: EPostMessageType;
42
- rect: IRectType;
43
- removeIds: string[];
44
- newWorkDatas: Map<string, {
45
- op: number[];
46
- opt: BaseShapeOptions;
47
- workId: IworkId;
48
- toolsType: EToolsKey;
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
- data: IWorkerMessage;
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
- rect?: undefined;
59
- removeIds?: undefined;
60
- newWorkDatas?: undefined;
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
- rect: IRectType;
64
- removeIds: string[];
65
- newWorkDatas: Map<string, {
66
- op: number[];
67
- opt: BaseShapeOptions;
68
- workId: IworkId;
69
- toolsType: EToolsKey;
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>;
@@ -8,4 +8,6 @@ export declare const FloatBtns: React.MemoExoticComponent<(props: {
8
8
  textOpt?: TextOptions;
9
9
  workIds?: string[];
10
10
  noLayer?: boolean;
11
+ noDelete?: boolean;
12
+ noCopy?: boolean;
11
13
  }) => React.JSX.Element>;