@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.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
|
});
|
|
@@ -29987,6 +30089,7 @@ var Whiteboard = class extends import_eventemitter38.default {
|
|
|
29987
30089
|
_defineProperty31(this, "scaleCamera", void 0);
|
|
29988
30090
|
_defineProperty31(this, "resetCamera", void 0);
|
|
29989
30091
|
_defineProperty31(this, "showLiveCursor", void 0);
|
|
30092
|
+
_defineProperty31(this, "updateViewport", void 0);
|
|
29990
30093
|
_defineProperty31(this, "setFreeModelUserPage", void 0);
|
|
29991
30094
|
_defineProperty31(this, "indexedNavigation", void 0);
|
|
29992
30095
|
_defineProperty31(this, "setViewModeToFree", void 0);
|
|
@@ -31143,6 +31246,21 @@ function _toPrimitive43(t, r) {
|
|
|
31143
31246
|
return ("string" === r ? String : Number)(t);
|
|
31144
31247
|
}
|
|
31145
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
|
+
}
|
|
31146
31264
|
var WhiteboardApplication = class extends import_forge_room12.AbstractApplication {
|
|
31147
31265
|
get undoManager() {
|
|
31148
31266
|
const page = this.pageModel.getCurrentPage(this.userId);
|
|
@@ -31151,6 +31269,20 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31151
31269
|
}
|
|
31152
31270
|
return null;
|
|
31153
31271
|
}
|
|
31272
|
+
get viewportWidth() {
|
|
31273
|
+
const vw = this.getMap("attrs").get("viewportWidth");
|
|
31274
|
+
if (vw) {
|
|
31275
|
+
return vw;
|
|
31276
|
+
}
|
|
31277
|
+
return this.option.width;
|
|
31278
|
+
}
|
|
31279
|
+
get viewportHeight() {
|
|
31280
|
+
const vh = this.getMap("attrs").get("viewportHeight");
|
|
31281
|
+
if (vh) {
|
|
31282
|
+
return vh;
|
|
31283
|
+
}
|
|
31284
|
+
return this.option.height;
|
|
31285
|
+
}
|
|
31154
31286
|
constructor() {
|
|
31155
31287
|
var _this;
|
|
31156
31288
|
super();
|
|
@@ -31184,12 +31316,33 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31184
31316
|
_defineProperty43(this, "disableViewModelUpdate", false);
|
|
31185
31317
|
_defineProperty43(this, "internalResizeObserver", true);
|
|
31186
31318
|
_defineProperty43(this, "sequenceExecutor", new SequenceExecutor());
|
|
31187
|
-
_defineProperty43(this, "
|
|
31319
|
+
_defineProperty43(this, "linkWhiteboardId", null);
|
|
31188
31320
|
_defineProperty43(this, "liveCursor", void 0);
|
|
31189
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
|
+
});
|
|
31190
31337
|
_defineProperty43(this, "enableToolEvent", () => {
|
|
31191
31338
|
return !(this.inputType === "pen" && !this.isPenEvent);
|
|
31192
31339
|
});
|
|
31340
|
+
_defineProperty43(this, "handleViewportUpdate", (evt) => {
|
|
31341
|
+
if (evt.keysChanged.has("viewportWidth") || evt.keysChanged.has("viewportHeight")) {
|
|
31342
|
+
const rect = this.rootElement.getBoundingClientRect();
|
|
31343
|
+
this.adjustByOutFrame(rect.width, rect.height);
|
|
31344
|
+
}
|
|
31345
|
+
});
|
|
31193
31346
|
_defineProperty43(this, "handleElementTranslateOut", (ids, container) => {
|
|
31194
31347
|
const shadowLayer = this.shadowScope.project.activeLayer;
|
|
31195
31348
|
let parent = null;
|
|
@@ -31300,7 +31453,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31300
31453
|
const renderableModel = this.layers.get(entry[0]);
|
|
31301
31454
|
this.layers.delete(entry[0]);
|
|
31302
31455
|
if (renderableModel) {
|
|
31303
|
-
renderableModel.dispose();
|
|
31456
|
+
renderableModel.dispose(true);
|
|
31304
31457
|
}
|
|
31305
31458
|
const cameraMode = this.userMap(this.userId).get(WhiteboardKeys.cameraMode);
|
|
31306
31459
|
const currentPage = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
@@ -31319,6 +31472,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31319
31472
|
return this.layers.get(layerId);
|
|
31320
31473
|
});
|
|
31321
31474
|
_defineProperty43(this, "handleElementClear", () => {
|
|
31475
|
+
this.shadowScope.project.activeLayer.removeChildren();
|
|
31322
31476
|
this.paperScope.project.activeLayer.removeChildren();
|
|
31323
31477
|
});
|
|
31324
31478
|
_defineProperty43(this, "handleElementInsert", (elements) => {
|
|
@@ -31404,34 +31558,44 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31404
31558
|
this.emitter.emit("elementDeselected", userId);
|
|
31405
31559
|
}
|
|
31406
31560
|
});
|
|
31407
|
-
_defineProperty43(this, "
|
|
31408
|
-
|
|
31409
|
-
|
|
31410
|
-
|
|
31411
|
-
|
|
31412
|
-
|
|
31413
|
-
|
|
31414
|
-
|
|
31415
|
-
|
|
31416
|
-
|
|
31417
|
-
|
|
31418
|
-
|
|
31419
|
-
|
|
31420
|
-
|
|
31421
|
-
|
|
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
|
+
}));
|
|
31422
31581
|
}
|
|
31423
31582
|
});
|
|
31424
31583
|
_defineProperty43(this, "adjustByOutFrame", (frameWidth, frameHeight) => {
|
|
31425
|
-
if (this.
|
|
31584
|
+
if (!this.paperScope.project.view || !this.shadowScope.project.view) {
|
|
31585
|
+
return;
|
|
31586
|
+
}
|
|
31587
|
+
const viewportWidth = this.viewportWidth;
|
|
31588
|
+
const viewportHeight = this.viewportHeight;
|
|
31589
|
+
if (viewportWidth > 0 && viewportHeight > 0) {
|
|
31426
31590
|
const minWidth = Math.max(frameWidth, 10);
|
|
31427
31591
|
const minHeight = Math.max(frameHeight, 10);
|
|
31428
31592
|
let width = minWidth;
|
|
31429
|
-
let height = width *
|
|
31593
|
+
let height = width * viewportHeight / viewportWidth;
|
|
31430
31594
|
if (height > minHeight) {
|
|
31431
31595
|
height = minHeight;
|
|
31432
|
-
width = height *
|
|
31596
|
+
width = height * viewportWidth / viewportHeight;
|
|
31433
31597
|
}
|
|
31434
|
-
this.camera.updateInherentScale(width /
|
|
31598
|
+
this.camera.updateInherentScale(width / viewportWidth);
|
|
31435
31599
|
this.paperScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
31436
31600
|
this.shadowScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
31437
31601
|
this.camera.triggerZoom();
|
|
@@ -31635,6 +31799,9 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31635
31799
|
this.emitter.showLiveCursor = (value) => {
|
|
31636
31800
|
this.liveCursor.showLiveCursor = value;
|
|
31637
31801
|
};
|
|
31802
|
+
this.emitter.updateViewport = (width, height) => {
|
|
31803
|
+
this.updateOptionSize(width, height);
|
|
31804
|
+
};
|
|
31638
31805
|
this.emitter.__setMainCanvasVisible = (visible) => {
|
|
31639
31806
|
this.canvasElement.style.opacity = visible ? "1" : "0";
|
|
31640
31807
|
};
|
|
@@ -31740,6 +31907,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31740
31907
|
that.camera.enableBoundaryHighlight = value;
|
|
31741
31908
|
}
|
|
31742
31909
|
});
|
|
31910
|
+
window.addEventListener("forge-whiteboard-synced-status", this.addWhiteboardStatus);
|
|
31743
31911
|
}
|
|
31744
31912
|
userMap(userId) {
|
|
31745
31913
|
return this.getMap(`user/${userId}`);
|
|
@@ -31753,10 +31921,18 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31753
31921
|
this.emitter["selfUserId"] = this.userId;
|
|
31754
31922
|
this.option = option;
|
|
31755
31923
|
if (this.option.stretchToFill) {
|
|
31756
|
-
this.
|
|
31757
|
-
this.
|
|
31924
|
+
this.getMap("attrs").set("viewportWidth", -1);
|
|
31925
|
+
this.getMap("attrs").set("viewportHeight", -1);
|
|
31926
|
+
} else {
|
|
31927
|
+
if (!this.getMap("attrs").has("viewportWidth")) {
|
|
31928
|
+
this.getMap("attrs").set("viewportWidth", option.width);
|
|
31929
|
+
}
|
|
31930
|
+
if (!this.getMap("attrs").has("viewportHeight")) {
|
|
31931
|
+
this.getMap("attrs").set("viewportHeight", option.height);
|
|
31932
|
+
}
|
|
31758
31933
|
}
|
|
31759
31934
|
this.userMap(this.userId).set(WhiteboardKeys.themeColor, "#009688");
|
|
31935
|
+
this.userMap(this.userId).observe(this.handleSyncedWhiteboardStatusChange);
|
|
31760
31936
|
this.shadowEmitter = new ShadowEmitter(this.userMap(this.userId));
|
|
31761
31937
|
this.pageModel = new PageModel(this.getMap("attrs"), this.userManager, (userId) => {
|
|
31762
31938
|
return this.userMap(userId);
|
|
@@ -31923,12 +32099,13 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
31923
32099
|
this.clearElements();
|
|
31924
32100
|
if (this.option.stretchToFill) {
|
|
31925
32101
|
window.addEventListener("resize", () => {
|
|
31926
|
-
const bounds =
|
|
32102
|
+
const bounds = this.rootElement.getBoundingClientRect();
|
|
31927
32103
|
this.updateOptionSize(bounds.width, bounds.height);
|
|
31928
32104
|
this.adjustByOutFrame(bounds.width, bounds.height);
|
|
31929
32105
|
});
|
|
31930
32106
|
}
|
|
31931
32107
|
this.rootElement.appendChild(this.liveCursor.container);
|
|
32108
|
+
this.getMap("attrs").observe(this.handleViewportUpdate);
|
|
31932
32109
|
}
|
|
31933
32110
|
clearElements() {
|
|
31934
32111
|
const userIds = this.userManager.userIdList();
|
|
@@ -32024,10 +32201,10 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
32024
32201
|
this.snapshotScope.view.viewSize = bounds.size.multiply(scale2);
|
|
32025
32202
|
this.snapshotScope.view.matrix = matrix;
|
|
32026
32203
|
} else if (area === "maxScale" && this.option.maxScaleRatio && this.option.maxScaleRatio !== -1) {
|
|
32027
|
-
const width = this.
|
|
32028
|
-
const height = this.
|
|
32029
|
-
const offsetX = this.
|
|
32030
|
-
const offsetY = this.
|
|
32204
|
+
const width = this.viewportWidth * this.option.maxScaleRatio;
|
|
32205
|
+
const height = this.viewportHeight * this.option.maxScaleRatio;
|
|
32206
|
+
const offsetX = this.viewportWidth * (this.option.maxScaleRatio - 1) / 2;
|
|
32207
|
+
const offsetY = this.viewportHeight * (this.option.maxScaleRatio - 1) / 2;
|
|
32031
32208
|
const matrix = new this.paperScope.Matrix();
|
|
32032
32209
|
matrix.scale(scale);
|
|
32033
32210
|
matrix.translate({
|
|
@@ -32051,28 +32228,23 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
32051
32228
|
this.disableViewModelUpdate = true;
|
|
32052
32229
|
}
|
|
32053
32230
|
linkToWhiteboard(targetId) {
|
|
32054
|
-
|
|
32055
|
-
|
|
32056
|
-
|
|
32057
|
-
|
|
32058
|
-
|
|
32059
|
-
|
|
32060
|
-
|
|
32061
|
-
|
|
32062
|
-
|
|
32063
|
-
|
|
32064
|
-
|
|
32065
|
-
|
|
32066
|
-
|
|
32067
|
-
|
|
32068
|
-
this.permissions.addPermission(this.linkTarget.get("permission"), this.userId);
|
|
32069
|
-
this.linkTarget.observe(this.handleLinkedMapChange);
|
|
32070
|
-
}
|
|
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
|
+
});
|
|
32071
32245
|
}
|
|
32072
32246
|
unlink() {
|
|
32073
|
-
|
|
32074
|
-
(0, import_forge_room13.removeObserver)(this.linkTarget, this.handleLinkedMapChange);
|
|
32075
|
-
}
|
|
32247
|
+
this.linkWhiteboardId = null;
|
|
32076
32248
|
}
|
|
32077
32249
|
setViewSize(width, height) {
|
|
32078
32250
|
this.paperScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
@@ -32089,11 +32261,14 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
32089
32261
|
this.internalResizeObserver = value;
|
|
32090
32262
|
}
|
|
32091
32263
|
updateOptionSize(width, height) {
|
|
32092
|
-
this.
|
|
32093
|
-
this.
|
|
32264
|
+
this.getMap("attrs").set("viewportWidth", width);
|
|
32265
|
+
this.getMap("attrs").set("viewportHeight", height);
|
|
32094
32266
|
this.camera.updateInitSize(new import_paper.default.Size(width, height));
|
|
32095
32267
|
}
|
|
32096
|
-
async dispose() {
|
|
32268
|
+
async dispose(removeSubDoc) {
|
|
32269
|
+
if (removeSubDoc) {
|
|
32270
|
+
this.deleteSubDoc(this.appId);
|
|
32271
|
+
}
|
|
32097
32272
|
this.selectElementsModel.dispose();
|
|
32098
32273
|
this.trashedElementsModel.dispose();
|
|
32099
32274
|
this.paperScope.view.remove();
|
|
@@ -32110,7 +32285,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
32110
32285
|
entry[1].off("stack-item-popped", this.handleStackItemPopped);
|
|
32111
32286
|
}
|
|
32112
32287
|
for (const entry of this.layers.entries()) {
|
|
32113
|
-
entry[1].dispose();
|
|
32288
|
+
entry[1].dispose(removeSubDoc);
|
|
32114
32289
|
entry[1].removeAllListeners();
|
|
32115
32290
|
}
|
|
32116
32291
|
this.camera.dispose();
|
|
@@ -32122,6 +32297,7 @@ var WhiteboardApplication = class extends import_forge_room12.AbstractApplicatio
|
|
|
32122
32297
|
this.toolbarModel.dispose();
|
|
32123
32298
|
this.emitter.indexedNavigation.dispose();
|
|
32124
32299
|
this.permissions.dispose();
|
|
32300
|
+
(0, import_forge_room13.removeObserver)(this.userMap(this.userId), this.handleSyncedWhiteboardStatusChange);
|
|
32125
32301
|
}
|
|
32126
32302
|
};
|
|
32127
32303
|
_defineProperty43(WhiteboardApplication, "applicationName", WHITEBOARD_APP_NAME);
|