@netless/forge-whiteboard 0.1.19 → 0.1.20-alpha.1
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/changelog.md +5 -1
- package/dist/WhiteboardApplication.d.ts +24 -3
- package/dist/WhiteboardApplication.d.ts.map +1 -1
- package/dist/model/RenderableModel.d.ts +1 -2
- package/dist/model/RenderableModel.d.ts.map +1 -1
- package/dist/model/renderable/CurveModel.d.ts.map +1 -1
- package/dist/whiteboard.esm.js +240 -99
- package/dist/whiteboard.esm.js.map +2 -2
- package/dist/whiteboard.js +240 -99
- package/dist/whiteboard.js.map +2 -2
- package/package.json +2 -2
package/dist/whiteboard.esm.js
CHANGED
|
@@ -25812,8 +25812,7 @@ var CurveModel = class extends ElementModel {
|
|
|
25812
25812
|
return (a2 + b2) / 2;
|
|
25813
25813
|
}
|
|
25814
25814
|
parsePoints(points) {
|
|
25815
|
-
|
|
25816
|
-
return ae(groupPoints, {
|
|
25815
|
+
return ae(points, {
|
|
25817
25816
|
size: this.strokeWidth,
|
|
25818
25817
|
smoothing: 0.5,
|
|
25819
25818
|
thinning: -0.5,
|
|
@@ -25830,15 +25829,15 @@ var CurveModel = class extends ElementModel {
|
|
|
25830
25829
|
});
|
|
25831
25830
|
}
|
|
25832
25831
|
matrixedPoints() {
|
|
25833
|
-
const
|
|
25834
|
-
|
|
25835
|
-
|
|
25836
|
-
|
|
25837
|
-
|
|
25838
|
-
|
|
25839
|
-
|
|
25840
|
-
|
|
25841
|
-
|
|
25832
|
+
const points = this.points;
|
|
25833
|
+
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
25834
|
+
const output = [];
|
|
25835
|
+
for (let i = 0, len = points.length; i < len; i += 2) {
|
|
25836
|
+
const p = new this.scope.Point(points[i], points[i + 1]);
|
|
25837
|
+
const tp = p.transform(matrix);
|
|
25838
|
+
output.push([tp.x, tp.y]);
|
|
25839
|
+
}
|
|
25840
|
+
return output;
|
|
25842
25841
|
}
|
|
25843
25842
|
createPath(points) {
|
|
25844
25843
|
const path = new this.scope.Path();
|
|
@@ -27587,28 +27586,11 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27587
27586
|
return model;
|
|
27588
27587
|
}
|
|
27589
27588
|
initElement(element) {
|
|
27590
|
-
let shadow = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
27591
|
-
if (shadow) {
|
|
27592
|
-
element.shadow = "layer";
|
|
27593
|
-
}
|
|
27594
|
-
element.strokeWidth = this.toolbarModel.strokeWidth;
|
|
27595
|
-
element.strokeColor = this.toolbarModel.strokeColor;
|
|
27596
|
-
element.fillColor = this.toolbarModel.fillColor;
|
|
27597
|
-
element.ownerId = this.userManager.selfId;
|
|
27598
27589
|
element.shadowEmitter = this.shadowEmitter;
|
|
27599
27590
|
}
|
|
27600
27591
|
removeElementItem(uuid) {
|
|
27601
27592
|
this.elements.delete(uuid);
|
|
27602
27593
|
}
|
|
27603
|
-
addElementToDoc(map, type) {
|
|
27604
|
-
this.elements.doc?.transact(() => {
|
|
27605
|
-
const uuid = this.uuid;
|
|
27606
|
-
map.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27607
|
-
map.set(ElementModel.KEYS.uuid, uuid);
|
|
27608
|
-
map.set("type", type);
|
|
27609
|
-
this.elements.set(uuid, map);
|
|
27610
|
-
}, elementsUndoOrigin);
|
|
27611
|
-
}
|
|
27612
27594
|
confirmPermission() {
|
|
27613
27595
|
const hasPermission = this.hasPermission(WhiteboardPermissionFlag.draw);
|
|
27614
27596
|
if (!hasPermission) {
|
|
@@ -27621,7 +27603,14 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27621
27603
|
return;
|
|
27622
27604
|
}
|
|
27623
27605
|
const yMap = new Y12.Map();
|
|
27624
|
-
this.
|
|
27606
|
+
this.elements.doc?.transact(() => {
|
|
27607
|
+
const uuid = this.uuid;
|
|
27608
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27609
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27610
|
+
yMap.set("type", "image");
|
|
27611
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27612
|
+
this.elements.set(uuid, yMap);
|
|
27613
|
+
}, elementsUndoOrigin);
|
|
27625
27614
|
const model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor);
|
|
27626
27615
|
model.root.set("src", src);
|
|
27627
27616
|
const initMatrix = new this.scope.Matrix();
|
|
@@ -27639,9 +27628,22 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27639
27628
|
return null;
|
|
27640
27629
|
}
|
|
27641
27630
|
const yMap = new Y12.Map();
|
|
27642
|
-
this.
|
|
27631
|
+
this.elements.doc?.transact(() => {
|
|
27632
|
+
const uuid = this.uuid;
|
|
27633
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27634
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27635
|
+
yMap.set("type", "curve");
|
|
27636
|
+
if (shadow) {
|
|
27637
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27638
|
+
}
|
|
27639
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27640
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27641
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27642
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27643
|
+
this.elements.set(uuid, yMap);
|
|
27644
|
+
}, elementsUndoOrigin);
|
|
27643
27645
|
const curveModel = new CurveModel(yMap, this.scope, this.liveCursor);
|
|
27644
|
-
this.initElement(curveModel
|
|
27646
|
+
this.initElement(curveModel);
|
|
27645
27647
|
return curveModel;
|
|
27646
27648
|
}
|
|
27647
27649
|
createLaserPointer() {
|
|
@@ -27649,15 +27651,21 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27649
27651
|
return null;
|
|
27650
27652
|
}
|
|
27651
27653
|
const yMap = new Y12.Map();
|
|
27652
|
-
this.
|
|
27654
|
+
this.elements.doc?.transact(() => {
|
|
27655
|
+
const uuid = this.uuid;
|
|
27656
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27657
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27658
|
+
yMap.set("type", "laser");
|
|
27659
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27660
|
+
yMap.set(ElementModel.KEYS.strokeWidth, 8);
|
|
27661
|
+
yMap.set(ElementModel.KEYS.strokeColor, "#F44336");
|
|
27662
|
+
yMap.set(ElementModel.KEYS.fillColor, "#F44336");
|
|
27663
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27664
|
+
this.elements.set(uuid, yMap);
|
|
27665
|
+
}, elementsUndoOrigin);
|
|
27653
27666
|
const model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, this.liveCursor, (uuid) => {
|
|
27654
27667
|
this.removeElementItem(uuid);
|
|
27655
27668
|
});
|
|
27656
|
-
model.strokeWidth = 8;
|
|
27657
|
-
model.strokeColor = "#F44336";
|
|
27658
|
-
model.fillColor = "#F44336";
|
|
27659
|
-
model.ownerId = this.userManager.selfId;
|
|
27660
|
-
model.shadow = "layer";
|
|
27661
27669
|
return model;
|
|
27662
27670
|
}
|
|
27663
27671
|
createEraser() {
|
|
@@ -27665,13 +27673,19 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27665
27673
|
return null;
|
|
27666
27674
|
}
|
|
27667
27675
|
const yMap = new Y12.Map();
|
|
27668
|
-
this.
|
|
27676
|
+
this.elements.doc?.transact(() => {
|
|
27677
|
+
const uuid = this.uuid;
|
|
27678
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27679
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27680
|
+
yMap.set("type", "eraser");
|
|
27681
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27682
|
+
yMap.set(ElementModel.KEYS.strokeWidth, 4);
|
|
27683
|
+
yMap.set(ElementModel.KEYS.strokeColor, "#9E9E9E");
|
|
27684
|
+
yMap.set(ElementModel.KEYS.fillColor, "#9E9E9E");
|
|
27685
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27686
|
+
this.elements.set(uuid, yMap);
|
|
27687
|
+
}, elementsUndoOrigin);
|
|
27669
27688
|
const model = new EraserModel(yMap, this.scope, this.liveCursor);
|
|
27670
|
-
model.strokeWidth = 4;
|
|
27671
|
-
model.strokeColor = "#9E9E9E";
|
|
27672
|
-
model.fillColor = "#9E9E9E";
|
|
27673
|
-
model.ownerId = this.userManager.selfId;
|
|
27674
|
-
model.shadow = "layer";
|
|
27675
27689
|
return model;
|
|
27676
27690
|
}
|
|
27677
27691
|
createTriangle(shadow) {
|
|
@@ -27679,9 +27693,22 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27679
27693
|
return null;
|
|
27680
27694
|
}
|
|
27681
27695
|
const yMap = new Y12.Map();
|
|
27682
|
-
this.
|
|
27696
|
+
this.elements.doc?.transact(() => {
|
|
27697
|
+
const uuid = this.uuid;
|
|
27698
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27699
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27700
|
+
yMap.set("type", "triangle");
|
|
27701
|
+
if (shadow) {
|
|
27702
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27703
|
+
}
|
|
27704
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27705
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27706
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27707
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27708
|
+
this.elements.set(uuid, yMap);
|
|
27709
|
+
}, elementsUndoOrigin);
|
|
27683
27710
|
const triangle = new TriangleModel(yMap, this.scope, this.liveCursor);
|
|
27684
|
-
this.initElement(triangle
|
|
27711
|
+
this.initElement(triangle);
|
|
27685
27712
|
triangle.dashArray = this.toolbarModel.dashArray;
|
|
27686
27713
|
return triangle;
|
|
27687
27714
|
}
|
|
@@ -27690,9 +27717,22 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27690
27717
|
return null;
|
|
27691
27718
|
}
|
|
27692
27719
|
const yMap = new Y12.Map();
|
|
27693
|
-
this.
|
|
27720
|
+
this.elements.doc?.transact(() => {
|
|
27721
|
+
const uuid = this.uuid;
|
|
27722
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27723
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27724
|
+
yMap.set("type", "rectangle");
|
|
27725
|
+
if (shadow) {
|
|
27726
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27727
|
+
}
|
|
27728
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27729
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27730
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27731
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27732
|
+
this.elements.set(uuid, yMap);
|
|
27733
|
+
}, elementsUndoOrigin);
|
|
27694
27734
|
const rect = new RectangleModel(yMap, this.scope, this.liveCursor);
|
|
27695
|
-
this.initElement(rect
|
|
27735
|
+
this.initElement(rect);
|
|
27696
27736
|
rect.dashArray = this.toolbarModel.dashArray;
|
|
27697
27737
|
return rect;
|
|
27698
27738
|
}
|
|
@@ -27701,9 +27741,22 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27701
27741
|
return null;
|
|
27702
27742
|
}
|
|
27703
27743
|
const yMap = new Y12.Map();
|
|
27704
|
-
this.
|
|
27744
|
+
this.elements.doc?.transact(() => {
|
|
27745
|
+
const uuid = this.uuid;
|
|
27746
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27747
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27748
|
+
yMap.set("type", type);
|
|
27749
|
+
if (shadow) {
|
|
27750
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27751
|
+
}
|
|
27752
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27753
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27754
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27755
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27756
|
+
this.elements.set(uuid, yMap);
|
|
27757
|
+
}, elementsUndoOrigin);
|
|
27705
27758
|
const segmentsModel = new SegmentsModel(yMap, this.scope, type, this.liveCursor);
|
|
27706
|
-
this.initElement(segmentsModel
|
|
27759
|
+
this.initElement(segmentsModel);
|
|
27707
27760
|
segmentsModel.dashArray = this.toolbarModel.dashArray;
|
|
27708
27761
|
return segmentsModel;
|
|
27709
27762
|
}
|
|
@@ -27713,7 +27766,15 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27713
27766
|
return null;
|
|
27714
27767
|
}
|
|
27715
27768
|
const yMap = new Y12.Map();
|
|
27716
|
-
this.
|
|
27769
|
+
this.elements.doc?.transact(() => {
|
|
27770
|
+
const uuid = this.uuid;
|
|
27771
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27772
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27773
|
+
yMap.set("type", "selector");
|
|
27774
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27775
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27776
|
+
this.elements.set(uuid, yMap);
|
|
27777
|
+
}, elementsUndoOrigin);
|
|
27717
27778
|
const selectorModel = new SelectorModel(yMap, this.scope, this.liveCursor);
|
|
27718
27779
|
selectorModel.shadow = "layer";
|
|
27719
27780
|
return selectorModel;
|
|
@@ -27723,9 +27784,22 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27723
27784
|
return null;
|
|
27724
27785
|
}
|
|
27725
27786
|
const yMap = new Y12.Map();
|
|
27726
|
-
this.
|
|
27787
|
+
this.elements.doc?.transact(() => {
|
|
27788
|
+
const uuid = this.uuid;
|
|
27789
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27790
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27791
|
+
yMap.set("type", "line");
|
|
27792
|
+
if (shadow) {
|
|
27793
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27794
|
+
}
|
|
27795
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27796
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27797
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27798
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27799
|
+
this.elements.set(uuid, yMap);
|
|
27800
|
+
}, elementsUndoOrigin);
|
|
27727
27801
|
const straightLineModel = new StraightLineModel(yMap, this.scope, this.liveCursor);
|
|
27728
|
-
this.initElement(straightLineModel
|
|
27802
|
+
this.initElement(straightLineModel);
|
|
27729
27803
|
straightLineModel.dashArray = this.toolbarModel.dashArray;
|
|
27730
27804
|
return straightLineModel;
|
|
27731
27805
|
}
|
|
@@ -27734,9 +27808,22 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27734
27808
|
return null;
|
|
27735
27809
|
}
|
|
27736
27810
|
const yMap = new Y12.Map();
|
|
27737
|
-
this.
|
|
27811
|
+
this.elements.doc?.transact(() => {
|
|
27812
|
+
const uuid = this.uuid;
|
|
27813
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27814
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27815
|
+
yMap.set("type", "arrow");
|
|
27816
|
+
if (shadow) {
|
|
27817
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27818
|
+
}
|
|
27819
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27820
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27821
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27822
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27823
|
+
this.elements.set(uuid, yMap);
|
|
27824
|
+
}, elementsUndoOrigin);
|
|
27738
27825
|
const lineModel = new LineModel(yMap, this.scope, this.liveCursor);
|
|
27739
|
-
this.initElement(lineModel
|
|
27826
|
+
this.initElement(lineModel);
|
|
27740
27827
|
lineModel.dashArray = this.toolbarModel.dashArray;
|
|
27741
27828
|
return lineModel;
|
|
27742
27829
|
}
|
|
@@ -27745,12 +27832,25 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27745
27832
|
return null;
|
|
27746
27833
|
}
|
|
27747
27834
|
const yMap = new Y12.Map();
|
|
27748
|
-
this.
|
|
27835
|
+
this.elements.doc?.transact(() => {
|
|
27836
|
+
const uuid = this.uuid;
|
|
27837
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27838
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27839
|
+
yMap.set("type", "point-text");
|
|
27840
|
+
if (shadow) {
|
|
27841
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27842
|
+
}
|
|
27843
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27844
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27845
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27846
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27847
|
+
this.elements.set(uuid, yMap);
|
|
27848
|
+
}, elementsUndoOrigin);
|
|
27749
27849
|
const pointTextModel = new PointTextModel(yMap, this.scope, this.liveCursor);
|
|
27750
27850
|
pointTextModel.setPoints([x, y]);
|
|
27751
27851
|
pointTextModel.fontSize = this.toolbarModel.fontSize;
|
|
27752
27852
|
pointTextModel.fontFamily = this.toolbarModel.fontFamily;
|
|
27753
|
-
this.initElement(pointTextModel
|
|
27853
|
+
this.initElement(pointTextModel);
|
|
27754
27854
|
return pointTextModel;
|
|
27755
27855
|
}
|
|
27756
27856
|
clearElement() {
|
|
@@ -27768,9 +27868,11 @@ var RenderableModel = class extends EventEmitter {
|
|
|
27768
27868
|
removeIds.forEach((id) => this.elements.delete(id));
|
|
27769
27869
|
});
|
|
27770
27870
|
}
|
|
27771
|
-
dispose() {
|
|
27871
|
+
dispose(clearElements) {
|
|
27772
27872
|
removeObserver2(this.elements, this.onElementsChange);
|
|
27773
|
-
|
|
27873
|
+
if (clearElements) {
|
|
27874
|
+
this.elements.clear();
|
|
27875
|
+
}
|
|
27774
27876
|
Array.from(this.elementModels.values()).forEach((model) => {
|
|
27775
27877
|
model.dispose();
|
|
27776
27878
|
});
|
|
@@ -31134,6 +31236,21 @@ function _toPrimitive43(t, r) {
|
|
|
31134
31236
|
return ("string" === r ? String : Number)(t);
|
|
31135
31237
|
}
|
|
31136
31238
|
var WHITEBOARD_APP_NAME = "whiteboard";
|
|
31239
|
+
var AsyncMap = class {
|
|
31240
|
+
constructor() {
|
|
31241
|
+
_defineProperty43(this, "map", void 0);
|
|
31242
|
+
this.map = /* @__PURE__ */ new Map();
|
|
31243
|
+
}
|
|
31244
|
+
get(key) {
|
|
31245
|
+
return Promise.resolve(this.map.get(key));
|
|
31246
|
+
}
|
|
31247
|
+
set(key, value) {
|
|
31248
|
+
this.map.set(key, value);
|
|
31249
|
+
}
|
|
31250
|
+
};
|
|
31251
|
+
if (!window.__forge_gl_wb_status__) {
|
|
31252
|
+
window.__forge_gl_wb_status__ = new AsyncMap();
|
|
31253
|
+
}
|
|
31137
31254
|
var WhiteboardApplication = class extends AbstractApplication {
|
|
31138
31255
|
get undoManager() {
|
|
31139
31256
|
const page = this.pageModel.getCurrentPage(this.userId);
|
|
@@ -31189,9 +31306,24 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31189
31306
|
_defineProperty43(this, "disableViewModelUpdate", false);
|
|
31190
31307
|
_defineProperty43(this, "internalResizeObserver", true);
|
|
31191
31308
|
_defineProperty43(this, "sequenceExecutor", new SequenceExecutor());
|
|
31192
|
-
_defineProperty43(this, "
|
|
31309
|
+
_defineProperty43(this, "linkWhiteboardId", null);
|
|
31193
31310
|
_defineProperty43(this, "liveCursor", void 0);
|
|
31194
31311
|
_defineProperty43(this, "delayTranslateOut", -1);
|
|
31312
|
+
_defineProperty43(this, "addWhiteboardStatus", (evt) => {
|
|
31313
|
+
if (evt.detail.whiteboardAppId && evt.detail.status) {
|
|
31314
|
+
if (this.linkWhiteboardId === evt.detail.whiteboardAppId) {
|
|
31315
|
+
this.toolbarModel.currentTool = evt.detail.status.currentTool;
|
|
31316
|
+
this.toolbarModel.strokeColor = evt.detail.status.strokeColor;
|
|
31317
|
+
this.toolbarModel.fillColor = evt.detail.status.fillColor;
|
|
31318
|
+
this.toolbarModel.fontSize = evt.detail.status.fontSize;
|
|
31319
|
+
this.toolbarModel.fontFamily = evt.detail.status.fontFamily;
|
|
31320
|
+
this.toolbarModel.strokeWidth = evt.detail.status.strokeWidth;
|
|
31321
|
+
this.toolbarModel.dashArray = evt.detail.status.dashArray;
|
|
31322
|
+
this.permissions.removePermission(WhiteboardPermissionFlag.all);
|
|
31323
|
+
this.permissions.addPermission(evt.detail.status.permission);
|
|
31324
|
+
}
|
|
31325
|
+
}
|
|
31326
|
+
});
|
|
31195
31327
|
_defineProperty43(this, "enableToolEvent", () => {
|
|
31196
31328
|
return !(this.inputType === "pen" && !this.isPenEvent);
|
|
31197
31329
|
});
|
|
@@ -31311,7 +31443,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31311
31443
|
const renderableModel = this.layers.get(entry[0]);
|
|
31312
31444
|
this.layers.delete(entry[0]);
|
|
31313
31445
|
if (renderableModel) {
|
|
31314
|
-
renderableModel.dispose();
|
|
31446
|
+
renderableModel.dispose(true);
|
|
31315
31447
|
}
|
|
31316
31448
|
const cameraMode = this.userMap(this.userId).get(WhiteboardKeys.cameraMode);
|
|
31317
31449
|
const currentPage = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
@@ -31330,6 +31462,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31330
31462
|
return this.layers.get(layerId);
|
|
31331
31463
|
});
|
|
31332
31464
|
_defineProperty43(this, "handleElementClear", () => {
|
|
31465
|
+
this.shadowScope.project.activeLayer.removeChildren();
|
|
31333
31466
|
this.paperScope.project.activeLayer.removeChildren();
|
|
31334
31467
|
});
|
|
31335
31468
|
_defineProperty43(this, "handleElementInsert", (elements) => {
|
|
@@ -31415,24 +31548,32 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31415
31548
|
this.emitter.emit("elementDeselected", userId);
|
|
31416
31549
|
}
|
|
31417
31550
|
});
|
|
31418
|
-
_defineProperty43(this, "
|
|
31419
|
-
|
|
31420
|
-
|
|
31421
|
-
|
|
31422
|
-
|
|
31423
|
-
|
|
31424
|
-
|
|
31425
|
-
|
|
31426
|
-
|
|
31427
|
-
|
|
31428
|
-
|
|
31429
|
-
|
|
31430
|
-
|
|
31431
|
-
|
|
31432
|
-
|
|
31551
|
+
_defineProperty43(this, "handleSyncedWhiteboardStatusChange", (evt) => {
|
|
31552
|
+
if ([TOOLBAR_KEYS.tool, TOOLBAR_KEYS.strokeColor, TOOLBAR_KEYS.fillColor, TOOLBAR_KEYS.fontSize, TOOLBAR_KEYS.fontFamily, TOOLBAR_KEYS.strokeWidth, TOOLBAR_KEYS.dashArray, "permission"].some((key) => evt.keysChanged.has(key))) {
|
|
31553
|
+
const nextState = {
|
|
31554
|
+
currentTool: evt.target.get(TOOLBAR_KEYS.tool),
|
|
31555
|
+
strokeColor: evt.target.get(TOOLBAR_KEYS.strokeColor),
|
|
31556
|
+
fillColor: evt.target.get(TOOLBAR_KEYS.fillColor),
|
|
31557
|
+
fontSize: evt.target.get(TOOLBAR_KEYS.fontSize),
|
|
31558
|
+
fontFamily: evt.target.get(TOOLBAR_KEYS.fontFamily),
|
|
31559
|
+
strokeWidth: evt.target.get(TOOLBAR_KEYS.strokeWidth),
|
|
31560
|
+
dashArray: evt.target.get(TOOLBAR_KEYS.dashArray),
|
|
31561
|
+
permission: evt.target.get("permission")
|
|
31562
|
+
};
|
|
31563
|
+
window.__forge_gl_wb_status__.set(this.appId, nextState);
|
|
31564
|
+
window.dispatchEvent(new CustomEvent("forge-whiteboard-synced-status", {
|
|
31565
|
+
detail: {
|
|
31566
|
+
whiteboardAppId: this.appId,
|
|
31567
|
+
status: nextState,
|
|
31568
|
+
userId: this.userId
|
|
31569
|
+
}
|
|
31570
|
+
}));
|
|
31433
31571
|
}
|
|
31434
31572
|
});
|
|
31435
31573
|
_defineProperty43(this, "adjustByOutFrame", (frameWidth, frameHeight) => {
|
|
31574
|
+
if (!this.paperScope.project.view || !this.shadowScope.project.view) {
|
|
31575
|
+
return;
|
|
31576
|
+
}
|
|
31436
31577
|
const viewportWidth = this.viewportWidth;
|
|
31437
31578
|
const viewportHeight = this.viewportHeight;
|
|
31438
31579
|
if (viewportWidth > 0 && viewportHeight > 0) {
|
|
@@ -31444,13 +31585,12 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31444
31585
|
height = minHeight;
|
|
31445
31586
|
width = height * viewportWidth / viewportHeight;
|
|
31446
31587
|
}
|
|
31447
|
-
this.camera.updateInherentScale(width /
|
|
31588
|
+
this.camera.updateInherentScale(width / viewportWidth);
|
|
31448
31589
|
this.paperScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
31449
31590
|
this.shadowScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
31450
31591
|
this.camera.triggerZoom();
|
|
31451
31592
|
}
|
|
31452
31593
|
});
|
|
31453
|
-
window._wb = this;
|
|
31454
31594
|
requestAnimationFrameHook(this.paperScope);
|
|
31455
31595
|
requestAnimationFrameHook(this.shadowScope);
|
|
31456
31596
|
const that = this;
|
|
@@ -31757,6 +31897,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31757
31897
|
that.camera.enableBoundaryHighlight = value;
|
|
31758
31898
|
}
|
|
31759
31899
|
});
|
|
31900
|
+
window.addEventListener("forge-whiteboard-synced-status", this.addWhiteboardStatus);
|
|
31760
31901
|
}
|
|
31761
31902
|
userMap(userId) {
|
|
31762
31903
|
return this.getMap(`user/${userId}`);
|
|
@@ -31781,6 +31922,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31781
31922
|
}
|
|
31782
31923
|
}
|
|
31783
31924
|
this.userMap(this.userId).set(WhiteboardKeys.themeColor, "#009688");
|
|
31925
|
+
this.userMap(this.userId).observe(this.handleSyncedWhiteboardStatusChange);
|
|
31784
31926
|
this.shadowEmitter = new ShadowEmitter(this.userMap(this.userId));
|
|
31785
31927
|
this.pageModel = new PageModel(this.getMap("attrs"), this.userManager, (userId) => {
|
|
31786
31928
|
return this.userMap(userId);
|
|
@@ -32076,28 +32218,23 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
32076
32218
|
this.disableViewModelUpdate = true;
|
|
32077
32219
|
}
|
|
32078
32220
|
linkToWhiteboard(targetId) {
|
|
32079
|
-
|
|
32080
|
-
|
|
32081
|
-
|
|
32082
|
-
|
|
32083
|
-
|
|
32084
|
-
|
|
32085
|
-
|
|
32086
|
-
|
|
32087
|
-
|
|
32088
|
-
|
|
32089
|
-
|
|
32090
|
-
|
|
32091
|
-
|
|
32092
|
-
|
|
32093
|
-
this.permissions.addPermission(this.linkTarget.get("permission"), this.userId);
|
|
32094
|
-
this.linkTarget.observe(this.handleLinkedMapChange);
|
|
32095
|
-
}
|
|
32221
|
+
this.linkWhiteboardId = targetId;
|
|
32222
|
+
window.__forge_gl_wb_status__.get(targetId).then((currentStatus) => {
|
|
32223
|
+
if (currentStatus) {
|
|
32224
|
+
this.toolbarModel.currentTool = currentStatus.currentTool;
|
|
32225
|
+
this.toolbarModel.strokeColor = currentStatus.strokeColor;
|
|
32226
|
+
this.toolbarModel.fillColor = currentStatus.fillColor;
|
|
32227
|
+
this.toolbarModel.fontSize = currentStatus.fontSize;
|
|
32228
|
+
this.toolbarModel.fontFamily = currentStatus.fontFamily;
|
|
32229
|
+
this.toolbarModel.strokeWidth = currentStatus.strokeWidth;
|
|
32230
|
+
this.toolbarModel.dashArray = currentStatus.dashArray;
|
|
32231
|
+
this.permissions.removePermission(WhiteboardPermissionFlag.all);
|
|
32232
|
+
this.permissions.addPermission(currentStatus.permission);
|
|
32233
|
+
}
|
|
32234
|
+
});
|
|
32096
32235
|
}
|
|
32097
32236
|
unlink() {
|
|
32098
|
-
|
|
32099
|
-
removeObserver7(this.linkTarget, this.handleLinkedMapChange);
|
|
32100
|
-
}
|
|
32237
|
+
this.linkWhiteboardId = null;
|
|
32101
32238
|
}
|
|
32102
32239
|
setViewSize(width, height) {
|
|
32103
32240
|
this.paperScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
@@ -32118,7 +32255,10 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
32118
32255
|
this.getMap("attrs").set("viewportHeight", height);
|
|
32119
32256
|
this.camera.updateInitSize(new import_paper.default.Size(width, height));
|
|
32120
32257
|
}
|
|
32121
|
-
async dispose() {
|
|
32258
|
+
async dispose(removeSubDoc) {
|
|
32259
|
+
if (removeSubDoc) {
|
|
32260
|
+
this.deleteSubDoc(this.appId);
|
|
32261
|
+
}
|
|
32122
32262
|
this.selectElementsModel.dispose();
|
|
32123
32263
|
this.trashedElementsModel.dispose();
|
|
32124
32264
|
this.paperScope.view.remove();
|
|
@@ -32135,7 +32275,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
32135
32275
|
entry[1].off("stack-item-popped", this.handleStackItemPopped);
|
|
32136
32276
|
}
|
|
32137
32277
|
for (const entry of this.layers.entries()) {
|
|
32138
|
-
entry[1].dispose();
|
|
32278
|
+
entry[1].dispose(removeSubDoc);
|
|
32139
32279
|
entry[1].removeAllListeners();
|
|
32140
32280
|
}
|
|
32141
32281
|
this.camera.dispose();
|
|
@@ -32147,6 +32287,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
32147
32287
|
this.toolbarModel.dispose();
|
|
32148
32288
|
this.emitter.indexedNavigation.dispose();
|
|
32149
32289
|
this.permissions.dispose();
|
|
32290
|
+
removeObserver7(this.userMap(this.userId), this.handleSyncedWhiteboardStatusChange);
|
|
32150
32291
|
}
|
|
32151
32292
|
};
|
|
32152
32293
|
_defineProperty43(WhiteboardApplication, "applicationName", WHITEBOARD_APP_NAME);
|