@netless/appliance-plugin 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -14
- package/cdn/cdn.js +1 -1
- package/cdn/fullWorker-uIttd_.js +437 -0
- package/cdn/subWorker-4wkCzC.js +437 -0
- package/dist/appliance-plugin.js +1 -1
- package/dist/appliance-plugin.mjs +14 -13
- package/dist/collector/base.d.ts +3 -1
- package/dist/collector/collector.d.ts +5 -4
- package/dist/collector/eventCollector.d.ts +2 -1
- package/dist/collector/magixEventCollector.d.ts +30 -0
- package/dist/collector/types.d.ts +27 -7
- package/dist/component/textEditor/manager.d.ts +2 -2
- package/dist/component/textEditor/types.d.ts +0 -1
- package/dist/component/textEditor/view.d.ts +4 -1
- package/dist/core/const.d.ts +2 -0
- package/dist/core/enum.d.ts +12 -5
- package/dist/core/mainEngine.d.ts +31 -10
- package/dist/core/mainThread/base.d.ts +6 -2
- package/dist/core/mainThread/snapshotThread.d.ts +3 -3
- package/dist/core/mainThread/subLocalThread.d.ts +18 -10
- package/dist/core/mainThread/subServiceThread.d.ts +2 -1
- package/dist/core/mainThread/subTopThread.d.ts +15 -8
- package/dist/core/msgEvent/deleteNode/forMainThread.d.ts +1 -5
- package/dist/core/msgEvent/deleteNode/forWorker.d.ts +1 -5
- package/dist/core/msgEvent/scaleNode/forMain.d.ts +7 -6
- package/dist/core/msgEvent/setFont/forMain.d.ts +2 -1
- package/dist/core/msgEvent/translateNode/forMain.d.ts +0 -1
- package/dist/core/tools/arrow.d.ts +36 -7
- package/dist/core/tools/base.d.ts +22 -8
- package/dist/core/tools/ellipse.d.ts +36 -7
- package/dist/core/tools/eraser.d.ts +40 -4
- package/dist/core/tools/image.d.ts +9 -5
- package/dist/core/tools/laserPen.d.ts +34 -4
- package/dist/core/tools/pencil.d.ts +37 -4
- package/dist/core/tools/polygon.d.ts +36 -7
- package/dist/core/tools/rectangle.d.ts +36 -7
- package/dist/core/tools/selector.d.ts +52 -5
- package/dist/core/tools/speechBalloon.d.ts +36 -8
- package/dist/core/tools/star.d.ts +36 -7
- package/dist/core/tools/straight.d.ts +36 -7
- package/dist/core/tools/text.d.ts +20 -10
- package/dist/core/tools/utils.d.ts +6 -5
- package/dist/core/types.d.ts +1 -3
- package/dist/core/utils/index.d.ts +10 -0
- package/dist/core/utils/math.d.ts +9 -2
- package/dist/core/{mainThread/vNodeManager.d.ts → vNodeManager.d.ts} +10 -3
- package/dist/core/worker/base.d.ts +18 -16
- package/dist/core/worker/fullWorkerLocal.d.ts +18 -9
- package/dist/core/worker/fullWorkerService.d.ts +10 -9
- package/dist/core/worker/subWorkerLocal.d.ts +5 -8
- package/dist/core/worker/subWorkerTopLayer.d.ts +13 -9
- package/dist/core/worker/workerManager.d.ts +18 -10
- package/dist/cursors/index.d.ts +44 -18
- package/dist/displayer/floatBtns/del.d.ts +1 -1
- package/dist/displayer/floatBtns/lock.d.ts +1 -1
- package/dist/fullWorker.js +141 -157
- package/dist/index-BdHH_zhp.js +1 -0
- package/dist/index-RCWmSJU4.mjs +9601 -0
- package/dist/index-RcUgPE7z.mjs +5570 -0
- package/dist/index-a-uKt6aD.js +1 -0
- package/dist/plugin/applianceSinglePlugin.d.ts +1 -0
- package/dist/plugin/baseApplianceManager.d.ts +7 -1
- package/dist/plugin/baseViewContainerManager.d.ts +0 -3
- package/dist/plugin/const.d.ts +11 -1
- package/dist/plugin/displayerView.d.ts +3 -5
- package/dist/plugin/multi/containerManager.d.ts +2 -1
- package/dist/style.css +1 -1
- package/dist/subWorker.js +141 -157
- package/package.json +2 -3
- package/cdn/fullWorker-CIvt1j.js +0 -453
- package/cdn/subWorker-BE-0dg.js +0 -453
- package/dist/core/worker/vNodeManager.d.ts +0 -34
- package/dist/index-BcIJbozZ.js +0 -1
- package/dist/index-C1YKkWHE.mjs +0 -9090
- package/dist/index-ClJPZxV-.mjs +0 -5462
- package/dist/index-SsMz_ohn.js +0 -1
package/README.md
CHANGED
|
@@ -11,8 +11,8 @@ A whiteboard pencil drawing plugin based on SpriteJS as a rendering engine.
|
|
|
11
11
|
The following two demos are implemented in the example folder for reference only.
|
|
12
12
|
| scenario | demo path | depends on |
|
|
13
13
|
| :-- | :----: | :-- |
|
|
14
|
-
| multi-window | example/src/multi.ts
|
|
15
|
-
| white-board | example/src/single.ts
|
|
14
|
+
| multi-window | [example/src/multi.ts](https://github.com/hqer927/appliance-plugin/blob/master/example/src/multi.ts) | @netless/window-manager、white-web-sdk |
|
|
15
|
+
| white-board | [example/src/single.ts](https://github.com/hqer927/appliance-plugin/blob/master/example/src/single.ts) | white-web-sdk |
|
|
16
16
|
<!-- | fastboard | todo | todo | -->
|
|
17
17
|
|
|
18
18
|
## Principle
|
|
@@ -71,7 +71,7 @@ const room = await whiteWebSdk.joinRoom({
|
|
|
71
71
|
invisiblePlugins: [WindowManager, ApplianceMultiPlugin],
|
|
72
72
|
useMultiViews: true,
|
|
73
73
|
})
|
|
74
|
-
const manager = await WindowManager.mount({ room , container:elm, chessboard: true, cursor: true,
|
|
74
|
+
const manager = await WindowManager.mount({ room , container:elm, chessboard: true, cursor: true, supportAppliancePlugin: true});
|
|
75
75
|
if (manager) {
|
|
76
76
|
await manager.switchMainViewToWriter();
|
|
77
77
|
await ApplianceMultiPlugin.getInstance(manager,
|
|
@@ -134,8 +134,29 @@ module: {
|
|
|
134
134
|
},
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
## Call introduction
|
|
138
|
+
### api introduction
|
|
139
|
+
The plugin re-implements some of the interfaces of the same name on room or Windows Manager, but internally we have re-injected them back into the original object via injectMethodToObject. No changes are required for external users. As follows:
|
|
140
|
+
```js
|
|
141
|
+
// Internal hack
|
|
142
|
+
injectMethodToObject(windowmanager, 'undo');
|
|
143
|
+
injectMethodToObject(windowmanager, 'redo');
|
|
144
|
+
injectMethodToObject(windowmanager,'cleanCurrentScene');
|
|
145
|
+
injectMethodToObject(windowmanager,'insertImage');
|
|
146
|
+
injectMethodToObject(windowmanager,'completeImageUpload');
|
|
147
|
+
injectMethodToObject(windowmanager,'lockImage');
|
|
148
|
+
injectMethodToObject(room,'getImagesInformation');
|
|
149
|
+
injectMethodToObject(room,'callbacks');
|
|
150
|
+
injectMethodToObject(room,'screenshotToCanvasAsync');
|
|
151
|
+
injectMethodToObject(room,'getBoundingRectAsync');
|
|
152
|
+
injectMethodToObject(room,'scenePreviewAsync');
|
|
153
|
+
injectMethodToObject(windowmanager.mainView,'setMemberState');
|
|
154
|
+
// These we can see the call behavior through the front-end log, for example:
|
|
155
|
+
// [ApplianceMultiPlugin] setMemberState
|
|
156
|
+
// [ApplianceMultiPlugin] cleanCurrentScene
|
|
157
|
+
```
|
|
158
|
+
The following interfaces are involved:
|
|
159
|
+
|
|
139
160
|
1. Interface on room
|
|
140
161
|
- `setMemberState`
|
|
141
162
|
- `undo`
|
|
@@ -165,13 +186,30 @@ The plug-in re-implements some interfaces of the same name on room or window or
|
|
|
165
186
|
- `getBoundingRectAsync`
|
|
166
187
|
- `screenshotToCanvasAsync`
|
|
167
188
|
- `scenePreviewAsync`
|
|
168
|
-
- `destroy`
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
189
|
+
- `destroy`
|
|
190
|
+
|
|
191
|
+
### Configure parameters
|
|
192
|
+
``getInstance(wm: WindowManager, adaptor: ApplianceAdaptor)``
|
|
193
|
+
- wm: WindowManager\room\player. In multi-window mode, you pass WindowManager, and in single-window mode, you pass room or player(whiteboard playback mode).
|
|
194
|
+
- adaptor: configures the adapter.
|
|
195
|
+
- options: ``AppliancePluginOptions``; The cdn addresses of both workers must be configured.
|
|
196
|
+
```js
|
|
197
|
+
export type AppliancePluginOptions = {
|
|
198
|
+
/** cdn Configuration item */
|
|
199
|
+
cdn: CdnOpt;
|
|
200
|
+
/** Synchronize data configuration items */
|
|
201
|
+
syncOpt? : SyncOpt;
|
|
202
|
+
/** Canvas configuration item */
|
|
203
|
+
canvasOpt? : CanvasOpt;
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
- cursorAdapter? : ``CursorAdapter``; This parameter is optional. In single whiteboard mode, customize the mouse style.
|
|
207
|
+
|
|
208
|
+
### Front-end debugging introduction
|
|
209
|
+
During the interconnection process, if you want to understand and track the internal status of the plug-in, you can view the internal data through the following console commands.
|
|
210
|
+
|
|
173
211
|
```js
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
212
|
+
const applianPlugin = await ApplianceSinglePlugin.getInstance(...)
|
|
213
|
+
applianPlugin.CurrentManager // can see the package version number, internal state, etc
|
|
214
|
+
applianPlugin.CurrentManager.ConsoleWorkerInfo () // can check information to draw on the worker
|
|
215
|
+
```
|
package/cdn/cdn.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r="/fullWorker-uIttd_.js",e="/subWorker-4wkCzC.js";exports.fullWorkerUrl=r;exports.subWorkerUrl=e;
|