@netless/appliance-plugin 1.0.6 → 1.0.7

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.
Files changed (45) hide show
  1. package/cdn/cdn.js +1 -1
  2. package/cdn/fullWorker-CF7R0e.js +438 -0
  3. package/cdn/subWorker-BbF9q2.js +438 -0
  4. package/dist/appliance-plugin.js +1 -1
  5. package/dist/appliance-plugin.mjs +7 -7
  6. package/dist/core/enum.d.ts +22 -16
  7. package/dist/core/mainEngine.d.ts +9 -2
  8. package/dist/core/mainThread/snapshotThread.d.ts +1 -1
  9. package/dist/core/mainThread/subLocalThread.d.ts +2 -1
  10. package/dist/core/mainThread/subTopThread.d.ts +2 -2
  11. package/dist/core/mainThread/workerMainThread.d.ts +99 -0
  12. package/dist/core/tools/eraser.d.ts +1 -20
  13. package/dist/core/tools/pencilEraser.d.ts +76 -0
  14. package/dist/core/tools/utils.d.ts +6 -5
  15. package/dist/core/types.d.ts +1 -0
  16. package/dist/core/utils/math.d.ts +3 -0
  17. package/dist/core/vNodeManager.d.ts +1 -0
  18. package/dist/core/worker/base.d.ts +5 -2
  19. package/dist/core/worker/fullWorkerLocal.d.ts +2 -0
  20. package/dist/core/worker/subWorkerLocal.d.ts +3 -2
  21. package/dist/core/worker/subWorkerTopLayer.d.ts +2 -2
  22. package/dist/core/worker/workerManager.d.ts +1 -0
  23. package/dist/fullWorker.js +125 -124
  24. package/dist/index-2kLI3OsH.js +1 -0
  25. package/dist/index-C7xQ-iwn.mjs +2304 -0
  26. package/dist/index-DWP99OFK.mjs +13721 -0
  27. package/dist/index-OwNIkbKl.js +1 -0
  28. package/dist/plugin/baseApplianceManager.d.ts +5 -3
  29. package/dist/plugin/baseViewContainerManager.d.ts +4 -1
  30. package/dist/plugin/displayerView.d.ts +1 -0
  31. package/dist/plugin/multi/containerManager.d.ts +2 -0
  32. package/dist/plugin/multi/displayer/appViewDisplayerManager.d.ts +1 -0
  33. package/dist/plugin/multi/displayer/mainViewDisplayerManager.d.ts +1 -0
  34. package/dist/plugin/single/containerManager.d.ts +2 -0
  35. package/dist/plugin/single/displayer/mainViewDisplayerManager.d.ts +1 -0
  36. package/dist/plugin/types.d.ts +11 -0
  37. package/dist/style.css +1 -1
  38. package/dist/subWorker.js +125 -124
  39. package/package.json +1 -1
  40. package/cdn/fullWorker-B41ROv.js +0 -437
  41. package/cdn/subWorker-D3x__X.js +0 -437
  42. package/dist/index-BUV3AIdR.js +0 -1
  43. package/dist/index-BwY-Y-lK.js +0 -1
  44. package/dist/index-DDd3tlz2.mjs +0 -9770
  45. package/dist/index-D_EDUBFF.mjs +0 -5675
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-BUV3AIdR.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.EMatrixrRelationType=e.EMatrixrRelationType;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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-OwNIkbKl.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.EMatrixrRelationType=e.EMatrixrRelationType;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,10 +1,10 @@
1
- import { a1 as s, W as p, Z as t, Y as l, X as r, a2 as n, a3 as y, j as E, N as i, h as T, E as o, l as v, f as g, a5 as S, K as c, a4 as k, k as W, a6 as u, a0 as A, $ as M, R as m, U as C } from "./index-DDd3tlz2.mjs";
1
+ import { H as s, A as p, B as t, z as r, y as l, J as n, K as y, h as E, r as i, k as T, O as o, F as v, E as g, N as S, p as c, L as k, a as A, P as u, I as M, G as W, w as m, x } from "./index-DWP99OFK.mjs";
2
2
  export {
3
3
  s as ActiveContainerType,
4
4
  p as ApplianceMultiPlugin,
5
5
  t as ApplianceNames,
6
- l as ApplianceSigleWrapper,
7
- r as ApplianceSinglePlugin,
6
+ r as ApplianceSigleWrapper,
7
+ l as ApplianceSinglePlugin,
8
8
  n as ECanvasContextType,
9
9
  y as ECanvasShowType,
10
10
  E as EDataType,
@@ -16,10 +16,10 @@ export {
16
16
  S as ElayerType,
17
17
  c as EmitEventType,
18
18
  k as EventMessageType,
19
- W as EvevtWorkState,
19
+ A as EvevtWorkState,
20
20
  u as EvevtWorkType,
21
- A as InternalMsgEmitterType,
22
- M as ShapeType,
21
+ M as InternalMsgEmitterType,
22
+ W as ShapeType,
23
23
  m as fullWorkerUrl,
24
- C as subWorkerUrl
24
+ x as subWorkerUrl
25
25
  };
@@ -3,36 +3,38 @@ export declare enum EToolsKey {
3
3
  Pencil = 1,
4
4
  /** 橡皮擦工具 */
5
5
  Eraser = 2,
6
+ /** 局部橡皮擦 */
7
+ PencilEraser = 3,
6
8
  /** 选择工具 */
7
- Selector = 3,
9
+ Selector = 4,
8
10
  /** 点击互动工具 */
9
- Clicker = 4,
11
+ Clicker = 5,
10
12
  /** 箭头工具 */
11
- Arrow = 5,
13
+ Arrow = 6,
12
14
  /** 抓手工具 */
13
- Hand = 6,
15
+ Hand = 7,
14
16
  /** 激光铅笔绘制工具 */
15
- LaserPen = 7,
17
+ LaserPen = 8,
16
18
  /** 文字工具 */
17
- Text = 8,
19
+ Text = 9,
18
20
  /** 直线工具 */
19
- Straight = 9,
21
+ Straight = 10,
20
22
  /** 矩形工具 */
21
- Rectangle = 10,
23
+ Rectangle = 11,
22
24
  /** 圆形工具 */
23
- Ellipse = 11,
25
+ Ellipse = 12,
24
26
  /** 星形工具 */
25
- Star = 12,
27
+ Star = 13,
26
28
  /** 三角形工具 */
27
- Triangle = 13,
29
+ Triangle = 14,
28
30
  /** 菱形工具 */
29
- Rhombus = 14,
31
+ Rhombus = 15,
30
32
  /** 多边形工具 */
31
- Polygon = 15,
33
+ Polygon = 16,
32
34
  /** 聊天泡泡框 */
33
- SpeechBalloon = 16,
35
+ SpeechBalloon = 17,
34
36
  /** 图片 */
35
- Image = 17
37
+ Image = 18
36
38
  }
37
39
  export declare enum EDataType {
38
40
  /** 本地数据 */
@@ -95,7 +97,11 @@ export declare enum EPostMessageType {
95
97
  /** 丢失焦点事件 */
96
98
  CursorBlur = 19,
97
99
  /** 前端日志 */
98
- Console = 20
100
+ Console = 20,
101
+ /** 优先激活worker */
102
+ PriorityWorker = 21,
103
+ /** 优先激活worker */
104
+ PriorityMainThreadWorker = 22
99
105
  }
100
106
  export declare enum ECanvasContextType {
101
107
  Webgl2 = "webgl2",
@@ -3,7 +3,7 @@ import { BaseCollectorReducerAction, DiffOneData } from "../collector";
3
3
  import { BaseApplianceManager } from "../plugin/baseApplianceManager";
4
4
  import { IActiveToolsDataType, IActiveWorkDataType, ICameraOpt, IMainMessage, IRectType, IUpdateNodeOpt, IWorkerMessage, IqueryTask, IworkId, ViewWorkerOptions } from "./types";
5
5
  import { BaseSubWorkModuleProps } from "../plugin/types";
6
- import type { ImageInformation } from "../plugin/types";
6
+ import type { ImageInformation, PriorityType } from "../plugin/types";
7
7
  import { MethodBuilderMain } from "./msgEvent";
8
8
  import { EvevtWorkState } from "./enum";
9
9
  import { BaseShapeOptions } from "./tools";
@@ -131,6 +131,7 @@ export declare class MasterControlForWorker extends MasterController {
131
131
  private mainThread?;
132
132
  private willSelectorWorkId?;
133
133
  private isLockSentEventCursor;
134
+ private subMainThreadWorker?;
134
135
  constructor(props: BaseSubWorkModuleProps);
135
136
  destroy(): void;
136
137
  private get viewContainerManager();
@@ -143,12 +144,17 @@ export declare class MasterControlForWorker extends MasterController {
143
144
  private get isCanStartEventConsum();
144
145
  init(): Promise<void>;
145
146
  on(): Promise<void>;
146
- private clearReRenders;
147
+ clearReRenders(num?: number): void;
147
148
  get isBusy(): boolean;
148
149
  getLockSentEventCursor(): boolean;
149
150
  setLockSentEventCursor(bol: boolean): void;
150
151
  getTasksqueueState(): EvevtWorkState.Doing | EvevtWorkState.Done;
151
152
  setMaxDrawCount(num: number): void;
153
+ getWorkDrawCount(): number;
154
+ getSubWorkerDrawCount(): number;
155
+ getMaxDrawCount(): number;
156
+ setWorkDrawCount(num: number): void;
157
+ setSubWorkerDrawCount(num: number): void;
152
158
  setWorkerTasksqueueCount(num: number): void;
153
159
  collectorSyncData(sp: IMainMessage[]): void;
154
160
  private collectorAsyncData;
@@ -209,4 +215,5 @@ export declare class MasterControlForWorker extends MasterController {
209
215
  setShapeSelectorByWorkId(workId: string, viewId: string): void;
210
216
  blurSelector(viewId: string, scenePath: string, workId?: string): void;
211
217
  consoleWorkerInfo(): void;
218
+ setPriority(priority: PriorityType): void;
212
219
  }
@@ -19,7 +19,7 @@ export declare class SnapshotThreadImpl {
19
19
  on(msg: IWorkerMessage): Promise<void>;
20
20
  createWorkShapeNode(opt: IActiveToolsDataType & {
21
21
  workId: string;
22
- }): import("../tools").PencilShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").StarShape | TextShape | import("../tools").SelectorShape | ImageShape | import("../tools").ArrowShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | undefined;
22
+ }): import("../tools").PencilShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").StarShape | TextShape | import("../tools").SelectorShape | ImageShape | import("../tools").ArrowShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | import("../tools/pencilEraser").PencilEraserShape | undefined;
23
23
  setFullWork(data: Pick<IWorkerMessage, 'workId' | 'opt' | 'toolsType'>): BaseShapeTool | undefined;
24
24
  runFullWork(data: IWorkerMessage): Promise<IRectType | undefined>;
25
25
  private getSnapshot;
@@ -98,6 +98,7 @@ export declare class SubLocalThreadImpl implements SubLocalThread {
98
98
  reRenderSelector(willSyncService?: boolean): Promise<void> | undefined;
99
99
  blurSelector(data?: IWorkerMessage): Promise<void>;
100
100
  clearWorkShapeNodeCache(workId: string): void;
101
+ private drawPencilEraser;
101
102
  private drawEraser;
102
103
  private updateBatchEraserCombineNode;
103
104
  private batchEraserCombine;
@@ -110,5 +111,5 @@ export declare class SubLocalThreadImpl implements SubLocalThread {
110
111
  setWorkOptions(workId: string, opt: BaseShapeOptions): void;
111
112
  createWorkShapeNode(opt: IActiveToolsDataType & {
112
113
  workId: string;
113
- }): PencilShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").StarShape | TextShape | SelectorShape | ImageShape | import("../tools").ArrowShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | undefined;
114
+ }): PencilShape | import("../tools").LaserPenShape | import("../tools").EraserShape | import("../tools").StarShape | TextShape | SelectorShape | ImageShape | import("../tools").ArrowShape | import("../tools/straight").StraightShape | import("../tools").EllipseShape | import("../tools").PolygonShape | import("../tools").RectangleShape | import("../tools").SpeechBalloonShape | import("../tools/pencilEraser").PencilEraserShape | undefined;
114
115
  }
@@ -33,7 +33,7 @@ export declare class SubTopThreadImpl implements SubTopThread {
33
33
  constructor(opt: ISubThreadInitOption);
34
34
  createLocalWork(data: IWorkerMessage): void;
35
35
  getLocalWorkShape(workId: string): ILocalWorkItem | undefined;
36
- createLocalWorkShape(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;
36
+ createLocalWorkShape(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 | import("../tools/pencilEraser").PencilEraserShape | undefined;
37
37
  canUseTopLayer(toolsType: EToolsKey): toolsType is EToolsKey.LaserPen;
38
38
  destroy(): void;
39
39
  clearAll(): void;
@@ -42,7 +42,7 @@ export declare class SubTopThreadImpl implements SubTopThread {
42
42
  getToolsOpt(): IActiveToolsDataType | undefined;
43
43
  createWorkShapeNode(opt: IActiveToolsDataType & {
44
44
  workId: string;
45
- }): 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;
45
+ }): 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 | import("../tools/pencilEraser").PencilEraserShape | undefined;
46
46
  private setNodeKey;
47
47
  private activeServiceWorkShape;
48
48
  private computNextAnimationIndex;
@@ -0,0 +1,99 @@
1
+ import { Group, Scene } from "spritejs";
2
+ import { EToolsKey } from "../enum";
3
+ import { MasterControlForWorker } from "../mainEngine";
4
+ import { IActiveToolsDataType, IBatchMainMessage, ICameraOpt, IWorkerMessage } from "../types";
5
+ import { IMainThreadInitOption } from "./base";
6
+ import { BaseShapeOptions, BaseShapeTool } from "../tools/base";
7
+ import { ShapeOptions } from "../tools/utils";
8
+ interface MainThreadWorkerManager {
9
+ master: MasterControlForWorker;
10
+ mainThreadWorkerMap: Map<string, MainThreadWorkerImpl>;
11
+ createMainThreadWorker(viewId: string, opt: IMainThreadInitOption): MainThreadWorkerImpl;
12
+ consume(msg: Set<IWorkerMessage>): void;
13
+ post(sp: Omit<IBatchMainMessage, 'render'>): void;
14
+ clearDrawCount(viewId: string): void;
15
+ notifyDrawCount(viewId: string): void;
16
+ active(): void;
17
+ destroy(): void;
18
+ updateCamera(): void;
19
+ }
20
+ export declare class MainThreadWorkerManagerImpl implements MainThreadWorkerManager {
21
+ master: MasterControlForWorker;
22
+ mainThreadWorkerMap: Map<string, MainThreadWorkerImpl>;
23
+ constructor(master: MasterControlForWorker);
24
+ updateCamera(): void;
25
+ notifyDrawCount(viewId: string): void;
26
+ clearDrawCount(viewId: string): void;
27
+ createMainThreadWorker(viewId: string, opt: IMainThreadInitOption): MainThreadWorkerImpl;
28
+ consume(msg: Set<IWorkerMessage>): void;
29
+ post(msg: Omit<IBatchMainMessage, 'render'>): void;
30
+ destroy(): void;
31
+ active(): void;
32
+ }
33
+ interface MainThreadWorker {
34
+ readonly viewId: string;
35
+ readonly subLocalLayer: Group;
36
+ readonly manager: MainThreadWorkerManager;
37
+ setCameraOpt(cameraOpt: ICameraOpt): void;
38
+ updateCamera(msg: IWorkerMessage): void;
39
+ on(msg: IWorkerMessage): void;
40
+ destroy(): void;
41
+ }
42
+ export declare class MainThreadWorkerImpl implements MainThreadWorker {
43
+ viewId: string;
44
+ opt: IMainThreadInitOption;
45
+ manager: MainThreadWorkerManager;
46
+ subLocalLayer: Group;
47
+ subLocalWork: SubMainThreadWorkerImpl;
48
+ protected scene: Scene;
49
+ protected cameraOpt?: ICameraOpt;
50
+ constructor(viewId: string, opt: IMainThreadInitOption, manager: MainThreadWorkerManager);
51
+ private createScene;
52
+ private createLayer;
53
+ private updateScene;
54
+ private updateLayer;
55
+ on(msg: IWorkerMessage): void;
56
+ setCameraOpt(cameraOpt: ICameraOpt): void;
57
+ updateCamera(msg: IWorkerMessage): void;
58
+ clearAll(): void;
59
+ destroy(): void;
60
+ clearDrawLayer(num: number): void;
61
+ }
62
+ interface SubMainThreadWorker {
63
+ workShapes: Map<string, BaseShapeTool>;
64
+ destroy(): void;
65
+ clearAll(): void;
66
+ getToolsOpt(): IActiveToolsDataType | undefined;
67
+ setToolsOpt(opt: IActiveToolsDataType): void;
68
+ canUseSubWorkerLayer(toolsType: EToolsKey): boolean;
69
+ consumeDrawAll(data: IWorkerMessage): void;
70
+ consumeDraw(data: IWorkerMessage): void;
71
+ removeNode(data: IWorkerMessage): void;
72
+ setWorkOptions(workId: string, opt: BaseShapeOptions): void;
73
+ }
74
+ export declare class SubMainThreadWorkerImpl implements SubMainThreadWorker {
75
+ thread: MainThreadWorkerImpl;
76
+ workShapes: Map<string, BaseShapeTool>;
77
+ private tmpOpt?;
78
+ private syncUnitTime;
79
+ private drawCount;
80
+ constructor(subThreadOpt: {
81
+ thread: MainThreadWorkerImpl;
82
+ });
83
+ getToolsOpt(): IActiveToolsDataType | undefined;
84
+ consumeDrawAll(data: IWorkerMessage): void;
85
+ consumeDraw(data: IWorkerMessage): void;
86
+ removeNode(data: IWorkerMessage): void;
87
+ createLocalWork(data: IWorkerMessage): void;
88
+ setWorkOptions(workId: string, opt: ShapeOptions): void;
89
+ destroy(): void;
90
+ clearAll(): void;
91
+ canUseSubWorkerLayer(toolsType: EToolsKey): toolsType is EToolsKey.Pencil;
92
+ setToolsOpt(opt: IActiveToolsDataType): void;
93
+ createWorkShapeNode(opt: IActiveToolsDataType & {
94
+ workId: string;
95
+ }): 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 | import("../tools/pencilEraser").PencilEraserShape | undefined;
96
+ clearWorkShapeNodeCache(workId: string): void;
97
+ getWorkShape(workId: string): BaseShapeTool | undefined;
98
+ }
99
+ export {};
@@ -1,10 +1,9 @@
1
1
  import { BaseShapeOptions, BaseShapeTool, BaseShapeToolProps } from "./base";
2
2
  import { EPostMessageType, EScaleType, EToolsKey } from "../enum";
3
- import { IWorkerMessage, IRectType, IworkId } from "../types";
3
+ import { IWorkerMessage, IRectType } from "../types";
4
4
  import type { ServiceThreadSubWork } from "./utils";
5
5
  export interface EraserOptions extends BaseShapeOptions {
6
6
  thickness: number;
7
- isLine: boolean;
8
7
  }
9
8
  export declare class EraserShape extends BaseShapeTool {
10
9
  readonly canRotate: boolean;
@@ -25,10 +24,6 @@ export declare class EraserShape extends BaseShapeTool {
25
24
  private createEraserRect;
26
25
  private computRectCenterPoints;
27
26
  private isNear;
28
- private cutPolyline;
29
- private isSamePoint;
30
- private translateIntersect;
31
- private isLineEraser;
32
27
  private remove;
33
28
  consume(props: {
34
29
  data: IWorkerMessage;
@@ -39,17 +34,10 @@ export declare class EraserShape extends BaseShapeTool {
39
34
  type: EPostMessageType;
40
35
  rect?: undefined;
41
36
  removeIds?: undefined;
42
- newWorkDatas?: undefined;
43
37
  } | {
44
38
  type: EPostMessageType;
45
39
  rect: IRectType;
46
40
  removeIds: string[];
47
- newWorkDatas: Map<string, {
48
- op: number[];
49
- opt: BaseShapeOptions;
50
- workId: IworkId;
51
- toolsType: EToolsKey;
52
- }>;
53
41
  };
54
42
  consumeAll(props: {
55
43
  data: IWorkerMessage;
@@ -60,17 +48,10 @@ export declare class EraserShape extends BaseShapeTool {
60
48
  type: EPostMessageType;
61
49
  rect?: undefined;
62
50
  removeIds?: undefined;
63
- newWorkDatas?: undefined;
64
51
  } | {
65
52
  type: EPostMessageType;
66
53
  rect: IRectType;
67
54
  removeIds: string[];
68
- newWorkDatas: Map<string, {
69
- op: number[];
70
- opt: BaseShapeOptions;
71
- workId: IworkId;
72
- toolsType: EToolsKey;
73
- }>;
74
55
  };
75
56
  clearTmpPoints(): void;
76
57
  private getUnLockNodeMap;
@@ -0,0 +1,76 @@
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";
5
+ export interface PencilEraserOptions extends BaseShapeOptions {
6
+ thickness: number;
7
+ }
8
+ export declare class PencilEraserShape extends BaseShapeTool {
9
+ readonly canRotate: boolean;
10
+ readonly scaleType: EScaleType;
11
+ readonly toolsType: EToolsKey;
12
+ readonly serviceWork?: ServiceThreadSubWork;
13
+ private static readonly eraserSizes;
14
+ protected tmpPoints: Array<number>;
15
+ protected workOptions: PencilEraserOptions;
16
+ worldPosition: [number, number];
17
+ worldScaling: [number, number];
18
+ eraserRect: IRectType | undefined;
19
+ eraserPolyline?: [number, number, number, number];
20
+ constructor(props: BaseShapeToolProps, serviceWork?: ServiceThreadSubWork);
21
+ combineConsume(): undefined;
22
+ consumeService(): IRectType | undefined;
23
+ setWorkOptions(setWorkOptions: PencilEraserOptions): void;
24
+ private createEraserRect;
25
+ private computRectCenterPoints;
26
+ private isNear;
27
+ private cutPolyline;
28
+ private isSamePoint;
29
+ private translateIntersect;
30
+ private isLineEraser;
31
+ private remove;
32
+ consume(props: {
33
+ data: IWorkerMessage;
34
+ }): {
35
+ workId: string;
36
+ toolsType: EToolsKey;
37
+ opt: import("./utils").ShapeOptions;
38
+ type: EPostMessageType;
39
+ rect?: undefined;
40
+ removeIds?: undefined;
41
+ newWorkDatas?: undefined;
42
+ } | {
43
+ type: EPostMessageType;
44
+ rect: IRectType;
45
+ removeIds: string[];
46
+ newWorkDatas: Map<string, {
47
+ op: number[];
48
+ opt: BaseShapeOptions;
49
+ workId: IworkId;
50
+ toolsType: EToolsKey;
51
+ }>;
52
+ };
53
+ consumeAll(props: {
54
+ data: IWorkerMessage;
55
+ }): {
56
+ workId: string;
57
+ toolsType: EToolsKey;
58
+ opt: import("./utils").ShapeOptions;
59
+ type: EPostMessageType;
60
+ rect?: undefined;
61
+ removeIds?: undefined;
62
+ newWorkDatas?: undefined;
63
+ } | {
64
+ type: EPostMessageType;
65
+ rect: IRectType;
66
+ removeIds: string[];
67
+ newWorkDatas: Map<string, {
68
+ op: number[];
69
+ opt: BaseShapeOptions;
70
+ workId: IworkId;
71
+ toolsType: EToolsKey;
72
+ }>;
73
+ };
74
+ clearTmpPoints(): void;
75
+ private getUnLockNodeMap;
76
+ }
@@ -19,9 +19,10 @@ import { ImageOptions, ImageShape } from "./image";
19
19
  import type { ServiceWorkForFullWorker } from "../worker/fullWorkerService";
20
20
  import type { SubServiceThread } from "../mainThread/subServiceThread";
21
21
  import { BaseShapeTool } from "./base";
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
- export type ShapeToolsClass = BaseShapeTool | PencilShape | LaserPenShape | EraserShape | StarShape | SelectorShape | ArrowShape | EllipseShape | RectangleShape | StarShape | PolygonShape | TextShape | SpeechBalloonShape | ImageShape;
24
- export type ShapeOptions = PencilOptions | LaserPenOptions | EraserOptions | StarOptions | SelectorOptions | ArrowOptions | EllipseOptions | RectangleOptions | StarOptions | PolygonOptions | StraightOptions | TextOptions | SpeechBalloonOptions | ImageOptions;
22
+ import { PencilEraserOptions, PencilEraserShape } from "./pencilEraser";
23
+ export type ShapeTools = typeof PencilShape | typeof LaserPenShape | typeof PencilEraserShape | typeof EraserShape | typeof StarShape | typeof SelectorShape | typeof ArrowShape | typeof EllipseShape | typeof RectangleShape | typeof StarShape | typeof PolygonShape | typeof TextShape | typeof SpeechBalloonShape | typeof ImageShape;
24
+ export type ShapeToolsClass = BaseShapeTool | PencilShape | LaserPenShape | PencilEraserShape | EraserShape | StarShape | SelectorShape | ArrowShape | EllipseShape | RectangleShape | StarShape | PolygonShape | TextShape | SpeechBalloonShape | ImageShape;
25
+ export type ShapeOptions = PencilOptions | LaserPenOptions | PencilEraserOptions | EraserOptions | StarOptions | SelectorOptions | ArrowOptions | EllipseOptions | RectangleOptions | StarOptions | PolygonOptions | StraightOptions | TextOptions | SpeechBalloonOptions | ImageOptions;
25
26
  export type ShapeNodes = Group | Path | Polyline | Rect | Ellipse | Sprite | Label;
26
27
  export type ServiceThreadSubWork = SubServiceThread | ServiceWorkForFullWorker;
27
28
  export interface CombineConsumeResult {
@@ -32,7 +33,7 @@ export interface CombineConsumeResult {
32
33
  export interface ShapeStateInfo {
33
34
  willClear: boolean;
34
35
  }
35
- export declare function getShapeTools(toolsType: EToolsKey): typeof PencilShape | typeof LaserPenShape | typeof EraserShape | typeof StarShape | typeof TextShape | typeof ArrowShape | typeof StraightShape | typeof EllipseShape | typeof PolygonShape | typeof RectangleShape | typeof SpeechBalloonShape | typeof SelectorShape | typeof ImageShape | undefined;
36
+ export declare function getShapeTools(toolsType: EToolsKey): typeof PencilShape | typeof LaserPenShape | typeof EraserShape | typeof StarShape | typeof TextShape | typeof ArrowShape | typeof StraightShape | typeof EllipseShape | typeof PolygonShape | typeof RectangleShape | typeof SpeechBalloonShape | typeof PencilEraserShape | typeof SelectorShape | typeof ImageShape | undefined;
36
37
  export declare function getShapeInstance(param: {
37
38
  workId: string;
38
39
  toolsType: EToolsKey;
@@ -40,5 +41,5 @@ export declare function getShapeInstance(param: {
40
41
  vNodes?: VNodeManager;
41
42
  fullLayer: Group;
42
43
  drawLayer?: Group;
43
- }, serviceWork?: ServiceThreadSubWork): PencilShape | LaserPenShape | EraserShape | StarShape | TextShape | SelectorShape | ImageShape | ArrowShape | StraightShape | EllipseShape | PolygonShape | RectangleShape | SpeechBalloonShape | undefined;
44
+ }, serviceWork?: ServiceThreadSubWork): PencilShape | LaserPenShape | EraserShape | StarShape | TextShape | SelectorShape | ImageShape | ArrowShape | StraightShape | EllipseShape | PolygonShape | RectangleShape | SpeechBalloonShape | PencilEraserShape | undefined;
44
45
  export declare function findShapeBody(nodes: ShapeNodes[]): ShapeNodes[];
@@ -205,6 +205,7 @@ export interface IBatchMainMessage {
205
205
  drawCount?: number;
206
206
  workerTasksqueueCount?: number;
207
207
  workIds?: Set<string>;
208
+ viewId?: string;
208
209
  }
209
210
  export interface ICameraOpt {
210
211
  centerX: number;
@@ -65,3 +65,6 @@ export declare function isIntersectForPoint(point: [number, number], rect: IRect
65
65
  export declare const getLineSegIntersection: (p1: [number, number], p2: [number, number], p3: [number, number], p4: [number, number]) => [number, number] | null;
66
66
  export declare function getWHRatio(w: number, h: number): [number, number];
67
67
  export declare function checkOp(op: number[]): boolean;
68
+ export declare function isDecimal(num: number): boolean;
69
+ export declare function decimalPlaces(num: number): number;
70
+ export declare function gcd(a: number, b: number): number;
@@ -11,6 +11,7 @@ export declare class VNodeManager {
11
11
  constructor(viewId: string, scene: Scene);
12
12
  init(fullLayer: Group): void;
13
13
  get(name: string): BaseNodeMapItem | undefined;
14
+ getUnLockNodes(): Map<string, BaseNodeMapItem>;
14
15
  getNodesByType(type: EToolsKey): Map<string, BaseNodeMapItem>;
15
16
  hasRenderNodes(): boolean;
16
17
  has(name: string): boolean;
@@ -42,8 +42,11 @@ export declare abstract class WorkThreadEngineBase {
42
42
  workName: EmitEventType;
43
43
  workState: EvevtWorkState;
44
44
  };
45
+ protected hasPriorityDraw: boolean;
45
46
  protected delayPostDoneResolve?: (bol: boolean) => void;
46
47
  constructor(viewId: string, opt: IWorkerInitOption, workerType: EWorkThreadType);
48
+ setHasPriorityDraw(bol: boolean): void;
49
+ getPriorityDraw(): boolean;
47
50
  setIsSafari(isSafari: boolean): void;
48
51
  on(msg: IWorkerMessage): Promise<void>;
49
52
  protected createLocalWork(data: IWorkerMessage): void;
@@ -59,7 +62,7 @@ export declare abstract class WorkThreadEngineBase {
59
62
  post(msg: IBatchMainMessage): Promise<void>;
60
63
  private runBatchPostData;
61
64
  protected combinePostData(): IBatchMainMessage;
62
- protected safariFixRect(rect: IRectType): IRectType | undefined;
65
+ protected safariFixRect(rect: IRectType, dpr: number): IRectType | undefined;
63
66
  protected getSceneRect(): IRectType;
64
67
  abstract combinePost(): Promise<void>;
65
68
  protected abstract getLayer(workLayer: ECanvasShowType): Group | undefined;
@@ -87,7 +90,7 @@ export declare abstract class LocalWork {
87
90
  setWorkOptions(workId: string, opt: BaseShapeOptions): void;
88
91
  createWorkShapeNode(opt: IActiveToolsDataType & {
89
92
  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;
93
+ }): 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 | import("../tools/pencilEraser").PencilEraserShape | undefined;
91
94
  setToolsOpt(opt: IActiveToolsDataType): void;
92
95
  getToolsOpt(): IActiveToolsDataType | undefined;
93
96
  clearWorkShapeNodeCache(workId: string): void;
@@ -45,8 +45,10 @@ export declare class LocalWorkForFullWorker extends LocalWork {
45
45
  destroy(): void;
46
46
  private drawPencilCombine;
47
47
  private drawSelector;
48
+ private drawPencilEraser;
48
49
  private drawEraser;
49
50
  private batchEraserCombine;
51
+ private drawShape;
50
52
  private drawPencil;
51
53
  private drawPencilFull;
52
54
  private updateBatchEraserCombineNode;
@@ -1,4 +1,4 @@
1
- import { IWorkerMessage, IRectType } from "..";
1
+ import { IWorkerMessage, IRectType, EToolsKey } from "..";
2
2
  import { LocalWork, ISubWorkerInitOption } from "./base";
3
3
  export declare class LocalWorkForSubWorker extends LocalWork {
4
4
  private drawWorkActiveId?;
@@ -6,10 +6,11 @@ export declare class LocalWorkForSubWorker extends LocalWork {
6
6
  runFullWork(data: IWorkerMessage): Promise<IRectType | undefined>;
7
7
  runSelectWork(data: IWorkerMessage): undefined;
8
8
  workShapesDone(): void;
9
+ canUseSubWorker(eToolsKey: EToolsKey): boolean;
9
10
  consumeDraw(data: IWorkerMessage): Promise<void>;
10
11
  consumeDrawAll(data: IWorkerMessage): Promise<void>;
11
12
  removeWork(data: IWorkerMessage): Promise<void>;
12
13
  private removeNode;
13
14
  private drawPencil;
14
- private drawArrow;
15
+ private drawShape;
15
16
  }
@@ -28,11 +28,11 @@ export declare class TopLayerWorkForSubWorker implements TopLayerWork {
28
28
  constructor(opt: ISubWorkerInitOption);
29
29
  canUseTopLayer(toolsType: EToolsKey): toolsType is EToolsKey.LaserPen;
30
30
  getWorkShape(workId: string): ILocalWorkItem | undefined;
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;
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 | import("../tools/pencilEraser").PencilEraserShape | undefined;
32
32
  setWorkOptions(workId: string, opt: BaseShapeOptions): void;
33
33
  createWorkShapeNode(opt: IActiveToolsDataType & {
34
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;
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 | import("../tools/pencilEraser").PencilEraserShape | undefined;
36
36
  clearAllWorkShapesCache(): void;
37
37
  setToolsOpt(opt: IActiveToolsDataType): void;
38
38
  getToolsOpt(): IActiveToolsDataType | undefined;
@@ -14,6 +14,7 @@ export declare class WorkerManager<T extends WorkThreadEngineBase> {
14
14
  readonly _self: Worker;
15
15
  readonly version: string;
16
16
  protected type: EWorkThreadType;
17
+ protected hasPriorityDraw: boolean;
17
18
  protected workThreadMap: Map<string, T>;
18
19
  constructor(worker: Worker, type: EWorkThreadType);
19
20
  private init;