@netless/forge-whiteboard 0.1.4 → 0.1.6
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
|
@@ -29993,6 +29993,8 @@ var WhiteboardApplication = class extends import_forge_room3.AbstractApplication
|
|
|
29993
29993
|
paperScope = new import_paper.default.PaperScope();
|
|
29994
29994
|
canvasElement = document.createElement("canvas");
|
|
29995
29995
|
shadowScope = new import_paper.default.PaperScope();
|
|
29996
|
+
snapshotCanvasElement = document.createElement("canvas");
|
|
29997
|
+
snapshotScope = new import_paper.default.PaperScope();
|
|
29996
29998
|
shadowCanvasElement = document.createElement("canvas");
|
|
29997
29999
|
shadowEmitter;
|
|
29998
30000
|
tools;
|
|
@@ -30314,6 +30316,7 @@ var WhiteboardApplication = class extends import_forge_room3.AbstractApplication
|
|
|
30314
30316
|
this.rootElement.appendChild(this.shadowCanvasElement);
|
|
30315
30317
|
this.shadowScope.setup(this.shadowCanvasElement);
|
|
30316
30318
|
this.shadowScope.settings.insertItems = false;
|
|
30319
|
+
this.snapshotScope.setup(this.snapshotCanvasElement);
|
|
30317
30320
|
this.resizeObserver = new ResizeObserver(() => {
|
|
30318
30321
|
const rootBounds = this.rootElement.getBoundingClientRect();
|
|
30319
30322
|
const minWidth = Math.max(rootBounds.width, 10);
|
|
@@ -30650,11 +30653,9 @@ var WhiteboardApplication = class extends import_forge_room3.AbstractApplication
|
|
|
30650
30653
|
if (!renderableModel) {
|
|
30651
30654
|
return Promise.resolve(null);
|
|
30652
30655
|
}
|
|
30653
|
-
|
|
30654
|
-
|
|
30655
|
-
|
|
30656
|
-
scope.view.matrix = this.paperScope.project.view.matrix.clone();
|
|
30657
|
-
scope.view.viewSize = this.paperScope.project.view.viewSize.clone();
|
|
30656
|
+
this.snapshotScope.project.activeLayer.removeChildren();
|
|
30657
|
+
this.snapshotScope.view.matrix = this.paperScope.project.view.matrix.clone();
|
|
30658
|
+
this.snapshotScope.view.viewSize = this.paperScope.project.view.viewSize.clone();
|
|
30658
30659
|
for (const key of Array.from(renderableModel.elements.keys())) {
|
|
30659
30660
|
let elementModel = null;
|
|
30660
30661
|
if (renderableModel.elementModels.has(key)) {
|
|
@@ -30671,14 +30672,13 @@ var WhiteboardApplication = class extends import_forge_room3.AbstractApplication
|
|
|
30671
30672
|
}
|
|
30672
30673
|
if (elementModel.item) {
|
|
30673
30674
|
const paperItem = elementModel.item.clone({ insert: false });
|
|
30674
|
-
|
|
30675
|
+
this.snapshotScope.project.activeLayer.addChild(paperItem);
|
|
30675
30676
|
}
|
|
30676
30677
|
}
|
|
30677
30678
|
}
|
|
30678
|
-
document.body.appendChild(scope.view.element);
|
|
30679
30679
|
return new Promise((resolve) => {
|
|
30680
30680
|
setTimeout(() => {
|
|
30681
|
-
resolve(
|
|
30681
|
+
resolve(this.snapshotScope.view.element.toDataURL("image/png"));
|
|
30682
30682
|
}, 32);
|
|
30683
30683
|
});
|
|
30684
30684
|
}
|
|
@@ -30694,6 +30694,7 @@ var WhiteboardApplication = class extends import_forge_room3.AbstractApplication
|
|
|
30694
30694
|
this.rootElement.removeChild(this.shadowCanvasElement);
|
|
30695
30695
|
this.paperScope.project.clear();
|
|
30696
30696
|
this.shadowScope.project.clear();
|
|
30697
|
+
this.snapshotScope.project.clear();
|
|
30697
30698
|
this.resizeObserver.disconnect();
|
|
30698
30699
|
}
|
|
30699
30700
|
};
|