@netless/forge-slide 0.1.1-alpha.10 → 0.1.1-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FoorerView.d.ts +23 -0
- package/dist/FoorerView.d.ts.map +1 -0
- package/dist/SiderBarView.d.ts +16 -0
- package/dist/SiderBarView.d.ts.map +1 -1
- package/dist/SlideApplication.d.ts +1 -2
- package/dist/SlideApplication.d.ts.map +1 -1
- package/dist/index.esm.js +1384 -703
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +1381 -700
- package/dist/index.js.map +4 -4
- package/dist/utils.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/SiderBarView.ts +124 -45
- package/src/SlideApplication.ts +45 -48
- package/src/utils.ts +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -35171,17 +35171,20 @@ void main(void){
|
|
|
35171
35171
|
});
|
|
35172
35172
|
|
|
35173
35173
|
// ../whiteboard/dist/whiteboard.esm.js
|
|
35174
|
-
import { AbstractApplication, log as
|
|
35174
|
+
import { AbstractApplication, log as log4 } from "@netless/forge-room";
|
|
35175
35175
|
import * as Y15 from "yjs";
|
|
35176
35176
|
import * as Y12 from "yjs";
|
|
35177
35177
|
import EventEmitter from "eventemitter3";
|
|
35178
35178
|
import { v4 as uuidv4 } from "uuid";
|
|
35179
|
+
import { log, removeObserver as removeObserver2 } from "@netless/forge-room";
|
|
35179
35180
|
import * as Y2 from "yjs";
|
|
35180
35181
|
import * as Y from "yjs";
|
|
35182
|
+
import { removeDeepObserver } from "@netless/forge-room";
|
|
35181
35183
|
import * as Y3 from "yjs";
|
|
35182
35184
|
import * as Y4 from "yjs";
|
|
35183
35185
|
import * as Y5 from "yjs";
|
|
35184
35186
|
import * as Y6 from "yjs";
|
|
35187
|
+
import { removeObserver } from "@netless/forge-room";
|
|
35185
35188
|
import * as Y7 from "yjs";
|
|
35186
35189
|
import * as Y8 from "yjs";
|
|
35187
35190
|
import * as Y9 from "yjs";
|
|
@@ -35189,20 +35192,26 @@ import * as Y10 from "yjs";
|
|
|
35189
35192
|
import { AbstractApplicationPermissions } from "@netless/forge-room";
|
|
35190
35193
|
import * as Y11 from "yjs";
|
|
35191
35194
|
import EventEmitter2 from "eventemitter3";
|
|
35195
|
+
import { removeObserver as removeObserver3 } from "@netless/forge-room";
|
|
35192
35196
|
import * as Y13 from "yjs";
|
|
35193
35197
|
import EventEmitter3 from "eventemitter3";
|
|
35198
|
+
import { removeDeepObserver as removeDeepObserver2 } from "@netless/forge-room";
|
|
35194
35199
|
import EventEmitter5 from "eventemitter3";
|
|
35195
35200
|
import { EventEmitter as EventEmitter4 } from "eventemitter3";
|
|
35196
35201
|
import EventEmitter7 from "eventemitter3";
|
|
35197
35202
|
import EventEmitter6 from "eventemitter3";
|
|
35203
|
+
import { removeObserver as removeObserver4 } from "@netless/forge-room";
|
|
35198
35204
|
import EventEmitter8 from "eventemitter3";
|
|
35199
35205
|
import * as Y14 from "yjs";
|
|
35200
35206
|
import EventEmitter9 from "eventemitter3";
|
|
35207
|
+
import { removeDeepObserver as removeDeepObserver3 } from "@netless/forge-room";
|
|
35201
35208
|
import EventEmitter10 from "eventemitter3";
|
|
35202
|
-
import { log } from "@netless/forge-room";
|
|
35209
|
+
import { log as log2, removeObserver as removeObserver5 } from "@netless/forge-room";
|
|
35203
35210
|
import EventEmitter11 from "eventemitter3";
|
|
35204
|
-
import { log as
|
|
35211
|
+
import { log as log3 } from "@netless/forge-room";
|
|
35212
|
+
import { removeObserver as removeObserver6 } from "@netless/forge-room";
|
|
35205
35213
|
import EventEmitter12 from "eventemitter3";
|
|
35214
|
+
import { removeObserver as removeObserver7 } from "@netless/forge-room";
|
|
35206
35215
|
var __create2 = Object.create;
|
|
35207
35216
|
var __defProp2 = Object.defineProperty;
|
|
35208
35217
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -60782,11 +60791,12 @@ var ElementModel = class _ElementModel {
|
|
|
60782
60791
|
set shadow(value) {
|
|
60783
60792
|
this.root.set(_ElementModel.KEYS.shadow, value);
|
|
60784
60793
|
}
|
|
60785
|
-
constructor(root, scope) {
|
|
60794
|
+
constructor(root, scope, liveCursor) {
|
|
60786
60795
|
_defineProperty(this, "shadowEmitter", null);
|
|
60787
60796
|
_defineProperty(this, "root", void 0);
|
|
60788
60797
|
_defineProperty(this, "scope", void 0);
|
|
60789
60798
|
_defineProperty(this, "item", void 0);
|
|
60799
|
+
_defineProperty(this, "liveCursor", void 0);
|
|
60790
60800
|
_defineProperty(this, "handlePropChange", (events) => {
|
|
60791
60801
|
if (!this.item) {
|
|
60792
60802
|
return;
|
|
@@ -60795,7 +60805,7 @@ var ElementModel = class _ElementModel {
|
|
|
60795
60805
|
if (event.target === this.root) {
|
|
60796
60806
|
const updatePaperItemKeys = this.vectorKeys().concat([_ElementModel.KEYS.pointsMatrix]);
|
|
60797
60807
|
for (const [key, value] of event.changes.keys.entries()) {
|
|
60798
|
-
if (value.action === "update") {
|
|
60808
|
+
if (value.action === "update" || value.action == "add") {
|
|
60799
60809
|
const includeKeys = this.styleKeys().include;
|
|
60800
60810
|
if (includeKeys.indexOf(key) >= 0) {
|
|
60801
60811
|
this.onStyleKeyUpdate(key);
|
|
@@ -60815,6 +60825,10 @@ var ElementModel = class _ElementModel {
|
|
|
60815
60825
|
if (this.shadow !== "") {
|
|
60816
60826
|
this.shadowEmitter?.emit("translateIn", [this.uuid], this.shadow);
|
|
60817
60827
|
} else {
|
|
60828
|
+
const ownerId = this.root.get(_ElementModel.KEYS.ownerId);
|
|
60829
|
+
if (ownerId) {
|
|
60830
|
+
this.liveCursor.updateCursorVisible(false, ownerId);
|
|
60831
|
+
}
|
|
60818
60832
|
this.shadowEmitter?.emit("translateOut", [this.uuid], value.oldValue);
|
|
60819
60833
|
}
|
|
60820
60834
|
}
|
|
@@ -60822,11 +60836,17 @@ var ElementModel = class _ElementModel {
|
|
|
60822
60836
|
}
|
|
60823
60837
|
} else if (event.target === this.root.get(_ElementModel.KEYS.points)) {
|
|
60824
60838
|
this.onVectorUpdate();
|
|
60839
|
+
const liveCursorPoint = this.liveCursorPoint();
|
|
60840
|
+
const ownerId = this.root.get(_ElementModel.KEYS.ownerId);
|
|
60841
|
+
if (liveCursorPoint && ownerId) {
|
|
60842
|
+
this.liveCursor.updateCursorPosition(liveCursorPoint, this.root.get(_ElementModel.KEYS.ownerId));
|
|
60843
|
+
}
|
|
60825
60844
|
} else {
|
|
60826
60845
|
}
|
|
60827
60846
|
}
|
|
60828
60847
|
});
|
|
60829
60848
|
this.scope = scope;
|
|
60849
|
+
this.liveCursor = liveCursor;
|
|
60830
60850
|
this.root = root;
|
|
60831
60851
|
if (!this.root.has(_ElementModel.KEYS.pointsMatrix)) {
|
|
60832
60852
|
this.root.set(_ElementModel.KEYS.pointsMatrix, [1, 0, 0, 1, 0, 0]);
|
|
@@ -60886,7 +60906,7 @@ var ElementModel = class _ElementModel {
|
|
|
60886
60906
|
}
|
|
60887
60907
|
dispose() {
|
|
60888
60908
|
this.subDispose();
|
|
60889
|
-
this.root
|
|
60909
|
+
removeDeepObserver(this.root, this.handlePropChange);
|
|
60890
60910
|
}
|
|
60891
60911
|
};
|
|
60892
60912
|
_defineProperty(ElementModel, "KEYS", {
|
|
@@ -60954,8 +60974,8 @@ function _toPrimitive3(t, r) {
|
|
|
60954
60974
|
return ("string" === r ? String : Number)(t);
|
|
60955
60975
|
}
|
|
60956
60976
|
var CurveModel = class extends ElementModel {
|
|
60957
|
-
constructor(root, scope) {
|
|
60958
|
-
super(root, scope);
|
|
60977
|
+
constructor(root, scope, liveCursor) {
|
|
60978
|
+
super(root, scope, liveCursor);
|
|
60959
60979
|
_defineProperty3(this, "item", null);
|
|
60960
60980
|
_defineProperty3(this, "debugPath", void 0);
|
|
60961
60981
|
_defineProperty3(this, "debug", false);
|
|
@@ -60971,8 +60991,7 @@ var CurveModel = class extends ElementModel {
|
|
|
60971
60991
|
return (a2 + b2) / 2;
|
|
60972
60992
|
}
|
|
60973
60993
|
parsePoints(points) {
|
|
60974
|
-
|
|
60975
|
-
return ae(groupPoints, {
|
|
60994
|
+
return ae(points, {
|
|
60976
60995
|
size: this.strokeWidth,
|
|
60977
60996
|
smoothing: 0.5,
|
|
60978
60997
|
thinning: -0.5,
|
|
@@ -60989,15 +61008,15 @@ var CurveModel = class extends ElementModel {
|
|
|
60989
61008
|
});
|
|
60990
61009
|
}
|
|
60991
61010
|
matrixedPoints() {
|
|
60992
|
-
const
|
|
60993
|
-
|
|
60994
|
-
|
|
60995
|
-
|
|
60996
|
-
|
|
60997
|
-
|
|
60998
|
-
|
|
60999
|
-
|
|
61000
|
-
|
|
61011
|
+
const points = this.points;
|
|
61012
|
+
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61013
|
+
const output = [];
|
|
61014
|
+
for (let i = 0, len = points.length; i < len; i += 2) {
|
|
61015
|
+
const p = new this.scope.Point(points[i], points[i + 1]);
|
|
61016
|
+
const tp = p.transform(matrix);
|
|
61017
|
+
output.push([tp.x, tp.y]);
|
|
61018
|
+
}
|
|
61019
|
+
return output;
|
|
61001
61020
|
}
|
|
61002
61021
|
createPath(points) {
|
|
61003
61022
|
const path = new this.scope.Path();
|
|
@@ -61072,6 +61091,15 @@ var CurveModel = class extends ElementModel {
|
|
|
61072
61091
|
exclude: ["dashArray", "fillColor"]
|
|
61073
61092
|
};
|
|
61074
61093
|
}
|
|
61094
|
+
liveCursorPoint() {
|
|
61095
|
+
const yArray = this.root.get(ElementModel.KEYS.points);
|
|
61096
|
+
if (yArray.length < 2) {
|
|
61097
|
+
return null;
|
|
61098
|
+
}
|
|
61099
|
+
const len = yArray.length;
|
|
61100
|
+
const point = new this.scope.Point(yArray.get(len - 2), yArray.get(len - 1));
|
|
61101
|
+
return point.transform(new this.scope.Matrix(this.pointsMatrix));
|
|
61102
|
+
}
|
|
61075
61103
|
onStyleKeyUpdate(key) {
|
|
61076
61104
|
if (!this.item) {
|
|
61077
61105
|
return;
|
|
@@ -61104,8 +61132,8 @@ function _toPrimitive4(t, r) {
|
|
|
61104
61132
|
return ("string" === r ? String : Number)(t);
|
|
61105
61133
|
}
|
|
61106
61134
|
var SelectorModel = class extends ElementModel {
|
|
61107
|
-
constructor(root, scope) {
|
|
61108
|
-
super(root, scope);
|
|
61135
|
+
constructor(root, scope, liveCursor) {
|
|
61136
|
+
super(root, scope, liveCursor);
|
|
61109
61137
|
_defineProperty4(this, "item", null);
|
|
61110
61138
|
if (!this.root.has("type")) {
|
|
61111
61139
|
this.root.set("type", "selector");
|
|
@@ -61116,6 +61144,9 @@ var SelectorModel = class extends ElementModel {
|
|
|
61116
61144
|
this.root.set("points", initPoints);
|
|
61117
61145
|
}
|
|
61118
61146
|
}
|
|
61147
|
+
liveCursorPoint() {
|
|
61148
|
+
return null;
|
|
61149
|
+
}
|
|
61119
61150
|
subDispose() {
|
|
61120
61151
|
}
|
|
61121
61152
|
createPaperRect() {
|
|
@@ -61235,8 +61266,8 @@ function _toPrimitive6(t, r) {
|
|
|
61235
61266
|
return ("string" === r ? String : Number)(t);
|
|
61236
61267
|
}
|
|
61237
61268
|
var SegmentsModel = class extends ElementModel {
|
|
61238
|
-
constructor(root, scope, type) {
|
|
61239
|
-
super(root, scope);
|
|
61269
|
+
constructor(root, scope, type, liveCursor) {
|
|
61270
|
+
super(root, scope, liveCursor);
|
|
61240
61271
|
_defineProperty6(this, "item", null);
|
|
61241
61272
|
if (!this.root.has("type")) {
|
|
61242
61273
|
this.root.set("type", type);
|
|
@@ -61247,6 +61278,14 @@ var SegmentsModel = class extends ElementModel {
|
|
|
61247
61278
|
}
|
|
61248
61279
|
subDispose() {
|
|
61249
61280
|
}
|
|
61281
|
+
liveCursorPoint() {
|
|
61282
|
+
const yArray = this.root.get(ElementModel.KEYS.points);
|
|
61283
|
+
if (yArray.length < 2) {
|
|
61284
|
+
return null;
|
|
61285
|
+
}
|
|
61286
|
+
const point = new this.scope.Point(yArray.get(0), yArray.get(1));
|
|
61287
|
+
return point.transform(new this.scope.Matrix(this.pointsMatrix));
|
|
61288
|
+
}
|
|
61250
61289
|
onVectorUpdate() {
|
|
61251
61290
|
if (!this.item) {
|
|
61252
61291
|
return;
|
|
@@ -61365,6 +61404,7 @@ var LineTool = class extends WhiteboardTool {
|
|
|
61365
61404
|
_defineProperty8(this, "elementModel", null);
|
|
61366
61405
|
_defineProperty8(this, "from", null);
|
|
61367
61406
|
_defineProperty8(this, "to", null);
|
|
61407
|
+
_defineProperty8(this, "showLiveCursor", true);
|
|
61368
61408
|
this.tool.minDistance = 1;
|
|
61369
61409
|
}
|
|
61370
61410
|
onMouseDown(event) {
|
|
@@ -61427,8 +61467,8 @@ var LineModel = class extends ElementModel {
|
|
|
61427
61467
|
set tailArrow(value) {
|
|
61428
61468
|
this.root.set("tailArrow", value);
|
|
61429
61469
|
}
|
|
61430
|
-
constructor(root, scope) {
|
|
61431
|
-
super(root, scope);
|
|
61470
|
+
constructor(root, scope, liveCursor) {
|
|
61471
|
+
super(root, scope, liveCursor);
|
|
61432
61472
|
_defineProperty9(this, "controlledPoints", []);
|
|
61433
61473
|
_defineProperty9(this, "item", null);
|
|
61434
61474
|
if (!this.root.has("type")) {
|
|
@@ -61477,6 +61517,15 @@ var LineModel = class extends ElementModel {
|
|
|
61477
61517
|
});
|
|
61478
61518
|
return [head, path, tail];
|
|
61479
61519
|
}
|
|
61520
|
+
liveCursorPoint() {
|
|
61521
|
+
const yArray = this.root.get(ElementModel.KEYS.points);
|
|
61522
|
+
if (yArray.length < 2) {
|
|
61523
|
+
return null;
|
|
61524
|
+
}
|
|
61525
|
+
const len = yArray.length;
|
|
61526
|
+
const point = new this.scope.Point(yArray.get(len - 2), yArray.get(len - 1));
|
|
61527
|
+
return point.transform(new this.scope.Matrix(this.pointsMatrix));
|
|
61528
|
+
}
|
|
61480
61529
|
createPaperItem() {
|
|
61481
61530
|
this.item = new this.scope.Group();
|
|
61482
61531
|
this.item.addChildren(this.renderLine());
|
|
@@ -61624,8 +61673,8 @@ var PointTextModel = class extends ElementModel {
|
|
|
61624
61673
|
set fontFamily(value) {
|
|
61625
61674
|
this.root.set("font-family", value);
|
|
61626
61675
|
}
|
|
61627
|
-
constructor(root, scope) {
|
|
61628
|
-
super(root, scope);
|
|
61676
|
+
constructor(root, scope, liveCursor) {
|
|
61677
|
+
super(root, scope, liveCursor);
|
|
61629
61678
|
_defineProperty10(this, "item", null);
|
|
61630
61679
|
_defineProperty10(this, "handleTextPropChange", (event) => {
|
|
61631
61680
|
if (!this.item) {
|
|
@@ -61657,7 +61706,16 @@ var PointTextModel = class extends ElementModel {
|
|
|
61657
61706
|
}
|
|
61658
61707
|
}
|
|
61659
61708
|
subDispose() {
|
|
61660
|
-
this.root
|
|
61709
|
+
removeObserver(this.root, this.handleTextPropChange);
|
|
61710
|
+
}
|
|
61711
|
+
liveCursorPoint() {
|
|
61712
|
+
const points = this.points;
|
|
61713
|
+
if (points.length < 1) {
|
|
61714
|
+
return null;
|
|
61715
|
+
}
|
|
61716
|
+
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61717
|
+
const topLeft = new this.scope.Point(points[0], points[1]).transform(matrix);
|
|
61718
|
+
return topLeft;
|
|
61661
61719
|
}
|
|
61662
61720
|
getInternalMeasurement() {
|
|
61663
61721
|
if (!this.item) {
|
|
@@ -61751,8 +61809,8 @@ function _toPrimitive11(t, r) {
|
|
|
61751
61809
|
return ("string" === r ? String : Number)(t);
|
|
61752
61810
|
}
|
|
61753
61811
|
var TriangleModel = class extends ElementModel {
|
|
61754
|
-
constructor(root, scope) {
|
|
61755
|
-
super(root, scope);
|
|
61812
|
+
constructor(root, scope, liveCursor) {
|
|
61813
|
+
super(root, scope, liveCursor);
|
|
61756
61814
|
_defineProperty11(this, "item", null);
|
|
61757
61815
|
if (!this.root.has("type")) {
|
|
61758
61816
|
this.root.set("type", "triangle");
|
|
@@ -61761,6 +61819,15 @@ var TriangleModel = class extends ElementModel {
|
|
|
61761
61819
|
this.root.set("points", new Y7.Array());
|
|
61762
61820
|
}
|
|
61763
61821
|
}
|
|
61822
|
+
liveCursorPoint() {
|
|
61823
|
+
const yArray = this.root.get(ElementModel.KEYS.points);
|
|
61824
|
+
if (yArray.length < 6) {
|
|
61825
|
+
return null;
|
|
61826
|
+
}
|
|
61827
|
+
const len = yArray.length;
|
|
61828
|
+
const point = new this.scope.Point(yArray.get(len - 4), yArray.get(len - 3));
|
|
61829
|
+
return point.transform(new this.scope.Matrix(this.pointsMatrix));
|
|
61830
|
+
}
|
|
61764
61831
|
subDispose() {
|
|
61765
61832
|
}
|
|
61766
61833
|
createPaperItem() {
|
|
@@ -61840,8 +61907,8 @@ function _toPrimitive12(t, r) {
|
|
|
61840
61907
|
return ("string" === r ? String : Number)(t);
|
|
61841
61908
|
}
|
|
61842
61909
|
var RectangleModel = class extends ElementModel {
|
|
61843
|
-
constructor(root, scope) {
|
|
61844
|
-
super(root, scope);
|
|
61910
|
+
constructor(root, scope, liveCursor) {
|
|
61911
|
+
super(root, scope, liveCursor);
|
|
61845
61912
|
_defineProperty12(this, "item", null);
|
|
61846
61913
|
if (!this.root.has("type")) {
|
|
61847
61914
|
this.root.set("type", "rectangle");
|
|
@@ -61857,6 +61924,14 @@ var RectangleModel = class extends ElementModel {
|
|
|
61857
61924
|
}
|
|
61858
61925
|
subDispose() {
|
|
61859
61926
|
}
|
|
61927
|
+
liveCursorPoint() {
|
|
61928
|
+
const points = this.points;
|
|
61929
|
+
if (points.length < 4) {
|
|
61930
|
+
return null;
|
|
61931
|
+
}
|
|
61932
|
+
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61933
|
+
return new this.scope.Point(points[2], points[3]).transform(matrix);
|
|
61934
|
+
}
|
|
61860
61935
|
createSegments() {
|
|
61861
61936
|
const [a2, b2, c, d] = this.points;
|
|
61862
61937
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
@@ -62011,8 +62086,8 @@ function _toPrimitive13(t, r) {
|
|
|
62011
62086
|
return ("string" === r ? String : Number)(t);
|
|
62012
62087
|
}
|
|
62013
62088
|
var EraserModel = class extends ElementModel {
|
|
62014
|
-
constructor(root, scope) {
|
|
62015
|
-
super(root, scope);
|
|
62089
|
+
constructor(root, scope, liveCursor) {
|
|
62090
|
+
super(root, scope, liveCursor);
|
|
62016
62091
|
_defineProperty13(this, "item", null);
|
|
62017
62092
|
_defineProperty13(this, "sliceBegin", 0);
|
|
62018
62093
|
if (!this.root.has("type")) {
|
|
@@ -62051,41 +62126,42 @@ var EraserModel = class extends ElementModel {
|
|
|
62051
62126
|
return path;
|
|
62052
62127
|
}
|
|
62053
62128
|
parsePoints(points) {
|
|
62054
|
-
|
|
62129
|
+
const groupPoints = (0, import_lodash5.chunk)(points, 2);
|
|
62130
|
+
return ae(groupPoints, {
|
|
62055
62131
|
size: this.strokeWidth,
|
|
62056
|
-
smoothing: 0,
|
|
62057
|
-
thinning: 0.5,
|
|
62132
|
+
smoothing: 0.5,
|
|
62133
|
+
thinning: -0.5,
|
|
62058
62134
|
streamline: 0.5,
|
|
62059
62135
|
simulatePressure: true,
|
|
62060
62136
|
start: {
|
|
62061
|
-
taper:
|
|
62137
|
+
taper: this.strokeWidth * 10,
|
|
62062
62138
|
cap: true
|
|
62063
62139
|
},
|
|
62064
62140
|
end: {
|
|
62065
|
-
taper:
|
|
62141
|
+
taper: this.strokeWidth * 20,
|
|
62066
62142
|
cap: true
|
|
62067
62143
|
}
|
|
62068
62144
|
});
|
|
62069
62145
|
}
|
|
62070
62146
|
matrixedPoints() {
|
|
62071
|
-
const
|
|
62072
|
-
|
|
62073
|
-
return groupPoints.map((_ref) => {
|
|
62147
|
+
const currentPoints = (0, import_lodash5.chunk)(this.points, 2).slice(this.sliceBegin);
|
|
62148
|
+
return currentPoints.map((_ref) => {
|
|
62074
62149
|
let [x, y] = _ref;
|
|
62075
|
-
return
|
|
62076
|
-
}).map((p) =>
|
|
62077
|
-
|
|
62078
|
-
|
|
62079
|
-
|
|
62080
|
-
|
|
62081
|
-
return path.segments;
|
|
62150
|
+
return new this.scope.Point(x, y);
|
|
62151
|
+
}).map((p) => p.transform(new this.scope.Matrix(this.pointsMatrix))).reduce((result, next) => {
|
|
62152
|
+
result.push(next.x);
|
|
62153
|
+
result.push(next.y);
|
|
62154
|
+
return result;
|
|
62155
|
+
}, []);
|
|
62082
62156
|
}
|
|
62083
62157
|
onVectorUpdate() {
|
|
62084
62158
|
if (!this.item) {
|
|
62085
62159
|
return;
|
|
62086
62160
|
}
|
|
62161
|
+
const points = this.parsePoints(this.matrixedPoints());
|
|
62162
|
+
const path = this.createPath(points);
|
|
62087
62163
|
this.item.removeSegments();
|
|
62088
|
-
this.item.addSegments(
|
|
62164
|
+
this.item.addSegments(path.segments);
|
|
62089
62165
|
}
|
|
62090
62166
|
createPaperItem() {
|
|
62091
62167
|
this.item = new this.scope.Path();
|
|
@@ -62094,21 +62170,13 @@ var EraserModel = class extends ElementModel {
|
|
|
62094
62170
|
this.item.strokeScaling = false;
|
|
62095
62171
|
this.item.strokeColor = new this.scope.Color(this.strokeColor);
|
|
62096
62172
|
this.item.fillColor = new this.scope.Color(this.strokeColor);
|
|
62097
|
-
this.
|
|
62098
|
-
let isBegin = false;
|
|
62173
|
+
this.onVectorUpdate();
|
|
62099
62174
|
this.item.onFrame = () => {
|
|
62100
62175
|
if (!this.points) {
|
|
62101
62176
|
return;
|
|
62102
62177
|
}
|
|
62103
|
-
if (this.points.length / 2
|
|
62104
|
-
|
|
62105
|
-
}
|
|
62106
|
-
if (this.points.length / 2 <= this.sliceBegin) {
|
|
62107
|
-
isBegin = false;
|
|
62108
|
-
}
|
|
62109
|
-
if (isBegin) {
|
|
62110
|
-
this.sliceBegin += 1;
|
|
62111
|
-
this.onVectorUpdate();
|
|
62178
|
+
if (this.points.length / 2 > 50) {
|
|
62179
|
+
this.sliceBegin = this.points.length / 2 - 50;
|
|
62112
62180
|
}
|
|
62113
62181
|
};
|
|
62114
62182
|
}
|
|
@@ -62129,6 +62197,15 @@ var EraserModel = class extends ElementModel {
|
|
|
62129
62197
|
}
|
|
62130
62198
|
subDispose() {
|
|
62131
62199
|
}
|
|
62200
|
+
liveCursorPoint() {
|
|
62201
|
+
const yArray = this.root.get(ElementModel.KEYS.points);
|
|
62202
|
+
if (yArray.length < 2) {
|
|
62203
|
+
return null;
|
|
62204
|
+
}
|
|
62205
|
+
const len = yArray.length;
|
|
62206
|
+
const point = new this.scope.Point(yArray.get(len - 2), yArray.get(len - 1));
|
|
62207
|
+
return point.transform(new this.scope.Matrix(this.pointsMatrix));
|
|
62208
|
+
}
|
|
62132
62209
|
};
|
|
62133
62210
|
var import_lodash6 = __toESM2(require_lodash(), 1);
|
|
62134
62211
|
function _defineProperty14(e, r, t) {
|
|
@@ -62149,8 +62226,8 @@ function _toPrimitive14(t, r) {
|
|
|
62149
62226
|
return ("string" === r ? String : Number)(t);
|
|
62150
62227
|
}
|
|
62151
62228
|
var LaserPointerModel = class extends ElementModel {
|
|
62152
|
-
constructor(clientId, root, scope, removeElement) {
|
|
62153
|
-
super(root, scope);
|
|
62229
|
+
constructor(clientId, root, scope, liveCursor, removeElement) {
|
|
62230
|
+
super(root, scope, liveCursor);
|
|
62154
62231
|
_defineProperty14(this, "item", null);
|
|
62155
62232
|
_defineProperty14(this, "clientId", void 0);
|
|
62156
62233
|
_defineProperty14(this, "sliceBegin", 0);
|
|
@@ -62287,6 +62364,15 @@ var LaserPointerModel = class extends ElementModel {
|
|
|
62287
62364
|
}
|
|
62288
62365
|
subDispose() {
|
|
62289
62366
|
}
|
|
62367
|
+
liveCursorPoint() {
|
|
62368
|
+
const yArray = this.root.get(ElementModel.KEYS.points);
|
|
62369
|
+
if (yArray.length < 2) {
|
|
62370
|
+
return null;
|
|
62371
|
+
}
|
|
62372
|
+
const len = yArray.length;
|
|
62373
|
+
const point = new this.scope.Point(yArray.get(len - 2), yArray.get(len - 1));
|
|
62374
|
+
return point.transform(new this.scope.Matrix(this.pointsMatrix));
|
|
62375
|
+
}
|
|
62290
62376
|
};
|
|
62291
62377
|
var WhiteboardPermissionFlag = function(WhiteboardPermissionFlag2) {
|
|
62292
62378
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["none"] = 0] = "none";
|
|
@@ -62329,8 +62415,8 @@ function _toPrimitive15(t, r) {
|
|
|
62329
62415
|
return ("string" === r ? String : Number)(t);
|
|
62330
62416
|
}
|
|
62331
62417
|
var StraightLineModel = class extends ElementModel {
|
|
62332
|
-
constructor(root, scope) {
|
|
62333
|
-
super(root, scope);
|
|
62418
|
+
constructor(root, scope, liveCursor) {
|
|
62419
|
+
super(root, scope, liveCursor);
|
|
62334
62420
|
_defineProperty15(this, "item", null);
|
|
62335
62421
|
if (!this.root.has("type")) {
|
|
62336
62422
|
this.root.set("type", "line");
|
|
@@ -62339,6 +62425,15 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62339
62425
|
this.root.set("points", new Y11.Array());
|
|
62340
62426
|
}
|
|
62341
62427
|
}
|
|
62428
|
+
liveCursorPoint() {
|
|
62429
|
+
const yArray = this.root.get(ElementModel.KEYS.points);
|
|
62430
|
+
if (yArray.length < 2) {
|
|
62431
|
+
return null;
|
|
62432
|
+
}
|
|
62433
|
+
const len = yArray.length;
|
|
62434
|
+
const point = new this.scope.Point(yArray.get(len - 2), yArray.get(len - 1));
|
|
62435
|
+
return point.transform(new this.scope.Matrix(this.pointsMatrix));
|
|
62436
|
+
}
|
|
62342
62437
|
subDispose() {
|
|
62343
62438
|
}
|
|
62344
62439
|
onVectorUpdate() {
|
|
@@ -62440,29 +62535,111 @@ function _toPrimitive16(t, r) {
|
|
|
62440
62535
|
}
|
|
62441
62536
|
return ("string" === r ? String : Number)(t);
|
|
62442
62537
|
}
|
|
62538
|
+
var ImageModel = class extends ElementModel {
|
|
62539
|
+
get src() {
|
|
62540
|
+
return this.root.get("src");
|
|
62541
|
+
}
|
|
62542
|
+
constructor(root, scope, imageSets, liveCursor) {
|
|
62543
|
+
super(root, scope, liveCursor);
|
|
62544
|
+
_defineProperty16(this, "item", null);
|
|
62545
|
+
_defineProperty16(this, "imageSets", void 0);
|
|
62546
|
+
this.imageSets = imageSets;
|
|
62547
|
+
if (!this.root.has("type")) {
|
|
62548
|
+
this.root.set("type", "image");
|
|
62549
|
+
}
|
|
62550
|
+
this.root.set(ElementModel.KEYS.shadow, "");
|
|
62551
|
+
}
|
|
62552
|
+
subDispose() {
|
|
62553
|
+
const img = this.imageSets.querySelector(`[id='${this.uuid}']`);
|
|
62554
|
+
if (img) {
|
|
62555
|
+
img.remove();
|
|
62556
|
+
}
|
|
62557
|
+
}
|
|
62558
|
+
createPaperItem() {
|
|
62559
|
+
if (this.item) {
|
|
62560
|
+
return;
|
|
62561
|
+
}
|
|
62562
|
+
if (!this.imageSets.querySelector(`[id='${this.uuid}']`)) {
|
|
62563
|
+
const img = document.createElement("img");
|
|
62564
|
+
img.src = this.src;
|
|
62565
|
+
img.id = this.uuid;
|
|
62566
|
+
this.imageSets.appendChild(img);
|
|
62567
|
+
}
|
|
62568
|
+
this.item = new this.scope.Raster(this.uuid);
|
|
62569
|
+
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62570
|
+
this.item.matrix = matrix;
|
|
62571
|
+
}
|
|
62572
|
+
onVectorUpdate() {
|
|
62573
|
+
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62574
|
+
if (this.item) {
|
|
62575
|
+
this.item.matrix = matrix;
|
|
62576
|
+
}
|
|
62577
|
+
}
|
|
62578
|
+
vectorKeys() {
|
|
62579
|
+
return [];
|
|
62580
|
+
}
|
|
62581
|
+
styleKeys() {
|
|
62582
|
+
return {
|
|
62583
|
+
include: [],
|
|
62584
|
+
exclude: ["dashArray", "strokeColor", "fillColor", "strokeWidth"]
|
|
62585
|
+
};
|
|
62586
|
+
}
|
|
62587
|
+
onStyleKeyUpdate(_key) {
|
|
62588
|
+
}
|
|
62589
|
+
editorConfig() {
|
|
62590
|
+
const cfg = new EditorConfig();
|
|
62591
|
+
cfg.resizeModel = () => "four-corner";
|
|
62592
|
+
cfg.uniformScale = () => true;
|
|
62593
|
+
return cfg;
|
|
62594
|
+
}
|
|
62595
|
+
liveCursorPoint() {
|
|
62596
|
+
return null;
|
|
62597
|
+
}
|
|
62598
|
+
};
|
|
62599
|
+
function _defineProperty17(e, r, t) {
|
|
62600
|
+
return (r = _toPropertyKey17(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62601
|
+
}
|
|
62602
|
+
function _toPropertyKey17(t) {
|
|
62603
|
+
var i = _toPrimitive17(t, "string");
|
|
62604
|
+
return "symbol" == typeof i ? i : i + "";
|
|
62605
|
+
}
|
|
62606
|
+
function _toPrimitive17(t, r) {
|
|
62607
|
+
if ("object" != typeof t || !t) return t;
|
|
62608
|
+
var e = t[Symbol.toPrimitive];
|
|
62609
|
+
if (void 0 !== e) {
|
|
62610
|
+
var i = e.call(t, r || "default");
|
|
62611
|
+
if ("object" != typeof i) return i;
|
|
62612
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
62613
|
+
}
|
|
62614
|
+
return ("string" === r ? String : Number)(t);
|
|
62615
|
+
}
|
|
62443
62616
|
var RenderableModel = class extends EventEmitter {
|
|
62444
62617
|
get uuid() {
|
|
62445
|
-
return uuidv4();
|
|
62618
|
+
return uuidv4().replace(/-/g, "");
|
|
62446
62619
|
}
|
|
62447
|
-
constructor(layerId, shadowEmitter, elements, scope, toolbarModel, userManager, hasPermission) {
|
|
62620
|
+
constructor(layerId, shadowEmitter, elements, scope, toolbarModel, userManager, imageSets, liveCursor, hasPermission) {
|
|
62448
62621
|
super();
|
|
62449
|
-
|
|
62450
|
-
|
|
62451
|
-
|
|
62452
|
-
|
|
62453
|
-
|
|
62454
|
-
|
|
62455
|
-
|
|
62456
|
-
|
|
62457
|
-
|
|
62458
|
-
|
|
62622
|
+
_defineProperty17(this, "scope", void 0);
|
|
62623
|
+
_defineProperty17(this, "toolbarModel", void 0);
|
|
62624
|
+
_defineProperty17(this, "userManager", void 0);
|
|
62625
|
+
_defineProperty17(this, "elementModels", void 0);
|
|
62626
|
+
_defineProperty17(this, "elements", void 0);
|
|
62627
|
+
_defineProperty17(this, "layerId", void 0);
|
|
62628
|
+
_defineProperty17(this, "maxIndex", -1);
|
|
62629
|
+
_defineProperty17(this, "hasPermission", void 0);
|
|
62630
|
+
_defineProperty17(this, "shadowEmitter", void 0);
|
|
62631
|
+
_defineProperty17(this, "imageSets", void 0);
|
|
62632
|
+
_defineProperty17(this, "liveCursor", void 0);
|
|
62633
|
+
_defineProperty17(this, "onElementsChange", (event) => {
|
|
62459
62634
|
for (const [key, value] of event.changes.keys.entries()) {
|
|
62460
62635
|
if (value.action === "add") {
|
|
62461
62636
|
const root = this.elements.get(key);
|
|
62462
62637
|
if (root) {
|
|
62463
62638
|
const model = this.convertToModel(root);
|
|
62464
62639
|
if (model) {
|
|
62465
|
-
|
|
62640
|
+
setTimeout(() => {
|
|
62641
|
+
this.emit("elementInsert", [model]);
|
|
62642
|
+
});
|
|
62466
62643
|
}
|
|
62467
62644
|
}
|
|
62468
62645
|
} else if (value.action === "delete") {
|
|
@@ -62470,6 +62647,8 @@ var RenderableModel = class extends EventEmitter {
|
|
|
62470
62647
|
}
|
|
62471
62648
|
}
|
|
62472
62649
|
});
|
|
62650
|
+
this.liveCursor = liveCursor;
|
|
62651
|
+
this.imageSets = imageSets;
|
|
62473
62652
|
this.hasPermission = hasPermission;
|
|
62474
62653
|
this.shadowEmitter = shadowEmitter;
|
|
62475
62654
|
this.layerId = layerId;
|
|
@@ -62508,27 +62687,29 @@ var RenderableModel = class extends EventEmitter {
|
|
|
62508
62687
|
const type = yMap.get("type");
|
|
62509
62688
|
let model = null;
|
|
62510
62689
|
if (type === "curve") {
|
|
62511
|
-
model = new CurveModel(yMap, this.scope);
|
|
62690
|
+
model = new CurveModel(yMap, this.scope, this.liveCursor);
|
|
62512
62691
|
} else if (["ellipse"].indexOf(type) >= 0) {
|
|
62513
|
-
model = new SegmentsModel(yMap, this.scope, type);
|
|
62692
|
+
model = new SegmentsModel(yMap, this.scope, type, this.liveCursor);
|
|
62514
62693
|
} else if (type === "selector") {
|
|
62515
|
-
model = new SelectorModel(yMap, this.scope);
|
|
62694
|
+
model = new SelectorModel(yMap, this.scope, this.liveCursor);
|
|
62516
62695
|
} else if (type === "arrow") {
|
|
62517
|
-
model = new LineModel(yMap, this.scope);
|
|
62696
|
+
model = new LineModel(yMap, this.scope, this.liveCursor);
|
|
62518
62697
|
} else if (type === "line") {
|
|
62519
|
-
model = new StraightLineModel(yMap, this.scope);
|
|
62698
|
+
model = new StraightLineModel(yMap, this.scope, this.liveCursor);
|
|
62520
62699
|
} else if (type === "point-text") {
|
|
62521
|
-
model = new PointTextModel(yMap, this.scope);
|
|
62700
|
+
model = new PointTextModel(yMap, this.scope, this.liveCursor);
|
|
62522
62701
|
} else if (type === "triangle") {
|
|
62523
|
-
model = new TriangleModel(yMap, this.scope);
|
|
62702
|
+
model = new TriangleModel(yMap, this.scope, this.liveCursor);
|
|
62524
62703
|
} else if (type === "rectangle") {
|
|
62525
|
-
model = new RectangleModel(yMap, this.scope);
|
|
62704
|
+
model = new RectangleModel(yMap, this.scope, this.liveCursor);
|
|
62526
62705
|
} else if (type === "eraser") {
|
|
62527
|
-
model = new EraserModel(yMap, this.scope);
|
|
62706
|
+
model = new EraserModel(yMap, this.scope, this.liveCursor);
|
|
62528
62707
|
} else if (type === "laser") {
|
|
62529
|
-
model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, (uuid) => {
|
|
62708
|
+
model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, this.liveCursor, (uuid) => {
|
|
62530
62709
|
this.removeElementItem(uuid);
|
|
62531
62710
|
});
|
|
62711
|
+
} else if (type === "image") {
|
|
62712
|
+
model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor);
|
|
62532
62713
|
}
|
|
62533
62714
|
if (model) {
|
|
62534
62715
|
model.shadowEmitter = this.shadowEmitter;
|
|
@@ -62537,100 +62718,178 @@ var RenderableModel = class extends EventEmitter {
|
|
|
62537
62718
|
return model;
|
|
62538
62719
|
}
|
|
62539
62720
|
initElement(element) {
|
|
62540
|
-
let shadow = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
62541
|
-
if (shadow) {
|
|
62542
|
-
element.shadow = "layer";
|
|
62543
|
-
}
|
|
62544
|
-
element.strokeWidth = this.toolbarModel.strokeWidth;
|
|
62545
|
-
element.strokeColor = this.toolbarModel.strokeColor;
|
|
62546
|
-
element.fillColor = this.toolbarModel.fillColor;
|
|
62547
|
-
element.ownerId = this.userManager.selfId;
|
|
62548
62721
|
element.shadowEmitter = this.shadowEmitter;
|
|
62549
62722
|
}
|
|
62550
62723
|
removeElementItem(uuid) {
|
|
62551
62724
|
this.elements.delete(uuid);
|
|
62552
62725
|
}
|
|
62553
|
-
addElementToDoc(map) {
|
|
62554
|
-
this.elements.doc?.transact(() => {
|
|
62555
|
-
const uuid = this.uuid;
|
|
62556
|
-
map.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62557
|
-
map.set(ElementModel.KEYS.uuid, uuid);
|
|
62558
|
-
this.elements.set(uuid, map);
|
|
62559
|
-
}, elementsUndoOrigin);
|
|
62560
|
-
}
|
|
62561
62726
|
confirmPermission() {
|
|
62562
62727
|
const hasPermission = this.hasPermission(WhiteboardPermissionFlag.draw);
|
|
62563
62728
|
if (!hasPermission) {
|
|
62564
|
-
|
|
62729
|
+
log("[@netless/forge-whiteboard] no permission to draw", {}, "warning");
|
|
62565
62730
|
}
|
|
62566
62731
|
return hasPermission;
|
|
62567
62732
|
}
|
|
62733
|
+
createImage(src) {
|
|
62734
|
+
if (!this.confirmPermission()) {
|
|
62735
|
+
return;
|
|
62736
|
+
}
|
|
62737
|
+
const yMap = new Y12.Map();
|
|
62738
|
+
this.elements.doc?.transact(() => {
|
|
62739
|
+
const uuid = this.uuid;
|
|
62740
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62741
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62742
|
+
yMap.set("type", "image");
|
|
62743
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62744
|
+
this.elements.set(uuid, yMap);
|
|
62745
|
+
}, elementsUndoOrigin);
|
|
62746
|
+
const model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor);
|
|
62747
|
+
model.root.set("src", src);
|
|
62748
|
+
const initMatrix = new this.scope.Matrix();
|
|
62749
|
+
const center = this.scope.project.view.center;
|
|
62750
|
+
initMatrix.translate({
|
|
62751
|
+
x: center.x,
|
|
62752
|
+
y: center.y
|
|
62753
|
+
});
|
|
62754
|
+
model.appendPointsMatrix(initMatrix);
|
|
62755
|
+
model.ownerId = this.userManager.selfId;
|
|
62756
|
+
}
|
|
62568
62757
|
createCurve() {
|
|
62569
62758
|
let shadow = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
62570
62759
|
if (!this.confirmPermission()) {
|
|
62571
62760
|
return null;
|
|
62572
62761
|
}
|
|
62573
|
-
const
|
|
62574
|
-
this.
|
|
62575
|
-
|
|
62762
|
+
const yMap = new Y12.Map();
|
|
62763
|
+
this.elements.doc?.transact(() => {
|
|
62764
|
+
const uuid = this.uuid;
|
|
62765
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62766
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62767
|
+
yMap.set("type", "curve");
|
|
62768
|
+
if (shadow) {
|
|
62769
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
62770
|
+
}
|
|
62771
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
62772
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
62773
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
62774
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62775
|
+
this.elements.set(uuid, yMap);
|
|
62776
|
+
}, elementsUndoOrigin);
|
|
62777
|
+
const curveModel = new CurveModel(yMap, this.scope, this.liveCursor);
|
|
62778
|
+
this.initElement(curveModel);
|
|
62576
62779
|
return curveModel;
|
|
62577
62780
|
}
|
|
62578
62781
|
createLaserPointer() {
|
|
62579
62782
|
if (!this.confirmPermission()) {
|
|
62580
62783
|
return null;
|
|
62581
62784
|
}
|
|
62582
|
-
const
|
|
62785
|
+
const yMap = new Y12.Map();
|
|
62786
|
+
this.elements.doc?.transact(() => {
|
|
62787
|
+
const uuid = this.uuid;
|
|
62788
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62789
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62790
|
+
yMap.set("type", "laser");
|
|
62791
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
62792
|
+
yMap.set(ElementModel.KEYS.strokeWidth, 8);
|
|
62793
|
+
yMap.set(ElementModel.KEYS.strokeColor, "#F44336");
|
|
62794
|
+
yMap.set(ElementModel.KEYS.fillColor, "#F44336");
|
|
62795
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62796
|
+
this.elements.set(uuid, yMap);
|
|
62797
|
+
}, elementsUndoOrigin);
|
|
62798
|
+
const model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, this.liveCursor, (uuid) => {
|
|
62583
62799
|
this.removeElementItem(uuid);
|
|
62584
62800
|
});
|
|
62585
|
-
model.strokeWidth = 8;
|
|
62586
|
-
model.strokeColor = "#F44336";
|
|
62587
|
-
model.fillColor = "#F44336";
|
|
62588
|
-
model.ownerId = this.userManager.selfId;
|
|
62589
|
-
model.shadow = "layer";
|
|
62590
|
-
this.addElementToDoc(model.root);
|
|
62591
62801
|
return model;
|
|
62592
62802
|
}
|
|
62593
62803
|
createEraser() {
|
|
62594
62804
|
if (!this.hasPermission(WhiteboardPermissionFlag.deleteSelf) && !this.hasPermission(WhiteboardPermissionFlag.deleteOthers)) {
|
|
62595
62805
|
return null;
|
|
62596
62806
|
}
|
|
62597
|
-
const
|
|
62598
|
-
|
|
62599
|
-
|
|
62600
|
-
|
|
62601
|
-
|
|
62602
|
-
|
|
62603
|
-
|
|
62807
|
+
const yMap = new Y12.Map();
|
|
62808
|
+
this.elements.doc?.transact(() => {
|
|
62809
|
+
const uuid = this.uuid;
|
|
62810
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62811
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62812
|
+
yMap.set("type", "eraser");
|
|
62813
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
62814
|
+
yMap.set(ElementModel.KEYS.strokeWidth, 4);
|
|
62815
|
+
yMap.set(ElementModel.KEYS.strokeColor, "#9E9E9E");
|
|
62816
|
+
yMap.set(ElementModel.KEYS.fillColor, "#9E9E9E");
|
|
62817
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62818
|
+
this.elements.set(uuid, yMap);
|
|
62819
|
+
}, elementsUndoOrigin);
|
|
62820
|
+
const model = new EraserModel(yMap, this.scope, this.liveCursor);
|
|
62604
62821
|
return model;
|
|
62605
62822
|
}
|
|
62606
62823
|
createTriangle(shadow) {
|
|
62607
62824
|
if (!this.confirmPermission()) {
|
|
62608
62825
|
return null;
|
|
62609
62826
|
}
|
|
62610
|
-
const
|
|
62611
|
-
this.
|
|
62827
|
+
const yMap = new Y12.Map();
|
|
62828
|
+
this.elements.doc?.transact(() => {
|
|
62829
|
+
const uuid = this.uuid;
|
|
62830
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62831
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62832
|
+
yMap.set("type", "triangle");
|
|
62833
|
+
if (shadow) {
|
|
62834
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
62835
|
+
}
|
|
62836
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
62837
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
62838
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
62839
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62840
|
+
this.elements.set(uuid, yMap);
|
|
62841
|
+
}, elementsUndoOrigin);
|
|
62842
|
+
const triangle = new TriangleModel(yMap, this.scope, this.liveCursor);
|
|
62843
|
+
this.initElement(triangle);
|
|
62612
62844
|
triangle.dashArray = this.toolbarModel.dashArray;
|
|
62613
|
-
this.addElementToDoc(triangle.root);
|
|
62614
62845
|
return triangle;
|
|
62615
62846
|
}
|
|
62616
62847
|
createRectangle(shadow) {
|
|
62617
62848
|
if (!this.confirmPermission()) {
|
|
62618
62849
|
return null;
|
|
62619
62850
|
}
|
|
62620
|
-
const
|
|
62621
|
-
this.
|
|
62851
|
+
const yMap = new Y12.Map();
|
|
62852
|
+
this.elements.doc?.transact(() => {
|
|
62853
|
+
const uuid = this.uuid;
|
|
62854
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62855
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62856
|
+
yMap.set("type", "rectangle");
|
|
62857
|
+
if (shadow) {
|
|
62858
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
62859
|
+
}
|
|
62860
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
62861
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
62862
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
62863
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62864
|
+
this.elements.set(uuid, yMap);
|
|
62865
|
+
}, elementsUndoOrigin);
|
|
62866
|
+
const rect = new RectangleModel(yMap, this.scope, this.liveCursor);
|
|
62867
|
+
this.initElement(rect);
|
|
62622
62868
|
rect.dashArray = this.toolbarModel.dashArray;
|
|
62623
|
-
this.addElementToDoc(rect.root);
|
|
62624
62869
|
return rect;
|
|
62625
62870
|
}
|
|
62626
62871
|
createSegmentedPath(type, shadow) {
|
|
62627
62872
|
if (!this.confirmPermission()) {
|
|
62628
62873
|
return null;
|
|
62629
62874
|
}
|
|
62630
|
-
const
|
|
62631
|
-
this.
|
|
62875
|
+
const yMap = new Y12.Map();
|
|
62876
|
+
this.elements.doc?.transact(() => {
|
|
62877
|
+
const uuid = this.uuid;
|
|
62878
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62879
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62880
|
+
yMap.set("type", type);
|
|
62881
|
+
if (shadow) {
|
|
62882
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
62883
|
+
}
|
|
62884
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
62885
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
62886
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
62887
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62888
|
+
this.elements.set(uuid, yMap);
|
|
62889
|
+
}, elementsUndoOrigin);
|
|
62890
|
+
const segmentsModel = new SegmentsModel(yMap, this.scope, type, this.liveCursor);
|
|
62891
|
+
this.initElement(segmentsModel);
|
|
62632
62892
|
segmentsModel.dashArray = this.toolbarModel.dashArray;
|
|
62633
|
-
this.addElementToDoc(segmentsModel.root);
|
|
62634
62893
|
return segmentsModel;
|
|
62635
62894
|
}
|
|
62636
62895
|
createSelector() {
|
|
@@ -62638,41 +62897,92 @@ var RenderableModel = class extends EventEmitter {
|
|
|
62638
62897
|
if (!this.hasPermission(WhiteboardPermissionFlag.editSelf) && !this.hasPermission(WhiteboardPermissionFlag.deleteOthers)) {
|
|
62639
62898
|
return null;
|
|
62640
62899
|
}
|
|
62641
|
-
const
|
|
62900
|
+
const yMap = new Y12.Map();
|
|
62901
|
+
this.elements.doc?.transact(() => {
|
|
62902
|
+
const uuid = this.uuid;
|
|
62903
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62904
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62905
|
+
yMap.set("type", "selector");
|
|
62906
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
62907
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62908
|
+
this.elements.set(uuid, yMap);
|
|
62909
|
+
}, elementsUndoOrigin);
|
|
62910
|
+
const selectorModel = new SelectorModel(yMap, this.scope, this.liveCursor);
|
|
62642
62911
|
selectorModel.shadow = "layer";
|
|
62643
|
-
this.addElementToDoc(selectorModel.root);
|
|
62644
62912
|
return selectorModel;
|
|
62645
62913
|
}
|
|
62646
62914
|
createStraightLine(shadow) {
|
|
62647
62915
|
if (!this.confirmPermission()) {
|
|
62648
62916
|
return null;
|
|
62649
62917
|
}
|
|
62650
|
-
const
|
|
62651
|
-
this.
|
|
62918
|
+
const yMap = new Y12.Map();
|
|
62919
|
+
this.elements.doc?.transact(() => {
|
|
62920
|
+
const uuid = this.uuid;
|
|
62921
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62922
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62923
|
+
yMap.set("type", "line");
|
|
62924
|
+
if (shadow) {
|
|
62925
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
62926
|
+
}
|
|
62927
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
62928
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
62929
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
62930
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62931
|
+
this.elements.set(uuid, yMap);
|
|
62932
|
+
}, elementsUndoOrigin);
|
|
62933
|
+
const straightLineModel = new StraightLineModel(yMap, this.scope, this.liveCursor);
|
|
62934
|
+
this.initElement(straightLineModel);
|
|
62652
62935
|
straightLineModel.dashArray = this.toolbarModel.dashArray;
|
|
62653
|
-
this.addElementToDoc(straightLineModel.root);
|
|
62654
62936
|
return straightLineModel;
|
|
62655
62937
|
}
|
|
62656
62938
|
createLinePath(shadow) {
|
|
62657
62939
|
if (!this.confirmPermission()) {
|
|
62658
62940
|
return null;
|
|
62659
62941
|
}
|
|
62660
|
-
const
|
|
62661
|
-
this.
|
|
62942
|
+
const yMap = new Y12.Map();
|
|
62943
|
+
this.elements.doc?.transact(() => {
|
|
62944
|
+
const uuid = this.uuid;
|
|
62945
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62946
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62947
|
+
yMap.set("type", "arrow");
|
|
62948
|
+
if (shadow) {
|
|
62949
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
62950
|
+
}
|
|
62951
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
62952
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
62953
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
62954
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62955
|
+
this.elements.set(uuid, yMap);
|
|
62956
|
+
}, elementsUndoOrigin);
|
|
62957
|
+
const lineModel = new LineModel(yMap, this.scope, this.liveCursor);
|
|
62958
|
+
this.initElement(lineModel);
|
|
62662
62959
|
lineModel.dashArray = this.toolbarModel.dashArray;
|
|
62663
|
-
this.addElementToDoc(lineModel.root);
|
|
62664
62960
|
return lineModel;
|
|
62665
62961
|
}
|
|
62666
62962
|
createPointText(x, y, shadow) {
|
|
62667
62963
|
if (!this.confirmPermission()) {
|
|
62668
62964
|
return null;
|
|
62669
62965
|
}
|
|
62670
|
-
const
|
|
62966
|
+
const yMap = new Y12.Map();
|
|
62967
|
+
this.elements.doc?.transact(() => {
|
|
62968
|
+
const uuid = this.uuid;
|
|
62969
|
+
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
62970
|
+
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
62971
|
+
yMap.set("type", "point-text");
|
|
62972
|
+
if (shadow) {
|
|
62973
|
+
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
62974
|
+
}
|
|
62975
|
+
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
62976
|
+
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
62977
|
+
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
62978
|
+
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
62979
|
+
this.elements.set(uuid, yMap);
|
|
62980
|
+
}, elementsUndoOrigin);
|
|
62981
|
+
const pointTextModel = new PointTextModel(yMap, this.scope, this.liveCursor);
|
|
62671
62982
|
pointTextModel.setPoints([x, y]);
|
|
62672
62983
|
pointTextModel.fontSize = this.toolbarModel.fontSize;
|
|
62673
62984
|
pointTextModel.fontFamily = this.toolbarModel.fontFamily;
|
|
62674
|
-
this.initElement(pointTextModel
|
|
62675
|
-
this.addElementToDoc(pointTextModel.root);
|
|
62985
|
+
this.initElement(pointTextModel);
|
|
62676
62986
|
return pointTextModel;
|
|
62677
62987
|
}
|
|
62678
62988
|
clearElement() {
|
|
@@ -62690,9 +63000,11 @@ var RenderableModel = class extends EventEmitter {
|
|
|
62690
63000
|
removeIds.forEach((id) => this.elements.delete(id));
|
|
62691
63001
|
});
|
|
62692
63002
|
}
|
|
62693
|
-
dispose() {
|
|
62694
|
-
this.elements
|
|
62695
|
-
|
|
63003
|
+
dispose(clearElements) {
|
|
63004
|
+
removeObserver2(this.elements, this.onElementsChange);
|
|
63005
|
+
if (clearElements) {
|
|
63006
|
+
this.elements.clear();
|
|
63007
|
+
}
|
|
62696
63008
|
Array.from(this.elementModels.values()).forEach((model) => {
|
|
62697
63009
|
model.dispose();
|
|
62698
63010
|
});
|
|
@@ -62915,14 +63227,14 @@ function Distance(p1, p2) {
|
|
|
62915
63227
|
function Deg2Rad(d) {
|
|
62916
63228
|
return d * Math.PI / 180;
|
|
62917
63229
|
}
|
|
62918
|
-
function
|
|
62919
|
-
return (r =
|
|
63230
|
+
function _defineProperty18(e, r, t) {
|
|
63231
|
+
return (r = _toPropertyKey18(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62920
63232
|
}
|
|
62921
|
-
function
|
|
62922
|
-
var i =
|
|
63233
|
+
function _toPropertyKey18(t) {
|
|
63234
|
+
var i = _toPrimitive18(t, "string");
|
|
62923
63235
|
return "symbol" == typeof i ? i : i + "";
|
|
62924
63236
|
}
|
|
62925
|
-
function
|
|
63237
|
+
function _toPrimitive18(t, r) {
|
|
62926
63238
|
if ("object" != typeof t || !t) return t;
|
|
62927
63239
|
var e = t[Symbol.toPrimitive];
|
|
62928
63240
|
if (void 0 !== e) {
|
|
@@ -62934,7 +63246,7 @@ function _toPrimitive17(t, r) {
|
|
|
62934
63246
|
}
|
|
62935
63247
|
var Recognizer = class {
|
|
62936
63248
|
constructor() {
|
|
62937
|
-
|
|
63249
|
+
_defineProperty18(this, "dollar", new DollarRecognizer());
|
|
62938
63250
|
}
|
|
62939
63251
|
recognize(points) {
|
|
62940
63252
|
let minX = Number.MAX_VALUE;
|
|
@@ -62960,14 +63272,14 @@ var Recognizer = class {
|
|
|
62960
63272
|
return null;
|
|
62961
63273
|
}
|
|
62962
63274
|
};
|
|
62963
|
-
function
|
|
62964
|
-
return (r =
|
|
63275
|
+
function _defineProperty19(e, r, t) {
|
|
63276
|
+
return (r = _toPropertyKey19(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62965
63277
|
}
|
|
62966
|
-
function
|
|
62967
|
-
var i =
|
|
63278
|
+
function _toPropertyKey19(t) {
|
|
63279
|
+
var i = _toPrimitive19(t, "string");
|
|
62968
63280
|
return "symbol" == typeof i ? i : i + "";
|
|
62969
63281
|
}
|
|
62970
|
-
function
|
|
63282
|
+
function _toPrimitive19(t, r) {
|
|
62971
63283
|
if ("object" != typeof t || !t) return t;
|
|
62972
63284
|
var e = t[Symbol.toPrimitive];
|
|
62973
63285
|
if (void 0 !== e) {
|
|
@@ -62980,10 +63292,11 @@ function _toPrimitive18(t, r) {
|
|
|
62980
63292
|
var CurveTool = class extends WhiteboardTool {
|
|
62981
63293
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
62982
63294
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
62983
|
-
|
|
62984
|
-
|
|
62985
|
-
|
|
62986
|
-
this
|
|
63295
|
+
_defineProperty19(this, "elementModel", null);
|
|
63296
|
+
_defineProperty19(this, "recognizer", new Recognizer());
|
|
63297
|
+
_defineProperty19(this, "pointCount", 0);
|
|
63298
|
+
_defineProperty19(this, "showLiveCursor", true);
|
|
63299
|
+
this.tool.minDistance = 5;
|
|
62987
63300
|
}
|
|
62988
63301
|
onMouseDown(_event) {
|
|
62989
63302
|
this.pointCount = 0;
|
|
@@ -63047,14 +63360,14 @@ var CurveTool = class extends WhiteboardTool {
|
|
|
63047
63360
|
}
|
|
63048
63361
|
}
|
|
63049
63362
|
};
|
|
63050
|
-
function
|
|
63051
|
-
return (r =
|
|
63363
|
+
function _defineProperty20(e, r, t) {
|
|
63364
|
+
return (r = _toPropertyKey20(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63052
63365
|
}
|
|
63053
|
-
function
|
|
63054
|
-
var i =
|
|
63366
|
+
function _toPropertyKey20(t) {
|
|
63367
|
+
var i = _toPrimitive20(t, "string");
|
|
63055
63368
|
return "symbol" == typeof i ? i : i + "";
|
|
63056
63369
|
}
|
|
63057
|
-
function
|
|
63370
|
+
function _toPrimitive20(t, r) {
|
|
63058
63371
|
if ("object" != typeof t || !t) return t;
|
|
63059
63372
|
var e = t[Symbol.toPrimitive];
|
|
63060
63373
|
if (void 0 !== e) {
|
|
@@ -63067,9 +63380,10 @@ function _toPrimitive19(t, r) {
|
|
|
63067
63380
|
var RectangleTool = class extends WhiteboardTool {
|
|
63068
63381
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
63069
63382
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
63070
|
-
|
|
63071
|
-
|
|
63072
|
-
|
|
63383
|
+
_defineProperty20(this, "elementModel", null);
|
|
63384
|
+
_defineProperty20(this, "from", null);
|
|
63385
|
+
_defineProperty20(this, "to", null);
|
|
63386
|
+
_defineProperty20(this, "showLiveCursor", true);
|
|
63073
63387
|
this.tool.minDistance = 1;
|
|
63074
63388
|
}
|
|
63075
63389
|
onMouseDown(event) {
|
|
@@ -63095,14 +63409,14 @@ var RectangleTool = class extends WhiteboardTool {
|
|
|
63095
63409
|
}
|
|
63096
63410
|
}
|
|
63097
63411
|
};
|
|
63098
|
-
function
|
|
63099
|
-
return (r =
|
|
63412
|
+
function _defineProperty21(e, r, t) {
|
|
63413
|
+
return (r = _toPropertyKey21(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63100
63414
|
}
|
|
63101
|
-
function
|
|
63102
|
-
var i =
|
|
63415
|
+
function _toPropertyKey21(t) {
|
|
63416
|
+
var i = _toPrimitive21(t, "string");
|
|
63103
63417
|
return "symbol" == typeof i ? i : i + "";
|
|
63104
63418
|
}
|
|
63105
|
-
function
|
|
63419
|
+
function _toPrimitive21(t, r) {
|
|
63106
63420
|
if ("object" != typeof t || !t) return t;
|
|
63107
63421
|
var e = t[Symbol.toPrimitive];
|
|
63108
63422
|
if (void 0 !== e) {
|
|
@@ -63166,8 +63480,8 @@ var ToolbarModel = class extends EventEmitter2 {
|
|
|
63166
63480
|
}
|
|
63167
63481
|
constructor(root, defaultStyle) {
|
|
63168
63482
|
super();
|
|
63169
|
-
|
|
63170
|
-
|
|
63483
|
+
_defineProperty21(this, "root", void 0);
|
|
63484
|
+
_defineProperty21(this, "handleRootUpdate", (evt) => {
|
|
63171
63485
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
63172
63486
|
if (Object.keys(TOOLBAR_KEYS).indexOf(key) >= 0 && (value.action === "add" || value.action === "update")) {
|
|
63173
63487
|
this.emit("update", {
|
|
@@ -63191,18 +63505,18 @@ var ToolbarModel = class extends EventEmitter2 {
|
|
|
63191
63505
|
});
|
|
63192
63506
|
}
|
|
63193
63507
|
dispose() {
|
|
63194
|
-
this.root
|
|
63508
|
+
removeObserver3(this.root, this.handleRootUpdate);
|
|
63195
63509
|
this.removeAllListeners();
|
|
63196
63510
|
}
|
|
63197
63511
|
};
|
|
63198
|
-
function
|
|
63199
|
-
return (r =
|
|
63512
|
+
function _defineProperty22(e, r, t) {
|
|
63513
|
+
return (r = _toPropertyKey22(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63200
63514
|
}
|
|
63201
|
-
function
|
|
63202
|
-
var i =
|
|
63515
|
+
function _toPropertyKey22(t) {
|
|
63516
|
+
var i = _toPrimitive22(t, "string");
|
|
63203
63517
|
return "symbol" == typeof i ? i : i + "";
|
|
63204
63518
|
}
|
|
63205
|
-
function
|
|
63519
|
+
function _toPrimitive22(t, r) {
|
|
63206
63520
|
if ("object" != typeof t || !t) return t;
|
|
63207
63521
|
var e = t[Symbol.toPrimitive];
|
|
63208
63522
|
if (void 0 !== e) {
|
|
@@ -63215,11 +63529,12 @@ function _toPrimitive21(t, r) {
|
|
|
63215
63529
|
var SelectorTool = class extends WhiteboardTool {
|
|
63216
63530
|
constructor(enableToolEvent, renderableModel, shadowEmitter, scope, selectElementsModel) {
|
|
63217
63531
|
super(enableToolEvent, renderableModel, shadowEmitter, scope);
|
|
63218
|
-
|
|
63219
|
-
|
|
63220
|
-
|
|
63221
|
-
|
|
63222
|
-
|
|
63532
|
+
_defineProperty22(this, "elementModel", null);
|
|
63533
|
+
_defineProperty22(this, "from", null);
|
|
63534
|
+
_defineProperty22(this, "to", null);
|
|
63535
|
+
_defineProperty22(this, "selectElementsModel", void 0);
|
|
63536
|
+
_defineProperty22(this, "selectElements", /* @__PURE__ */ new Map());
|
|
63537
|
+
_defineProperty22(this, "showLiveCursor", false);
|
|
63223
63538
|
this.selectElementsModel = selectElementsModel;
|
|
63224
63539
|
}
|
|
63225
63540
|
onMouseDown(event) {
|
|
@@ -63283,14 +63598,14 @@ var WhiteboardKeys = {
|
|
|
63283
63598
|
viewMatrix: "viewMatrix",
|
|
63284
63599
|
cameraMode: "cameraMode"
|
|
63285
63600
|
};
|
|
63286
|
-
function
|
|
63287
|
-
return (r =
|
|
63601
|
+
function _defineProperty23(e, r, t) {
|
|
63602
|
+
return (r = _toPropertyKey23(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63288
63603
|
}
|
|
63289
|
-
function
|
|
63290
|
-
var i =
|
|
63604
|
+
function _toPropertyKey23(t) {
|
|
63605
|
+
var i = _toPrimitive23(t, "string");
|
|
63291
63606
|
return "symbol" == typeof i ? i : i + "";
|
|
63292
63607
|
}
|
|
63293
|
-
function
|
|
63608
|
+
function _toPrimitive23(t, r) {
|
|
63294
63609
|
if ("object" != typeof t || !t) return t;
|
|
63295
63610
|
var e = t[Symbol.toPrimitive];
|
|
63296
63611
|
if (void 0 !== e) {
|
|
@@ -63309,28 +63624,28 @@ var SelectElementsModel = class extends EventEmitter3 {
|
|
|
63309
63624
|
}
|
|
63310
63625
|
constructor(userManager, requestUserMap, hasPermission) {
|
|
63311
63626
|
super();
|
|
63312
|
-
|
|
63313
|
-
|
|
63314
|
-
|
|
63315
|
-
|
|
63316
|
-
|
|
63627
|
+
_defineProperty23(this, "requestUserMap", void 0);
|
|
63628
|
+
_defineProperty23(this, "userManager", void 0);
|
|
63629
|
+
_defineProperty23(this, "hasPermission", void 0);
|
|
63630
|
+
_defineProperty23(this, "observers", /* @__PURE__ */ new Map());
|
|
63631
|
+
_defineProperty23(this, "handleUserLeave", (user) => {
|
|
63317
63632
|
const cb = this.observers.get(user.id);
|
|
63318
63633
|
if (cb) {
|
|
63319
|
-
this.requestUserMap(user.id)
|
|
63634
|
+
removeDeepObserver2(this.requestUserMap(user.id), cb);
|
|
63320
63635
|
this.observers.delete(user.id);
|
|
63321
63636
|
}
|
|
63322
63637
|
});
|
|
63323
|
-
|
|
63638
|
+
_defineProperty23(this, "handleUserJoin", (user) => {
|
|
63324
63639
|
const observer = (evts) => {
|
|
63325
63640
|
this.handleUserSelectElementsChange(user.id, evts);
|
|
63326
63641
|
};
|
|
63327
63642
|
if (this.observers.has(user.id)) {
|
|
63328
|
-
this.requestUserMap(user.id)
|
|
63643
|
+
removeDeepObserver2(this.requestUserMap(user.id), this.observers.get(user.id));
|
|
63329
63644
|
}
|
|
63330
63645
|
this.requestUserMap(user.id).observeDeep(observer);
|
|
63331
63646
|
this.observers.set(user.id, observer);
|
|
63332
63647
|
});
|
|
63333
|
-
|
|
63648
|
+
_defineProperty23(this, "handleUserSelectElementsChange", (userId, evts) => {
|
|
63334
63649
|
for (const evt of evts) {
|
|
63335
63650
|
if (evt.target.get("inner-map-id") === WhiteboardKeys.selectElements) {
|
|
63336
63651
|
const elementIds = Array.from(evt.target.keys()).filter((v) => v !== "inner-map-id");
|
|
@@ -63347,7 +63662,7 @@ var SelectElementsModel = class extends EventEmitter3 {
|
|
|
63347
63662
|
this.handleUserSelectElementsChange(userId, evts);
|
|
63348
63663
|
};
|
|
63349
63664
|
if (this.observers.has(userId)) {
|
|
63350
|
-
this.requestUserMap(userId)
|
|
63665
|
+
removeDeepObserver2(this.requestUserMap(userId), this.observers.get(userId));
|
|
63351
63666
|
}
|
|
63352
63667
|
this.requestUserMap(userId).observeDeep(observer);
|
|
63353
63668
|
this.observers.set(userId, observer);
|
|
@@ -63404,21 +63719,21 @@ var SelectElementsModel = class extends EventEmitter3 {
|
|
|
63404
63719
|
}
|
|
63405
63720
|
dispose() {
|
|
63406
63721
|
for (const [key, value] of this.observers.entries()) {
|
|
63407
|
-
this.requestUserMap(key)
|
|
63722
|
+
removeDeepObserver2(this.requestUserMap(key), value);
|
|
63408
63723
|
}
|
|
63409
63724
|
this.observers.clear();
|
|
63410
63725
|
this.userManager.off("leave", this.handleUserLeave);
|
|
63411
63726
|
this.userManager.off("join", this.handleUserJoin);
|
|
63412
63727
|
}
|
|
63413
63728
|
};
|
|
63414
|
-
function
|
|
63415
|
-
return (r =
|
|
63729
|
+
function _defineProperty24(e, r, t) {
|
|
63730
|
+
return (r = _toPropertyKey24(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63416
63731
|
}
|
|
63417
|
-
function
|
|
63418
|
-
var i =
|
|
63732
|
+
function _toPropertyKey24(t) {
|
|
63733
|
+
var i = _toPrimitive24(t, "string");
|
|
63419
63734
|
return "symbol" == typeof i ? i : i + "";
|
|
63420
63735
|
}
|
|
63421
|
-
function
|
|
63736
|
+
function _toPrimitive24(t, r) {
|
|
63422
63737
|
if ("object" != typeof t || !t) return t;
|
|
63423
63738
|
var e = t[Symbol.toPrimitive];
|
|
63424
63739
|
if (void 0 !== e) {
|
|
@@ -63431,28 +63746,28 @@ function _toPrimitive23(t, r) {
|
|
|
63431
63746
|
var TextEditor = class extends EventEmitter4 {
|
|
63432
63747
|
constructor(camera) {
|
|
63433
63748
|
super();
|
|
63434
|
-
|
|
63435
|
-
|
|
63436
|
-
|
|
63437
|
-
|
|
63438
|
-
|
|
63439
|
-
|
|
63440
|
-
|
|
63441
|
-
|
|
63749
|
+
_defineProperty24(this, "rootView", void 0);
|
|
63750
|
+
_defineProperty24(this, "content", void 0);
|
|
63751
|
+
_defineProperty24(this, "camera", void 0);
|
|
63752
|
+
_defineProperty24(this, "originX", 0);
|
|
63753
|
+
_defineProperty24(this, "originY", 0);
|
|
63754
|
+
_defineProperty24(this, "rotation", 0);
|
|
63755
|
+
_defineProperty24(this, "scale", 1);
|
|
63756
|
+
_defineProperty24(this, "handleContentInput", () => {
|
|
63442
63757
|
this.emit("change", this.content.textContent ?? "");
|
|
63443
63758
|
this.translateCaretIntoView();
|
|
63444
63759
|
});
|
|
63445
|
-
|
|
63760
|
+
_defineProperty24(this, "handleContentKeydown", (evt) => {
|
|
63446
63761
|
if (/^Arrow/.test(evt.key)) {
|
|
63447
63762
|
setTimeout(() => {
|
|
63448
63763
|
this.translateCaretIntoView();
|
|
63449
63764
|
}, 50);
|
|
63450
63765
|
}
|
|
63451
63766
|
});
|
|
63452
|
-
|
|
63767
|
+
_defineProperty24(this, "handleContentBlur", () => {
|
|
63453
63768
|
this.emit("done", this.content.textContent ?? "");
|
|
63454
63769
|
});
|
|
63455
|
-
|
|
63770
|
+
_defineProperty24(this, "handleRootClick", (evt) => {
|
|
63456
63771
|
if (evt.target === this.rootView) {
|
|
63457
63772
|
evt.stopPropagation();
|
|
63458
63773
|
evt.preventDefault();
|
|
@@ -63542,14 +63857,14 @@ var TextEditor = class extends EventEmitter4 {
|
|
|
63542
63857
|
this.rootView.removeEventListener("pointerdown", this.handleRootClick);
|
|
63543
63858
|
}
|
|
63544
63859
|
};
|
|
63545
|
-
function
|
|
63546
|
-
return (r =
|
|
63860
|
+
function _defineProperty25(e, r, t) {
|
|
63861
|
+
return (r = _toPropertyKey25(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63547
63862
|
}
|
|
63548
|
-
function
|
|
63549
|
-
var i =
|
|
63863
|
+
function _toPropertyKey25(t) {
|
|
63864
|
+
var i = _toPrimitive25(t, "string");
|
|
63550
63865
|
return "symbol" == typeof i ? i : i + "";
|
|
63551
63866
|
}
|
|
63552
|
-
function
|
|
63867
|
+
function _toPrimitive25(t, r) {
|
|
63553
63868
|
if ("object" != typeof t || !t) return t;
|
|
63554
63869
|
var e = t[Symbol.toPrimitive];
|
|
63555
63870
|
if (void 0 !== e) {
|
|
@@ -63584,12 +63899,12 @@ var Bounds = class extends EventEmitter5 {
|
|
|
63584
63899
|
}
|
|
63585
63900
|
constructor(binding, scope) {
|
|
63586
63901
|
super();
|
|
63587
|
-
|
|
63588
|
-
|
|
63589
|
-
|
|
63590
|
-
|
|
63591
|
-
|
|
63592
|
-
|
|
63902
|
+
_defineProperty25(this, "minX", 0);
|
|
63903
|
+
_defineProperty25(this, "minY", 0);
|
|
63904
|
+
_defineProperty25(this, "maxX", 0);
|
|
63905
|
+
_defineProperty25(this, "maxY", 0);
|
|
63906
|
+
_defineProperty25(this, "binding", void 0);
|
|
63907
|
+
_defineProperty25(this, "scope", void 0);
|
|
63593
63908
|
this.binding = binding;
|
|
63594
63909
|
this.scope = scope;
|
|
63595
63910
|
}
|
|
@@ -63711,32 +64026,32 @@ var Bounds = class extends EventEmitter5 {
|
|
|
63711
64026
|
var Editor = class extends EventEmitter5 {
|
|
63712
64027
|
constructor(scope, shadowScope, shadowEmitter, canvasElement, camera, initConfig) {
|
|
63713
64028
|
super();
|
|
63714
|
-
|
|
63715
|
-
|
|
63716
|
-
|
|
63717
|
-
|
|
63718
|
-
|
|
63719
|
-
|
|
63720
|
-
|
|
63721
|
-
|
|
63722
|
-
|
|
63723
|
-
|
|
63724
|
-
|
|
63725
|
-
|
|
63726
|
-
|
|
63727
|
-
|
|
63728
|
-
|
|
63729
|
-
|
|
63730
|
-
|
|
63731
|
-
|
|
63732
|
-
|
|
63733
|
-
|
|
63734
|
-
|
|
63735
|
-
|
|
63736
|
-
|
|
63737
|
-
|
|
63738
|
-
|
|
63739
|
-
|
|
64029
|
+
_defineProperty25(this, "rootView", void 0);
|
|
64030
|
+
_defineProperty25(this, "frame", void 0);
|
|
64031
|
+
_defineProperty25(this, "rotator", void 0);
|
|
64032
|
+
_defineProperty25(this, "scope", void 0);
|
|
64033
|
+
_defineProperty25(this, "shadowScope", void 0);
|
|
64034
|
+
_defineProperty25(this, "shadowContainer", void 0);
|
|
64035
|
+
_defineProperty25(this, "ctrlUserMap", void 0);
|
|
64036
|
+
_defineProperty25(this, "viewerId", void 0);
|
|
64037
|
+
_defineProperty25(this, "ctrlId", void 0);
|
|
64038
|
+
_defineProperty25(this, "ctrlNickName", void 0);
|
|
64039
|
+
_defineProperty25(this, "editMode", null);
|
|
64040
|
+
_defineProperty25(this, "editCtrlName", null);
|
|
64041
|
+
_defineProperty25(this, "editAnchor", null);
|
|
64042
|
+
_defineProperty25(this, "lastEditPoint", null);
|
|
64043
|
+
_defineProperty25(this, "bounds", void 0);
|
|
64044
|
+
_defineProperty25(this, "targets", []);
|
|
64045
|
+
_defineProperty25(this, "editorConfig", null);
|
|
64046
|
+
_defineProperty25(this, "aspectRatio", -1);
|
|
64047
|
+
_defineProperty25(this, "uniformScale", false);
|
|
64048
|
+
_defineProperty25(this, "camera", void 0);
|
|
64049
|
+
_defineProperty25(this, "canvasElement", void 0);
|
|
64050
|
+
_defineProperty25(this, "resizeObserver", void 0);
|
|
64051
|
+
_defineProperty25(this, "anchors", []);
|
|
64052
|
+
_defineProperty25(this, "title", null);
|
|
64053
|
+
_defineProperty25(this, "shadowEmitter", void 0);
|
|
64054
|
+
_defineProperty25(this, "handleMatrix", (matrix) => {
|
|
63740
64055
|
if (this.shadowContainer) {
|
|
63741
64056
|
const next = matrix.appended(this.shadowContainer.data.shadowMatrix ?? new this.shadowScope.Matrix());
|
|
63742
64057
|
this.shadowContainer.data.shadowMatrix = next;
|
|
@@ -63746,7 +64061,7 @@ var Editor = class extends EventEmitter5 {
|
|
|
63746
64061
|
this.targets.forEach((target) => target.appendPointsMatrix(matrix));
|
|
63747
64062
|
}
|
|
63748
64063
|
});
|
|
63749
|
-
|
|
64064
|
+
_defineProperty25(this, "handlePointerDown", (evt) => {
|
|
63750
64065
|
if (!evt.target) {
|
|
63751
64066
|
return;
|
|
63752
64067
|
}
|
|
@@ -63802,7 +64117,7 @@ var Editor = class extends EventEmitter5 {
|
|
|
63802
64117
|
};
|
|
63803
64118
|
}
|
|
63804
64119
|
});
|
|
63805
|
-
|
|
64120
|
+
_defineProperty25(this, "handlePointerMove", (evt) => {
|
|
63806
64121
|
evt.preventDefault();
|
|
63807
64122
|
if (!evt.target) {
|
|
63808
64123
|
return;
|
|
@@ -63853,7 +64168,7 @@ var Editor = class extends EventEmitter5 {
|
|
|
63853
64168
|
}
|
|
63854
64169
|
}
|
|
63855
64170
|
});
|
|
63856
|
-
|
|
64171
|
+
_defineProperty25(this, "handlePointerUp", (evt) => {
|
|
63857
64172
|
evt.preventDefault();
|
|
63858
64173
|
this.resetShadow();
|
|
63859
64174
|
this.shadowEmitter.setActive(false);
|
|
@@ -63870,7 +64185,7 @@ var Editor = class extends EventEmitter5 {
|
|
|
63870
64185
|
this.lastEditPoint = null;
|
|
63871
64186
|
this.uniformScale = false;
|
|
63872
64187
|
});
|
|
63873
|
-
|
|
64188
|
+
_defineProperty25(this, "handleFrameDBClick", (evt) => {
|
|
63874
64189
|
if (evt.target === this.frame && this.targets.length === 1) {
|
|
63875
64190
|
if (this.targets[0].type === "point-text") {
|
|
63876
64191
|
this.frame.style.display = "none";
|
|
@@ -63878,7 +64193,7 @@ var Editor = class extends EventEmitter5 {
|
|
|
63878
64193
|
}
|
|
63879
64194
|
}
|
|
63880
64195
|
});
|
|
63881
|
-
|
|
64196
|
+
_defineProperty25(this, "updateBounds", () => {
|
|
63882
64197
|
let minX = Number.MAX_VALUE;
|
|
63883
64198
|
let maxX = -Number.MAX_VALUE;
|
|
63884
64199
|
let minY = Number.MAX_VALUE;
|
|
@@ -63911,7 +64226,7 @@ var Editor = class extends EventEmitter5 {
|
|
|
63911
64226
|
this.ctrlId = initConfig.ctrlId;
|
|
63912
64227
|
this.ctrlNickName = initConfig.ctrlNickName;
|
|
63913
64228
|
this.rootView = document.createElement("div");
|
|
63914
|
-
this.rootView.style.cssText = "position:absolute;display:none;width:100%;height:100%;top:50%;left:50%;transform:translate(-50%,-50%);";
|
|
64229
|
+
this.rootView.style.cssText = "overflow:hidden;position:absolute;display:none;width:100%;height:100%;top:50%;left:50%;transform:translate(-50%,-50%);";
|
|
63915
64230
|
this.frame = document.createElement("div");
|
|
63916
64231
|
this.frame.style.position = "absolute";
|
|
63917
64232
|
this.frame.style.padding = "8px";
|
|
@@ -64128,14 +64443,14 @@ var Editor = class extends EventEmitter5 {
|
|
|
64128
64443
|
this.resizeObserver.disconnect();
|
|
64129
64444
|
}
|
|
64130
64445
|
};
|
|
64131
|
-
function
|
|
64132
|
-
return (r =
|
|
64446
|
+
function _defineProperty26(e, r, t) {
|
|
64447
|
+
return (r = _toPropertyKey26(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64133
64448
|
}
|
|
64134
|
-
function
|
|
64135
|
-
var i =
|
|
64449
|
+
function _toPropertyKey26(t) {
|
|
64450
|
+
var i = _toPrimitive26(t, "string");
|
|
64136
64451
|
return "symbol" == typeof i ? i : i + "";
|
|
64137
64452
|
}
|
|
64138
|
-
function
|
|
64453
|
+
function _toPrimitive26(t, r) {
|
|
64139
64454
|
if ("object" != typeof t || !t) return t;
|
|
64140
64455
|
var e = t[Symbol.toPrimitive];
|
|
64141
64456
|
if (void 0 !== e) {
|
|
@@ -64148,13 +64463,14 @@ function _toPrimitive25(t, r) {
|
|
|
64148
64463
|
var TextTool = class extends WhiteboardTool {
|
|
64149
64464
|
constructor(enableToolEvent, model, shadowEmitter, scope, rootView, canvasElement, toolbarModel, camera) {
|
|
64150
64465
|
super(enableToolEvent, model, shadowEmitter, scope);
|
|
64151
|
-
|
|
64152
|
-
|
|
64153
|
-
|
|
64154
|
-
|
|
64155
|
-
|
|
64156
|
-
|
|
64157
|
-
|
|
64466
|
+
_defineProperty26(this, "from", null);
|
|
64467
|
+
_defineProperty26(this, "to", null);
|
|
64468
|
+
_defineProperty26(this, "rootView", void 0);
|
|
64469
|
+
_defineProperty26(this, "canvasElement", void 0);
|
|
64470
|
+
_defineProperty26(this, "elementModel", null);
|
|
64471
|
+
_defineProperty26(this, "toolbarModel", void 0);
|
|
64472
|
+
_defineProperty26(this, "camera", void 0);
|
|
64473
|
+
_defineProperty26(this, "showLiveCursor", false);
|
|
64158
64474
|
this.rootView = rootView;
|
|
64159
64475
|
this.canvasElement = canvasElement;
|
|
64160
64476
|
this.toolbarModel = toolbarModel;
|
|
@@ -64216,14 +64532,14 @@ var TextTool = class extends WhiteboardTool {
|
|
|
64216
64532
|
}, 30);
|
|
64217
64533
|
}
|
|
64218
64534
|
};
|
|
64219
|
-
function
|
|
64220
|
-
return (r =
|
|
64535
|
+
function _defineProperty27(e, r, t) {
|
|
64536
|
+
return (r = _toPropertyKey27(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64221
64537
|
}
|
|
64222
|
-
function
|
|
64223
|
-
var i =
|
|
64538
|
+
function _toPropertyKey27(t) {
|
|
64539
|
+
var i = _toPrimitive27(t, "string");
|
|
64224
64540
|
return "symbol" == typeof i ? i : i + "";
|
|
64225
64541
|
}
|
|
64226
|
-
function
|
|
64542
|
+
function _toPrimitive27(t, r) {
|
|
64227
64543
|
if ("object" != typeof t || !t) return t;
|
|
64228
64544
|
var e = t[Symbol.toPrimitive];
|
|
64229
64545
|
if (void 0 !== e) {
|
|
@@ -64236,11 +64552,11 @@ function _toPrimitive26(t, r) {
|
|
|
64236
64552
|
var Gesture = class extends EventEmitter6 {
|
|
64237
64553
|
constructor(element, scope) {
|
|
64238
64554
|
super();
|
|
64239
|
-
|
|
64240
|
-
|
|
64241
|
-
|
|
64242
|
-
|
|
64243
|
-
|
|
64555
|
+
_defineProperty27(this, "element", void 0);
|
|
64556
|
+
_defineProperty27(this, "scope", void 0);
|
|
64557
|
+
_defineProperty27(this, "lastVector", null);
|
|
64558
|
+
_defineProperty27(this, "lastPoint", null);
|
|
64559
|
+
_defineProperty27(this, "onTouchStart", (evt) => {
|
|
64244
64560
|
if (evt.touches.length > 1) {
|
|
64245
64561
|
evt.preventDefault();
|
|
64246
64562
|
evt.stopPropagation();
|
|
@@ -64253,7 +64569,7 @@ var Gesture = class extends EventEmitter6 {
|
|
|
64253
64569
|
this.lastVector = p2.subtract(p1);
|
|
64254
64570
|
this.lastPoint = p1;
|
|
64255
64571
|
});
|
|
64256
|
-
|
|
64572
|
+
_defineProperty27(this, "onTouchMove", (evt) => {
|
|
64257
64573
|
if (this.lastVector && this.lastPoint && evt.touches.length === 2) {
|
|
64258
64574
|
evt.preventDefault();
|
|
64259
64575
|
evt.stopPropagation();
|
|
@@ -64284,7 +64600,7 @@ var Gesture = class extends EventEmitter6 {
|
|
|
64284
64600
|
this.lastPoint = null;
|
|
64285
64601
|
}
|
|
64286
64602
|
});
|
|
64287
|
-
|
|
64603
|
+
_defineProperty27(this, "onTouchEnd", () => {
|
|
64288
64604
|
this.lastVector = null;
|
|
64289
64605
|
this.lastPoint = null;
|
|
64290
64606
|
});
|
|
@@ -64295,14 +64611,14 @@ var Gesture = class extends EventEmitter6 {
|
|
|
64295
64611
|
this.element.addEventListener("touchend", this.onTouchEnd);
|
|
64296
64612
|
}
|
|
64297
64613
|
};
|
|
64298
|
-
function
|
|
64299
|
-
return (r =
|
|
64614
|
+
function _defineProperty28(e, r, t) {
|
|
64615
|
+
return (r = _toPropertyKey28(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64300
64616
|
}
|
|
64301
|
-
function
|
|
64302
|
-
var i =
|
|
64617
|
+
function _toPropertyKey28(t) {
|
|
64618
|
+
var i = _toPrimitive28(t, "string");
|
|
64303
64619
|
return "symbol" == typeof i ? i : i + "";
|
|
64304
64620
|
}
|
|
64305
|
-
function
|
|
64621
|
+
function _toPrimitive28(t, r) {
|
|
64306
64622
|
if ("object" != typeof t || !t) return t;
|
|
64307
64623
|
var e = t[Symbol.toPrimitive];
|
|
64308
64624
|
if (void 0 !== e) {
|
|
@@ -64324,31 +64640,31 @@ var Camera = class extends EventEmitter7 {
|
|
|
64324
64640
|
}
|
|
64325
64641
|
constructor(initSize, maxScale, dom, userManager, scope, whiteboardAttrsMap, hasPermission, requestUserMap, _paperSize, _domSize) {
|
|
64326
64642
|
super();
|
|
64327
|
-
|
|
64328
|
-
|
|
64329
|
-
|
|
64330
|
-
|
|
64643
|
+
_defineProperty28(this, "scope", void 0);
|
|
64644
|
+
_defineProperty28(this, "dom", void 0);
|
|
64645
|
+
_defineProperty28(this, "lastTriggerTime", 0);
|
|
64646
|
+
_defineProperty28(this, "lastDelta", {
|
|
64331
64647
|
x: 0,
|
|
64332
64648
|
y: 0
|
|
64333
64649
|
});
|
|
64334
|
-
|
|
64335
|
-
|
|
64336
|
-
|
|
64337
|
-
|
|
64338
|
-
|
|
64339
|
-
|
|
64340
|
-
|
|
64341
|
-
|
|
64342
|
-
|
|
64343
|
-
|
|
64344
|
-
|
|
64345
|
-
|
|
64346
|
-
|
|
64347
|
-
|
|
64348
|
-
|
|
64349
|
-
|
|
64350
|
-
|
|
64351
|
-
|
|
64650
|
+
_defineProperty28(this, "requestUserMap", void 0);
|
|
64651
|
+
_defineProperty28(this, "userManager", void 0);
|
|
64652
|
+
_defineProperty28(this, "observers", /* @__PURE__ */ new Map());
|
|
64653
|
+
_defineProperty28(this, "whiteboardAttrsMap", void 0);
|
|
64654
|
+
_defineProperty28(this, "paperSize", void 0);
|
|
64655
|
+
_defineProperty28(this, "domSize", void 0);
|
|
64656
|
+
_defineProperty28(this, "hasPermission", void 0);
|
|
64657
|
+
_defineProperty28(this, "gesture", void 0);
|
|
64658
|
+
_defineProperty28(this, "inherentScale", 1);
|
|
64659
|
+
_defineProperty28(this, "maxScale", void 0);
|
|
64660
|
+
_defineProperty28(this, "initSize", void 0);
|
|
64661
|
+
_defineProperty28(this, "bound", void 0);
|
|
64662
|
+
_defineProperty28(this, "boundTiemoutId", void 0);
|
|
64663
|
+
_defineProperty28(this, "enableByMouse", true);
|
|
64664
|
+
_defineProperty28(this, "enableByTouch", true);
|
|
64665
|
+
_defineProperty28(this, "boundaryColor", "#F44336");
|
|
64666
|
+
_defineProperty28(this, "enableBoundaryHighlight", true);
|
|
64667
|
+
_defineProperty28(this, "handleMainCameraChange", (evt) => {
|
|
64352
64668
|
const userMap = this.requestUserMap(this.userManager.selfId);
|
|
64353
64669
|
const cameraMode = userMap.get(WhiteboardKeys.cameraMode);
|
|
64354
64670
|
if (cameraMode !== "main") {
|
|
@@ -64365,23 +64681,23 @@ var Camera = class extends EventEmitter7 {
|
|
|
64365
64681
|
}
|
|
64366
64682
|
}
|
|
64367
64683
|
});
|
|
64368
|
-
|
|
64684
|
+
_defineProperty28(this, "handleUserLeave", (user) => {
|
|
64369
64685
|
const cb = this.observers.get(user.id);
|
|
64370
64686
|
if (cb) {
|
|
64371
|
-
this.requestUserMap(user.id)
|
|
64687
|
+
removeObserver4(this.requestUserMap(user.id), cb);
|
|
64372
64688
|
}
|
|
64373
64689
|
});
|
|
64374
|
-
|
|
64690
|
+
_defineProperty28(this, "handleUserJoin", (user) => {
|
|
64375
64691
|
const observer = (evt) => {
|
|
64376
64692
|
this.handleViewMatrixUpdate(user.id, evt);
|
|
64377
64693
|
};
|
|
64378
64694
|
if (this.observers.has(user.id)) {
|
|
64379
|
-
this.requestUserMap(user.id)
|
|
64695
|
+
removeObserver4(this.requestUserMap(user.id), observer);
|
|
64380
64696
|
}
|
|
64381
64697
|
this.requestUserMap(user.id).observe(observer);
|
|
64382
64698
|
this.observers.set(user.id, observer);
|
|
64383
64699
|
});
|
|
64384
|
-
|
|
64700
|
+
_defineProperty28(this, "handleViewMatrixUpdate", (userId, evt) => {
|
|
64385
64701
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
64386
64702
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
64387
64703
|
if (value.action === "update") {
|
|
@@ -64408,7 +64724,7 @@ var Camera = class extends EventEmitter7 {
|
|
|
64408
64724
|
}
|
|
64409
64725
|
}
|
|
64410
64726
|
});
|
|
64411
|
-
|
|
64727
|
+
_defineProperty28(this, "handleWheel", (evt) => {
|
|
64412
64728
|
if (!this.enableByMouse) {
|
|
64413
64729
|
return;
|
|
64414
64730
|
}
|
|
@@ -64483,7 +64799,7 @@ var Camera = class extends EventEmitter7 {
|
|
|
64483
64799
|
this.handleViewMatrixUpdate(userId, evt);
|
|
64484
64800
|
};
|
|
64485
64801
|
if (this.observers.has(userId)) {
|
|
64486
|
-
this.requestUserMap(userId)
|
|
64802
|
+
removeObserver4(this.requestUserMap(userId), observer);
|
|
64487
64803
|
}
|
|
64488
64804
|
this.requestUserMap(userId).observe(observer);
|
|
64489
64805
|
this.observers.set(userId, observer);
|
|
@@ -64680,24 +64996,24 @@ var Camera = class extends EventEmitter7 {
|
|
|
64680
64996
|
Array.from(this.observers.keys()).forEach((userId) => {
|
|
64681
64997
|
const cb = this.observers.get(userId);
|
|
64682
64998
|
if (cb) {
|
|
64683
|
-
this.requestUserMap(userId)
|
|
64999
|
+
removeObserver4(this.requestUserMap(userId), cb);
|
|
64684
65000
|
}
|
|
64685
65001
|
});
|
|
64686
|
-
this.whiteboardAttrsMap
|
|
65002
|
+
removeObserver4(this.whiteboardAttrsMap, this.handleMainCameraChange);
|
|
64687
65003
|
this.userManager.off("join", this.handleUserJoin);
|
|
64688
65004
|
this.userManager.off("leave", this.handleUserLeave);
|
|
64689
65005
|
this.gesture.removeAllListeners();
|
|
64690
65006
|
this.removeAllListeners();
|
|
64691
65007
|
}
|
|
64692
65008
|
};
|
|
64693
|
-
function
|
|
64694
|
-
return (r =
|
|
65009
|
+
function _defineProperty29(e, r, t) {
|
|
65010
|
+
return (r = _toPropertyKey29(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64695
65011
|
}
|
|
64696
|
-
function
|
|
64697
|
-
var i =
|
|
65012
|
+
function _toPropertyKey29(t) {
|
|
65013
|
+
var i = _toPrimitive29(t, "string");
|
|
64698
65014
|
return "symbol" == typeof i ? i : i + "";
|
|
64699
65015
|
}
|
|
64700
|
-
function
|
|
65016
|
+
function _toPrimitive29(t, r) {
|
|
64701
65017
|
if ("object" != typeof t || !t) return t;
|
|
64702
65018
|
var e = t[Symbol.toPrimitive];
|
|
64703
65019
|
if (void 0 !== e) {
|
|
@@ -64710,9 +65026,10 @@ function _toPrimitive28(t, r) {
|
|
|
64710
65026
|
var EllipseTool = class extends WhiteboardTool {
|
|
64711
65027
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
64712
65028
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
64713
|
-
|
|
64714
|
-
|
|
64715
|
-
|
|
65029
|
+
_defineProperty29(this, "elementModel", null);
|
|
65030
|
+
_defineProperty29(this, "from", null);
|
|
65031
|
+
_defineProperty29(this, "to", null);
|
|
65032
|
+
_defineProperty29(this, "showLiveCursor", true);
|
|
64716
65033
|
this.tool.minDistance = 1;
|
|
64717
65034
|
}
|
|
64718
65035
|
onMouseDown(event) {
|
|
@@ -64742,14 +65059,14 @@ var EllipseTool = class extends WhiteboardTool {
|
|
|
64742
65059
|
}
|
|
64743
65060
|
}
|
|
64744
65061
|
};
|
|
64745
|
-
function
|
|
64746
|
-
return (r =
|
|
65062
|
+
function _defineProperty30(e, r, t) {
|
|
65063
|
+
return (r = _toPropertyKey30(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64747
65064
|
}
|
|
64748
|
-
function
|
|
64749
|
-
var i =
|
|
65065
|
+
function _toPropertyKey30(t) {
|
|
65066
|
+
var i = _toPrimitive30(t, "string");
|
|
64750
65067
|
return "symbol" == typeof i ? i : i + "";
|
|
64751
65068
|
}
|
|
64752
|
-
function
|
|
65069
|
+
function _toPrimitive30(t, r) {
|
|
64753
65070
|
if ("object" != typeof t || !t) return t;
|
|
64754
65071
|
var e = t[Symbol.toPrimitive];
|
|
64755
65072
|
if (void 0 !== e) {
|
|
@@ -64762,9 +65079,10 @@ function _toPrimitive29(t, r) {
|
|
|
64762
65079
|
var TriangleTool = class extends WhiteboardTool {
|
|
64763
65080
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
64764
65081
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
64765
|
-
|
|
64766
|
-
|
|
64767
|
-
|
|
65082
|
+
_defineProperty30(this, "elementModel", null);
|
|
65083
|
+
_defineProperty30(this, "from", null);
|
|
65084
|
+
_defineProperty30(this, "to", null);
|
|
65085
|
+
_defineProperty30(this, "showLiveCursor", true);
|
|
64768
65086
|
this.tool.minDistance = 1;
|
|
64769
65087
|
}
|
|
64770
65088
|
onMouseDown(event) {
|
|
@@ -64790,14 +65108,14 @@ var TriangleTool = class extends WhiteboardTool {
|
|
|
64790
65108
|
}
|
|
64791
65109
|
}
|
|
64792
65110
|
};
|
|
64793
|
-
function
|
|
64794
|
-
return (r =
|
|
65111
|
+
function _defineProperty31(e, r, t) {
|
|
65112
|
+
return (r = _toPropertyKey31(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64795
65113
|
}
|
|
64796
|
-
function
|
|
64797
|
-
var i =
|
|
65114
|
+
function _toPropertyKey31(t) {
|
|
65115
|
+
var i = _toPrimitive31(t, "string");
|
|
64798
65116
|
return "symbol" == typeof i ? i : i + "";
|
|
64799
65117
|
}
|
|
64800
|
-
function
|
|
65118
|
+
function _toPrimitive31(t, r) {
|
|
64801
65119
|
if ("object" != typeof t || !t) return t;
|
|
64802
65120
|
var e = t[Symbol.toPrimitive];
|
|
64803
65121
|
if (void 0 !== e) {
|
|
@@ -64808,62 +65126,65 @@ function _toPrimitive30(t, r) {
|
|
|
64808
65126
|
return ("string" === r ? String : Number)(t);
|
|
64809
65127
|
}
|
|
64810
65128
|
var Whiteboard = class extends EventEmitter8 {
|
|
64811
|
-
// public insertImage!: (src: string) => void;
|
|
64812
65129
|
constructor(view) {
|
|
64813
65130
|
super();
|
|
64814
|
-
|
|
64815
|
-
|
|
64816
|
-
|
|
64817
|
-
|
|
64818
|
-
|
|
64819
|
-
|
|
64820
|
-
|
|
64821
|
-
|
|
64822
|
-
|
|
64823
|
-
|
|
64824
|
-
|
|
64825
|
-
|
|
64826
|
-
|
|
64827
|
-
|
|
64828
|
-
|
|
64829
|
-
|
|
64830
|
-
|
|
64831
|
-
|
|
64832
|
-
|
|
64833
|
-
|
|
64834
|
-
|
|
64835
|
-
|
|
64836
|
-
|
|
64837
|
-
|
|
64838
|
-
|
|
64839
|
-
|
|
64840
|
-
|
|
64841
|
-
|
|
64842
|
-
|
|
64843
|
-
|
|
64844
|
-
|
|
64845
|
-
|
|
64846
|
-
|
|
64847
|
-
|
|
64848
|
-
|
|
64849
|
-
|
|
64850
|
-
|
|
64851
|
-
|
|
64852
|
-
|
|
64853
|
-
|
|
64854
|
-
|
|
64855
|
-
|
|
65131
|
+
_defineProperty31(this, "view", void 0);
|
|
65132
|
+
_defineProperty31(this, "selfUserId", void 0);
|
|
65133
|
+
_defineProperty31(this, "permissions", void 0);
|
|
65134
|
+
_defineProperty31(this, "tool", void 0);
|
|
65135
|
+
_defineProperty31(this, "fontSize", void 0);
|
|
65136
|
+
_defineProperty31(this, "dashArray", void 0);
|
|
65137
|
+
_defineProperty31(this, "fontFamily", void 0);
|
|
65138
|
+
_defineProperty31(this, "strokeColor", void 0);
|
|
65139
|
+
_defineProperty31(this, "fillColor", void 0);
|
|
65140
|
+
_defineProperty31(this, "strokeWidth", void 0);
|
|
65141
|
+
_defineProperty31(this, "enableCameraByMouse", void 0);
|
|
65142
|
+
_defineProperty31(this, "enableCameraByTouch", void 0);
|
|
65143
|
+
_defineProperty31(this, "cameraBoundaryColor", void 0);
|
|
65144
|
+
_defineProperty31(this, "enableCameraBoundaryHighlight", void 0);
|
|
65145
|
+
_defineProperty31(this, "getElementAttribute", void 0);
|
|
65146
|
+
_defineProperty31(this, "setElementAttribute", void 0);
|
|
65147
|
+
_defineProperty31(this, "removeElement", void 0);
|
|
65148
|
+
_defineProperty31(this, "getCurrentTool", void 0);
|
|
65149
|
+
_defineProperty31(this, "setCurrentTool", void 0);
|
|
65150
|
+
_defineProperty31(this, "setCanvasBackgroundColor", void 0);
|
|
65151
|
+
_defineProperty31(this, "setThemeColor", void 0);
|
|
65152
|
+
_defineProperty31(this, "gotoPage", void 0);
|
|
65153
|
+
_defineProperty31(this, "addPage", void 0);
|
|
65154
|
+
_defineProperty31(this, "deletePage", void 0);
|
|
65155
|
+
_defineProperty31(this, "pageList", void 0);
|
|
65156
|
+
_defineProperty31(this, "currentPageId", void 0);
|
|
65157
|
+
_defineProperty31(this, "clonePage", void 0);
|
|
65158
|
+
_defineProperty31(this, "clearPage", void 0);
|
|
65159
|
+
_defineProperty31(this, "translateCamera", void 0);
|
|
65160
|
+
_defineProperty31(this, "scaleCamera", void 0);
|
|
65161
|
+
_defineProperty31(this, "resetCamera", void 0);
|
|
65162
|
+
_defineProperty31(this, "showLiveCursor", void 0);
|
|
65163
|
+
_defineProperty31(this, "updateViewport", void 0);
|
|
65164
|
+
_defineProperty31(this, "setFreeModelUserPage", void 0);
|
|
65165
|
+
_defineProperty31(this, "indexedNavigation", void 0);
|
|
65166
|
+
_defineProperty31(this, "setViewModeToFree", void 0);
|
|
65167
|
+
_defineProperty31(this, "setViewModeToFlow", void 0);
|
|
65168
|
+
_defineProperty31(this, "setViewModeToMain", void 0);
|
|
65169
|
+
_defineProperty31(this, "getViewModel", void 0);
|
|
65170
|
+
_defineProperty31(this, "undo", void 0);
|
|
65171
|
+
_defineProperty31(this, "redo", void 0);
|
|
65172
|
+
_defineProperty31(this, "rasterizeViewport", void 0);
|
|
65173
|
+
_defineProperty31(this, "rasterizeElementsBounds", void 0);
|
|
65174
|
+
_defineProperty31(this, "rasterizeMaxBounds", void 0);
|
|
65175
|
+
_defineProperty31(this, "setInputType", void 0);
|
|
65176
|
+
_defineProperty31(this, "insertImage", void 0);
|
|
64856
65177
|
this.view = view;
|
|
64857
65178
|
}
|
|
64858
65179
|
};
|
|
64859
|
-
function
|
|
64860
|
-
return (r =
|
|
65180
|
+
function _defineProperty32(e, r, t) {
|
|
65181
|
+
return (r = _toPropertyKey32(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64861
65182
|
}
|
|
64862
|
-
function
|
|
64863
|
-
var i =
|
|
65183
|
+
function _toPropertyKey32(t) {
|
|
65184
|
+
var i = _toPrimitive32(t, "string");
|
|
64864
65185
|
return "symbol" == typeof i ? i : i + "";
|
|
64865
65186
|
}
|
|
64866
|
-
function
|
|
65187
|
+
function _toPrimitive32(t, r) {
|
|
64867
65188
|
if ("object" != typeof t || !t) return t;
|
|
64868
65189
|
var e = t[Symbol.toPrimitive];
|
|
64869
65190
|
if (void 0 !== e) {
|
|
@@ -64874,13 +65195,16 @@ function _toPrimitive31(t, r) {
|
|
|
64874
65195
|
return ("string" === r ? String : Number)(t);
|
|
64875
65196
|
}
|
|
64876
65197
|
var EraserTool = class extends WhiteboardTool {
|
|
64877
|
-
constructor(enableToolEvent, renderableModel, shadowEmitter, scope, trashedElementsModel) {
|
|
65198
|
+
constructor(enableToolEvent, renderableModel, shadowEmitter, scope, trashedElementsModel, shadowScope) {
|
|
64878
65199
|
super(enableToolEvent, renderableModel, shadowEmitter, scope);
|
|
64879
|
-
|
|
64880
|
-
|
|
64881
|
-
|
|
65200
|
+
_defineProperty32(this, "elementModel", null);
|
|
65201
|
+
_defineProperty32(this, "trashedElementsModel", void 0);
|
|
65202
|
+
_defineProperty32(this, "pointCount", 0);
|
|
65203
|
+
_defineProperty32(this, "showLiveCursor", true);
|
|
65204
|
+
_defineProperty32(this, "shadowScope", void 0);
|
|
64882
65205
|
this.trashedElementsModel = trashedElementsModel;
|
|
64883
|
-
this.tool.minDistance =
|
|
65206
|
+
this.tool.minDistance = 2;
|
|
65207
|
+
this.shadowScope = shadowScope;
|
|
64884
65208
|
}
|
|
64885
65209
|
onMouseDown(_event) {
|
|
64886
65210
|
this.pointCount = 0;
|
|
@@ -64907,6 +65231,16 @@ var EraserTool = class extends WhiteboardTool {
|
|
|
64907
65231
|
this.trashedElementsModel.addTrashedElementForSelf(item.data.uuid, item.data.ownerId);
|
|
64908
65232
|
}
|
|
64909
65233
|
});
|
|
65234
|
+
this.shadowScope.project.activeLayer.children.forEach((item) => {
|
|
65235
|
+
if (item.data.type && ["selector", "eraser", "laser"].indexOf(item.data.type) < 0 && item.hitTest(event.point, {
|
|
65236
|
+
segments: true,
|
|
65237
|
+
stroke: true,
|
|
65238
|
+
fill: true,
|
|
65239
|
+
tolerance: 5
|
|
65240
|
+
})) {
|
|
65241
|
+
this.trashedElementsModel.addTrashedElementForSelf(item.data.uuid, item.data.ownerId);
|
|
65242
|
+
}
|
|
65243
|
+
});
|
|
64910
65244
|
}
|
|
64911
65245
|
onMouseUp(_event) {
|
|
64912
65246
|
if (this.elementModel) {
|
|
@@ -64915,14 +65249,14 @@ var EraserTool = class extends WhiteboardTool {
|
|
|
64915
65249
|
this.trashedElementsModel.removeAllTrashedElementsForSelf();
|
|
64916
65250
|
}
|
|
64917
65251
|
};
|
|
64918
|
-
function
|
|
64919
|
-
return (r =
|
|
65252
|
+
function _defineProperty33(e, r, t) {
|
|
65253
|
+
return (r = _toPropertyKey33(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64920
65254
|
}
|
|
64921
|
-
function
|
|
64922
|
-
var i =
|
|
65255
|
+
function _toPropertyKey33(t) {
|
|
65256
|
+
var i = _toPrimitive33(t, "string");
|
|
64923
65257
|
return "symbol" == typeof i ? i : i + "";
|
|
64924
65258
|
}
|
|
64925
|
-
function
|
|
65259
|
+
function _toPrimitive33(t, r) {
|
|
64926
65260
|
if ("object" != typeof t || !t) return t;
|
|
64927
65261
|
var e = t[Symbol.toPrimitive];
|
|
64928
65262
|
if (void 0 !== e) {
|
|
@@ -64941,22 +65275,22 @@ var TrashedElementsModel = class extends EventEmitter9 {
|
|
|
64941
65275
|
}
|
|
64942
65276
|
constructor(userManager, requestUserMap, hasPermission) {
|
|
64943
65277
|
super();
|
|
64944
|
-
|
|
64945
|
-
|
|
64946
|
-
|
|
64947
|
-
|
|
64948
|
-
|
|
65278
|
+
_defineProperty33(this, "requestUserMap", void 0);
|
|
65279
|
+
_defineProperty33(this, "userManager", void 0);
|
|
65280
|
+
_defineProperty33(this, "hasPermission", void 0);
|
|
65281
|
+
_defineProperty33(this, "observers", /* @__PURE__ */ new Map());
|
|
65282
|
+
_defineProperty33(this, "handleUserLeave", (user) => {
|
|
64949
65283
|
const cb = this.observers.get(user.id);
|
|
64950
65284
|
if (cb) {
|
|
64951
|
-
this.requestUserMap(user.id)
|
|
65285
|
+
removeDeepObserver3(this.requestUserMap(user.id), cb);
|
|
64952
65286
|
}
|
|
64953
65287
|
});
|
|
64954
|
-
|
|
65288
|
+
_defineProperty33(this, "handleUserJoin", (user) => {
|
|
64955
65289
|
const observer = (evts) => {
|
|
64956
65290
|
this.handleUserTrashElementsChange(user.id, evts);
|
|
64957
65291
|
};
|
|
64958
65292
|
if (this.observers.has(user.id)) {
|
|
64959
|
-
this.requestUserMap(user.id)
|
|
65293
|
+
removeDeepObserver3(this.requestUserMap(user.id), this.observers.get(user.id));
|
|
64960
65294
|
}
|
|
64961
65295
|
this.requestUserMap(user.id).observeDeep(observer);
|
|
64962
65296
|
this.observers.set(user.id, observer);
|
|
@@ -64970,7 +65304,7 @@ var TrashedElementsModel = class extends EventEmitter9 {
|
|
|
64970
65304
|
this.handleUserTrashElementsChange(userId, evts);
|
|
64971
65305
|
};
|
|
64972
65306
|
if (this.observers.has(userId)) {
|
|
64973
|
-
this.requestUserMap(userId)
|
|
65307
|
+
removeDeepObserver3(this.requestUserMap(userId), userId);
|
|
64974
65308
|
}
|
|
64975
65309
|
this.requestUserMap(userId).observeDeep(observer);
|
|
64976
65310
|
this.observers.set(userId, observer);
|
|
@@ -65027,21 +65361,21 @@ var TrashedElementsModel = class extends EventEmitter9 {
|
|
|
65027
65361
|
}
|
|
65028
65362
|
dispose() {
|
|
65029
65363
|
for (const [key, value] of this.observers.entries()) {
|
|
65030
|
-
this.requestUserMap(key)
|
|
65364
|
+
removeDeepObserver3(this.requestUserMap(key), value);
|
|
65031
65365
|
}
|
|
65032
65366
|
this.observers.clear();
|
|
65033
65367
|
this.userManager.off("leave", this.handleUserLeave);
|
|
65034
65368
|
this.userManager.off("join", this.handleUserJoin);
|
|
65035
65369
|
}
|
|
65036
65370
|
};
|
|
65037
|
-
function
|
|
65038
|
-
return (r =
|
|
65371
|
+
function _defineProperty34(e, r, t) {
|
|
65372
|
+
return (r = _toPropertyKey34(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65039
65373
|
}
|
|
65040
|
-
function
|
|
65041
|
-
var i =
|
|
65374
|
+
function _toPropertyKey34(t) {
|
|
65375
|
+
var i = _toPrimitive34(t, "string");
|
|
65042
65376
|
return "symbol" == typeof i ? i : i + "";
|
|
65043
65377
|
}
|
|
65044
|
-
function
|
|
65378
|
+
function _toPrimitive34(t, r) {
|
|
65045
65379
|
if ("object" != typeof t || !t) return t;
|
|
65046
65380
|
var e = t[Symbol.toPrimitive];
|
|
65047
65381
|
if (void 0 !== e) {
|
|
@@ -65054,8 +65388,9 @@ function _toPrimitive33(t, r) {
|
|
|
65054
65388
|
var LaserPointerTool = class extends WhiteboardTool {
|
|
65055
65389
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65056
65390
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65057
|
-
|
|
65058
|
-
|
|
65391
|
+
_defineProperty34(this, "elementModel", null);
|
|
65392
|
+
_defineProperty34(this, "pointCount", 0);
|
|
65393
|
+
_defineProperty34(this, "showLiveCursor", true);
|
|
65059
65394
|
this.tool.minDistance = 5;
|
|
65060
65395
|
}
|
|
65061
65396
|
onMouseDown(_event) {
|
|
@@ -65080,14 +65415,14 @@ var LaserPointerTool = class extends WhiteboardTool {
|
|
|
65080
65415
|
}
|
|
65081
65416
|
}
|
|
65082
65417
|
};
|
|
65083
|
-
function
|
|
65084
|
-
return (r =
|
|
65418
|
+
function _defineProperty35(e, r, t) {
|
|
65419
|
+
return (r = _toPropertyKey35(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65085
65420
|
}
|
|
65086
|
-
function
|
|
65087
|
-
var i =
|
|
65421
|
+
function _toPropertyKey35(t) {
|
|
65422
|
+
var i = _toPrimitive35(t, "string");
|
|
65088
65423
|
return "symbol" == typeof i ? i : i + "";
|
|
65089
65424
|
}
|
|
65090
|
-
function
|
|
65425
|
+
function _toPrimitive35(t, r) {
|
|
65091
65426
|
if ("object" != typeof t || !t) return t;
|
|
65092
65427
|
var e = t[Symbol.toPrimitive];
|
|
65093
65428
|
if (void 0 !== e) {
|
|
@@ -65100,22 +65435,22 @@ function _toPrimitive34(t, r) {
|
|
|
65100
65435
|
var PageModel = class extends EventEmitter10 {
|
|
65101
65436
|
constructor(whiteboardAttrsMap, userManager, requestUserMap, pageMap, hasPermission) {
|
|
65102
65437
|
super();
|
|
65103
|
-
|
|
65104
|
-
|
|
65105
|
-
|
|
65106
|
-
|
|
65107
|
-
|
|
65108
|
-
|
|
65109
|
-
|
|
65438
|
+
_defineProperty35(this, "whiteboardAttrsMap", void 0);
|
|
65439
|
+
_defineProperty35(this, "pageMap", void 0);
|
|
65440
|
+
_defineProperty35(this, "requestUserMap", void 0);
|
|
65441
|
+
_defineProperty35(this, "userManager", void 0);
|
|
65442
|
+
_defineProperty35(this, "observers", /* @__PURE__ */ new Map());
|
|
65443
|
+
_defineProperty35(this, "hasPermission", void 0);
|
|
65444
|
+
_defineProperty35(this, "handleUserLeave", (user) => {
|
|
65110
65445
|
const cb = this.observers.get(user.id);
|
|
65111
65446
|
if (cb) {
|
|
65112
|
-
this.requestUserMap(user.id)
|
|
65447
|
+
removeObserver5(this.requestUserMap(user.id), cb);
|
|
65113
65448
|
}
|
|
65114
65449
|
});
|
|
65115
|
-
|
|
65450
|
+
_defineProperty35(this, "handleUserJoin", (user) => {
|
|
65116
65451
|
this.createCurrentPageObserver(user.id);
|
|
65117
65452
|
});
|
|
65118
|
-
|
|
65453
|
+
_defineProperty35(this, "handleMainPageChange", (evt) => {
|
|
65119
65454
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
65120
65455
|
if (key === WhiteboardKeys.currentPage) {
|
|
65121
65456
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
@@ -65123,7 +65458,7 @@ var PageModel = class extends EventEmitter10 {
|
|
|
65123
65458
|
if (cameraMode === "main") {
|
|
65124
65459
|
const targetPage = this.whiteboardAttrsMap.get(WhiteboardKeys.currentPage);
|
|
65125
65460
|
if (!this.pageMap.has(targetPage) && targetPage !== "_i_") {
|
|
65126
|
-
|
|
65461
|
+
log2(`main page {${targetPage}} not found.`, {}, "error");
|
|
65127
65462
|
return;
|
|
65128
65463
|
}
|
|
65129
65464
|
this.requestUserMap(this.userManager.selfId).set(WhiteboardKeys.currentPage, targetPage);
|
|
@@ -65133,7 +65468,7 @@ var PageModel = class extends EventEmitter10 {
|
|
|
65133
65468
|
}
|
|
65134
65469
|
}
|
|
65135
65470
|
});
|
|
65136
|
-
|
|
65471
|
+
_defineProperty35(this, "handleUserCurrentPageChange", (userId, evt) => {
|
|
65137
65472
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
65138
65473
|
if (key === WhiteboardKeys.currentPage) {
|
|
65139
65474
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
@@ -65150,7 +65485,7 @@ var PageModel = class extends EventEmitter10 {
|
|
|
65150
65485
|
}
|
|
65151
65486
|
}
|
|
65152
65487
|
});
|
|
65153
|
-
|
|
65488
|
+
_defineProperty35(this, "handlePageMapChange", () => {
|
|
65154
65489
|
this.emit("pagesChange", Array.from(this.pageMap.keys()));
|
|
65155
65490
|
});
|
|
65156
65491
|
this.hasPermission = hasPermission;
|
|
@@ -65251,12 +65586,12 @@ var PageModel = class extends EventEmitter10 {
|
|
|
65251
65586
|
dispose() {
|
|
65252
65587
|
for (const entry of this.observers.entries()) {
|
|
65253
65588
|
const [userId, observer] = entry;
|
|
65254
|
-
this.requestUserMap(userId)
|
|
65589
|
+
removeObserver5(this.requestUserMap(userId), observer);
|
|
65255
65590
|
}
|
|
65256
65591
|
this.userManager.off("join", this.handleUserJoin);
|
|
65257
65592
|
this.userManager.off("leave", this.handleUserLeave);
|
|
65258
|
-
this.whiteboardAttrsMap
|
|
65259
|
-
this.pageMap
|
|
65593
|
+
removeObserver5(this.whiteboardAttrsMap, this.handleMainPageChange);
|
|
65594
|
+
removeObserver5(this.pageMap, this.handlePageMapChange);
|
|
65260
65595
|
}
|
|
65261
65596
|
};
|
|
65262
65597
|
var delay = (value) => new Promise((resolve) => setTimeout(resolve, value));
|
|
@@ -65266,14 +65601,14 @@ async function waitUntil(fn, timeout) {
|
|
|
65266
65601
|
await delay(50);
|
|
65267
65602
|
}
|
|
65268
65603
|
}
|
|
65269
|
-
function
|
|
65270
|
-
return (r =
|
|
65604
|
+
function _defineProperty36(e, r, t) {
|
|
65605
|
+
return (r = _toPropertyKey36(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65271
65606
|
}
|
|
65272
|
-
function
|
|
65273
|
-
var i =
|
|
65607
|
+
function _toPropertyKey36(t) {
|
|
65608
|
+
var i = _toPrimitive36(t, "string");
|
|
65274
65609
|
return "symbol" == typeof i ? i : i + "";
|
|
65275
65610
|
}
|
|
65276
|
-
function
|
|
65611
|
+
function _toPrimitive36(t, r) {
|
|
65277
65612
|
if ("object" != typeof t || !t) return t;
|
|
65278
65613
|
var e = t[Symbol.toPrimitive];
|
|
65279
65614
|
if (void 0 !== e) {
|
|
@@ -65292,7 +65627,7 @@ var IndexedNavigation = class extends EventEmitter11 {
|
|
|
65292
65627
|
return this.list[key] && this.list[key].prev === "";
|
|
65293
65628
|
});
|
|
65294
65629
|
if (!headId) {
|
|
65295
|
-
|
|
65630
|
+
log3("indexed navigation confusion", {
|
|
65296
65631
|
list: JSON.stringify(this.list)
|
|
65297
65632
|
}, "error");
|
|
65298
65633
|
throw new Error("indexed navigation confusion");
|
|
@@ -65310,13 +65645,13 @@ var IndexedNavigation = class extends EventEmitter11 {
|
|
|
65310
65645
|
}
|
|
65311
65646
|
constructor(pageModel, userMap, indexedPageMap, hasPermission) {
|
|
65312
65647
|
super();
|
|
65313
|
-
|
|
65314
|
-
|
|
65315
|
-
|
|
65316
|
-
|
|
65317
|
-
|
|
65318
|
-
|
|
65319
|
-
|
|
65648
|
+
_defineProperty36(this, "idPool", /* @__PURE__ */ new Set());
|
|
65649
|
+
_defineProperty36(this, "pageModel", void 0);
|
|
65650
|
+
_defineProperty36(this, "userMap", void 0);
|
|
65651
|
+
_defineProperty36(this, "indexedPageMap", void 0);
|
|
65652
|
+
_defineProperty36(this, "list", {});
|
|
65653
|
+
_defineProperty36(this, "hasPermission", void 0);
|
|
65654
|
+
_defineProperty36(this, "handleIndexedPageMapUpdate", (_evt) => {
|
|
65320
65655
|
this.list = this.indexedPageMap.get("list");
|
|
65321
65656
|
const needRemoveList = this.pageModel.pageList().filter((v) => /^_i_/.test(v) && Object.keys(this.list).indexOf(v) < 0);
|
|
65322
65657
|
const needAddList = Object.keys(this.list).filter((v) => this.pageModel.pageList().indexOf(v) < 0);
|
|
@@ -65394,6 +65729,9 @@ var IndexedNavigation = class extends EventEmitter11 {
|
|
|
65394
65729
|
const userPageId = this.userMap.get(WhiteboardKeys.currentPage);
|
|
65395
65730
|
return this.getPageIndex(userPageId);
|
|
65396
65731
|
}
|
|
65732
|
+
get currentPageId() {
|
|
65733
|
+
return this.userMap.get(WhiteboardKeys.currentPage);
|
|
65734
|
+
}
|
|
65397
65735
|
getPageIndex(pageId) {
|
|
65398
65736
|
let i = 0;
|
|
65399
65737
|
let currentId = this.head;
|
|
@@ -65564,9 +65902,7 @@ var IndexedNavigation = class extends EventEmitter11 {
|
|
|
65564
65902
|
if (this.pageCount <= 1) {
|
|
65565
65903
|
return this.pageCount;
|
|
65566
65904
|
}
|
|
65567
|
-
|
|
65568
|
-
if (cameraMode !== "main") {
|
|
65569
|
-
console.warn("cannot modify pages in non-main view mode.");
|
|
65905
|
+
if (!this.modifyDetect()) {
|
|
65570
65906
|
return this.pageCount;
|
|
65571
65907
|
}
|
|
65572
65908
|
const targetId = this.getPageId(index);
|
|
@@ -65607,19 +65943,19 @@ var IndexedNavigation = class extends EventEmitter11 {
|
|
|
65607
65943
|
}
|
|
65608
65944
|
}
|
|
65609
65945
|
dispose() {
|
|
65610
|
-
this.indexedPageMap
|
|
65946
|
+
removeObserver6(this.indexedPageMap, this.handleIndexedPageMapUpdate);
|
|
65611
65947
|
this.pageModel.off("switchPage");
|
|
65612
65948
|
this.pageModel.off("pagesChange");
|
|
65613
65949
|
}
|
|
65614
65950
|
};
|
|
65615
|
-
function
|
|
65616
|
-
return (r =
|
|
65951
|
+
function _defineProperty37(e, r, t) {
|
|
65952
|
+
return (r = _toPropertyKey37(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65617
65953
|
}
|
|
65618
|
-
function
|
|
65619
|
-
var i =
|
|
65954
|
+
function _toPropertyKey37(t) {
|
|
65955
|
+
var i = _toPrimitive37(t, "string");
|
|
65620
65956
|
return "symbol" == typeof i ? i : i + "";
|
|
65621
65957
|
}
|
|
65622
|
-
function
|
|
65958
|
+
function _toPrimitive37(t, r) {
|
|
65623
65959
|
if ("object" != typeof t || !t) return t;
|
|
65624
65960
|
var e = t[Symbol.toPrimitive];
|
|
65625
65961
|
if (void 0 !== e) {
|
|
@@ -65632,7 +65968,7 @@ function _toPrimitive36(t, r) {
|
|
|
65632
65968
|
var ShadowEmitter = class extends EventEmitter12 {
|
|
65633
65969
|
constructor(userMap) {
|
|
65634
65970
|
super();
|
|
65635
|
-
|
|
65971
|
+
_defineProperty37(this, "userMap", void 0);
|
|
65636
65972
|
this.userMap = userMap;
|
|
65637
65973
|
}
|
|
65638
65974
|
getActive() {
|
|
@@ -65642,14 +65978,14 @@ var ShadowEmitter = class extends EventEmitter12 {
|
|
|
65642
65978
|
return this.userMap.set("shadowActive", value);
|
|
65643
65979
|
}
|
|
65644
65980
|
};
|
|
65645
|
-
function
|
|
65646
|
-
return (r =
|
|
65981
|
+
function _defineProperty38(e, r, t) {
|
|
65982
|
+
return (r = _toPropertyKey38(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65647
65983
|
}
|
|
65648
|
-
function
|
|
65649
|
-
var i =
|
|
65984
|
+
function _toPropertyKey38(t) {
|
|
65985
|
+
var i = _toPrimitive38(t, "string");
|
|
65650
65986
|
return "symbol" == typeof i ? i : i + "";
|
|
65651
65987
|
}
|
|
65652
|
-
function
|
|
65988
|
+
function _toPrimitive38(t, r) {
|
|
65653
65989
|
if ("object" != typeof t || !t) return t;
|
|
65654
65990
|
var e = t[Symbol.toPrimitive];
|
|
65655
65991
|
if (void 0 !== e) {
|
|
@@ -65662,9 +65998,10 @@ function _toPrimitive37(t, r) {
|
|
|
65662
65998
|
var StraightLineTool = class extends WhiteboardTool {
|
|
65663
65999
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65664
66000
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65665
|
-
|
|
65666
|
-
|
|
65667
|
-
|
|
66001
|
+
_defineProperty38(this, "elementModel", null);
|
|
66002
|
+
_defineProperty38(this, "from", null);
|
|
66003
|
+
_defineProperty38(this, "to", null);
|
|
66004
|
+
_defineProperty38(this, "showLiveCursor", true);
|
|
65668
66005
|
this.tool.minDistance = 1;
|
|
65669
66006
|
}
|
|
65670
66007
|
onMouseDown(event) {
|
|
@@ -65690,14 +66027,14 @@ var StraightLineTool = class extends WhiteboardTool {
|
|
|
65690
66027
|
}
|
|
65691
66028
|
}
|
|
65692
66029
|
};
|
|
65693
|
-
function
|
|
65694
|
-
return (r =
|
|
66030
|
+
function _defineProperty39(e, r, t) {
|
|
66031
|
+
return (r = _toPropertyKey39(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65695
66032
|
}
|
|
65696
|
-
function
|
|
65697
|
-
var i =
|
|
66033
|
+
function _toPropertyKey39(t) {
|
|
66034
|
+
var i = _toPrimitive39(t, "string");
|
|
65698
66035
|
return "symbol" == typeof i ? i : i + "";
|
|
65699
66036
|
}
|
|
65700
|
-
function
|
|
66037
|
+
function _toPrimitive39(t, r) {
|
|
65701
66038
|
if ("object" != typeof t || !t) return t;
|
|
65702
66039
|
var e = t[Symbol.toPrimitive];
|
|
65703
66040
|
if (void 0 !== e) {
|
|
@@ -65710,8 +66047,9 @@ function _toPrimitive38(t, r) {
|
|
|
65710
66047
|
var GrabTool = class extends WhiteboardTool {
|
|
65711
66048
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope, camera) {
|
|
65712
66049
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65713
|
-
|
|
65714
|
-
|
|
66050
|
+
_defineProperty39(this, "camera", void 0);
|
|
66051
|
+
_defineProperty39(this, "downPoint", null);
|
|
66052
|
+
_defineProperty39(this, "showLiveCursor", false);
|
|
65715
66053
|
this.camera = camera;
|
|
65716
66054
|
}
|
|
65717
66055
|
onMouseDown(event) {
|
|
@@ -65730,9 +66068,27 @@ var GrabTool = class extends WhiteboardTool {
|
|
|
65730
66068
|
this.shadowEmitter.emit("grabUp");
|
|
65731
66069
|
}
|
|
65732
66070
|
};
|
|
66071
|
+
function _defineProperty40(e, r, t) {
|
|
66072
|
+
return (r = _toPropertyKey40(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
66073
|
+
}
|
|
66074
|
+
function _toPropertyKey40(t) {
|
|
66075
|
+
var i = _toPrimitive40(t, "string");
|
|
66076
|
+
return "symbol" == typeof i ? i : i + "";
|
|
66077
|
+
}
|
|
66078
|
+
function _toPrimitive40(t, r) {
|
|
66079
|
+
if ("object" != typeof t || !t) return t;
|
|
66080
|
+
var e = t[Symbol.toPrimitive];
|
|
66081
|
+
if (void 0 !== e) {
|
|
66082
|
+
var i = e.call(t, r || "default");
|
|
66083
|
+
if ("object" != typeof i) return i;
|
|
66084
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
66085
|
+
}
|
|
66086
|
+
return ("string" === r ? String : Number)(t);
|
|
66087
|
+
}
|
|
65733
66088
|
var PointerTool = class extends WhiteboardTool {
|
|
65734
66089
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65735
66090
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
66091
|
+
_defineProperty40(this, "showLiveCursor", false);
|
|
65736
66092
|
}
|
|
65737
66093
|
onMouseDown(_event) {
|
|
65738
66094
|
}
|
|
@@ -65741,14 +66097,14 @@ var PointerTool = class extends WhiteboardTool {
|
|
|
65741
66097
|
onMouseUp() {
|
|
65742
66098
|
}
|
|
65743
66099
|
};
|
|
65744
|
-
function
|
|
65745
|
-
return (r =
|
|
66100
|
+
function _defineProperty41(e, r, t) {
|
|
66101
|
+
return (r = _toPropertyKey41(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65746
66102
|
}
|
|
65747
|
-
function
|
|
65748
|
-
var i =
|
|
66103
|
+
function _toPropertyKey41(t) {
|
|
66104
|
+
var i = _toPrimitive41(t, "string");
|
|
65749
66105
|
return "symbol" == typeof i ? i : i + "";
|
|
65750
66106
|
}
|
|
65751
|
-
function
|
|
66107
|
+
function _toPrimitive41(t, r) {
|
|
65752
66108
|
if ("object" != typeof t || !t) return t;
|
|
65753
66109
|
var e = t[Symbol.toPrimitive];
|
|
65754
66110
|
if (void 0 !== e) {
|
|
@@ -65760,8 +66116,8 @@ function _toPrimitive39(t, r) {
|
|
|
65760
66116
|
}
|
|
65761
66117
|
var SequenceExecutor = class {
|
|
65762
66118
|
constructor() {
|
|
65763
|
-
|
|
65764
|
-
|
|
66119
|
+
_defineProperty41(this, "tasks", []);
|
|
66120
|
+
_defineProperty41(this, "isRunning", false);
|
|
65765
66121
|
}
|
|
65766
66122
|
addTask(task) {
|
|
65767
66123
|
this.tasks.push(task);
|
|
@@ -65786,14 +66142,133 @@ var SequenceExecutor = class {
|
|
|
65786
66142
|
this.isRunning = false;
|
|
65787
66143
|
}
|
|
65788
66144
|
};
|
|
65789
|
-
function
|
|
65790
|
-
return (r =
|
|
66145
|
+
function _defineProperty42(e, r, t) {
|
|
66146
|
+
return (r = _toPropertyKey42(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65791
66147
|
}
|
|
65792
|
-
function
|
|
65793
|
-
var i =
|
|
66148
|
+
function _toPropertyKey42(t) {
|
|
66149
|
+
var i = _toPrimitive42(t, "string");
|
|
65794
66150
|
return "symbol" == typeof i ? i : i + "";
|
|
65795
66151
|
}
|
|
65796
|
-
function
|
|
66152
|
+
function _toPrimitive42(t, r) {
|
|
66153
|
+
if ("object" != typeof t || !t) return t;
|
|
66154
|
+
var e = t[Symbol.toPrimitive];
|
|
66155
|
+
if (void 0 !== e) {
|
|
66156
|
+
var i = e.call(t, r || "default");
|
|
66157
|
+
if ("object" != typeof i) return i;
|
|
66158
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
66159
|
+
}
|
|
66160
|
+
return ("string" === r ? String : Number)(t);
|
|
66161
|
+
}
|
|
66162
|
+
var LiveCursor = class {
|
|
66163
|
+
constructor(canvasElement, paperScope, userManager, requestUserMap) {
|
|
66164
|
+
_defineProperty42(this, "container", document.createElement("div"));
|
|
66165
|
+
_defineProperty42(this, "showLiveCursor", true);
|
|
66166
|
+
_defineProperty42(this, "userManager", void 0);
|
|
66167
|
+
_defineProperty42(this, "requestUserMap", void 0);
|
|
66168
|
+
_defineProperty42(this, "cursors", /* @__PURE__ */ new Map());
|
|
66169
|
+
_defineProperty42(this, "paperScope", void 0);
|
|
66170
|
+
_defineProperty42(this, "resizeobserver", void 0);
|
|
66171
|
+
_defineProperty42(this, "timeoutIdMap", /* @__PURE__ */ new Map());
|
|
66172
|
+
_defineProperty42(this, "lastVisibleChangeTimes", /* @__PURE__ */ new Map());
|
|
66173
|
+
this.userManager = userManager;
|
|
66174
|
+
this.paperScope = paperScope;
|
|
66175
|
+
this.requestUserMap = requestUserMap;
|
|
66176
|
+
this.container.setAttribute("data-forge-cursors", "");
|
|
66177
|
+
this.container.style.cssText = "overflow:hidden;pointer-events:none;z-index:999;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);";
|
|
66178
|
+
this.container.style.pointerEvents = "none";
|
|
66179
|
+
this.resizeobserver = new ResizeObserver(() => {
|
|
66180
|
+
const bounds = canvasElement.getBoundingClientRect();
|
|
66181
|
+
this.container.style.width = bounds.width + "px";
|
|
66182
|
+
this.container.style.height = bounds.height + "px";
|
|
66183
|
+
});
|
|
66184
|
+
this.resizeobserver.observe(canvasElement);
|
|
66185
|
+
}
|
|
66186
|
+
createCursor(userId) {
|
|
66187
|
+
const cursor = document.createElement("fcursor");
|
|
66188
|
+
cursor.setAttribute("data-forge-cursor", userId);
|
|
66189
|
+
cursor.style.backgroundColor = this.requestUserMap(userId).get(WhiteboardKeys.themeColor);
|
|
66190
|
+
cursor.style.color = "#fff";
|
|
66191
|
+
cursor.style.position = "absolute";
|
|
66192
|
+
cursor.style.whiteSpace = "nowrap";
|
|
66193
|
+
cursor.style.display = "block";
|
|
66194
|
+
cursor.style.fontSize = "12px";
|
|
66195
|
+
cursor.style.padding = "2px 4px";
|
|
66196
|
+
cursor.style.borderRadius = "4px";
|
|
66197
|
+
cursor.textContent = this.userManager.getUser(userId)?.nickName ?? userId;
|
|
66198
|
+
return cursor;
|
|
66199
|
+
}
|
|
66200
|
+
isOnSamePage(userId) {
|
|
66201
|
+
const otherPage = this.requestUserMap(userId).get(WhiteboardKeys.currentPage);
|
|
66202
|
+
const selfPage = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.currentPage);
|
|
66203
|
+
if (otherPage !== selfPage) {
|
|
66204
|
+
return false;
|
|
66205
|
+
}
|
|
66206
|
+
return true;
|
|
66207
|
+
}
|
|
66208
|
+
detectEnable(userId) {
|
|
66209
|
+
if (!this.showLiveCursor) {
|
|
66210
|
+
const cursor = this.cursors.get(userId);
|
|
66211
|
+
if (cursor) {
|
|
66212
|
+
cursor.style.display = "none";
|
|
66213
|
+
}
|
|
66214
|
+
}
|
|
66215
|
+
return this.showLiveCursor;
|
|
66216
|
+
}
|
|
66217
|
+
updateCursorPosition(point, userId) {
|
|
66218
|
+
if (!this.isOnSamePage(userId) || userId === this.userManager.selfId) {
|
|
66219
|
+
return;
|
|
66220
|
+
}
|
|
66221
|
+
if (!this.detectEnable(userId)) {
|
|
66222
|
+
return;
|
|
66223
|
+
}
|
|
66224
|
+
const lastVisibleChangeTime = this.lastVisibleChangeTimes.get(userId);
|
|
66225
|
+
if (lastVisibleChangeTime && Date.now() - lastVisibleChangeTime < 100) {
|
|
66226
|
+
return;
|
|
66227
|
+
}
|
|
66228
|
+
if (!this.cursors.has(userId)) {
|
|
66229
|
+
const cursor2 = this.createCursor(userId);
|
|
66230
|
+
this.cursors.set(userId, cursor2);
|
|
66231
|
+
this.container.appendChild(cursor2);
|
|
66232
|
+
}
|
|
66233
|
+
const cursor = this.cursors.get(userId);
|
|
66234
|
+
if (cursor) {
|
|
66235
|
+
const viewPoint = this.paperScope.project.view.projectToView(point);
|
|
66236
|
+
cursor.style.left = viewPoint.x + "px";
|
|
66237
|
+
cursor.style.top = viewPoint.y + "px";
|
|
66238
|
+
cursor.style.display = "block";
|
|
66239
|
+
}
|
|
66240
|
+
if (this.timeoutIdMap.has(userId)) {
|
|
66241
|
+
clearTimeout(this.timeoutIdMap.get(userId));
|
|
66242
|
+
}
|
|
66243
|
+
this.timeoutIdMap.set(userId, setTimeout(() => {
|
|
66244
|
+
const cursor2 = this.cursors.get(userId);
|
|
66245
|
+
if (cursor2) {
|
|
66246
|
+
cursor2.style.display = "none";
|
|
66247
|
+
}
|
|
66248
|
+
}, 5e3));
|
|
66249
|
+
}
|
|
66250
|
+
updateCursorVisible(visible, userId) {
|
|
66251
|
+
if (!this.isOnSamePage(userId) || userId === this.userManager.selfId) {
|
|
66252
|
+
return;
|
|
66253
|
+
}
|
|
66254
|
+
if (!this.detectEnable(userId)) {
|
|
66255
|
+
return;
|
|
66256
|
+
}
|
|
66257
|
+
this.lastVisibleChangeTimes.set(userId, Date.now());
|
|
66258
|
+
const cursor = this.cursors.get(userId);
|
|
66259
|
+
if (cursor) {
|
|
66260
|
+
cursor.style.display = visible ? "block" : "none";
|
|
66261
|
+
}
|
|
66262
|
+
}
|
|
66263
|
+
};
|
|
66264
|
+
function _defineProperty43(e, r, t) {
|
|
66265
|
+
return (r = _toPropertyKey43(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
66266
|
+
}
|
|
66267
|
+
function _toPropertyKey43(t) {
|
|
66268
|
+
var i = _toPrimitive43(t, "string");
|
|
66269
|
+
return "symbol" == typeof i ? i : i + "";
|
|
66270
|
+
}
|
|
66271
|
+
function _toPrimitive43(t, r) {
|
|
65797
66272
|
if ("object" != typeof t || !t) return t;
|
|
65798
66273
|
var e = t[Symbol.toPrimitive];
|
|
65799
66274
|
if (void 0 !== e) {
|
|
@@ -65804,6 +66279,21 @@ function _toPrimitive40(t, r) {
|
|
|
65804
66279
|
return ("string" === r ? String : Number)(t);
|
|
65805
66280
|
}
|
|
65806
66281
|
var WHITEBOARD_APP_NAME = "whiteboard";
|
|
66282
|
+
var AsyncMap = class {
|
|
66283
|
+
constructor() {
|
|
66284
|
+
_defineProperty43(this, "map", void 0);
|
|
66285
|
+
this.map = /* @__PURE__ */ new Map();
|
|
66286
|
+
}
|
|
66287
|
+
get(key) {
|
|
66288
|
+
return Promise.resolve(this.map.get(key));
|
|
66289
|
+
}
|
|
66290
|
+
set(key, value) {
|
|
66291
|
+
this.map.set(key, value);
|
|
66292
|
+
}
|
|
66293
|
+
};
|
|
66294
|
+
if (!window.__forge_gl_wb_status__) {
|
|
66295
|
+
window.__forge_gl_wb_status__ = new AsyncMap();
|
|
66296
|
+
}
|
|
65807
66297
|
var WhiteboardApplication = class extends AbstractApplication {
|
|
65808
66298
|
get undoManager() {
|
|
65809
66299
|
const page = this.pageModel.getCurrentPage(this.userId);
|
|
@@ -65812,43 +66302,110 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65812
66302
|
}
|
|
65813
66303
|
return null;
|
|
65814
66304
|
}
|
|
66305
|
+
get viewportWidth() {
|
|
66306
|
+
const vw = this.getMap("attrs").get("viewportWidth");
|
|
66307
|
+
if (vw) {
|
|
66308
|
+
return vw;
|
|
66309
|
+
}
|
|
66310
|
+
return this.option.width;
|
|
66311
|
+
}
|
|
66312
|
+
get viewportHeight() {
|
|
66313
|
+
const vh = this.getMap("attrs").get("viewportHeight");
|
|
66314
|
+
if (vh) {
|
|
66315
|
+
return vh;
|
|
66316
|
+
}
|
|
66317
|
+
return this.option.height;
|
|
66318
|
+
}
|
|
65815
66319
|
constructor() {
|
|
65816
66320
|
var _this;
|
|
65817
66321
|
super();
|
|
65818
66322
|
_this = this;
|
|
65819
|
-
|
|
65820
|
-
|
|
65821
|
-
|
|
65822
|
-
|
|
65823
|
-
|
|
65824
|
-
|
|
65825
|
-
|
|
65826
|
-
|
|
65827
|
-
|
|
65828
|
-
|
|
65829
|
-
|
|
65830
|
-
|
|
65831
|
-
|
|
65832
|
-
|
|
65833
|
-
|
|
65834
|
-
|
|
65835
|
-
|
|
65836
|
-
|
|
65837
|
-
|
|
65838
|
-
|
|
65839
|
-
|
|
65840
|
-
|
|
65841
|
-
|
|
65842
|
-
|
|
65843
|
-
|
|
65844
|
-
|
|
65845
|
-
|
|
65846
|
-
|
|
65847
|
-
|
|
65848
|
-
|
|
66323
|
+
_defineProperty43(this, "name", WHITEBOARD_APP_NAME);
|
|
66324
|
+
_defineProperty43(this, "emitter", void 0);
|
|
66325
|
+
_defineProperty43(this, "toolbarModel", void 0);
|
|
66326
|
+
_defineProperty43(this, "selectElementsModel", void 0);
|
|
66327
|
+
_defineProperty43(this, "trashedElementsModel", void 0);
|
|
66328
|
+
_defineProperty43(this, "pageModel", void 0);
|
|
66329
|
+
_defineProperty43(this, "layers", /* @__PURE__ */ new Map());
|
|
66330
|
+
_defineProperty43(this, "undoManagers", /* @__PURE__ */ new Map());
|
|
66331
|
+
_defineProperty43(this, "imageSets", document.createElement("div"));
|
|
66332
|
+
_defineProperty43(this, "rootElement", document.createElement("div"));
|
|
66333
|
+
_defineProperty43(this, "paperScope", new import_paper.default.PaperScope());
|
|
66334
|
+
_defineProperty43(this, "canvasElement", document.createElement("canvas"));
|
|
66335
|
+
_defineProperty43(this, "shadowScope", new import_paper.default.PaperScope());
|
|
66336
|
+
_defineProperty43(this, "snapshotCanvasElement", document.createElement("canvas"));
|
|
66337
|
+
_defineProperty43(this, "snapshotScope", new import_paper.default.PaperScope());
|
|
66338
|
+
_defineProperty43(this, "shadowCanvasElement", document.createElement("canvas"));
|
|
66339
|
+
_defineProperty43(this, "shadowEmitter", void 0);
|
|
66340
|
+
_defineProperty43(this, "tools", void 0);
|
|
66341
|
+
_defineProperty43(this, "editors", /* @__PURE__ */ new Map());
|
|
66342
|
+
_defineProperty43(this, "camera", void 0);
|
|
66343
|
+
_defineProperty43(this, "resizeObserver", void 0);
|
|
66344
|
+
_defineProperty43(this, "option", void 0);
|
|
66345
|
+
_defineProperty43(this, "permissions", void 0);
|
|
66346
|
+
_defineProperty43(this, "inputType", "any");
|
|
66347
|
+
_defineProperty43(this, "isPenEvent", false);
|
|
66348
|
+
_defineProperty43(this, "hasPenInput", null);
|
|
66349
|
+
_defineProperty43(this, "disableViewModelUpdate", false);
|
|
66350
|
+
_defineProperty43(this, "internalResizeObserver", true);
|
|
66351
|
+
_defineProperty43(this, "sequenceExecutor", new SequenceExecutor());
|
|
66352
|
+
_defineProperty43(this, "linkWhiteboardId", null);
|
|
66353
|
+
_defineProperty43(this, "liveCursor", void 0);
|
|
66354
|
+
_defineProperty43(this, "delayTranslateOut", -1);
|
|
66355
|
+
_defineProperty43(this, "addWhiteboardStatus", (evt) => {
|
|
66356
|
+
if (evt.detail.whiteboardAppId && evt.detail.status) {
|
|
66357
|
+
if (this.linkWhiteboardId === evt.detail.whiteboardAppId) {
|
|
66358
|
+
this.toolbarModel.currentTool = evt.detail.status.currentTool;
|
|
66359
|
+
this.toolbarModel.strokeColor = evt.detail.status.strokeColor;
|
|
66360
|
+
this.toolbarModel.fillColor = evt.detail.status.fillColor;
|
|
66361
|
+
this.toolbarModel.fontSize = evt.detail.status.fontSize;
|
|
66362
|
+
this.toolbarModel.fontFamily = evt.detail.status.fontFamily;
|
|
66363
|
+
this.toolbarModel.strokeWidth = evt.detail.status.strokeWidth;
|
|
66364
|
+
this.toolbarModel.dashArray = evt.detail.status.dashArray;
|
|
66365
|
+
this.permissions.removePermission(WhiteboardPermissionFlag.all);
|
|
66366
|
+
this.permissions.addPermission(evt.detail.status.permission);
|
|
66367
|
+
}
|
|
66368
|
+
}
|
|
66369
|
+
});
|
|
66370
|
+
_defineProperty43(this, "enableToolEvent", () => {
|
|
65849
66371
|
return !(this.inputType === "pen" && !this.isPenEvent);
|
|
65850
66372
|
});
|
|
65851
|
-
|
|
66373
|
+
_defineProperty43(this, "handleViewportUpdate", (evt) => {
|
|
66374
|
+
if (evt.keysChanged.has("viewportWidth") || evt.keysChanged.has("viewportHeight")) {
|
|
66375
|
+
const rect = this.rootElement.getBoundingClientRect();
|
|
66376
|
+
this.adjustByOutFrame(rect.width, rect.height);
|
|
66377
|
+
}
|
|
66378
|
+
});
|
|
66379
|
+
_defineProperty43(this, "handleElementTranslateOut", (ids, container) => {
|
|
66380
|
+
const shadowLayer = this.shadowScope.project.activeLayer;
|
|
66381
|
+
let parent = null;
|
|
66382
|
+
if (container === "layer") {
|
|
66383
|
+
parent = shadowLayer;
|
|
66384
|
+
} else {
|
|
66385
|
+
parent = shadowLayer.children.find((child) => child.data.uuid === container) ?? null;
|
|
66386
|
+
}
|
|
66387
|
+
if (parent) {
|
|
66388
|
+
ids.forEach((id) => {
|
|
66389
|
+
const target = parent.children.find((child) => child.data.uuid === id);
|
|
66390
|
+
if (target) {
|
|
66391
|
+
target.remove();
|
|
66392
|
+
this.insertElementToParent(target, this.paperScope.project.activeLayer);
|
|
66393
|
+
} else {
|
|
66394
|
+
const pageId = this.pageModel.getCurrentPage(this.userId);
|
|
66395
|
+
if (pageId) {
|
|
66396
|
+
const page = this.layers.get(pageId);
|
|
66397
|
+
if (page) {
|
|
66398
|
+
const model = page.elementModels.get(id);
|
|
66399
|
+
if (model && model.item) {
|
|
66400
|
+
this.insertElementToParent(model.item, this.paperScope.project.activeLayer);
|
|
66401
|
+
}
|
|
66402
|
+
}
|
|
66403
|
+
}
|
|
66404
|
+
}
|
|
66405
|
+
});
|
|
66406
|
+
}
|
|
66407
|
+
});
|
|
66408
|
+
_defineProperty43(this, "handlePageSwitch", (pageId) => {
|
|
65852
66409
|
this.sequenceExecutor.addTask(async () => {
|
|
65853
66410
|
for (const editor of this.editors.values()) {
|
|
65854
66411
|
editor.hidden();
|
|
@@ -65878,7 +66435,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65878
66435
|
}
|
|
65879
66436
|
} else {
|
|
65880
66437
|
console.warn(`[@netless/forge-whiteboard] page ${pageId} not found`);
|
|
65881
|
-
|
|
66438
|
+
log4(`[@netless/forge-whiteboard] page ${pageId} not found`, {}, "warning");
|
|
65882
66439
|
}
|
|
65883
66440
|
await waitUntil(() => this.undoManagers.has(pageId), 1e3);
|
|
65884
66441
|
if (this.undoManagers.has(pageId)) {
|
|
@@ -65890,30 +66447,30 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65890
66447
|
this.undoManagers.get(pageId).on("stack-item-popped", this.handleStackItemPopped);
|
|
65891
66448
|
} else {
|
|
65892
66449
|
console.warn(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`);
|
|
65893
|
-
|
|
66450
|
+
log4(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`, {}, "warning");
|
|
65894
66451
|
}
|
|
65895
66452
|
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
65896
66453
|
this.emitter.emit("undoStackLength", this.undoManager?.undoStack.length ?? 0);
|
|
65897
66454
|
});
|
|
65898
66455
|
});
|
|
65899
|
-
|
|
66456
|
+
_defineProperty43(this, "hasPermission", (flag) => {
|
|
65900
66457
|
return this.permissions.hasPermission(flag, this.userId);
|
|
65901
66458
|
});
|
|
65902
|
-
|
|
66459
|
+
_defineProperty43(this, "handleStackItemAdded", () => {
|
|
65903
66460
|
this.selectElementsModel.clearSelectElementForSelf();
|
|
65904
66461
|
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
65905
66462
|
this.emitter.emit("undoStackLength", this.undoManager?.undoStack.length ?? 0);
|
|
65906
66463
|
});
|
|
65907
|
-
|
|
66464
|
+
_defineProperty43(this, "handleStackItemPopped", () => {
|
|
65908
66465
|
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
65909
66466
|
this.emitter.emit("undoStackLength", this.undoManager?.undoStack.length ?? 0);
|
|
65910
66467
|
});
|
|
65911
|
-
|
|
66468
|
+
_defineProperty43(this, "handleLayersChange", (ids) => {
|
|
65912
66469
|
for (let i = 0, len = ids.length; i < len; i++) {
|
|
65913
66470
|
const id = ids[i];
|
|
65914
66471
|
if (!this.layers.has(id)) {
|
|
65915
66472
|
const elementsMap = this.getMap(`layer/${id}/elements`);
|
|
65916
|
-
const renderableModel = new RenderableModel(id, this.shadowEmitter, elementsMap, this.paperScope, this.toolbarModel, this.userManager, this.hasPermission);
|
|
66473
|
+
const renderableModel = new RenderableModel(id, this.shadowEmitter, elementsMap, this.paperScope, this.toolbarModel, this.userManager, this.imageSets, this.liveCursor, this.hasPermission);
|
|
65917
66474
|
this.layers.set(id, renderableModel);
|
|
65918
66475
|
}
|
|
65919
66476
|
if (!this.undoManagers.has(id)) {
|
|
@@ -65929,7 +66486,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65929
66486
|
const renderableModel = this.layers.get(entry[0]);
|
|
65930
66487
|
this.layers.delete(entry[0]);
|
|
65931
66488
|
if (renderableModel) {
|
|
65932
|
-
renderableModel.dispose();
|
|
66489
|
+
renderableModel.dispose(true);
|
|
65933
66490
|
}
|
|
65934
66491
|
const cameraMode = this.userMap(this.userId).get(WhiteboardKeys.cameraMode);
|
|
65935
66492
|
const currentPage = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
@@ -65940,17 +66497,18 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65940
66497
|
}
|
|
65941
66498
|
}
|
|
65942
66499
|
});
|
|
65943
|
-
|
|
66500
|
+
_defineProperty43(this, "getCurrentRenderableModel", () => {
|
|
65944
66501
|
const layerId = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
65945
66502
|
if (!this.layers.has(layerId)) {
|
|
65946
66503
|
this.emitter.emit("error", 300002, `target page: ${layerId} not found`);
|
|
65947
66504
|
}
|
|
65948
66505
|
return this.layers.get(layerId);
|
|
65949
66506
|
});
|
|
65950
|
-
|
|
66507
|
+
_defineProperty43(this, "handleElementClear", () => {
|
|
66508
|
+
this.shadowScope.project.activeLayer.removeChildren();
|
|
65951
66509
|
this.paperScope.project.activeLayer.removeChildren();
|
|
65952
66510
|
});
|
|
65953
|
-
|
|
66511
|
+
_defineProperty43(this, "handleElementInsert", (elements) => {
|
|
65954
66512
|
for (const element of elements) {
|
|
65955
66513
|
element.createPaperElement();
|
|
65956
66514
|
const scope = element.shadow === "" ? this.paperScope : this.shadowScope;
|
|
@@ -65962,7 +66520,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65962
66520
|
this.insertElementToParent(element.item, scope.project.activeLayer);
|
|
65963
66521
|
}
|
|
65964
66522
|
});
|
|
65965
|
-
|
|
66523
|
+
_defineProperty43(this, "handleElementRemove", (elementId, layerId) => {
|
|
65966
66524
|
const layerModel = this.layers.get(layerId);
|
|
65967
66525
|
if (!layerModel) {
|
|
65968
66526
|
return;
|
|
@@ -65973,11 +66531,11 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65973
66531
|
}
|
|
65974
66532
|
layerModel.elementModels.delete(elementId);
|
|
65975
66533
|
});
|
|
65976
|
-
|
|
66534
|
+
_defineProperty43(this, "handleRemoveTrashedElementForSelf", (userId, elementId) => {
|
|
65977
66535
|
const selfLayerId = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
65978
66536
|
this.layers.get(selfLayerId)?.removeElementItem(elementId);
|
|
65979
66537
|
});
|
|
65980
|
-
|
|
66538
|
+
_defineProperty43(this, "handleElementsTrash", (userId, elements) => {
|
|
65981
66539
|
const targetLayerId = this.userMap(userId).get(WhiteboardKeys.currentPage);
|
|
65982
66540
|
const selfLayerId = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
65983
66541
|
if (targetLayerId !== selfLayerId || !this.layers.has(targetLayerId)) {
|
|
@@ -65990,7 +66548,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65990
66548
|
}
|
|
65991
66549
|
});
|
|
65992
66550
|
});
|
|
65993
|
-
|
|
66551
|
+
_defineProperty43(this, "handleElementsSelect", (userId, elements) => {
|
|
65994
66552
|
if (!this.editors.has(userId)) {
|
|
65995
66553
|
const ctrl = this.userManager.getUser(userId);
|
|
65996
66554
|
const editor2 = new Editor(this.paperScope, this.shadowScope, this.shadowEmitter, this.canvasElement, this.camera, {
|
|
@@ -66033,34 +66591,44 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66033
66591
|
this.emitter.emit("elementDeselected", userId);
|
|
66034
66592
|
}
|
|
66035
66593
|
});
|
|
66036
|
-
|
|
66037
|
-
|
|
66038
|
-
|
|
66039
|
-
|
|
66040
|
-
|
|
66041
|
-
|
|
66042
|
-
|
|
66043
|
-
|
|
66044
|
-
|
|
66045
|
-
|
|
66046
|
-
|
|
66047
|
-
|
|
66048
|
-
|
|
66049
|
-
|
|
66050
|
-
|
|
66594
|
+
_defineProperty43(this, "handleSyncedWhiteboardStatusChange", (evt) => {
|
|
66595
|
+
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))) {
|
|
66596
|
+
const nextState = {
|
|
66597
|
+
currentTool: evt.target.get(TOOLBAR_KEYS.tool),
|
|
66598
|
+
strokeColor: evt.target.get(TOOLBAR_KEYS.strokeColor),
|
|
66599
|
+
fillColor: evt.target.get(TOOLBAR_KEYS.fillColor),
|
|
66600
|
+
fontSize: evt.target.get(TOOLBAR_KEYS.fontSize),
|
|
66601
|
+
fontFamily: evt.target.get(TOOLBAR_KEYS.fontFamily),
|
|
66602
|
+
strokeWidth: evt.target.get(TOOLBAR_KEYS.strokeWidth),
|
|
66603
|
+
dashArray: evt.target.get(TOOLBAR_KEYS.dashArray),
|
|
66604
|
+
permission: evt.target.get("permission")
|
|
66605
|
+
};
|
|
66606
|
+
window.__forge_gl_wb_status__.set(this.appId, nextState);
|
|
66607
|
+
window.dispatchEvent(new CustomEvent("forge-whiteboard-synced-status", {
|
|
66608
|
+
detail: {
|
|
66609
|
+
whiteboardAppId: this.appId,
|
|
66610
|
+
status: nextState,
|
|
66611
|
+
userId: this.userId
|
|
66612
|
+
}
|
|
66613
|
+
}));
|
|
66051
66614
|
}
|
|
66052
66615
|
});
|
|
66053
|
-
|
|
66054
|
-
if (this.
|
|
66616
|
+
_defineProperty43(this, "adjustByOutFrame", (frameWidth, frameHeight) => {
|
|
66617
|
+
if (!this.paperScope.project.view || !this.shadowScope.project.view) {
|
|
66618
|
+
return;
|
|
66619
|
+
}
|
|
66620
|
+
const viewportWidth = this.viewportWidth;
|
|
66621
|
+
const viewportHeight = this.viewportHeight;
|
|
66622
|
+
if (viewportWidth > 0 && viewportHeight > 0) {
|
|
66055
66623
|
const minWidth = Math.max(frameWidth, 10);
|
|
66056
66624
|
const minHeight = Math.max(frameHeight, 10);
|
|
66057
66625
|
let width = minWidth;
|
|
66058
|
-
let height = width *
|
|
66626
|
+
let height = width * viewportHeight / viewportWidth;
|
|
66059
66627
|
if (height > minHeight) {
|
|
66060
66628
|
height = minHeight;
|
|
66061
|
-
width = height *
|
|
66629
|
+
width = height * viewportWidth / viewportHeight;
|
|
66062
66630
|
}
|
|
66063
|
-
this.camera.updateInherentScale(width /
|
|
66631
|
+
this.camera.updateInherentScale(width / viewportWidth);
|
|
66064
66632
|
this.paperScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
66065
66633
|
this.shadowScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
66066
66634
|
this.camera.triggerZoom();
|
|
@@ -66070,6 +66638,9 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66070
66638
|
requestAnimationFrameHook(this.shadowScope);
|
|
66071
66639
|
const that = this;
|
|
66072
66640
|
this.rootElement.setAttribute("data-forge-app", "whiteboard");
|
|
66641
|
+
this.imageSets.style.display = "none";
|
|
66642
|
+
this.imageSets.setAttribute("data-image-sets", "");
|
|
66643
|
+
this.rootElement.appendChild(this.imageSets);
|
|
66073
66644
|
document.body.addEventListener("pointerdown", (evt) => {
|
|
66074
66645
|
this.isPenEvent = evt.pointerType === "pen";
|
|
66075
66646
|
if (evt.pointerType === "pen" && this.hasPenInput === null) {
|
|
@@ -66131,7 +66702,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66131
66702
|
this.emitter.setViewModeToFree = (userId) => {
|
|
66132
66703
|
if (that.disableViewModelUpdate) {
|
|
66133
66704
|
console.warn("Operation failed. Perspective mode switching is disabled in the current environment.");
|
|
66134
|
-
|
|
66705
|
+
log4("Operation failed. Perspective mode switching is disabled in the current environment.", {}, "warning");
|
|
66135
66706
|
return;
|
|
66136
66707
|
}
|
|
66137
66708
|
const targetId = userId ? this.hasPermission(WhiteboardPermissionFlag.setOthersView) ? userId : null : this.userId;
|
|
@@ -66142,7 +66713,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66142
66713
|
this.emitter.setViewModeToFlow = (flowId, userId) => {
|
|
66143
66714
|
if (that.disableViewModelUpdate) {
|
|
66144
66715
|
console.warn("Operation failed. Perspective mode switching is disabled in the current environment.");
|
|
66145
|
-
|
|
66716
|
+
log4("Operation failed. Perspective mode switching is disabled in the current environment.", {}, "warning");
|
|
66146
66717
|
return;
|
|
66147
66718
|
}
|
|
66148
66719
|
const targetId = userId ? this.hasPermission(WhiteboardPermissionFlag.setOthersView) ? userId : null : this.userId;
|
|
@@ -66157,7 +66728,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66157
66728
|
this.emitter.setViewModeToMain = (userId) => {
|
|
66158
66729
|
if (that.disableViewModelUpdate) {
|
|
66159
66730
|
console.warn("Operation failed. Perspective mode switching is disabled in the current environment.");
|
|
66160
|
-
|
|
66731
|
+
log4("Operation failed. Perspective mode switching is disabled in the current environment.", {}, "warning");
|
|
66161
66732
|
return;
|
|
66162
66733
|
}
|
|
66163
66734
|
const targetId = userId ? this.hasPermission(WhiteboardPermissionFlag.setOthersView) ? userId : null : this.userId;
|
|
@@ -66169,6 +66740,30 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66169
66740
|
this.camera.resetViewMatrixToMain();
|
|
66170
66741
|
}
|
|
66171
66742
|
};
|
|
66743
|
+
this.emitter.insertImage = (src, pageId) => {
|
|
66744
|
+
if (!/https/.test(src)) {
|
|
66745
|
+
log4("[@netless/forge-whiteboard] invalid image url, src needs to be in the HTTPS protocol.", {
|
|
66746
|
+
src
|
|
66747
|
+
}, "warning");
|
|
66748
|
+
return;
|
|
66749
|
+
}
|
|
66750
|
+
let targetPageId = pageId;
|
|
66751
|
+
if (!targetPageId) {
|
|
66752
|
+
targetPageId = this.pageModel.getCurrentPage(this.userManager.selfId);
|
|
66753
|
+
}
|
|
66754
|
+
if (!targetPageId) {
|
|
66755
|
+
log4("[@netless/forge-whiteboard] page not found", {}, "warning");
|
|
66756
|
+
return;
|
|
66757
|
+
}
|
|
66758
|
+
this.layers.get(targetPageId)?.createImage(src);
|
|
66759
|
+
};
|
|
66760
|
+
this.emitter.removeElement = (pageId, elementId) => {
|
|
66761
|
+
if (!this.layers.has(pageId)) {
|
|
66762
|
+
log4("[@netless/forge-whiteboard] page not found", {}, "warning");
|
|
66763
|
+
return;
|
|
66764
|
+
}
|
|
66765
|
+
this.layers.get(pageId)?.removeElementItem(elementId);
|
|
66766
|
+
};
|
|
66172
66767
|
this.emitter.getViewModel = (userId) => {
|
|
66173
66768
|
const targetId = userId ? userId : this.userId;
|
|
66174
66769
|
return this.userMap(targetId).get(WhiteboardKeys.cameraMode);
|
|
@@ -66184,7 +66779,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66184
66779
|
const source = this.getMap(`layer/${sourceId}/elements`);
|
|
66185
66780
|
const target = this.getMap(`layer/${targetId}/elements`);
|
|
66186
66781
|
if (!this.layers.has(targetId)) {
|
|
66187
|
-
this.layers.set(targetId, new RenderableModel(targetId, this.shadowEmitter, target, this.paperScope, this.toolbarModel, this.userManager, this.hasPermission));
|
|
66782
|
+
this.layers.set(targetId, new RenderableModel(targetId, this.shadowEmitter, target, this.paperScope, this.toolbarModel, this.userManager, this.imageSets, this.liveCursor, this.hasPermission));
|
|
66188
66783
|
}
|
|
66189
66784
|
if (!this.undoManagers.has(targetId)) {
|
|
66190
66785
|
const undoManager = new Y15.UndoManager(target, {
|
|
@@ -66234,12 +66829,29 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66234
66829
|
this.emitter.resetCamera = () => {
|
|
66235
66830
|
this.camera.reset();
|
|
66236
66831
|
};
|
|
66832
|
+
this.emitter.showLiveCursor = (value) => {
|
|
66833
|
+
this.liveCursor.showLiveCursor = value;
|
|
66834
|
+
};
|
|
66835
|
+
this.emitter.updateViewport = (width, height) => {
|
|
66836
|
+
this.updateOptionSize(width, height);
|
|
66837
|
+
};
|
|
66838
|
+
this.emitter.__setMainCanvasVisible = (visible) => {
|
|
66839
|
+
this.canvasElement.style.opacity = visible ? "1" : "0";
|
|
66840
|
+
};
|
|
66237
66841
|
this.emitter.on("error", (errorCode, errorMessage) => {
|
|
66238
|
-
|
|
66842
|
+
log4("WhiteboardApplicationError", {
|
|
66239
66843
|
errorCode,
|
|
66240
66844
|
errorMessage
|
|
66241
66845
|
});
|
|
66242
66846
|
});
|
|
66847
|
+
Object.defineProperty(this.emitter, "__delayTranslateOut", {
|
|
66848
|
+
get() {
|
|
66849
|
+
return that.delayTranslateOut;
|
|
66850
|
+
},
|
|
66851
|
+
set(value) {
|
|
66852
|
+
that.delayTranslateOut = value;
|
|
66853
|
+
}
|
|
66854
|
+
});
|
|
66243
66855
|
Object.defineProperty(this.emitter, "tool", {
|
|
66244
66856
|
get() {
|
|
66245
66857
|
return that.toolbarModel.currentTool;
|
|
@@ -66328,6 +66940,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66328
66940
|
that.camera.enableBoundaryHighlight = value;
|
|
66329
66941
|
}
|
|
66330
66942
|
});
|
|
66943
|
+
window.addEventListener("forge-whiteboard-synced-status", this.addWhiteboardStatus);
|
|
66331
66944
|
}
|
|
66332
66945
|
userMap(userId) {
|
|
66333
66946
|
return this.getMap(`user/${userId}`);
|
|
@@ -66340,7 +66953,19 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66340
66953
|
this.emitter["permissions"] = this.permissions;
|
|
66341
66954
|
this.emitter["selfUserId"] = this.userId;
|
|
66342
66955
|
this.option = option;
|
|
66956
|
+
if (this.option.stretchToFill) {
|
|
66957
|
+
this.getMap("attrs").set("viewportWidth", -1);
|
|
66958
|
+
this.getMap("attrs").set("viewportHeight", -1);
|
|
66959
|
+
} else {
|
|
66960
|
+
if (!this.getMap("attrs").has("viewportWidth")) {
|
|
66961
|
+
this.getMap("attrs").set("viewportWidth", option.width);
|
|
66962
|
+
}
|
|
66963
|
+
if (!this.getMap("attrs").has("viewportHeight")) {
|
|
66964
|
+
this.getMap("attrs").set("viewportHeight", option.height);
|
|
66965
|
+
}
|
|
66966
|
+
}
|
|
66343
66967
|
this.userMap(this.userId).set(WhiteboardKeys.themeColor, "#009688");
|
|
66968
|
+
this.userMap(this.userId).observe(this.handleSyncedWhiteboardStatusChange);
|
|
66344
66969
|
this.shadowEmitter = new ShadowEmitter(this.userMap(this.userId));
|
|
66345
66970
|
this.pageModel = new PageModel(this.getMap("attrs"), this.userManager, (userId) => {
|
|
66346
66971
|
return this.userMap(userId);
|
|
@@ -66388,6 +67013,9 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66388
67013
|
this.selectElementsModel = new SelectElementsModel(this.userManager, (userId) => {
|
|
66389
67014
|
return this.userMap(userId);
|
|
66390
67015
|
}, this.hasPermission);
|
|
67016
|
+
this.liveCursor = new LiveCursor(this.canvasElement, this.paperScope, this.userManager, (userId) => {
|
|
67017
|
+
return this.userMap(userId);
|
|
67018
|
+
});
|
|
66391
67019
|
this.tools = {
|
|
66392
67020
|
pointer: new PointerTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
|
|
66393
67021
|
curve: new CurveTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
|
|
@@ -66398,7 +67026,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66398
67026
|
text: new TextTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope, this.rootElement, this.canvasElement, this.toolbarModel, this.camera),
|
|
66399
67027
|
ellipse: new EllipseTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
|
|
66400
67028
|
triangle: new TriangleTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
|
|
66401
|
-
eraser: new EraserTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope, this.trashedElementsModel),
|
|
67029
|
+
eraser: new EraserTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope, this.trashedElementsModel, this.shadowScope),
|
|
66402
67030
|
laser: new LaserPointerTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope),
|
|
66403
67031
|
grab: new GrabTool(this.enableToolEvent, this.getCurrentRenderableModel, this.shadowEmitter, this.paperScope, this.camera)
|
|
66404
67032
|
};
|
|
@@ -66419,7 +67047,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66419
67047
|
this.paperScope.tool = this.tools[this.toolbarModel.currentTool].tool;
|
|
66420
67048
|
} else {
|
|
66421
67049
|
this.paperScope.tool = this.tools["curve"].tool;
|
|
66422
|
-
|
|
67050
|
+
log4(`${this.toolbarModel.currentTool} not supported, backup to curve`);
|
|
66423
67051
|
}
|
|
66424
67052
|
this.selectElementsModel.on("elementsChange", this.handleElementsSelect);
|
|
66425
67053
|
this.trashedElementsModel.on("elementsChange", this.handleElementsTrash);
|
|
@@ -66470,32 +67098,12 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66470
67098
|
}
|
|
66471
67099
|
});
|
|
66472
67100
|
this.shadowEmitter.on("translateOut", (ids, container) => {
|
|
66473
|
-
|
|
66474
|
-
|
|
66475
|
-
|
|
66476
|
-
|
|
67101
|
+
if (this.delayTranslateOut > 0) {
|
|
67102
|
+
setTimeout(() => {
|
|
67103
|
+
this.handleElementTranslateOut(ids, container);
|
|
67104
|
+
}, this.delayTranslateOut);
|
|
66477
67105
|
} else {
|
|
66478
|
-
|
|
66479
|
-
}
|
|
66480
|
-
if (parent) {
|
|
66481
|
-
ids.forEach((id) => {
|
|
66482
|
-
const target = parent.children.find((child) => child.data.uuid === id);
|
|
66483
|
-
if (target) {
|
|
66484
|
-
target.remove();
|
|
66485
|
-
this.insertElementToParent(target, this.paperScope.project.activeLayer);
|
|
66486
|
-
} else {
|
|
66487
|
-
const pageId = this.pageModel.getCurrentPage(this.userId);
|
|
66488
|
-
if (pageId) {
|
|
66489
|
-
const page = this.layers.get(pageId);
|
|
66490
|
-
if (page) {
|
|
66491
|
-
const model = page.elementModels.get(id);
|
|
66492
|
-
if (model && model.item) {
|
|
66493
|
-
this.insertElementToParent(model.item, this.paperScope.project.activeLayer);
|
|
66494
|
-
}
|
|
66495
|
-
}
|
|
66496
|
-
}
|
|
66497
|
-
}
|
|
66498
|
-
});
|
|
67106
|
+
this.handleElementTranslateOut(ids, container);
|
|
66499
67107
|
}
|
|
66500
67108
|
});
|
|
66501
67109
|
this.shadowEmitter.on("translateIn", (ids, container) => {
|
|
@@ -66522,6 +67130,15 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66522
67130
|
this.emitter.emit("grabUp");
|
|
66523
67131
|
});
|
|
66524
67132
|
this.clearElements();
|
|
67133
|
+
if (this.option.stretchToFill) {
|
|
67134
|
+
window.addEventListener("resize", () => {
|
|
67135
|
+
const bounds = this.rootElement.getBoundingClientRect();
|
|
67136
|
+
this.updateOptionSize(bounds.width, bounds.height);
|
|
67137
|
+
this.adjustByOutFrame(bounds.width, bounds.height);
|
|
67138
|
+
});
|
|
67139
|
+
}
|
|
67140
|
+
this.rootElement.appendChild(this.liveCursor.container);
|
|
67141
|
+
this.getMap("attrs").observe(this.handleViewportUpdate);
|
|
66525
67142
|
}
|
|
66526
67143
|
clearElements() {
|
|
66527
67144
|
const userIds = this.userManager.userIdList();
|
|
@@ -66617,10 +67234,10 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66617
67234
|
this.snapshotScope.view.viewSize = bounds.size.multiply(scale2);
|
|
66618
67235
|
this.snapshotScope.view.matrix = matrix;
|
|
66619
67236
|
} else if (area === "maxScale" && this.option.maxScaleRatio && this.option.maxScaleRatio !== -1) {
|
|
66620
|
-
const width = this.
|
|
66621
|
-
const height = this.
|
|
66622
|
-
const offsetX = this.
|
|
66623
|
-
const offsetY = this.
|
|
67237
|
+
const width = this.viewportWidth * this.option.maxScaleRatio;
|
|
67238
|
+
const height = this.viewportHeight * this.option.maxScaleRatio;
|
|
67239
|
+
const offsetX = this.viewportWidth * (this.option.maxScaleRatio - 1) / 2;
|
|
67240
|
+
const offsetY = this.viewportHeight * (this.option.maxScaleRatio - 1) / 2;
|
|
66624
67241
|
const matrix = new this.paperScope.Matrix();
|
|
66625
67242
|
matrix.scale(scale);
|
|
66626
67243
|
matrix.translate({
|
|
@@ -66644,28 +67261,23 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66644
67261
|
this.disableViewModelUpdate = true;
|
|
66645
67262
|
}
|
|
66646
67263
|
linkToWhiteboard(targetId) {
|
|
66647
|
-
|
|
66648
|
-
|
|
66649
|
-
|
|
66650
|
-
|
|
66651
|
-
|
|
66652
|
-
|
|
66653
|
-
|
|
66654
|
-
|
|
66655
|
-
|
|
66656
|
-
|
|
66657
|
-
|
|
66658
|
-
|
|
66659
|
-
|
|
66660
|
-
|
|
66661
|
-
this.permissions.addPermission(this.linkTarget.get("permission"), this.userId);
|
|
66662
|
-
this.linkTarget.observe(this.handleLinkedMapChange);
|
|
66663
|
-
}
|
|
67264
|
+
this.linkWhiteboardId = targetId;
|
|
67265
|
+
window.__forge_gl_wb_status__.get(targetId).then((currentStatus) => {
|
|
67266
|
+
if (currentStatus) {
|
|
67267
|
+
this.toolbarModel.currentTool = currentStatus.currentTool;
|
|
67268
|
+
this.toolbarModel.strokeColor = currentStatus.strokeColor;
|
|
67269
|
+
this.toolbarModel.fillColor = currentStatus.fillColor;
|
|
67270
|
+
this.toolbarModel.fontSize = currentStatus.fontSize;
|
|
67271
|
+
this.toolbarModel.fontFamily = currentStatus.fontFamily;
|
|
67272
|
+
this.toolbarModel.strokeWidth = currentStatus.strokeWidth;
|
|
67273
|
+
this.toolbarModel.dashArray = currentStatus.dashArray;
|
|
67274
|
+
this.permissions.removePermission(WhiteboardPermissionFlag.all);
|
|
67275
|
+
this.permissions.addPermission(currentStatus.permission);
|
|
67276
|
+
}
|
|
67277
|
+
});
|
|
66664
67278
|
}
|
|
66665
67279
|
unlink() {
|
|
66666
|
-
|
|
66667
|
-
this.linkTarget.unobserve(this.handleLinkedMapChange);
|
|
66668
|
-
}
|
|
67280
|
+
this.linkWhiteboardId = null;
|
|
66669
67281
|
}
|
|
66670
67282
|
setViewSize(width, height) {
|
|
66671
67283
|
this.paperScope.project.view.viewSize = new this.paperScope.Size(width, height);
|
|
@@ -66682,11 +67294,14 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66682
67294
|
this.internalResizeObserver = value;
|
|
66683
67295
|
}
|
|
66684
67296
|
updateOptionSize(width, height) {
|
|
66685
|
-
this.
|
|
66686
|
-
this.
|
|
67297
|
+
this.getMap("attrs").set("viewportWidth", width);
|
|
67298
|
+
this.getMap("attrs").set("viewportHeight", height);
|
|
66687
67299
|
this.camera.updateInitSize(new import_paper.default.Size(width, height));
|
|
66688
67300
|
}
|
|
66689
|
-
async dispose() {
|
|
67301
|
+
async dispose(removeSubDoc) {
|
|
67302
|
+
if (removeSubDoc) {
|
|
67303
|
+
this.deleteSubDoc(this.appId);
|
|
67304
|
+
}
|
|
66690
67305
|
this.selectElementsModel.dispose();
|
|
66691
67306
|
this.trashedElementsModel.dispose();
|
|
66692
67307
|
this.paperScope.view.remove();
|
|
@@ -66703,7 +67318,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66703
67318
|
entry[1].off("stack-item-popped", this.handleStackItemPopped);
|
|
66704
67319
|
}
|
|
66705
67320
|
for (const entry of this.layers.entries()) {
|
|
66706
|
-
entry[1].dispose();
|
|
67321
|
+
entry[1].dispose(removeSubDoc);
|
|
66707
67322
|
entry[1].removeAllListeners();
|
|
66708
67323
|
}
|
|
66709
67324
|
this.camera.dispose();
|
|
@@ -66715,13 +67330,14 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66715
67330
|
this.toolbarModel.dispose();
|
|
66716
67331
|
this.emitter.indexedNavigation.dispose();
|
|
66717
67332
|
this.permissions.dispose();
|
|
67333
|
+
removeObserver7(this.userMap(this.userId), this.handleSyncedWhiteboardStatusChange);
|
|
66718
67334
|
}
|
|
66719
67335
|
};
|
|
66720
|
-
|
|
67336
|
+
_defineProperty43(WhiteboardApplication, "applicationName", WHITEBOARD_APP_NAME);
|
|
66721
67337
|
|
|
66722
67338
|
// src/SlideApplication.ts
|
|
66723
67339
|
var import_slide = __toESM(require_Slide());
|
|
66724
|
-
import { AbstractApplication as AbstractApplication2, kvStore } from "@netless/forge-room";
|
|
67340
|
+
import { AbstractApplication as AbstractApplication2, kvStore as kvStore2 } from "@netless/forge-room";
|
|
66725
67341
|
|
|
66726
67342
|
// src/Slide.ts
|
|
66727
67343
|
import EventEmitter13 from "eventemitter3";
|
|
@@ -66941,10 +67557,16 @@ var FooterView = class extends EventEmitter14 {
|
|
|
66941
67557
|
|
|
66942
67558
|
// src/SiderBarView.ts
|
|
66943
67559
|
import EventEmitter15 from "eventemitter3";
|
|
67560
|
+
import { kvStore } from "@netless/forge-room";
|
|
66944
67561
|
var SideBarView = class extends EventEmitter15 {
|
|
66945
67562
|
root = document.createElement("div");
|
|
66946
67563
|
isShow = false;
|
|
66947
67564
|
eventsMap = /* @__PURE__ */ new Map();
|
|
67565
|
+
taskId = "";
|
|
67566
|
+
prefix = "";
|
|
67567
|
+
addImagesPool = [];
|
|
67568
|
+
scheduleId = 0;
|
|
67569
|
+
isSchedule = false;
|
|
66948
67570
|
constructor() {
|
|
66949
67571
|
super();
|
|
66950
67572
|
this.root.style.backgroundColor = "#eee";
|
|
@@ -66965,49 +67587,110 @@ var SideBarView = class extends EventEmitter15 {
|
|
|
66965
67587
|
get isShowSideBar() {
|
|
66966
67588
|
return this.isShow;
|
|
66967
67589
|
}
|
|
67590
|
+
async getPreviewImage(imageUrl) {
|
|
67591
|
+
const image = await fetch(imageUrl);
|
|
67592
|
+
const blob = await image.blob();
|
|
67593
|
+
return new Promise((resolve) => {
|
|
67594
|
+
const reader = new FileReader();
|
|
67595
|
+
reader.onloadend = () => {
|
|
67596
|
+
const base64Data = reader.result;
|
|
67597
|
+
const img = document.createElement("img");
|
|
67598
|
+
img.src = base64Data;
|
|
67599
|
+
img.onload = () => {
|
|
67600
|
+
resolve({
|
|
67601
|
+
url: imageUrl,
|
|
67602
|
+
src: base64Data,
|
|
67603
|
+
width: img.width,
|
|
67604
|
+
height: img.height
|
|
67605
|
+
});
|
|
67606
|
+
};
|
|
67607
|
+
};
|
|
67608
|
+
reader.readAsDataURL(blob);
|
|
67609
|
+
});
|
|
67610
|
+
}
|
|
67611
|
+
async appendPreviewImage(pageIndex) {
|
|
67612
|
+
const itemContainer = document.createElement("div");
|
|
67613
|
+
itemContainer.style.width = "60%";
|
|
67614
|
+
itemContainer.style.display = "flex";
|
|
67615
|
+
itemContainer.style.justifyContent = "center";
|
|
67616
|
+
itemContainer.style.alignItems = "flex-start";
|
|
67617
|
+
itemContainer.style.position = "relative";
|
|
67618
|
+
itemContainer.style.borderRadius = "4px";
|
|
67619
|
+
itemContainer.style.transition = "border-color .3s";
|
|
67620
|
+
itemContainer.style.marginBottom = "10px";
|
|
67621
|
+
const onMouseOverHandle = () => {
|
|
67622
|
+
itemContainer.style.borderColor = "#ccc";
|
|
67623
|
+
};
|
|
67624
|
+
const onMouseOutHandle = () => {
|
|
67625
|
+
itemContainer.style.borderColor = "transparent";
|
|
67626
|
+
};
|
|
67627
|
+
const onClickHandle = () => {
|
|
67628
|
+
this.emit("pageChange", pageIndex);
|
|
67629
|
+
};
|
|
67630
|
+
itemContainer.addEventListener("click", onClickHandle);
|
|
67631
|
+
itemContainer.addEventListener("mouseover", onMouseOverHandle);
|
|
67632
|
+
itemContainer.addEventListener("mouseout", onMouseOutHandle);
|
|
67633
|
+
this.eventsMap.set(itemContainer, [onClickHandle, onMouseOverHandle, onMouseOutHandle]);
|
|
67634
|
+
const pageIndexContainer = document.createElement("span");
|
|
67635
|
+
pageIndexContainer.textContent = `${pageIndex}`;
|
|
67636
|
+
pageIndexContainer.style.position = "absolute";
|
|
67637
|
+
pageIndexContainer.style.top = "1px";
|
|
67638
|
+
pageIndexContainer.style.left = "-10px";
|
|
67639
|
+
pageIndexContainer.style.transform = "translate(-100%)";
|
|
67640
|
+
pageIndexContainer.style.fontSize = "12px";
|
|
67641
|
+
pageIndexContainer.style.color = "#5f5f5f";
|
|
67642
|
+
const previewUrl = `${this.prefix}/${this.taskId}/preview/${pageIndex}.png`;
|
|
67643
|
+
const preview = document.createElement("img");
|
|
67644
|
+
const cachePreview = await kvStore.getItem(previewUrl);
|
|
67645
|
+
if (cachePreview) {
|
|
67646
|
+
const { src } = JSON.parse(cachePreview);
|
|
67647
|
+
preview.src = src;
|
|
67648
|
+
} else {
|
|
67649
|
+
const previewInfo = await this.getPreviewImage(previewUrl);
|
|
67650
|
+
await kvStore.setItem(previewUrl, JSON.stringify(previewInfo));
|
|
67651
|
+
const { src } = previewInfo;
|
|
67652
|
+
preview.src = src;
|
|
67653
|
+
}
|
|
67654
|
+
preview.style.width = "100%";
|
|
67655
|
+
preview.style.display = "inline-block";
|
|
67656
|
+
itemContainer.appendChild(preview);
|
|
67657
|
+
itemContainer.appendChild(pageIndexContainer);
|
|
67658
|
+
this.root.appendChild(itemContainer);
|
|
67659
|
+
}
|
|
67660
|
+
async scheduleGetPreviewImage() {
|
|
67661
|
+
if (!this.isSchedule) {
|
|
67662
|
+
this.scheduleId = setTimeout(async () => {
|
|
67663
|
+
await this.scheduleGetPreviewImage();
|
|
67664
|
+
}, 32);
|
|
67665
|
+
return;
|
|
67666
|
+
}
|
|
67667
|
+
const pageIndex = this.addImagesPool.shift();
|
|
67668
|
+
if (!pageIndex) {
|
|
67669
|
+
clearTimeout(this.scheduleId);
|
|
67670
|
+
this.scheduleId = 0;
|
|
67671
|
+
return;
|
|
67672
|
+
}
|
|
67673
|
+
await this.appendPreviewImage(pageIndex);
|
|
67674
|
+
this.scheduleId = setTimeout(async () => {
|
|
67675
|
+
await this.scheduleGetPreviewImage();
|
|
67676
|
+
}, 32);
|
|
67677
|
+
}
|
|
67678
|
+
async startGetPreviewImageSchedule() {
|
|
67679
|
+
this.isSchedule = true;
|
|
67680
|
+
}
|
|
67681
|
+
pauseGetPreviewImageSchedule() {
|
|
67682
|
+
this.isSchedule = false;
|
|
67683
|
+
}
|
|
66968
67684
|
initialize(slideCount, option) {
|
|
67685
|
+
this.taskId = option.taskId;
|
|
67686
|
+
this.prefix = option.prefix;
|
|
66969
67687
|
for (let i = 1; i <= slideCount; i++) {
|
|
66970
|
-
|
|
66971
|
-
itemContainer.style.width = "60%";
|
|
66972
|
-
itemContainer.style.display = "flex";
|
|
66973
|
-
itemContainer.style.justifyContent = "center";
|
|
66974
|
-
itemContainer.style.alignItems = "flex-start";
|
|
66975
|
-
itemContainer.style.position = "relative";
|
|
66976
|
-
itemContainer.style.borderRadius = "4px";
|
|
66977
|
-
itemContainer.style.transition = "border-color .3s";
|
|
66978
|
-
itemContainer.style.marginBottom = "10px";
|
|
66979
|
-
const onMouseOverHandle = () => {
|
|
66980
|
-
itemContainer.style.borderColor = "#ccc";
|
|
66981
|
-
};
|
|
66982
|
-
const onMouseOutHandle = () => {
|
|
66983
|
-
itemContainer.style.borderColor = "transparent";
|
|
66984
|
-
};
|
|
66985
|
-
const onClickHandle = () => {
|
|
66986
|
-
this.emit("pageChange", i);
|
|
66987
|
-
};
|
|
66988
|
-
itemContainer.addEventListener("click", onClickHandle);
|
|
66989
|
-
itemContainer.addEventListener("mouseover", onMouseOverHandle);
|
|
66990
|
-
itemContainer.addEventListener("mouseout", onMouseOutHandle);
|
|
66991
|
-
this.eventsMap.set(itemContainer, [onClickHandle, onMouseOverHandle, onMouseOutHandle]);
|
|
66992
|
-
const pageIndex = document.createElement("span");
|
|
66993
|
-
pageIndex.textContent = `${i}`;
|
|
66994
|
-
pageIndex.style.position = "absolute";
|
|
66995
|
-
pageIndex.style.top = "1px";
|
|
66996
|
-
pageIndex.style.left = "-10px";
|
|
66997
|
-
pageIndex.style.transform = "translate(-100%)";
|
|
66998
|
-
pageIndex.style.fontSize = "12px";
|
|
66999
|
-
pageIndex.style.color = "#5f5f5f";
|
|
67000
|
-
const preview = document.createElement("img");
|
|
67001
|
-
preview.style.width = "100%";
|
|
67002
|
-
preview.style.display = "inline-block";
|
|
67003
|
-
preview.src = `${option.prefix}/${option.taskId}/preview/${i}.png`;
|
|
67004
|
-
itemContainer.appendChild(preview);
|
|
67005
|
-
itemContainer.appendChild(pageIndex);
|
|
67006
|
-
this.root.appendChild(itemContainer);
|
|
67688
|
+
this.addImagesPool.push(i);
|
|
67007
67689
|
}
|
|
67690
|
+
this.scheduleGetPreviewImage();
|
|
67008
67691
|
}
|
|
67009
67692
|
hidden() {
|
|
67010
|
-
if (!this.root) {
|
|
67693
|
+
if (!this.root || !this.isShow) {
|
|
67011
67694
|
return;
|
|
67012
67695
|
}
|
|
67013
67696
|
this.root.style.left = "-240px";
|
|
@@ -67036,7 +67719,7 @@ var SideBarView = class extends EventEmitter15 {
|
|
|
67036
67719
|
};
|
|
67037
67720
|
|
|
67038
67721
|
// src/utils.ts
|
|
67039
|
-
function deepEqual(a2, b2, excludeKeys = ["
|
|
67722
|
+
function deepEqual(a2, b2, excludeKeys = ["mediaState"]) {
|
|
67040
67723
|
if (a2 === b2) return true;
|
|
67041
67724
|
if (typeof a2 !== "object" || a2 === null || typeof b2 !== "object" || b2 === null) return false;
|
|
67042
67725
|
if (a2.constructor !== b2.constructor) return false;
|
|
@@ -67097,7 +67780,7 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67097
67780
|
super();
|
|
67098
67781
|
window.emitter = this.emitter;
|
|
67099
67782
|
this.rootView.setAttribute("data-forge-app", Slide_APP_NAME);
|
|
67100
|
-
this.rootView.style.background = "#
|
|
67783
|
+
this.rootView.style.background = "#f9f9fc";
|
|
67101
67784
|
this.rootView.style.overflow = "hidden";
|
|
67102
67785
|
this.contentContainer.style.width = "100%";
|
|
67103
67786
|
this.contentContainer.style.height = "100%";
|
|
@@ -67270,28 +67953,6 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67270
67953
|
}
|
|
67271
67954
|
return `${this.prefix}/${this.taskId}/preview/${pageIndex}.png`;
|
|
67272
67955
|
}
|
|
67273
|
-
async getPreviewImage(imageUrl) {
|
|
67274
|
-
const image = fetch(imageUrl);
|
|
67275
|
-
return await image.then((res) => res.blob()).then((blob) => {
|
|
67276
|
-
return new Promise((resolve) => {
|
|
67277
|
-
const reader = new FileReader();
|
|
67278
|
-
reader.onloadend = () => {
|
|
67279
|
-
const base64Data = reader.result;
|
|
67280
|
-
const img = document.createElement("img");
|
|
67281
|
-
img.src = base64Data;
|
|
67282
|
-
img.onload = () => {
|
|
67283
|
-
resolve({
|
|
67284
|
-
url: imageUrl,
|
|
67285
|
-
src: base64Data,
|
|
67286
|
-
width: img.width,
|
|
67287
|
-
height: img.height
|
|
67288
|
-
});
|
|
67289
|
-
};
|
|
67290
|
-
};
|
|
67291
|
-
reader.readAsDataURL(blob);
|
|
67292
|
-
});
|
|
67293
|
-
});
|
|
67294
|
-
}
|
|
67295
67956
|
async getImageUrl(pageIndex) {
|
|
67296
67957
|
return this.getPreviewImageUrl(pageIndex);
|
|
67297
67958
|
}
|
|
@@ -67299,7 +67960,7 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67299
67960
|
const imageUrl = this.getPreviewImageUrl(pageIndex);
|
|
67300
67961
|
let preview = null;
|
|
67301
67962
|
try {
|
|
67302
|
-
const result = await
|
|
67963
|
+
const result = await kvStore2.getItem(imageUrl);
|
|
67303
67964
|
preview = result ? JSON.parse(result) : null;
|
|
67304
67965
|
} catch (e) {
|
|
67305
67966
|
console.warn("kvStore getItem error", e);
|
|
@@ -67307,15 +67968,15 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67307
67968
|
if (preview) {
|
|
67308
67969
|
return { width: preview.width, height: preview.height };
|
|
67309
67970
|
}
|
|
67310
|
-
preview = await this.getPreviewImage(imageUrl);
|
|
67311
|
-
await
|
|
67971
|
+
preview = await this.sideBar.getPreviewImage(imageUrl);
|
|
67972
|
+
await kvStore2.setItem(imageUrl, JSON.stringify(preview));
|
|
67312
67973
|
return { width: preview.width, height: preview.height };
|
|
67313
67974
|
}
|
|
67314
67975
|
async getImageContent(pageIndex) {
|
|
67315
67976
|
const imageUrl = this.getPreviewImageUrl(pageIndex);
|
|
67316
67977
|
let preview = null;
|
|
67317
67978
|
try {
|
|
67318
|
-
const result = await
|
|
67979
|
+
const result = await kvStore2.getItem(imageUrl);
|
|
67319
67980
|
preview = result ? JSON.parse(result) : null;
|
|
67320
67981
|
} catch (e) {
|
|
67321
67982
|
console.warn("kvStore getItem error", e);
|
|
@@ -67323,8 +67984,8 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67323
67984
|
if (preview) {
|
|
67324
67985
|
return preview.src;
|
|
67325
67986
|
}
|
|
67326
|
-
preview = await this.getPreviewImage(imageUrl);
|
|
67327
|
-
await
|
|
67987
|
+
preview = await this.sideBar.getPreviewImage(imageUrl);
|
|
67988
|
+
await kvStore2.setItem(imageUrl, JSON.stringify(preview));
|
|
67328
67989
|
return preview.src;
|
|
67329
67990
|
}
|
|
67330
67991
|
nextTick = () => {
|
|
@@ -67346,10 +68007,14 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67346
68007
|
this.syncMessageQueue = [];
|
|
67347
68008
|
this.isSyncing = true;
|
|
67348
68009
|
const { state, dispatch } = lastSyncMessage;
|
|
67349
|
-
|
|
68010
|
+
let ignoreKeys = void 0;
|
|
68011
|
+
if (dispatch.type === "mediaPlay" || dispatch.type === "mediaPause" || dispatch.type === "mediaFullscreen") {
|
|
68012
|
+
ignoreKeys = [dispatch.id];
|
|
68013
|
+
}
|
|
68014
|
+
if (this.slide.slideState.currentSlideIndex < 0 || state.currentSlideIndex < 0) {
|
|
67350
68015
|
await this.slide.receiveSyncHandler(dispatch);
|
|
67351
68016
|
return this.nextTick();
|
|
67352
|
-
} else if (!deepEqual(this.slide.slideState, state)) {
|
|
68017
|
+
} else if (!deepEqual(this.slide.slideState, state, ignoreKeys)) {
|
|
67353
68018
|
await this.slide.setSlideState(state);
|
|
67354
68019
|
await this.slide.receiveSyncHandler(dispatch);
|
|
67355
68020
|
} else {
|
|
@@ -67402,11 +68067,11 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67402
68067
|
this.prefix = option.prefix;
|
|
67403
68068
|
this.taskId = option.taskId;
|
|
67404
68069
|
const whiteboardApp = new WhiteboardApplication();
|
|
67405
|
-
whiteboardApp.
|
|
67406
|
-
whiteboardApp.appId = `${
|
|
68070
|
+
whiteboardApp.appDoc = this.appDoc;
|
|
68071
|
+
whiteboardApp.appId = `${this.appId}_wb`;
|
|
67407
68072
|
whiteboardApp.userId = this.userId;
|
|
67408
68073
|
whiteboardApp.userManager = this.userManager;
|
|
67409
|
-
whiteboardApp.
|
|
68074
|
+
whiteboardApp.deleteSubDoc = this.deleteSubDoc;
|
|
67410
68075
|
const json = await fetch(`${option.prefix}/${option.taskId}/jsonOutput/slide-1.json`).then((res) => res.json());
|
|
67411
68076
|
this.slideCount = json.slideCount;
|
|
67412
68077
|
await whiteboardApp.initialize({
|
|
@@ -67444,7 +68109,13 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67444
68109
|
...option.options,
|
|
67445
68110
|
interactive: true,
|
|
67446
68111
|
anchor: this.slideContainer,
|
|
67447
|
-
mode: "interactive"
|
|
68112
|
+
mode: "interactive",
|
|
68113
|
+
clientId: Math.random().toString(36).substring(2, 15),
|
|
68114
|
+
timestamp: () => {
|
|
68115
|
+
console.log("timestamp");
|
|
68116
|
+
console.log(Date.now, this.calibrationTimestamp, Date.now() - this.calibrationTimestamp);
|
|
68117
|
+
return this.calibrationTimestamp;
|
|
68118
|
+
}
|
|
67448
68119
|
// logger: {
|
|
67449
68120
|
// info: console.log,
|
|
67450
68121
|
// warn: console.warn,
|
|
@@ -67465,25 +68136,28 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67465
68136
|
this.slide.on(import_slide.SLIDE_EVENTS.mainSeqStepEnd, (animateIndex) => {
|
|
67466
68137
|
this.emitter.emit("mainSeqStepEnd", animateIndex);
|
|
67467
68138
|
});
|
|
67468
|
-
this.slide.on(import_slide.SLIDE_EVENTS.animateStart, () => {
|
|
67469
|
-
this.sideBar.hidden();
|
|
67470
|
-
});
|
|
67471
68139
|
this.slide.on(import_slide.SLIDE_EVENTS.renderError, ({ error, index }) => {
|
|
67472
68140
|
if (error.errorType === "CANVAS_CRASH") {
|
|
67473
68141
|
this.slide.renderSlide(index);
|
|
67474
68142
|
}
|
|
67475
68143
|
});
|
|
67476
68144
|
this.slide.on(import_slide.SLIDE_EVENTS.renderStart, (slideIndex) => {
|
|
67477
|
-
|
|
67478
|
-
|
|
67479
|
-
|
|
67480
|
-
|
|
67481
|
-
|
|
68145
|
+
if (slideIndex >= 0) {
|
|
68146
|
+
this.sideBar.pauseGetPreviewImageSchedule();
|
|
68147
|
+
this.whiteboardApp.emitter.view.style.opacity = "0";
|
|
68148
|
+
this.whiteboardApp.emitter.addPage(`${slideIndex}`);
|
|
68149
|
+
this.whiteboardApp.emitter.gotoPage(`${slideIndex}`);
|
|
68150
|
+
this.sideBar.hidden();
|
|
68151
|
+
this.emitter.emit("renderStart", slideIndex);
|
|
68152
|
+
}
|
|
67482
68153
|
});
|
|
67483
68154
|
this.slide.on(import_slide.SLIDE_EVENTS.renderEnd, (slideIndex) => {
|
|
67484
|
-
|
|
67485
|
-
|
|
67486
|
-
|
|
68155
|
+
if (slideIndex >= 0) {
|
|
68156
|
+
this.sideBar.startGetPreviewImageSchedule();
|
|
68157
|
+
this.currentSlideIndex = slideIndex;
|
|
68158
|
+
this.whiteboardApp.emitter.view.style.opacity = "1";
|
|
68159
|
+
this.emitter.emit("renderEnd", slideIndex);
|
|
68160
|
+
}
|
|
67487
68161
|
});
|
|
67488
68162
|
this.slide.on(import_slide.SLIDE_EVENTS.stateChange, (state) => {
|
|
67489
68163
|
this.getMap(this.name).set("slideState", state);
|
|
@@ -67492,6 +68166,9 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67492
68166
|
window.slide = this.slide;
|
|
67493
68167
|
window.slideWhiteboard = this.whiteboardApp;
|
|
67494
68168
|
window.forgeSlide = this;
|
|
68169
|
+
this.whiteboardContainer.addEventListener("click", () => {
|
|
68170
|
+
this.sideBar.hidden();
|
|
68171
|
+
}, false);
|
|
67495
68172
|
const syncSlide = this.getMap(this.name).get("slideState");
|
|
67496
68173
|
if (syncSlide && syncSlide.taskId === option.taskId) {
|
|
67497
68174
|
this.slide.setSlideState(syncSlide);
|
|
@@ -67535,6 +68212,7 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67535
68212
|
this.onRefocusInstance();
|
|
67536
68213
|
}
|
|
67537
68214
|
});
|
|
68215
|
+
this.bindKeyBoardEvent();
|
|
67538
68216
|
}
|
|
67539
68217
|
window.__forge_slide = this;
|
|
67540
68218
|
window.slidePermissions = this.permissions;
|
|
@@ -67543,8 +68221,11 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67543
68221
|
userMap(userId) {
|
|
67544
68222
|
return this.getMap(`user/${userId}`);
|
|
67545
68223
|
}
|
|
67546
|
-
async dispose() {
|
|
67547
|
-
|
|
68224
|
+
async dispose(removeSubDoc) {
|
|
68225
|
+
if (removeSubDoc) {
|
|
68226
|
+
this.deleteSubDoc(this.appId);
|
|
68227
|
+
}
|
|
68228
|
+
await this.whiteboardApp.dispose(removeSubDoc);
|
|
67548
68229
|
this.rootView.parentElement?.removeChild(this.rootView);
|
|
67549
68230
|
this.slide.destroy();
|
|
67550
68231
|
this.sideBar.dispose();
|