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