@netless/forge-whiteboard 0.1.6 → 0.1.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.
package/dist/whiteboard.js
CHANGED
|
@@ -27761,7 +27761,7 @@ var ToolbarModel = class extends import_eventemitter33.default {
|
|
|
27761
27761
|
this.root = root;
|
|
27762
27762
|
this.root.observe(this.handleRootUpdate);
|
|
27763
27763
|
Object.keys(defaultStyle).forEach((key) => {
|
|
27764
|
-
if (!this.root.has(key)) {
|
|
27764
|
+
if (!this.root.has(key) || this.root.get(key) === void 0) {
|
|
27765
27765
|
this.root.set(key, defaultStyle[key]);
|
|
27766
27766
|
}
|
|
27767
27767
|
});
|
|
@@ -30149,6 +30149,12 @@ var WhiteboardApplication = class extends import_forge_room3.AbstractApplication
|
|
|
30149
30149
|
this.inputType = type;
|
|
30150
30150
|
this.emitter.emit("inputTypeChange", this.inputType);
|
|
30151
30151
|
};
|
|
30152
|
+
this.emitter.on("error", (errorCode, errorMessage) => {
|
|
30153
|
+
(0, import_forge_room3.log)("WhiteboardApplicationError", {
|
|
30154
|
+
errorCode,
|
|
30155
|
+
errorMessage
|
|
30156
|
+
});
|
|
30157
|
+
});
|
|
30152
30158
|
const that = this;
|
|
30153
30159
|
Object.defineProperty(this.emitter, "tool", {
|
|
30154
30160
|
get() {
|
|
@@ -30294,10 +30300,19 @@ var WhiteboardApplication = class extends import_forge_room3.AbstractApplication
|
|
|
30294
30300
|
grab: new GrabTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope, this.camera)
|
|
30295
30301
|
};
|
|
30296
30302
|
this.toolbarModel.on("update", (style) => {
|
|
30297
|
-
|
|
30303
|
+
if (this.tools[style.tool]) {
|
|
30304
|
+
this.paperScope.tool = this.tools[style.tool].tool;
|
|
30305
|
+
} else {
|
|
30306
|
+
this.emitter.emit("error", 300001, `${style.tool} not supported`);
|
|
30307
|
+
}
|
|
30298
30308
|
this.emitter.emit("toolbarStyleChange", style);
|
|
30299
30309
|
});
|
|
30300
|
-
|
|
30310
|
+
if (this.tools[this.toolbarModel.currentTool]) {
|
|
30311
|
+
this.paperScope.tool = this.tools[this.toolbarModel.currentTool].tool;
|
|
30312
|
+
} else {
|
|
30313
|
+
this.paperScope.tool = this.tools["curve"].tool;
|
|
30314
|
+
(0, import_forge_room3.log)(`${this.toolbarModel.currentTool} not supported, backup to curve`);
|
|
30315
|
+
}
|
|
30301
30316
|
this.selectElementsModel.on("elementsChange", this.handleElementsSelect);
|
|
30302
30317
|
this.trashedElementsModel.on("elementsChange", this.handleElementsTrash);
|
|
30303
30318
|
this.trashedElementsModel.on("removeElementForSelf", this.handleRemoveTrashedElementForSelf);
|
|
@@ -30516,7 +30531,7 @@ var WhiteboardApplication = class extends import_forge_room3.AbstractApplication
|
|
|
30516
30531
|
getCurrentRenderableModel = () => {
|
|
30517
30532
|
let layerId = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
30518
30533
|
if (!this.layers.has(layerId)) {
|
|
30519
|
-
this.emitter.emit("error",
|
|
30534
|
+
this.emitter.emit("error", 300002, `target page: ${layerId} not found`);
|
|
30520
30535
|
}
|
|
30521
30536
|
return this.layers.get(layerId);
|
|
30522
30537
|
};
|