@netless/forge-slide 1.0.5 → 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.
- package/dist/index.esm.js +197 -195
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +197 -195
- package/dist/index.js.map +2 -2
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -63134,7 +63134,7 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63134
63134
|
confirmPermission() {
|
|
63135
63135
|
const hasPermission = this.hasPermission(WhiteboardPermissionFlag.draw);
|
|
63136
63136
|
if (!hasPermission) {
|
|
63137
|
-
(0, import_forge_room2.log)("[@netless/forge-whiteboard] no permission to draw", {}, "
|
|
63137
|
+
(0, import_forge_room2.log)("[@netless/forge-whiteboard] no permission to draw", {}, "warn");
|
|
63138
63138
|
}
|
|
63139
63139
|
return hasPermission;
|
|
63140
63140
|
}
|
|
@@ -66932,7 +66932,7 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
66932
66932
|
}
|
|
66933
66933
|
} else {
|
|
66934
66934
|
console.warn(`[@netless/forge-whiteboard] page ${pageId} not found`);
|
|
66935
|
-
(0, import_forge_room.log)(`[@netless/forge-whiteboard] page ${pageId} not found`, {}, "
|
|
66935
|
+
(0, import_forge_room.log)(`[@netless/forge-whiteboard] page ${pageId} not found`, {}, "warn");
|
|
66936
66936
|
}
|
|
66937
66937
|
await waitUntil(() => this.undoManagers.has(pageId), 1e3);
|
|
66938
66938
|
if (this.undoManagers.has(pageId)) {
|
|
@@ -66944,7 +66944,7 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
66944
66944
|
this.undoManagers.get(pageId).on("stack-item-popped", this.handleStackItemPopped);
|
|
66945
66945
|
} else {
|
|
66946
66946
|
console.warn(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`);
|
|
66947
|
-
(0, import_forge_room.log)(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`, {}, "
|
|
66947
|
+
(0, import_forge_room.log)(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`, {}, "warn");
|
|
66948
66948
|
}
|
|
66949
66949
|
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
66950
66950
|
this.emitter.emit("undoStackLength", this.undoManager?.undoStack.length ?? 0);
|
|
@@ -67211,7 +67211,7 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67211
67211
|
this.emitter.setViewModeToFree = (userId) => {
|
|
67212
67212
|
if (that.disableViewModelUpdate) {
|
|
67213
67213
|
console.warn("Operation failed. Perspective mode switching is disabled in the current environment.");
|
|
67214
|
-
(0, import_forge_room.log)("Operation failed. Perspective mode switching is disabled in the current environment.", {}, "
|
|
67214
|
+
(0, import_forge_room.log)("Operation failed. Perspective mode switching is disabled in the current environment.", {}, "warn");
|
|
67215
67215
|
return;
|
|
67216
67216
|
}
|
|
67217
67217
|
const targetId = userId ? this.hasPermission(WhiteboardPermissionFlag.setOthersView) ? userId : null : this.userId;
|
|
@@ -67222,7 +67222,7 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67222
67222
|
this.emitter.setViewModeToFlow = (flowId, userId) => {
|
|
67223
67223
|
if (that.disableViewModelUpdate) {
|
|
67224
67224
|
console.warn("Operation failed. Perspective mode switching is disabled in the current environment.");
|
|
67225
|
-
(0, import_forge_room.log)("Operation failed. Perspective mode switching is disabled in the current environment.", {}, "
|
|
67225
|
+
(0, import_forge_room.log)("Operation failed. Perspective mode switching is disabled in the current environment.", {}, "warn");
|
|
67226
67226
|
return;
|
|
67227
67227
|
}
|
|
67228
67228
|
const targetId = userId ? this.hasPermission(WhiteboardPermissionFlag.setOthersView) ? userId : null : this.userId;
|
|
@@ -67237,7 +67237,7 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67237
67237
|
this.emitter.setViewModeToMain = (userId) => {
|
|
67238
67238
|
if (that.disableViewModelUpdate) {
|
|
67239
67239
|
console.warn("Operation failed. Perspective mode switching is disabled in the current environment.");
|
|
67240
|
-
(0, import_forge_room.log)("Operation failed. Perspective mode switching is disabled in the current environment.", {}, "
|
|
67240
|
+
(0, import_forge_room.log)("Operation failed. Perspective mode switching is disabled in the current environment.", {}, "warn");
|
|
67241
67241
|
return;
|
|
67242
67242
|
}
|
|
67243
67243
|
const targetId = userId ? this.hasPermission(WhiteboardPermissionFlag.setOthersView) ? userId : null : this.userId;
|
|
@@ -67253,7 +67253,7 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67253
67253
|
if (!/https/.test(src)) {
|
|
67254
67254
|
(0, import_forge_room.log)("[@netless/forge-whiteboard] invalid image url, src needs to be in the HTTPS protocol.", {
|
|
67255
67255
|
src
|
|
67256
|
-
}, "
|
|
67256
|
+
}, "warn");
|
|
67257
67257
|
return;
|
|
67258
67258
|
}
|
|
67259
67259
|
let targetPageId = pageId;
|
|
@@ -67261,14 +67261,14 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67261
67261
|
targetPageId = this.pageModel.getCurrentPage(this.userManager.selfId);
|
|
67262
67262
|
}
|
|
67263
67263
|
if (!targetPageId) {
|
|
67264
|
-
(0, import_forge_room.log)("[@netless/forge-whiteboard] page not found", {}, "
|
|
67264
|
+
(0, import_forge_room.log)("[@netless/forge-whiteboard] page not found", {}, "warn");
|
|
67265
67265
|
return;
|
|
67266
67266
|
}
|
|
67267
67267
|
this.layers.get(targetPageId)?.createImage(src);
|
|
67268
67268
|
};
|
|
67269
67269
|
this.emitter.removeElement = (pageId, elementId) => {
|
|
67270
67270
|
if (!this.layers.has(pageId)) {
|
|
67271
|
-
(0, import_forge_room.log)("[@netless/forge-whiteboard] page not found", {}, "
|
|
67271
|
+
(0, import_forge_room.log)("[@netless/forge-whiteboard] page not found", {}, "warn");
|
|
67272
67272
|
return;
|
|
67273
67273
|
}
|
|
67274
67274
|
this.layers.get(pageId)?.removeElementItem(elementId);
|
|
@@ -67466,202 +67466,204 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67466
67466
|
async initialize(option) {
|
|
67467
67467
|
_WhiteboardApplication.instanceCount.set(this.appId, (_WhiteboardApplication.instanceCount.get(this.appId) ?? 0) + 1);
|
|
67468
67468
|
(0, import_forge_room.log)(`whiteboard ${this.appId} initialize. instance count: ${_WhiteboardApplication.instanceCount.get(this.appId) ?? 0}`, {}, "info");
|
|
67469
|
-
this.
|
|
67470
|
-
|
|
67471
|
-
|
|
67472
|
-
this.permissions.setPermission(WhiteboardPermissionFlag.all);
|
|
67473
|
-
this.emitter["permissions"] = this.permissions;
|
|
67474
|
-
this.emitter["selfUserId"] = this.userId;
|
|
67475
|
-
this.option = option;
|
|
67476
|
-
if (this.option.stretchToFill) {
|
|
67477
|
-
this.getMap("attrs").set("viewportWidth", -1);
|
|
67478
|
-
this.getMap("attrs").set("viewportHeight", -1);
|
|
67479
|
-
} else {
|
|
67480
|
-
if (!this.getMap("attrs").has("viewportWidth")) {
|
|
67481
|
-
this.getMap("attrs").set("viewportWidth", option.width);
|
|
67482
|
-
}
|
|
67483
|
-
if (!this.getMap("attrs").has("viewportHeight")) {
|
|
67484
|
-
this.getMap("attrs").set("viewportHeight", option.height);
|
|
67485
|
-
}
|
|
67486
|
-
}
|
|
67487
|
-
this.userMap(this.userId).set(WhiteboardKeys.themeColor, "#009688");
|
|
67488
|
-
this.userMap(this.userId).observe(this.handleSyncedWhiteboardStatusChange);
|
|
67489
|
-
this.shadowEmitter = new ShadowEmitter(this.userMap(this.userId));
|
|
67490
|
-
this.pageModel = new PageModel(this.getMap("attrs"), this.userManager, (userId) => {
|
|
67491
|
-
return this.userMap(userId);
|
|
67492
|
-
}, this.getMap("pages"), this.hasPermission);
|
|
67493
|
-
this.pageModel.on("pagesChange", this.handleLayersChange);
|
|
67494
|
-
this.pageModel.on("switchPage", this.handlePageSwitch);
|
|
67495
|
-
if (option.maxScaleRatio && option.maxScaleRatio < 1 && option.maxScaleRatio !== -1) {
|
|
67496
|
-
throw new Error(`[@netless/forge-whiteboard] invalid maxScaleRatio ${option.maxScaleRatio}`);
|
|
67497
|
-
}
|
|
67498
|
-
this.camera = new Camera(new this.paperScope.Size(option.width, option.height), option.maxScaleRatio ?? -1, this.rootElement, this.userManager, this.paperScope, this.getMap("attrs"), this.hasPermission, (userId) => {
|
|
67499
|
-
return this.userMap(userId);
|
|
67500
|
-
}, () => {
|
|
67501
|
-
return [this.paperScope.project.view.size.width, this.paperScope.project.view.size.height];
|
|
67502
|
-
}, () => {
|
|
67503
|
-
const rect = this.canvasElement.getBoundingClientRect();
|
|
67504
|
-
return [rect.width, rect.height];
|
|
67505
|
-
});
|
|
67506
|
-
this.camera.on("zoom", (matrix) => {
|
|
67507
|
-
this.paperScope.project.view.matrix = matrix;
|
|
67508
|
-
this.shadowScope.project.view.matrix = matrix;
|
|
67509
|
-
this.editors.forEach((editor) => {
|
|
67510
|
-
editor.updateBounds();
|
|
67469
|
+
this.appDoc.transact(() => {
|
|
67470
|
+
this.permissions = new WhiteboardPermissions(this.userManager, (userId) => {
|
|
67471
|
+
return this.userMap(userId);
|
|
67511
67472
|
});
|
|
67512
|
-
|
|
67513
|
-
|
|
67514
|
-
this.emitter
|
|
67515
|
-
|
|
67516
|
-
|
|
67517
|
-
|
|
67518
|
-
this.
|
|
67519
|
-
}
|
|
67520
|
-
|
|
67521
|
-
|
|
67522
|
-
|
|
67523
|
-
|
|
67524
|
-
|
|
67525
|
-
|
|
67526
|
-
|
|
67527
|
-
|
|
67528
|
-
|
|
67529
|
-
|
|
67530
|
-
|
|
67531
|
-
|
|
67532
|
-
|
|
67533
|
-
|
|
67534
|
-
|
|
67535
|
-
|
|
67536
|
-
|
|
67537
|
-
|
|
67538
|
-
|
|
67539
|
-
|
|
67540
|
-
|
|
67541
|
-
|
|
67542
|
-
|
|
67543
|
-
|
|
67544
|
-
|
|
67545
|
-
|
|
67546
|
-
|
|
67547
|
-
|
|
67548
|
-
|
|
67549
|
-
|
|
67550
|
-
|
|
67551
|
-
|
|
67552
|
-
|
|
67553
|
-
|
|
67554
|
-
|
|
67555
|
-
|
|
67556
|
-
|
|
67557
|
-
|
|
67558
|
-
|
|
67559
|
-
|
|
67560
|
-
|
|
67473
|
+
this.permissions.setPermission(WhiteboardPermissionFlag.all);
|
|
67474
|
+
this.emitter["permissions"] = this.permissions;
|
|
67475
|
+
this.emitter["selfUserId"] = this.userId;
|
|
67476
|
+
this.option = option;
|
|
67477
|
+
if (this.option.stretchToFill) {
|
|
67478
|
+
this.getMap("attrs").set("viewportWidth", -1);
|
|
67479
|
+
this.getMap("attrs").set("viewportHeight", -1);
|
|
67480
|
+
} else {
|
|
67481
|
+
if (!this.getMap("attrs").has("viewportWidth")) {
|
|
67482
|
+
this.getMap("attrs").set("viewportWidth", option.width);
|
|
67483
|
+
}
|
|
67484
|
+
if (!this.getMap("attrs").has("viewportHeight")) {
|
|
67485
|
+
this.getMap("attrs").set("viewportHeight", option.height);
|
|
67486
|
+
}
|
|
67487
|
+
}
|
|
67488
|
+
this.userMap(this.userId).set(WhiteboardKeys.themeColor, "#009688");
|
|
67489
|
+
this.userMap(this.userId).observe(this.handleSyncedWhiteboardStatusChange);
|
|
67490
|
+
this.shadowEmitter = new ShadowEmitter(this.userMap(this.userId));
|
|
67491
|
+
this.pageModel = new PageModel(this.getMap("attrs"), this.userManager, (userId) => {
|
|
67492
|
+
return this.userMap(userId);
|
|
67493
|
+
}, this.getMap("pages"), this.hasPermission);
|
|
67494
|
+
this.pageModel.on("pagesChange", this.handleLayersChange);
|
|
67495
|
+
this.pageModel.on("switchPage", this.handlePageSwitch);
|
|
67496
|
+
if (option.maxScaleRatio && option.maxScaleRatio < 1 && option.maxScaleRatio !== -1) {
|
|
67497
|
+
throw new Error(`[@netless/forge-whiteboard] invalid maxScaleRatio ${option.maxScaleRatio}`);
|
|
67498
|
+
}
|
|
67499
|
+
this.camera = new Camera(new this.paperScope.Size(option.width, option.height), option.maxScaleRatio ?? -1, this.rootElement, this.userManager, this.paperScope, this.getMap("attrs"), this.hasPermission, (userId) => {
|
|
67500
|
+
return this.userMap(userId);
|
|
67501
|
+
}, () => {
|
|
67502
|
+
return [this.paperScope.project.view.size.width, this.paperScope.project.view.size.height];
|
|
67503
|
+
}, () => {
|
|
67504
|
+
const rect = this.canvasElement.getBoundingClientRect();
|
|
67505
|
+
return [rect.width, rect.height];
|
|
67506
|
+
});
|
|
67507
|
+
this.camera.on("zoom", (matrix) => {
|
|
67508
|
+
this.paperScope.project.view.matrix = matrix;
|
|
67509
|
+
this.shadowScope.project.view.matrix = matrix;
|
|
67510
|
+
this.editors.forEach((editor) => {
|
|
67511
|
+
editor.updateBounds();
|
|
67512
|
+
});
|
|
67513
|
+
});
|
|
67514
|
+
this.camera.on("userPageChange", (userId, pageId) => {
|
|
67515
|
+
this.emitter.emit("activePageChange", userId, pageId);
|
|
67516
|
+
});
|
|
67517
|
+
this.camera.on("userViewModeChange", (userId, mode, oldMode) => {
|
|
67518
|
+
if (oldMode !== "main" && mode === "main") {
|
|
67519
|
+
this.emitter.setViewModeToMain(userId);
|
|
67520
|
+
}
|
|
67521
|
+
this.emitter.emit("userViewModeChange", userId, mode);
|
|
67522
|
+
});
|
|
67523
|
+
this.rootElement.style.position = "relative";
|
|
67524
|
+
this.rootElement.appendChild(this.canvasElement);
|
|
67525
|
+
this.toolbarModel = new ToolbarModel(this.userMap(this.userId), Object.assign({
|
|
67526
|
+
tool: "grab",
|
|
67527
|
+
strokeColor: "#009688",
|
|
67528
|
+
fillColor: null,
|
|
67529
|
+
fontSize: 24,
|
|
67530
|
+
fontFamily: "Courier New",
|
|
67531
|
+
strokeWidth: 4,
|
|
67532
|
+
dashArray: []
|
|
67533
|
+
}, option.defaultToolbarStyle ?? {}));
|
|
67534
|
+
this.trashedElementsModel = new TrashedElementsModel(this.userManager, (userId) => {
|
|
67535
|
+
return this.userMap(userId);
|
|
67536
|
+
}, this.hasPermission);
|
|
67537
|
+
this.selectElementsModel = new SelectElementsModel(this.userManager, (userId) => {
|
|
67538
|
+
return this.userMap(userId);
|
|
67539
|
+
}, this.hasPermission);
|
|
67540
|
+
this.liveCursor = new LiveCursor(this.canvasElement, this.paperScope, this.userManager, (userId) => {
|
|
67541
|
+
return this.userMap(userId);
|
|
67542
|
+
});
|
|
67543
|
+
this.tools = {
|
|
67544
|
+
pointer: new PointerTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
|
|
67545
|
+
curve: new CurveTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
|
|
67546
|
+
rectangle: new RectangleTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
|
|
67547
|
+
selector: new SelectorTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope, this.selectElementsModel),
|
|
67548
|
+
arrow: new LineTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
|
|
67549
|
+
line: new StraightLineTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
|
|
67550
|
+
text: new TextTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope, this.rootElement, this.canvasElement, this.toolbarModel, this.camera),
|
|
67551
|
+
ellipse: new EllipseTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
|
|
67552
|
+
triangle: new TriangleTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
|
|
67553
|
+
eraser: new EraserTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope, this.trashedElementsModel, this.shadowScope),
|
|
67554
|
+
laser: new LaserPointerTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope),
|
|
67555
|
+
grab: new GrabTool(this.enableToolEvent, this.getCurrentRendererModel, this.shadowEmitter, this.paperScope, this.camera)
|
|
67556
|
+
};
|
|
67557
|
+
this.toolbarModel.on("update", (style) => {
|
|
67558
|
+
if (this.tools[style.tool]) {
|
|
67559
|
+
this.paperScope.tool = this.tools[style.tool].tool;
|
|
67560
|
+
if (style.tool === "pointer") {
|
|
67561
|
+
this.rootElement.style.pointerEvents = "none";
|
|
67562
|
+
} else {
|
|
67563
|
+
this.rootElement.style.pointerEvents = "auto";
|
|
67564
|
+
}
|
|
67561
67565
|
} else {
|
|
67562
|
-
this.
|
|
67566
|
+
this.emitter.emit("error", 300001, `${style.tool} not supported`);
|
|
67563
67567
|
}
|
|
67568
|
+
this.emitter.emit("toolbarStyleChange", style);
|
|
67569
|
+
});
|
|
67570
|
+
if (this.tools[this.toolbarModel.currentTool]) {
|
|
67571
|
+
this.paperScope.tool = this.tools[this.toolbarModel.currentTool].tool;
|
|
67564
67572
|
} else {
|
|
67565
|
-
this.
|
|
67566
|
-
|
|
67567
|
-
|
|
67568
|
-
|
|
67569
|
-
|
|
67570
|
-
this.
|
|
67571
|
-
|
|
67572
|
-
this.
|
|
67573
|
-
|
|
67574
|
-
|
|
67575
|
-
|
|
67576
|
-
|
|
67577
|
-
|
|
67578
|
-
|
|
67579
|
-
|
|
67580
|
-
|
|
67581
|
-
|
|
67582
|
-
|
|
67583
|
-
|
|
67584
|
-
|
|
67585
|
-
|
|
67586
|
-
|
|
67587
|
-
|
|
67588
|
-
|
|
67589
|
-
|
|
67590
|
-
|
|
67591
|
-
|
|
67592
|
-
|
|
67593
|
-
|
|
67594
|
-
|
|
67595
|
-
|
|
67596
|
-
|
|
67597
|
-
|
|
67598
|
-
|
|
67599
|
-
|
|
67600
|
-
|
|
67601
|
-
|
|
67602
|
-
|
|
67603
|
-
|
|
67604
|
-
|
|
67605
|
-
|
|
67606
|
-
|
|
67607
|
-
|
|
67608
|
-
|
|
67609
|
-
|
|
67610
|
-
|
|
67611
|
-
|
|
67612
|
-
if (currentPage) {
|
|
67613
|
-
this.userMap(this.userId).set(WhiteboardKeys.currentPage, currentPage);
|
|
67614
|
-
this.handlePageSwitch(currentPage);
|
|
67573
|
+
this.paperScope.tool = this.tools["curve"].tool;
|
|
67574
|
+
(0, import_forge_room.log)(`${this.toolbarModel.currentTool} not supported, backup to curve`);
|
|
67575
|
+
}
|
|
67576
|
+
this.selectElementsModel.on("elementsChange", this.handleElementsSelect);
|
|
67577
|
+
this.trashedElementsModel.on("elementsChange", this.handleElementsTrash);
|
|
67578
|
+
this.trashedElementsModel.on("removeElementForSelf", this.handleRemoveTrashedElementForSelf);
|
|
67579
|
+
this.canvasElement.style.background = "#FFEB3B";
|
|
67580
|
+
this.canvasElement.style.position = "absolute";
|
|
67581
|
+
this.canvasElement.style.top = "50%";
|
|
67582
|
+
this.canvasElement.style.left = "50%";
|
|
67583
|
+
this.canvasElement.style.transform = "translate(-50%, -50%)";
|
|
67584
|
+
this.canvasElement.setAttribute("id", `${this.appId}-main`);
|
|
67585
|
+
this.paperScope.setup(this.canvasElement);
|
|
67586
|
+
this.paperScope.settings.insertItems = false;
|
|
67587
|
+
this.shadowCanvasElement.style.position = "absolute";
|
|
67588
|
+
this.shadowCanvasElement.style.top = "50%";
|
|
67589
|
+
this.shadowCanvasElement.style.left = "50%";
|
|
67590
|
+
this.shadowCanvasElement.style.transform = "translate(-50%, -50%)";
|
|
67591
|
+
this.shadowCanvasElement.style.pointerEvents = "none";
|
|
67592
|
+
this.shadowCanvasElement.setAttribute("id", `${this.appId}-shadow`);
|
|
67593
|
+
this.rootElement.appendChild(this.shadowCanvasElement);
|
|
67594
|
+
this.shadowScope.setup(this.shadowCanvasElement);
|
|
67595
|
+
this.shadowScope.settings.insertItems = false;
|
|
67596
|
+
this.snapshotCanvasElement.setAttribute("id", `${this.appId}-snapshot`);
|
|
67597
|
+
this.snapshotScope.setup(this.snapshotCanvasElement);
|
|
67598
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
67599
|
+
if (this.internalResizeObserver) {
|
|
67600
|
+
const rootBounds = this.rootElement.getBoundingClientRect();
|
|
67601
|
+
this.adjustByOutFrame(rootBounds.width, rootBounds.height);
|
|
67602
|
+
}
|
|
67603
|
+
});
|
|
67604
|
+
this.resizeObserver.observe(this.rootElement);
|
|
67605
|
+
if (!this.getMap("attrs").has(WhiteboardKeys.currentPage)) {
|
|
67606
|
+
this.getMap("attrs").set(WhiteboardKeys.currentPage, "_i_");
|
|
67607
|
+
}
|
|
67608
|
+
this.emitter.indexedNavigation = new IndexedNavigation(this.pageModel, this.userMap(this.userId), this.getMap("indexedNavigation"), this.hasPermission);
|
|
67609
|
+
this.emitter.indexedNavigation.initIndexed().then((inited) => {
|
|
67610
|
+
if (!inited) {
|
|
67611
|
+
this.handleLayersChange(this.pageModel.pageList());
|
|
67612
|
+
const currentPage = this.pageModel.getCurrentPage(this.userId);
|
|
67613
|
+
if (currentPage) {
|
|
67614
|
+
this.userMap(this.userId).set(WhiteboardKeys.currentPage, currentPage);
|
|
67615
|
+
this.handlePageSwitch(currentPage);
|
|
67616
|
+
} else {
|
|
67617
|
+
this.userMap(this.userId).set(WhiteboardKeys.currentPage, "_i_");
|
|
67618
|
+
this.handlePageSwitch("_i_");
|
|
67619
|
+
}
|
|
67615
67620
|
} else {
|
|
67616
67621
|
this.userMap(this.userId).set(WhiteboardKeys.currentPage, "_i_");
|
|
67617
|
-
this.handlePageSwitch("_i_");
|
|
67618
67622
|
}
|
|
67619
|
-
}
|
|
67620
|
-
|
|
67621
|
-
|
|
67622
|
-
|
|
67623
|
-
|
|
67624
|
-
|
|
67625
|
-
|
|
67623
|
+
});
|
|
67624
|
+
this.shadowEmitter.on("translateOut", (ids, container) => {
|
|
67625
|
+
if (this.delayTranslateOut > 0) {
|
|
67626
|
+
setTimeout(() => {
|
|
67627
|
+
this.handleElementTranslateOut(ids, container);
|
|
67628
|
+
}, this.delayTranslateOut);
|
|
67629
|
+
} else {
|
|
67626
67630
|
this.handleElementTranslateOut(ids, container);
|
|
67627
|
-
}
|
|
67628
|
-
}
|
|
67629
|
-
|
|
67630
|
-
|
|
67631
|
-
|
|
67632
|
-
|
|
67633
|
-
|
|
67634
|
-
|
|
67635
|
-
|
|
67636
|
-
|
|
67637
|
-
|
|
67638
|
-
|
|
67639
|
-
|
|
67640
|
-
|
|
67641
|
-
|
|
67642
|
-
|
|
67643
|
-
|
|
67644
|
-
|
|
67645
|
-
|
|
67631
|
+
}
|
|
67632
|
+
});
|
|
67633
|
+
this.shadowEmitter.on("translateIn", (ids, container) => {
|
|
67634
|
+
let parent = null;
|
|
67635
|
+
if (container === "layer") {
|
|
67636
|
+
parent = this.shadowScope.project.activeLayer;
|
|
67637
|
+
} else {
|
|
67638
|
+
parent = this.shadowScope.project.activeLayer.children.find((child) => child.data.uuid === container) ?? null;
|
|
67639
|
+
}
|
|
67640
|
+
if (parent) {
|
|
67641
|
+
ids.forEach((id) => {
|
|
67642
|
+
const target = this.paperScope.project.activeLayer.children.find((child) => child.data.uuid === id);
|
|
67643
|
+
if (target) {
|
|
67644
|
+
target.remove();
|
|
67645
|
+
this.insertElementToParent(target, parent);
|
|
67646
|
+
}
|
|
67647
|
+
});
|
|
67648
|
+
}
|
|
67649
|
+
});
|
|
67650
|
+
this.shadowEmitter.on("grabDown", () => {
|
|
67651
|
+
this.emitter.emit("grabDown");
|
|
67652
|
+
});
|
|
67653
|
+
this.shadowEmitter.on("grabUp", () => {
|
|
67654
|
+
this.emitter.emit("grabUp");
|
|
67655
|
+
});
|
|
67656
|
+
this.clearElements();
|
|
67657
|
+
if (this.option.stretchToFill) {
|
|
67658
|
+
window.addEventListener("resize", () => {
|
|
67659
|
+
const bounds = this.rootElement.getBoundingClientRect();
|
|
67660
|
+
this.updateOptionSize(bounds.width, bounds.height);
|
|
67661
|
+
this.adjustByOutFrame(bounds.width, bounds.height);
|
|
67646
67662
|
});
|
|
67647
67663
|
}
|
|
67648
|
-
|
|
67649
|
-
|
|
67650
|
-
|
|
67651
|
-
});
|
|
67652
|
-
this.shadowEmitter.on("grabUp", () => {
|
|
67653
|
-
this.emitter.emit("grabUp");
|
|
67654
|
-
});
|
|
67655
|
-
this.clearElements();
|
|
67656
|
-
if (this.option.stretchToFill) {
|
|
67657
|
-
window.addEventListener("resize", () => {
|
|
67658
|
-
const bounds = this.rootElement.getBoundingClientRect();
|
|
67659
|
-
this.updateOptionSize(bounds.width, bounds.height);
|
|
67660
|
-
this.adjustByOutFrame(bounds.width, bounds.height);
|
|
67661
|
-
});
|
|
67662
|
-
}
|
|
67663
|
-
this.rootElement.appendChild(this.liveCursor.container);
|
|
67664
|
-
this.getMap("attrs").observe(this.handleViewportUpdate);
|
|
67664
|
+
this.rootElement.appendChild(this.liveCursor.container);
|
|
67665
|
+
this.getMap("attrs").observe(this.handleViewportUpdate);
|
|
67666
|
+
}, "whiteboard-initialize");
|
|
67665
67667
|
}
|
|
67666
67668
|
clearElements() {
|
|
67667
67669
|
const userIds = this.userManager.userIdList();
|