@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.js
CHANGED
|
@@ -25822,8 +25822,7 @@ var CurveModel = class extends ElementModel {
|
|
|
25822
25822
|
return (a2 + b2) / 2;
|
|
25823
25823
|
}
|
|
25824
25824
|
parsePoints(points) {
|
|
25825
|
-
|
|
25826
|
-
return ae(groupPoints, {
|
|
25825
|
+
return ae(points, {
|
|
25827
25826
|
size: this.strokeWidth,
|
|
25828
25827
|
smoothing: 0.5,
|
|
25829
25828
|
thinning: -0.5,
|
|
@@ -25840,15 +25839,15 @@ var CurveModel = class extends ElementModel {
|
|
|
25840
25839
|
});
|
|
25841
25840
|
}
|
|
25842
25841
|
matrixedPoints() {
|
|
25843
|
-
const
|
|
25844
|
-
|
|
25845
|
-
|
|
25846
|
-
|
|
25847
|
-
|
|
25848
|
-
|
|
25849
|
-
|
|
25850
|
-
|
|
25851
|
-
|
|
25842
|
+
const points = this.points;
|
|
25843
|
+
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
25844
|
+
const output = [];
|
|
25845
|
+
for (let i = 0, len = points.length; i < len; i += 2) {
|
|
25846
|
+
const p = new this.scope.Point(points[i], points[i + 1]);
|
|
25847
|
+
const tp = p.transform(matrix);
|
|
25848
|
+
output.push([tp.x, tp.y]);
|
|
25849
|
+
}
|
|
25850
|
+
return output;
|
|
25852
25851
|
}
|
|
25853
25852
|
createPath(points) {
|
|
25854
25853
|
const path = new this.scope.Path();
|
|
@@ -27597,28 +27596,11 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27597
27596
|
return model;
|
|
27598
27597
|
}
|
|
27599
27598
|
initElement(element) {
|
|
27600
|
-
let shadow = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
27601
|
-
if (shadow) {
|
|
27602
|
-
element.shadow = "layer";
|
|
27603
|
-
}
|
|
27604
|
-
element.strokeWidth = this.toolbarModel.strokeWidth;
|
|
27605
|
-
element.strokeColor = this.toolbarModel.strokeColor;
|
|
27606
|
-
element.fillColor = this.toolbarModel.fillColor;
|
|
27607
|
-
element.ownerId = this.userManager.selfId;
|
|
27608
27599
|
element.shadowEmitter = this.shadowEmitter;
|
|
27609
27600
|
}
|
|
27610
27601
|
removeElementItem(uuid) {
|
|
27611
27602
|
this.elements.delete(uuid);
|
|
27612
27603
|
}
|
|
27613
|
-
addElementToDoc(map, type) {
|
|
27614
|
-
this.elements.doc?.transact(() => {
|
|
27615
|
-
const uuid = this.uuid;
|
|
27616
|
-
map.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27617
|
-
map.set(ElementModel.KEYS.uuid, uuid);
|
|
27618
|
-
map.set("type", type);
|
|
27619
|
-
this.elements.set(uuid, map);
|
|
27620
|
-
}, elementsUndoOrigin);
|
|
27621
|
-
}
|
|
27622
27604
|
confirmPermission() {
|
|
27623
27605
|
const hasPermission = this.hasPermission(WhiteboardPermissionFlag.draw);
|
|
27624
27606
|
if (!hasPermission) {
|
|
@@ -27631,7 +27613,14 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27631
27613
|
return;
|
|
27632
27614
|
}
|
|
27633
27615
|
const yMap = new Y12.Map();
|
|
27634
|
-
this.
|
|
27616
|
+
this.elements.doc?.transact(() => {
|
|
27617
|
+
const uuid = this.uuid;
|
|
27618
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27619
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27620
|
+
yMap.set("type", "image");
|
|
27621
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27622
|
+
this.elements.set(uuid, yMap);
|
|
27623
|
+
}, elementsUndoOrigin);
|
|
27635
27624
|
const model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor);
|
|
27636
27625
|
model.root.set("src", src);
|
|
27637
27626
|
const initMatrix = new this.scope.Matrix();
|
|
@@ -27649,9 +27638,22 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27649
27638
|
return null;
|
|
27650
27639
|
}
|
|
27651
27640
|
const yMap = new Y12.Map();
|
|
27652
|
-
this.
|
|
27641
|
+
this.elements.doc?.transact(() => {
|
|
27642
|
+
const uuid = this.uuid;
|
|
27643
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27644
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27645
|
+
yMap.set("type", "curve");
|
|
27646
|
+
if (shadow) {
|
|
27647
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27648
|
+
}
|
|
27649
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27650
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27651
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27652
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27653
|
+
this.elements.set(uuid, yMap);
|
|
27654
|
+
}, elementsUndoOrigin);
|
|
27653
27655
|
const curveModel = new CurveModel(yMap, this.scope, this.liveCursor);
|
|
27654
|
-
this.initElement(curveModel
|
|
27656
|
+
this.initElement(curveModel);
|
|
27655
27657
|
return curveModel;
|
|
27656
27658
|
}
|
|
27657
27659
|
createLaserPointer() {
|
|
@@ -27659,15 +27661,21 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27659
27661
|
return null;
|
|
27660
27662
|
}
|
|
27661
27663
|
const yMap = new Y12.Map();
|
|
27662
|
-
this.
|
|
27664
|
+
this.elements.doc?.transact(() => {
|
|
27665
|
+
const uuid = this.uuid;
|
|
27666
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27667
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27668
|
+
yMap.set("type", "laser");
|
|
27669
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27670
|
+
yMap.set(ElementModel.KEYS.strokeWidth, 8);
|
|
27671
|
+
yMap.set(ElementModel.KEYS.strokeColor, "#F44336");
|
|
27672
|
+
yMap.set(ElementModel.KEYS.fillColor, "#F44336");
|
|
27673
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27674
|
+
this.elements.set(uuid, yMap);
|
|
27675
|
+
}, elementsUndoOrigin);
|
|
27663
27676
|
const model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, this.liveCursor, (uuid) => {
|
|
27664
27677
|
this.removeElementItem(uuid);
|
|
27665
27678
|
});
|
|
27666
|
-
model.strokeWidth = 8;
|
|
27667
|
-
model.strokeColor = "#F44336";
|
|
27668
|
-
model.fillColor = "#F44336";
|
|
27669
|
-
model.ownerId = this.userManager.selfId;
|
|
27670
|
-
model.shadow = "layer";
|
|
27671
27679
|
return model;
|
|
27672
27680
|
}
|
|
27673
27681
|
createEraser() {
|
|
@@ -27675,13 +27683,19 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27675
27683
|
return null;
|
|
27676
27684
|
}
|
|
27677
27685
|
const yMap = new Y12.Map();
|
|
27678
|
-
this.
|
|
27686
|
+
this.elements.doc?.transact(() => {
|
|
27687
|
+
const uuid = this.uuid;
|
|
27688
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27689
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27690
|
+
yMap.set("type", "eraser");
|
|
27691
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27692
|
+
yMap.set(ElementModel.KEYS.strokeWidth, 4);
|
|
27693
|
+
yMap.set(ElementModel.KEYS.strokeColor, "#9E9E9E");
|
|
27694
|
+
yMap.set(ElementModel.KEYS.fillColor, "#9E9E9E");
|
|
27695
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27696
|
+
this.elements.set(uuid, yMap);
|
|
27697
|
+
}, elementsUndoOrigin);
|
|
27679
27698
|
const model = new EraserModel(yMap, this.scope, this.liveCursor);
|
|
27680
|
-
model.strokeWidth = 4;
|
|
27681
|
-
model.strokeColor = "#9E9E9E";
|
|
27682
|
-
model.fillColor = "#9E9E9E";
|
|
27683
|
-
model.ownerId = this.userManager.selfId;
|
|
27684
|
-
model.shadow = "layer";
|
|
27685
27699
|
return model;
|
|
27686
27700
|
}
|
|
27687
27701
|
createTriangle(shadow) {
|
|
@@ -27689,9 +27703,22 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27689
27703
|
return null;
|
|
27690
27704
|
}
|
|
27691
27705
|
const yMap = new Y12.Map();
|
|
27692
|
-
this.
|
|
27706
|
+
this.elements.doc?.transact(() => {
|
|
27707
|
+
const uuid = this.uuid;
|
|
27708
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27709
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27710
|
+
yMap.set("type", "triangle");
|
|
27711
|
+
if (shadow) {
|
|
27712
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27713
|
+
}
|
|
27714
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27715
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27716
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27717
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27718
|
+
this.elements.set(uuid, yMap);
|
|
27719
|
+
}, elementsUndoOrigin);
|
|
27693
27720
|
const triangle = new TriangleModel(yMap, this.scope, this.liveCursor);
|
|
27694
|
-
this.initElement(triangle
|
|
27721
|
+
this.initElement(triangle);
|
|
27695
27722
|
triangle.dashArray = this.toolbarModel.dashArray;
|
|
27696
27723
|
return triangle;
|
|
27697
27724
|
}
|
|
@@ -27700,9 +27727,22 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27700
27727
|
return null;
|
|
27701
27728
|
}
|
|
27702
27729
|
const yMap = new Y12.Map();
|
|
27703
|
-
this.
|
|
27730
|
+
this.elements.doc?.transact(() => {
|
|
27731
|
+
const uuid = this.uuid;
|
|
27732
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27733
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27734
|
+
yMap.set("type", "rectangle");
|
|
27735
|
+
if (shadow) {
|
|
27736
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27737
|
+
}
|
|
27738
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27739
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27740
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27741
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27742
|
+
this.elements.set(uuid, yMap);
|
|
27743
|
+
}, elementsUndoOrigin);
|
|
27704
27744
|
const rect = new RectangleModel(yMap, this.scope, this.liveCursor);
|
|
27705
|
-
this.initElement(rect
|
|
27745
|
+
this.initElement(rect);
|
|
27706
27746
|
rect.dashArray = this.toolbarModel.dashArray;
|
|
27707
27747
|
return rect;
|
|
27708
27748
|
}
|
|
@@ -27711,9 +27751,22 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27711
27751
|
return null;
|
|
27712
27752
|
}
|
|
27713
27753
|
const yMap = new Y12.Map();
|
|
27714
|
-
this.
|
|
27754
|
+
this.elements.doc?.transact(() => {
|
|
27755
|
+
const uuid = this.uuid;
|
|
27756
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27757
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27758
|
+
yMap.set("type", type);
|
|
27759
|
+
if (shadow) {
|
|
27760
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27761
|
+
}
|
|
27762
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27763
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27764
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27765
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27766
|
+
this.elements.set(uuid, yMap);
|
|
27767
|
+
}, elementsUndoOrigin);
|
|
27715
27768
|
const segmentsModel = new SegmentsModel(yMap, this.scope, type, this.liveCursor);
|
|
27716
|
-
this.initElement(segmentsModel
|
|
27769
|
+
this.initElement(segmentsModel);
|
|
27717
27770
|
segmentsModel.dashArray = this.toolbarModel.dashArray;
|
|
27718
27771
|
return segmentsModel;
|
|
27719
27772
|
}
|
|
@@ -27723,7 +27776,15 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27723
27776
|
return null;
|
|
27724
27777
|
}
|
|
27725
27778
|
const yMap = new Y12.Map();
|
|
27726
|
-
this.
|
|
27779
|
+
this.elements.doc?.transact(() => {
|
|
27780
|
+
const uuid = this.uuid;
|
|
27781
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27782
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27783
|
+
yMap.set("type", "selector");
|
|
27784
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27785
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27786
|
+
this.elements.set(uuid, yMap);
|
|
27787
|
+
}, elementsUndoOrigin);
|
|
27727
27788
|
const selectorModel = new SelectorModel(yMap, this.scope, this.liveCursor);
|
|
27728
27789
|
selectorModel.shadow = "layer";
|
|
27729
27790
|
return selectorModel;
|
|
@@ -27733,9 +27794,22 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27733
27794
|
return null;
|
|
27734
27795
|
}
|
|
27735
27796
|
const yMap = new Y12.Map();
|
|
27736
|
-
this.
|
|
27797
|
+
this.elements.doc?.transact(() => {
|
|
27798
|
+
const uuid = this.uuid;
|
|
27799
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27800
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27801
|
+
yMap.set("type", "line");
|
|
27802
|
+
if (shadow) {
|
|
27803
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27804
|
+
}
|
|
27805
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27806
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27807
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27808
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27809
|
+
this.elements.set(uuid, yMap);
|
|
27810
|
+
}, elementsUndoOrigin);
|
|
27737
27811
|
const straightLineModel = new StraightLineModel(yMap, this.scope, this.liveCursor);
|
|
27738
|
-
this.initElement(straightLineModel
|
|
27812
|
+
this.initElement(straightLineModel);
|
|
27739
27813
|
straightLineModel.dashArray = this.toolbarModel.dashArray;
|
|
27740
27814
|
return straightLineModel;
|
|
27741
27815
|
}
|
|
@@ -27744,9 +27818,22 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27744
27818
|
return null;
|
|
27745
27819
|
}
|
|
27746
27820
|
const yMap = new Y12.Map();
|
|
27747
|
-
this.
|
|
27821
|
+
this.elements.doc?.transact(() => {
|
|
27822
|
+
const uuid = this.uuid;
|
|
27823
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27824
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27825
|
+
yMap.set("type", "arrow");
|
|
27826
|
+
if (shadow) {
|
|
27827
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27828
|
+
}
|
|
27829
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27830
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27831
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27832
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27833
|
+
this.elements.set(uuid, yMap);
|
|
27834
|
+
}, elementsUndoOrigin);
|
|
27748
27835
|
const lineModel = new LineModel(yMap, this.scope, this.liveCursor);
|
|
27749
|
-
this.initElement(lineModel
|
|
27836
|
+
this.initElement(lineModel);
|
|
27750
27837
|
lineModel.dashArray = this.toolbarModel.dashArray;
|
|
27751
27838
|
return lineModel;
|
|
27752
27839
|
}
|
|
@@ -27755,12 +27842,25 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27755
27842
|
return null;
|
|
27756
27843
|
}
|
|
27757
27844
|
const yMap = new Y12.Map();
|
|
27758
|
-
this.
|
|
27845
|
+
this.elements.doc?.transact(() => {
|
|
27846
|
+
const uuid = this.uuid;
|
|
27847
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
27848
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
27849
|
+
yMap.set("type", "point-text");
|
|
27850
|
+
if (shadow) {
|
|
27851
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
27852
|
+
}
|
|
27853
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
27854
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
27855
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
27856
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
27857
|
+
this.elements.set(uuid, yMap);
|
|
27858
|
+
}, elementsUndoOrigin);
|
|
27759
27859
|
const pointTextModel = new PointTextModel(yMap, this.scope, this.liveCursor);
|
|
27760
27860
|
pointTextModel.setPoints([x, y]);
|
|
27761
27861
|
pointTextModel.fontSize = this.toolbarModel.fontSize;
|
|
27762
27862
|
pointTextModel.fontFamily = this.toolbarModel.fontFamily;
|
|
27763
|
-
this.initElement(pointTextModel
|
|
27863
|
+
this.initElement(pointTextModel);
|
|
27764
27864
|
return pointTextModel;
|
|
27765
27865
|
}
|
|
27766
27866
|
clearElement() {
|
|
@@ -27778,9 +27878,11 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
27778
27878
|
removeIds.forEach((id) => this.elements.delete(id));
|
|
27779
27879
|
});
|
|
27780
27880
|
}
|
|
27781
|
-
dispose() {
|
|
27881
|
+
dispose(clearElements) {
|
|
27782
27882
|
(0, import_forge_room4.removeObserver)(this.elements, this.onElementsChange);
|
|
27783
|
-
|
|
27883
|
+
if (clearElements) {
|
|
27884
|
+
this.elements.clear();
|
|
27885
|
+
}
|
|
27784
27886
|
Array.from(this.elementModels.values()).forEach((model) => {
|
|
27785
27887
|
model.dispose();
|
|
27786
27888
|
});
|
|
@@ -31144,6 +31246,21 @@ function _toPrimitive43(t, r) {
|
|
|
31144
31246
|
return ("string" === r ? String : Number)(t);
|
|
31145
31247
|
}
|
|
31146
31248
|
var WHITEBOARD_APP_NAME = "whiteboard";
|
|
31249
|
+
var AsyncMap = class {
|
|
31250
|
+
constructor() {
|
|
31251
|
+
_defineProperty43(this, "map", void 0);
|
|
31252
|
+
this.map = /* @__PURE__ */ new Map();
|
|
31253
|
+
}
|
|
31254
|
+
get(key) {
|
|
31255
|
+
return Promise.resolve(this.map.get(key));
|
|
31256
|
+
}
|
|
31257
|
+
set(key, value) {
|
|
31258
|
+
this.map.set(key, value);
|
|
31259
|
+
}
|
|
31260
|
+
};
|
|
31261
|
+
if (!window.__forge_gl_wb_status__) {
|
|
31262
|
+
window.__forge_gl_wb_status__ = new AsyncMap();
|
|
31263
|
+
}
|
|
31147
31264
|
var WhiteboardApplication = class extends import_forge_room12.AbstractApplication {
|
|
31148
31265
|
get undoManager() {
|
|
31149
31266
|
const page = this.pageModel.getCurrentPage(this.userId);
|
|
@@ -31199,9 +31316,24 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31199
31316
|
_defineProperty43(this, "disableViewModelUpdate", false);
|
|
31200
31317
|
_defineProperty43(this, "internalResizeObserver", true);
|
|
31201
31318
|
_defineProperty43(this, "sequenceExecutor", new SequenceExecutor());
|
|
31202
|
-
_defineProperty43(this, "
|
|
31319
|
+
_defineProperty43(this, "linkWhiteboardId", null);
|
|
31203
31320
|
_defineProperty43(this, "liveCursor", void 0);
|
|
31204
31321
|
_defineProperty43(this, "delayTranslateOut", -1);
|
|
31322
|
+
_defineProperty43(this, "addWhiteboardStatus", (evt) => {
|
|
31323
|
+
if (evt.detail.whiteboardAppId && evt.detail.status) {
|
|
31324
|
+
if (this.linkWhiteboardId === evt.detail.whiteboardAppId) {
|
|
31325
|
+
this.toolbarModel.currentTool = evt.detail.status.currentTool;
|
|
31326
|
+
this.toolbarModel.strokeColor = evt.detail.status.strokeColor;
|
|
31327
|
+
this.toolbarModel.fillColor = evt.detail.status.fillColor;
|
|
31328
|
+
this.toolbarModel.fontSize = evt.detail.status.fontSize;
|
|
31329
|
+
this.toolbarModel.fontFamily = evt.detail.status.fontFamily;
|
|
31330
|
+
this.toolbarModel.strokeWidth = evt.detail.status.strokeWidth;
|
|
31331
|
+
this.toolbarModel.dashArray = evt.detail.status.dashArray;
|
|
31332
|
+
this.permissions.removePermission(WhiteboardPermissionFlag.all);
|
|
31333
|
+
this.permissions.addPermission(evt.detail.status.permission);
|
|
31334
|
+
}
|
|
31335
|
+
}
|
|
31336
|
+
});
|
|
31205
31337
|
_defineProperty43(this, "enableToolEvent", () => {
|
|
31206
31338
|
return !(this.inputType === "pen" && !this.isPenEvent);
|
|
31207
31339
|
});
|
|
@@ -31321,7 +31453,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31321
31453
|
const renderableModel = this.layers.get(entry[0]);
|
|
31322
31454
|
this.layers.delete(entry[0]);
|
|
31323
31455
|
if (renderableModel) {
|
|
31324
|
-
renderableModel.dispose();
|
|
31456
|
+
renderableModel.dispose(true);
|
|
31325
31457
|
}
|
|
31326
31458
|
const cameraMode = this.userMap(this.userId).get(WhiteboardKeys.cameraMode);
|
|
31327
31459
|
const currentPage = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
@@ -31340,6 +31472,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31340
31472
|
return this.layers.get(layerId);
|
|
31341
31473
|
});
|
|
31342
31474
|
_defineProperty43(this, "handleElementClear", () => {
|
|
31475
|
+
this.shadowScope.project.activeLayer.removeChildren();
|
|
31343
31476
|
this.paperScope.project.activeLayer.removeChildren();
|
|
31344
31477
|
});
|
|
31345
31478
|
_defineProperty43(this, "handleElementInsert", (elements) => {
|
|
@@ -31425,24 +31558,32 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31425
31558
|
this.emitter.emit("elementDeselected", userId);
|
|
31426
31559
|
}
|
|
31427
31560
|
});
|
|
31428
|
-
_defineProperty43(this, "
|
|
31429
|
-
|
|
31430
|
-
|
|
31431
|
-
|
|
31432
|
-
|
|
31433
|
-
|
|
31434
|
-
|
|
31435
|
-
|
|
31436
|
-
|
|
31437
|
-
|
|
31438
|
-
|
|
31439
|
-
|
|
31440
|
-
|
|
31441
|
-
|
|
31442
|
-
|
|
31561
|
+
_defineProperty43(this, "handleSyncedWhiteboardStatusChange", (evt) => {
|
|
31562
|
+
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))) {
|
|
31563
|
+
const nextState = {
|
|
31564
|
+
currentTool: evt.target.get(TOOLBAR_KEYS.tool),
|
|
31565
|
+
strokeColor: evt.target.get(TOOLBAR_KEYS.strokeColor),
|
|
31566
|
+
fillColor: evt.target.get(TOOLBAR_KEYS.fillColor),
|
|
31567
|
+
fontSize: evt.target.get(TOOLBAR_KEYS.fontSize),
|
|
31568
|
+
fontFamily: evt.target.get(TOOLBAR_KEYS.fontFamily),
|
|
31569
|
+
strokeWidth: evt.target.get(TOOLBAR_KEYS.strokeWidth),
|
|
31570
|
+
dashArray: evt.target.get(TOOLBAR_KEYS.dashArray),
|
|
31571
|
+
permission: evt.target.get("permission")
|
|
31572
|
+
};
|
|
31573
|
+
window.__forge_gl_wb_status__.set(this.appId, nextState);
|
|
31574
|
+
window.dispatchEvent(new CustomEvent("forge-whiteboard-synced-status", {
|
|
31575
|
+
detail: {
|
|
31576
|
+
whiteboardAppId: this.appId,
|
|
31577
|
+
status: nextState,
|
|
31578
|
+
userId: this.userId
|
|
31579
|
+
}
|
|
31580
|
+
}));
|
|
31443
31581
|
}
|
|
31444
31582
|
});
|
|
31445
31583
|
_defineProperty43(this, "adjustByOutFrame", (frameWidth, frameHeight) => {
|
|
31584
|
+
if (!this.paperScope.project.view || !this.shadowScope.project.view) {
|
|
31585
|
+
return;
|
|
31586
|
+
}
|
|
31446
31587
|
const viewportWidth = this.viewportWidth;
|
|
31447
31588
|
const viewportHeight = this.viewportHeight;
|
|
31448
31589
|
if (viewportWidth > 0 && viewportHeight > 0) {
|
|
@@ -31454,13 +31595,12 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31454
31595
|
height = minHeight;
|
|
31455
31596
|
width = height * viewportWidth / viewportHeight;
|
|
31456
31597
|
}
|
|
31457
|
-
this.camera.updateInherentScale(width /
|
|
31598
|
+
this.camera.updateInherentScale(width / viewportWidth);
|
|
31458
31599
|
this.paperScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
31459
31600
|
this.shadowScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
31460
31601
|
this.camera.triggerZoom();
|
|
31461
31602
|
}
|
|
31462
31603
|
});
|
|
31463
|
-
window._wb = this;
|
|
31464
31604
|
requestAnimationFrameHook(this.paperScope);
|
|
31465
31605
|
requestAnimationFrameHook(this.shadowScope);
|
|
31466
31606
|
const that = this;
|
|
@@ -31767,6 +31907,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31767
31907
|
that.camera.enableBoundaryHighlight = value;
|
|
31768
31908
|
}
|
|
31769
31909
|
});
|
|
31910
|
+
window.addEventListener("forge-whiteboard-synced-status", this.addWhiteboardStatus);
|
|
31770
31911
|
}
|
|
31771
31912
|
userMap(userId) {
|
|
31772
31913
|
return this.getMap(`user/${userId}`);
|
|
@@ -31791,6 +31932,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31791
31932
|
}
|
|
31792
31933
|
}
|
|
31793
31934
|
this.userMap(this.userId).set(WhiteboardKeys.themeColor, "#009688");
|
|
31935
|
+
this.userMap(this.userId).observe(this.handleSyncedWhiteboardStatusChange);
|
|
31794
31936
|
this.shadowEmitter = new ShadowEmitter(this.userMap(this.userId));
|
|
31795
31937
|
this.pageModel = new PageModel(this.getMap("attrs"), this.userManager, (userId) => {
|
|
31796
31938
|
return this.userMap(userId);
|
|
@@ -32086,28 +32228,23 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
32086
32228
|
this.disableViewModelUpdate = true;
|
|
32087
32229
|
}
|
|
32088
32230
|
linkToWhiteboard(targetId) {
|
|
32089
|
-
|
|
32090
|
-
|
|
32091
|
-
|
|
32092
|
-
|
|
32093
|
-
|
|
32094
|
-
|
|
32095
|
-
|
|
32096
|
-
|
|
32097
|
-
|
|
32098
|
-
|
|
32099
|
-
|
|
32100
|
-
|
|
32101
|
-
|
|
32102
|
-
|
|
32103
|
-
this.permissions.addPermission(this.linkTarget.get("permission"), this.userId);
|
|
32104
|
-
this.linkTarget.observe(this.handleLinkedMapChange);
|
|
32105
|
-
}
|
|
32231
|
+
this.linkWhiteboardId = targetId;
|
|
32232
|
+
window.__forge_gl_wb_status__.get(targetId).then((currentStatus) => {
|
|
32233
|
+
if (currentStatus) {
|
|
32234
|
+
this.toolbarModel.currentTool = currentStatus.currentTool;
|
|
32235
|
+
this.toolbarModel.strokeColor = currentStatus.strokeColor;
|
|
32236
|
+
this.toolbarModel.fillColor = currentStatus.fillColor;
|
|
32237
|
+
this.toolbarModel.fontSize = currentStatus.fontSize;
|
|
32238
|
+
this.toolbarModel.fontFamily = currentStatus.fontFamily;
|
|
32239
|
+
this.toolbarModel.strokeWidth = currentStatus.strokeWidth;
|
|
32240
|
+
this.toolbarModel.dashArray = currentStatus.dashArray;
|
|
32241
|
+
this.permissions.removePermission(WhiteboardPermissionFlag.all);
|
|
32242
|
+
this.permissions.addPermission(currentStatus.permission);
|
|
32243
|
+
}
|
|
32244
|
+
});
|
|
32106
32245
|
}
|
|
32107
32246
|
unlink() {
|
|
32108
|
-
|
|
32109
|
-
(0, import_forge_room13.removeObserver)(this.linkTarget, this.handleLinkedMapChange);
|
|
32110
|
-
}
|
|
32247
|
+
this.linkWhiteboardId = null;
|
|
32111
32248
|
}
|
|
32112
32249
|
setViewSize(width, height) {
|
|
32113
32250
|
this.paperScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
@@ -32128,7 +32265,10 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
32128
32265
|
this.getMap("attrs").set("viewportHeight", height);
|
|
32129
32266
|
this.camera.updateInitSize(new import_paper.default.Size(width, height));
|
|
32130
32267
|
}
|
|
32131
|
-
async dispose() {
|
|
32268
|
+
async dispose(removeSubDoc) {
|
|
32269
|
+
if (removeSubDoc) {
|
|
32270
|
+
this.deleteSubDoc(this.appId);
|
|
32271
|
+
}
|
|
32132
32272
|
this.selectElementsModel.dispose();
|
|
32133
32273
|
this.trashedElementsModel.dispose();
|
|
32134
32274
|
this.paperScope.view.remove();
|
|
@@ -32145,7 +32285,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
32145
32285
|
entry[1].off("stack-item-popped", this.handleStackItemPopped);
|
|
32146
32286
|
}
|
|
32147
32287
|
for (const entry of this.layers.entries()) {
|
|
32148
|
-
entry[1].dispose();
|
|
32288
|
+
entry[1].dispose(removeSubDoc);
|
|
32149
32289
|
entry[1].removeAllListeners();
|
|
32150
32290
|
}
|
|
32151
32291
|
this.camera.dispose();
|
|
@@ -32157,6 +32297,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
32157
32297
|
this.toolbarModel.dispose();
|
|
32158
32298
|
this.emitter.indexedNavigation.dispose();
|
|
32159
32299
|
this.permissions.dispose();
|
|
32300
|
+
(0, import_forge_room13.removeObserver)(this.userMap(this.userId), this.handleSyncedWhiteboardStatusChange);
|
|
32160
32301
|
}
|
|
32161
32302
|
};
|
|
32162
32303
|
_defineProperty43(WhiteboardApplication, "applicationName", WHITEBOARD_APP_NAME);
|