@netless/forge-whiteboard 0.1.18 → 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 +8 -0
- package/dist/Whiteboard.d.ts +4 -0
- package/dist/Whiteboard.d.ts.map +1 -1
- package/dist/WhiteboardApplication.d.ts +27 -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 +286 -110
- package/dist/whiteboard.esm.js.map +2 -2
- package/dist/whiteboard.js +286 -110
- 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
|
});
|
|
@@ -29977,6 +30079,7 @@ var Whiteboard = class extends EventEmitter8 {
|
|
|
29977
30079
|
_defineProperty31(this, "scaleCamera", void 0);
|
|
29978
30080
|
_defineProperty31(this, "resetCamera", void 0);
|
|
29979
30081
|
_defineProperty31(this, "showLiveCursor", void 0);
|
|
30082
|
+
_defineProperty31(this, "updateViewport", void 0);
|
|
29980
30083
|
_defineProperty31(this, "setFreeModelUserPage", void 0);
|
|
29981
30084
|
_defineProperty31(this, "indexedNavigation", void 0);
|
|
29982
30085
|
_defineProperty31(this, "setViewModeToFree", void 0);
|
|
@@ -31133,6 +31236,21 @@ function _toPrimitive43(t, r) {
|
|
|
31133
31236
|
return ("string" === r ? String : Number)(t);
|
|
31134
31237
|
}
|
|
31135
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
|
+
}
|
|
31136
31254
|
var WhiteboardApplication = class extends AbstractApplication {
|
|
31137
31255
|
get undoManager() {
|
|
31138
31256
|
const page = this.pageModel.getCurrentPage(this.userId);
|
|
@@ -31141,6 +31259,20 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31141
31259
|
}
|
|
31142
31260
|
return null;
|
|
31143
31261
|
}
|
|
31262
|
+
get viewportWidth() {
|
|
31263
|
+
const vw = this.getMap("attrs").get("viewportWidth");
|
|
31264
|
+
if (vw) {
|
|
31265
|
+
return vw;
|
|
31266
|
+
}
|
|
31267
|
+
return this.option.width;
|
|
31268
|
+
}
|
|
31269
|
+
get viewportHeight() {
|
|
31270
|
+
const vh = this.getMap("attrs").get("viewportHeight");
|
|
31271
|
+
if (vh) {
|
|
31272
|
+
return vh;
|
|
31273
|
+
}
|
|
31274
|
+
return this.option.height;
|
|
31275
|
+
}
|
|
31144
31276
|
constructor() {
|
|
31145
31277
|
var _this;
|
|
31146
31278
|
super();
|
|
@@ -31174,12 +31306,33 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31174
31306
|
_defineProperty43(this, "disableViewModelUpdate", false);
|
|
31175
31307
|
_defineProperty43(this, "internalResizeObserver", true);
|
|
31176
31308
|
_defineProperty43(this, "sequenceExecutor", new SequenceExecutor());
|
|
31177
|
-
_defineProperty43(this, "
|
|
31309
|
+
_defineProperty43(this, "linkWhiteboardId", null);
|
|
31178
31310
|
_defineProperty43(this, "liveCursor", void 0);
|
|
31179
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
|
+
});
|
|
31180
31327
|
_defineProperty43(this, "enableToolEvent", () => {
|
|
31181
31328
|
return !(this.inputType === "pen" && !this.isPenEvent);
|
|
31182
31329
|
});
|
|
31330
|
+
_defineProperty43(this, "handleViewportUpdate", (evt) => {
|
|
31331
|
+
if (evt.keysChanged.has("viewportWidth") || evt.keysChanged.has("viewportHeight")) {
|
|
31332
|
+
const rect = this.rootElement.getBoundingClientRect();
|
|
31333
|
+
this.adjustByOutFrame(rect.width, rect.height);
|
|
31334
|
+
}
|
|
31335
|
+
});
|
|
31183
31336
|
_defineProperty43(this, "handleElementTranslateOut", (ids, container) => {
|
|
31184
31337
|
const shadowLayer = this.shadowScope.project.activeLayer;
|
|
31185
31338
|
let parent = null;
|
|
@@ -31290,7 +31443,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31290
31443
|
const renderableModel = this.layers.get(entry[0]);
|
|
31291
31444
|
this.layers.delete(entry[0]);
|
|
31292
31445
|
if (renderableModel) {
|
|
31293
|
-
renderableModel.dispose();
|
|
31446
|
+
renderableModel.dispose(true);
|
|
31294
31447
|
}
|
|
31295
31448
|
const cameraMode = this.userMap(this.userId).get(WhiteboardKeys.cameraMode);
|
|
31296
31449
|
const currentPage = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
@@ -31309,6 +31462,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31309
31462
|
return this.layers.get(layerId);
|
|
31310
31463
|
});
|
|
31311
31464
|
_defineProperty43(this, "handleElementClear", () => {
|
|
31465
|
+
this.shadowScope.project.activeLayer.removeChildren();
|
|
31312
31466
|
this.paperScope.project.activeLayer.removeChildren();
|
|
31313
31467
|
});
|
|
31314
31468
|
_defineProperty43(this, "handleElementInsert", (elements) => {
|
|
@@ -31394,34 +31548,44 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31394
31548
|
this.emitter.emit("elementDeselected", userId);
|
|
31395
31549
|
}
|
|
31396
31550
|
});
|
|
31397
|
-
_defineProperty43(this, "
|
|
31398
|
-
|
|
31399
|
-
|
|
31400
|
-
|
|
31401
|
-
|
|
31402
|
-
|
|
31403
|
-
|
|
31404
|
-
|
|
31405
|
-
|
|
31406
|
-
|
|
31407
|
-
|
|
31408
|
-
|
|
31409
|
-
|
|
31410
|
-
|
|
31411
|
-
|
|
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
|
+
}));
|
|
31412
31571
|
}
|
|
31413
31572
|
});
|
|
31414
31573
|
_defineProperty43(this, "adjustByOutFrame", (frameWidth, frameHeight) => {
|
|
31415
|
-
if (this.
|
|
31574
|
+
if (!this.paperScope.project.view || !this.shadowScope.project.view) {
|
|
31575
|
+
return;
|
|
31576
|
+
}
|
|
31577
|
+
const viewportWidth = this.viewportWidth;
|
|
31578
|
+
const viewportHeight = this.viewportHeight;
|
|
31579
|
+
if (viewportWidth > 0 && viewportHeight > 0) {
|
|
31416
31580
|
const minWidth = Math.max(frameWidth, 10);
|
|
31417
31581
|
const minHeight = Math.max(frameHeight, 10);
|
|
31418
31582
|
let width = minWidth;
|
|
31419
|
-
let height = width *
|
|
31583
|
+
let height = width * viewportHeight / viewportWidth;
|
|
31420
31584
|
if (height > minHeight) {
|
|
31421
31585
|
height = minHeight;
|
|
31422
|
-
width = height *
|
|
31586
|
+
width = height * viewportWidth / viewportHeight;
|
|
31423
31587
|
}
|
|
31424
|
-
this.camera.updateInherentScale(width /
|
|
31588
|
+
this.camera.updateInherentScale(width / viewportWidth);
|
|
31425
31589
|
this.paperScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
31426
31590
|
this.shadowScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
31427
31591
|
this.camera.triggerZoom();
|
|
@@ -31625,6 +31789,9 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31625
31789
|
this.emitter.showLiveCursor = (value) => {
|
|
31626
31790
|
this.liveCursor.showLiveCursor = value;
|
|
31627
31791
|
};
|
|
31792
|
+
this.emitter.updateViewport = (width, height) => {
|
|
31793
|
+
this.updateOptionSize(width, height);
|
|
31794
|
+
};
|
|
31628
31795
|
this.emitter.__setMainCanvasVisible = (visible) => {
|
|
31629
31796
|
this.canvasElement.style.opacity = visible ? "1" : "0";
|
|
31630
31797
|
};
|
|
@@ -31730,6 +31897,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31730
31897
|
that.camera.enableBoundaryHighlight = value;
|
|
31731
31898
|
}
|
|
31732
31899
|
});
|
|
31900
|
+
window.addEventListener("forge-whiteboard-synced-status", this.addWhiteboardStatus);
|
|
31733
31901
|
}
|
|
31734
31902
|
userMap(userId) {
|
|
31735
31903
|
return this.getMap(`user/${userId}`);
|
|
@@ -31743,10 +31911,18 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31743
31911
|
this.emitter["selfUserId"] = this.userId;
|
|
31744
31912
|
this.option = option;
|
|
31745
31913
|
if (this.option.stretchToFill) {
|
|
31746
|
-
this.
|
|
31747
|
-
this.
|
|
31914
|
+
this.getMap("attrs").set("viewportWidth", -1);
|
|
31915
|
+
this.getMap("attrs").set("viewportHeight", -1);
|
|
31916
|
+
} else {
|
|
31917
|
+
if (!this.getMap("attrs").has("viewportWidth")) {
|
|
31918
|
+
this.getMap("attrs").set("viewportWidth", option.width);
|
|
31919
|
+
}
|
|
31920
|
+
if (!this.getMap("attrs").has("viewportHeight")) {
|
|
31921
|
+
this.getMap("attrs").set("viewportHeight", option.height);
|
|
31922
|
+
}
|
|
31748
31923
|
}
|
|
31749
31924
|
this.userMap(this.userId).set(WhiteboardKeys.themeColor, "#009688");
|
|
31925
|
+
this.userMap(this.userId).observe(this.handleSyncedWhiteboardStatusChange);
|
|
31750
31926
|
this.shadowEmitter = new ShadowEmitter(this.userMap(this.userId));
|
|
31751
31927
|
this.pageModel = new PageModel(this.getMap("attrs"), this.userManager, (userId) => {
|
|
31752
31928
|
return this.userMap(userId);
|
|
@@ -31913,12 +32089,13 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
31913
32089
|
this.clearElements();
|
|
31914
32090
|
if (this.option.stretchToFill) {
|
|
31915
32091
|
window.addEventListener("resize", () => {
|
|
31916
|
-
const bounds =
|
|
32092
|
+
const bounds = this.rootElement.getBoundingClientRect();
|
|
31917
32093
|
this.updateOptionSize(bounds.width, bounds.height);
|
|
31918
32094
|
this.adjustByOutFrame(bounds.width, bounds.height);
|
|
31919
32095
|
});
|
|
31920
32096
|
}
|
|
31921
32097
|
this.rootElement.appendChild(this.liveCursor.container);
|
|
32098
|
+
this.getMap("attrs").observe(this.handleViewportUpdate);
|
|
31922
32099
|
}
|
|
31923
32100
|
clearElements() {
|
|
31924
32101
|
const userIds = this.userManager.userIdList();
|
|
@@ -32014,10 +32191,10 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
32014
32191
|
this.snapshotScope.view.viewSize = bounds.size.multiply(scale2);
|
|
32015
32192
|
this.snapshotScope.view.matrix = matrix;
|
|
32016
32193
|
} else if (area === "maxScale" && this.option.maxScaleRatio && this.option.maxScaleRatio !== -1) {
|
|
32017
|
-
const width = this.
|
|
32018
|
-
const height = this.
|
|
32019
|
-
const offsetX = this.
|
|
32020
|
-
const offsetY = this.
|
|
32194
|
+
const width = this.viewportWidth * this.option.maxScaleRatio;
|
|
32195
|
+
const height = this.viewportHeight * this.option.maxScaleRatio;
|
|
32196
|
+
const offsetX = this.viewportWidth * (this.option.maxScaleRatio - 1) / 2;
|
|
32197
|
+
const offsetY = this.viewportHeight * (this.option.maxScaleRatio - 1) / 2;
|
|
32021
32198
|
const matrix = new this.paperScope.Matrix();
|
|
32022
32199
|
matrix.scale(scale);
|
|
32023
32200
|
matrix.translate({
|
|
@@ -32041,28 +32218,23 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
32041
32218
|
this.disableViewModelUpdate = true;
|
|
32042
32219
|
}
|
|
32043
32220
|
linkToWhiteboard(targetId) {
|
|
32044
|
-
|
|
32045
|
-
|
|
32046
|
-
|
|
32047
|
-
|
|
32048
|
-
|
|
32049
|
-
|
|
32050
|
-
|
|
32051
|
-
|
|
32052
|
-
|
|
32053
|
-
|
|
32054
|
-
|
|
32055
|
-
|
|
32056
|
-
|
|
32057
|
-
|
|
32058
|
-
this.permissions.addPermission(this.linkTarget.get("permission"), this.userId);
|
|
32059
|
-
this.linkTarget.observe(this.handleLinkedMapChange);
|
|
32060
|
-
}
|
|
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
|
+
});
|
|
32061
32235
|
}
|
|
32062
32236
|
unlink() {
|
|
32063
|
-
|
|
32064
|
-
removeObserver7(this.linkTarget, this.handleLinkedMapChange);
|
|
32065
|
-
}
|
|
32237
|
+
this.linkWhiteboardId = null;
|
|
32066
32238
|
}
|
|
32067
32239
|
setViewSize(width, height) {
|
|
32068
32240
|
this.paperScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
@@ -32079,11 +32251,14 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
32079
32251
|
this.internalResizeObserver = value;
|
|
32080
32252
|
}
|
|
32081
32253
|
updateOptionSize(width, height) {
|
|
32082
|
-
this.
|
|
32083
|
-
this.
|
|
32254
|
+
this.getMap("attrs").set("viewportWidth", width);
|
|
32255
|
+
this.getMap("attrs").set("viewportHeight", height);
|
|
32084
32256
|
this.camera.updateInitSize(new import_paper.default.Size(width, height));
|
|
32085
32257
|
}
|
|
32086
|
-
async dispose() {
|
|
32258
|
+
async dispose(removeSubDoc) {
|
|
32259
|
+
if (removeSubDoc) {
|
|
32260
|
+
this.deleteSubDoc(this.appId);
|
|
32261
|
+
}
|
|
32087
32262
|
this.selectElementsModel.dispose();
|
|
32088
32263
|
this.trashedElementsModel.dispose();
|
|
32089
32264
|
this.paperScope.view.remove();
|
|
@@ -32100,7 +32275,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
32100
32275
|
entry[1].off("stack-item-popped", this.handleStackItemPopped);
|
|
32101
32276
|
}
|
|
32102
32277
|
for (const entry of this.layers.entries()) {
|
|
32103
|
-
entry[1].dispose();
|
|
32278
|
+
entry[1].dispose(removeSubDoc);
|
|
32104
32279
|
entry[1].removeAllListeners();
|
|
32105
32280
|
}
|
|
32106
32281
|
this.camera.dispose();
|
|
@@ -32112,6 +32287,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
32112
32287
|
this.toolbarModel.dispose();
|
|
32113
32288
|
this.emitter.indexedNavigation.dispose();
|
|
32114
32289
|
this.permissions.dispose();
|
|
32290
|
+
removeObserver7(this.userMap(this.userId), this.handleSyncedWhiteboardStatusChange);
|
|
32115
32291
|
}
|
|
32116
32292
|
};
|
|
32117
32293
|
_defineProperty43(WhiteboardApplication, "applicationName", WHITEBOARD_APP_NAME);
|