@netless/forge-slide 0.1.1-alpha.8 → 0.1.1-alpha.9
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/build.mjs +21 -21
- package/dist/FooterView.d.ts +4 -1
- package/dist/FooterView.d.ts.map +1 -1
- package/dist/ForgeSlidePermession.d.ts +7 -46
- package/dist/ForgeSlidePermession.d.ts.map +1 -1
- package/dist/SiderBarView.d.ts +3 -6
- package/dist/SiderBarView.d.ts.map +1 -1
- package/dist/Slide.d.ts +29 -30
- package/dist/Slide.d.ts.map +1 -1
- package/dist/SlideApplication.d.ts +6 -4
- package/dist/SlideApplication.d.ts.map +1 -1
- package/dist/SlidePool.d.ts +22 -0
- package/dist/SlidePool.d.ts.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.esm.js +831 -824
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +834 -827
- package/dist/index.js.map +4 -4
- package/package.json +7 -7
- package/src/FooterView.ts +117 -95
- package/src/ForgeSlidePermession.ts +13 -120
- package/src/SiderBarView.ts +101 -100
- package/src/Slide.ts +29 -30
- package/src/SlideApplication.ts +504 -466
- package/src/SlidePool.ts +110 -0
- package/src/icons.ts +5 -5
- package/src/index.ts +4 -4
- package/src/utils.ts +42 -42
- package/dist/FoorerView.d.ts +0 -23
- package/dist/FoorerView.d.ts.map +0 -1
- package/dist/classes.d.ts +0 -3
- package/dist/classes.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -35154,23 +35154,23 @@ var Y7 = __toESM(require("yjs"), 1);
|
|
|
35154
35154
|
var Y8 = __toESM(require("yjs"), 1);
|
|
35155
35155
|
var Y9 = __toESM(require("yjs"), 1);
|
|
35156
35156
|
var Y10 = __toESM(require("yjs"), 1);
|
|
35157
|
-
var
|
|
35157
|
+
var import_forge_room2 = require("@netless/forge-room");
|
|
35158
35158
|
var Y11 = __toESM(require("yjs"), 1);
|
|
35159
|
-
var
|
|
35159
|
+
var import_eventemitter32 = __toESM(require("eventemitter3"), 1);
|
|
35160
35160
|
var Y13 = __toESM(require("yjs"), 1);
|
|
35161
|
+
var import_eventemitter33 = __toESM(require("eventemitter3"), 1);
|
|
35161
35162
|
var import_eventemitter34 = __toESM(require("eventemitter3"), 1);
|
|
35162
|
-
var import_eventemitter35 =
|
|
35163
|
-
var import_eventemitter36 = require("eventemitter3");
|
|
35163
|
+
var import_eventemitter35 = require("eventemitter3");
|
|
35164
|
+
var import_eventemitter36 = __toESM(require("eventemitter3"), 1);
|
|
35164
35165
|
var import_eventemitter37 = __toESM(require("eventemitter3"), 1);
|
|
35165
35166
|
var import_eventemitter38 = __toESM(require("eventemitter3"), 1);
|
|
35166
|
-
var import_eventemitter39 = __toESM(require("eventemitter3"), 1);
|
|
35167
35167
|
var Y14 = __toESM(require("yjs"), 1);
|
|
35168
|
+
var import_eventemitter39 = __toESM(require("eventemitter3"), 1);
|
|
35168
35169
|
var import_eventemitter310 = __toESM(require("eventemitter3"), 1);
|
|
35170
|
+
var import_forge_room3 = require("@netless/forge-room");
|
|
35169
35171
|
var import_eventemitter311 = __toESM(require("eventemitter3"), 1);
|
|
35170
|
-
var
|
|
35172
|
+
var import_forge_room4 = require("@netless/forge-room");
|
|
35171
35173
|
var import_eventemitter312 = __toESM(require("eventemitter3"), 1);
|
|
35172
|
-
var import_forge_room3 = require("@netless/forge-room");
|
|
35173
|
-
var import_eventemitter313 = __toESM(require("eventemitter3"), 1);
|
|
35174
35174
|
var __create2 = Object.create;
|
|
35175
35175
|
var __defProp2 = Object.defineProperty;
|
|
35176
35176
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -60852,6 +60852,10 @@ var ElementModel = class _ElementModel {
|
|
|
60852
60852
|
const ext = this.styleKeys();
|
|
60853
60853
|
return Array.from(new Set(["dashArray", "strokeColor", "fillColor", "strokeWidth"].filter((v) => ext.exclude.indexOf(v) < 0).concat(ext.include)));
|
|
60854
60854
|
}
|
|
60855
|
+
dispose() {
|
|
60856
|
+
this.subDispose();
|
|
60857
|
+
this.root.unobserveDeep(this.handlePropChange);
|
|
60858
|
+
}
|
|
60855
60859
|
};
|
|
60856
60860
|
_defineProperty(ElementModel, "KEYS", {
|
|
60857
60861
|
index: "index",
|
|
@@ -61028,6 +61032,8 @@ var CurveModel = class extends ElementModel {
|
|
|
61028
61032
|
this.item.fillColor = new this.scope.Color(this.strokeColor);
|
|
61029
61033
|
}
|
|
61030
61034
|
}
|
|
61035
|
+
subDispose() {
|
|
61036
|
+
}
|
|
61031
61037
|
};
|
|
61032
61038
|
function _defineProperty4(e, r, t) {
|
|
61033
61039
|
return (r = _toPropertyKey4(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
@@ -61059,14 +61065,12 @@ var SelectorModel = class extends ElementModel {
|
|
|
61059
61065
|
this.root.set("points", initPoints);
|
|
61060
61066
|
}
|
|
61061
61067
|
}
|
|
61068
|
+
subDispose() {
|
|
61069
|
+
}
|
|
61062
61070
|
createPaperRect() {
|
|
61063
61071
|
const scope = this.scope;
|
|
61064
61072
|
const bounds = new scope.Rectangle(new scope.Point(this.points[0], this.points[1]), new scope.Size(this.points[2], this.points[3]));
|
|
61065
|
-
return new scope.Path.Rectangle(
|
|
61066
|
-
bounds,
|
|
61067
|
-
new scope.Point(this.points[4], this.points[4])
|
|
61068
|
-
// 圆角
|
|
61069
|
-
);
|
|
61073
|
+
return new scope.Path.Rectangle(bounds, new scope.Point(this.points[4], this.points[4]));
|
|
61070
61074
|
}
|
|
61071
61075
|
onVectorUpdate() {
|
|
61072
61076
|
if (!this.item) {
|
|
@@ -61092,7 +61096,7 @@ var SelectorModel = class extends ElementModel {
|
|
|
61092
61096
|
exclude: []
|
|
61093
61097
|
};
|
|
61094
61098
|
}
|
|
61095
|
-
onStyleKeyUpdate(
|
|
61099
|
+
onStyleKeyUpdate(_key) {
|
|
61096
61100
|
}
|
|
61097
61101
|
};
|
|
61098
61102
|
var import_lodash2 = __toESM2(require_lodash(), 1);
|
|
@@ -61139,7 +61143,7 @@ var AnimationFrame = class {
|
|
|
61139
61143
|
_defineProperty5(this, "lastTime", 0);
|
|
61140
61144
|
_defineProperty5(this, "fps", 45);
|
|
61141
61145
|
_defineProperty5(this, "handleCallbacks", () => {
|
|
61142
|
-
|
|
61146
|
+
const functions = this.callbacks;
|
|
61143
61147
|
this.callbacks = [];
|
|
61144
61148
|
for (let i = 0, l2 = functions.length; i < l2; i++) {
|
|
61145
61149
|
functions[i]();
|
|
@@ -61190,6 +61194,8 @@ var SegmentsModel = class extends ElementModel {
|
|
|
61190
61194
|
this.root.set("points", new Y4.Array());
|
|
61191
61195
|
}
|
|
61192
61196
|
}
|
|
61197
|
+
subDispose() {
|
|
61198
|
+
}
|
|
61193
61199
|
onVectorUpdate() {
|
|
61194
61200
|
if (!this.item) {
|
|
61195
61201
|
return;
|
|
@@ -61224,7 +61230,7 @@ var SegmentsModel = class extends ElementModel {
|
|
|
61224
61230
|
exclude: []
|
|
61225
61231
|
};
|
|
61226
61232
|
}
|
|
61227
|
-
onStyleKeyUpdate(
|
|
61233
|
+
onStyleKeyUpdate(_key) {
|
|
61228
61234
|
}
|
|
61229
61235
|
};
|
|
61230
61236
|
var import_lodash4 = __toESM2(require_lodash(), 1);
|
|
@@ -61311,6 +61317,9 @@ var LineTool = class extends WhiteboardTool {
|
|
|
61311
61317
|
this.tool.minDistance = 1;
|
|
61312
61318
|
}
|
|
61313
61319
|
onMouseDown(event) {
|
|
61320
|
+
if (this.elementModel) {
|
|
61321
|
+
this.elementModel.dispose();
|
|
61322
|
+
}
|
|
61314
61323
|
this.elementModel = this.modelGetter().createLinePath(true);
|
|
61315
61324
|
this.from = event.point.clone();
|
|
61316
61325
|
this.to = event.point.clone();
|
|
@@ -61384,6 +61393,8 @@ var LineModel = class extends ElementModel {
|
|
|
61384
61393
|
this.root.set("tailArrow", "normal");
|
|
61385
61394
|
}
|
|
61386
61395
|
}
|
|
61396
|
+
subDispose() {
|
|
61397
|
+
}
|
|
61387
61398
|
onVectorUpdate() {
|
|
61388
61399
|
if (!this.item) {
|
|
61389
61400
|
return;
|
|
@@ -61420,7 +61431,7 @@ var LineModel = class extends ElementModel {
|
|
|
61420
61431
|
this.item.addChildren(this.renderLine());
|
|
61421
61432
|
}
|
|
61422
61433
|
createArrow(path) {
|
|
61423
|
-
|
|
61434
|
+
const [headPath, tailPath] = [new this.scope.Path(), new this.scope.Path()];
|
|
61424
61435
|
if (!path) {
|
|
61425
61436
|
return [headPath, tailPath];
|
|
61426
61437
|
}
|
|
@@ -61474,7 +61485,7 @@ var LineModel = class extends ElementModel {
|
|
|
61474
61485
|
exclude: ["fillColor"]
|
|
61475
61486
|
};
|
|
61476
61487
|
}
|
|
61477
|
-
onStyleKeyUpdate(
|
|
61488
|
+
onStyleKeyUpdate(_key) {
|
|
61478
61489
|
this.onVectorUpdate();
|
|
61479
61490
|
}
|
|
61480
61491
|
};
|
|
@@ -61594,6 +61605,9 @@ var PointTextModel = class extends ElementModel {
|
|
|
61594
61605
|
}, 60);
|
|
61595
61606
|
}
|
|
61596
61607
|
}
|
|
61608
|
+
subDispose() {
|
|
61609
|
+
this.root.unobserve(this.handleTextPropChange);
|
|
61610
|
+
}
|
|
61597
61611
|
getInternalMeasurement() {
|
|
61598
61612
|
if (!this.item) {
|
|
61599
61613
|
return null;
|
|
@@ -61696,6 +61710,8 @@ var TriangleModel = class extends ElementModel {
|
|
|
61696
61710
|
this.root.set("points", new Y7.Array());
|
|
61697
61711
|
}
|
|
61698
61712
|
}
|
|
61713
|
+
subDispose() {
|
|
61714
|
+
}
|
|
61699
61715
|
createPaperItem() {
|
|
61700
61716
|
this.item = new this.scope.Path();
|
|
61701
61717
|
this.item.strokeCap = "butt";
|
|
@@ -61752,7 +61768,7 @@ var TriangleModel = class extends ElementModel {
|
|
|
61752
61768
|
exclude: []
|
|
61753
61769
|
};
|
|
61754
61770
|
}
|
|
61755
|
-
onStyleKeyUpdate(
|
|
61771
|
+
onStyleKeyUpdate(_key) {
|
|
61756
61772
|
}
|
|
61757
61773
|
};
|
|
61758
61774
|
function _defineProperty12(e, r, t) {
|
|
@@ -61788,6 +61804,8 @@ var RectangleModel = class extends ElementModel {
|
|
|
61788
61804
|
this.root.set("radius", 0);
|
|
61789
61805
|
}
|
|
61790
61806
|
}
|
|
61807
|
+
subDispose() {
|
|
61808
|
+
}
|
|
61791
61809
|
createSegments() {
|
|
61792
61810
|
const [a2, b2, c, d] = this.points;
|
|
61793
61811
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
@@ -61919,7 +61937,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
61919
61937
|
exclude: []
|
|
61920
61938
|
};
|
|
61921
61939
|
}
|
|
61922
|
-
onStyleKeyUpdate(
|
|
61940
|
+
onStyleKeyUpdate(_key) {
|
|
61923
61941
|
}
|
|
61924
61942
|
};
|
|
61925
61943
|
var elementsUndoOrigin = "elementsUndoOrigin";
|
|
@@ -62055,9 +62073,11 @@ var EraserModel = class extends ElementModel {
|
|
|
62055
62073
|
exclude: []
|
|
62056
62074
|
};
|
|
62057
62075
|
}
|
|
62058
|
-
onStyleKeyUpdate(
|
|
62076
|
+
onStyleKeyUpdate(_key) {
|
|
62059
62077
|
return;
|
|
62060
62078
|
}
|
|
62079
|
+
subDispose() {
|
|
62080
|
+
}
|
|
62061
62081
|
};
|
|
62062
62082
|
var import_lodash6 = __toESM2(require_lodash(), 1);
|
|
62063
62083
|
function _defineProperty14(e, r, t) {
|
|
@@ -62211,27 +62231,12 @@ var LaserPointerModel = class extends ElementModel {
|
|
|
62211
62231
|
exclude: []
|
|
62212
62232
|
};
|
|
62213
62233
|
}
|
|
62214
|
-
onStyleKeyUpdate(
|
|
62234
|
+
onStyleKeyUpdate(_key) {
|
|
62215
62235
|
return;
|
|
62216
62236
|
}
|
|
62217
|
-
|
|
62218
|
-
function _defineProperty15(e, r, t) {
|
|
62219
|
-
return (r = _toPropertyKey15(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62220
|
-
}
|
|
62221
|
-
function _toPropertyKey15(t) {
|
|
62222
|
-
var i = _toPrimitive15(t, "string");
|
|
62223
|
-
return "symbol" == typeof i ? i : i + "";
|
|
62224
|
-
}
|
|
62225
|
-
function _toPrimitive15(t, r) {
|
|
62226
|
-
if ("object" != typeof t || !t) return t;
|
|
62227
|
-
var e = t[Symbol.toPrimitive];
|
|
62228
|
-
if (void 0 !== e) {
|
|
62229
|
-
var i = e.call(t, r || "default");
|
|
62230
|
-
if ("object" != typeof i) return i;
|
|
62231
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
62237
|
+
subDispose() {
|
|
62232
62238
|
}
|
|
62233
|
-
|
|
62234
|
-
}
|
|
62239
|
+
};
|
|
62235
62240
|
var WhiteboardPermissionFlag = function(WhiteboardPermissionFlag2) {
|
|
62236
62241
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["none"] = 0] = "none";
|
|
62237
62242
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["draw"] = 1] = "draw";
|
|
@@ -62244,117 +62249,25 @@ var WhiteboardPermissionFlag = function(WhiteboardPermissionFlag2) {
|
|
|
62244
62249
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["all"] = WhiteboardPermissionFlag2.draw | WhiteboardPermissionFlag2.editSelf | WhiteboardPermissionFlag2.editOthers | WhiteboardPermissionFlag2.deleteSelf | WhiteboardPermissionFlag2.deleteOthers | WhiteboardPermissionFlag2.mainView | WhiteboardPermissionFlag2.setOthersView] = "all";
|
|
62245
62250
|
return WhiteboardPermissionFlag2;
|
|
62246
62251
|
}({});
|
|
62247
|
-
var WhiteboardPermissions = class extends
|
|
62248
|
-
constructor(userManager, requestUserMap) {
|
|
62249
|
-
super();
|
|
62250
|
-
_defineProperty15(this, "requestUserMap", void 0);
|
|
62251
|
-
_defineProperty15(this, "userManager", void 0);
|
|
62252
|
-
_defineProperty15(this, "observers", /* @__PURE__ */ new Map());
|
|
62253
|
-
_defineProperty15(this, "handleUserLeave", (user) => {
|
|
62254
|
-
const cb = this.observers.get(user.id);
|
|
62255
|
-
if (cb) {
|
|
62256
|
-
this.requestUserMap(user.id).unobserve(cb);
|
|
62257
|
-
}
|
|
62258
|
-
});
|
|
62259
|
-
_defineProperty15(this, "handleUserJoin", (user) => {
|
|
62260
|
-
this.addObserve(user.id);
|
|
62261
|
-
});
|
|
62262
|
-
this.userManager = userManager;
|
|
62263
|
-
this.requestUserMap = requestUserMap;
|
|
62264
|
-
this.createModel(this.userManager.selfId);
|
|
62265
|
-
this.userManager.userIdList().forEach((userId) => {
|
|
62266
|
-
this.addObserve(userId);
|
|
62267
|
-
});
|
|
62268
|
-
this.userManager.on("join", this.handleUserJoin);
|
|
62269
|
-
this.userManager.on("leave", this.handleUserLeave);
|
|
62270
|
-
}
|
|
62271
|
-
addObserve(userId) {
|
|
62272
|
-
if (this.observers.has(userId)) {
|
|
62273
|
-
return;
|
|
62274
|
-
}
|
|
62275
|
-
const observer = (evt) => {
|
|
62276
|
-
this.handleUserPermissionChange(userId, evt);
|
|
62277
|
-
};
|
|
62278
|
-
this.observers.set(userId, observer);
|
|
62279
|
-
this.requestUserMap(userId).observe(observer);
|
|
62280
|
-
}
|
|
62281
|
-
createModel(userId) {
|
|
62282
|
-
const userMap = this.requestUserMap(userId);
|
|
62283
|
-
if (!userMap.has("permission")) {
|
|
62284
|
-
userMap.set("permission", 0);
|
|
62285
|
-
}
|
|
62286
|
-
}
|
|
62287
|
-
handleUserPermissionChange(userId, evt) {
|
|
62288
|
-
for (const [key, value] of evt.changes.keys.entries()) {
|
|
62289
|
-
if (key === "permission") {
|
|
62290
|
-
if (value.action === "add" || value.action === "update") {
|
|
62291
|
-
const newValue = this.requestUserMap(userId).get("permission");
|
|
62292
|
-
this.emit("change", userId, this.resolveFlags(newValue), newValue);
|
|
62293
|
-
}
|
|
62294
|
-
}
|
|
62295
|
-
}
|
|
62296
|
-
}
|
|
62252
|
+
var WhiteboardPermissions = class extends import_forge_room2.AbstractApplicationPermissions {
|
|
62297
62253
|
/**
|
|
62298
|
-
|
|
62299
|
-
|
|
62300
|
-
|
|
62301
|
-
|
|
62254
|
+
* 解析权限列表组合
|
|
62255
|
+
* @param {number} value - 权限数字值
|
|
62256
|
+
* @return {WhiteboardPermissionFlag[]} - 权限列表
|
|
62257
|
+
*/
|
|
62302
62258
|
resolveFlags(value) {
|
|
62303
62259
|
return [WhiteboardPermissionFlag.draw, WhiteboardPermissionFlag.editSelf, WhiteboardPermissionFlag.editOthers, WhiteboardPermissionFlag.deleteSelf, WhiteboardPermissionFlag.deleteOthers, WhiteboardPermissionFlag.mainView, WhiteboardPermissionFlag.setOthersView].filter((v) => (v & value) !== 0);
|
|
62304
62260
|
}
|
|
62305
|
-
/**
|
|
62306
|
-
* 获取权限列表组合对应的数值
|
|
62307
|
-
* @param { string } userId 不传表示获取自己
|
|
62308
|
-
*/
|
|
62309
|
-
getPermissionValue(userId) {
|
|
62310
|
-
return this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
62311
|
-
}
|
|
62312
|
-
/**
|
|
62313
|
-
* 获取权限列表
|
|
62314
|
-
* @param {string=} userId 可选, 不传表示获取自己
|
|
62315
|
-
*/
|
|
62316
|
-
getPermissionFlags(userId) {
|
|
62317
|
-
const value = this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
62318
|
-
return this.resolveFlags(value);
|
|
62319
|
-
}
|
|
62320
|
-
/**
|
|
62321
|
-
* 返回对应 userId 是否有相应权限
|
|
62322
|
-
* @param {string=} userId 可选, 不传表示返回自己是否有相应权限
|
|
62323
|
-
* @param {WhiteboardPermissionFlag} flag
|
|
62324
|
-
*/
|
|
62325
|
-
hasPermission(flag, userId) {
|
|
62326
|
-
return ((this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0) & flag) !== 0;
|
|
62327
|
-
}
|
|
62328
|
-
/**
|
|
62329
|
-
* 添加权限
|
|
62330
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
62331
|
-
* @param {string=} userId 可选, 为 userId 添加权限, 不传表示为自己添加权限
|
|
62332
|
-
*/
|
|
62333
|
-
addPermission(flag, userId) {
|
|
62334
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
62335
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
62336
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue | flag);
|
|
62337
|
-
}
|
|
62338
|
-
/**
|
|
62339
|
-
* 移除权限
|
|
62340
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
62341
|
-
* @param {string=} userId 可选, 为 userId 移除权限, 不传表示为自己移除权限
|
|
62342
|
-
*/
|
|
62343
|
-
removePermission(flag, userId) {
|
|
62344
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
62345
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
62346
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue & ~flag);
|
|
62347
|
-
}
|
|
62348
62261
|
};
|
|
62349
62262
|
var import_lodash7 = __toESM2(require_lodash(), 1);
|
|
62350
|
-
function
|
|
62351
|
-
return (r =
|
|
62263
|
+
function _defineProperty15(e, r, t) {
|
|
62264
|
+
return (r = _toPropertyKey15(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62352
62265
|
}
|
|
62353
|
-
function
|
|
62354
|
-
var i =
|
|
62266
|
+
function _toPropertyKey15(t) {
|
|
62267
|
+
var i = _toPrimitive15(t, "string");
|
|
62355
62268
|
return "symbol" == typeof i ? i : i + "";
|
|
62356
62269
|
}
|
|
62357
|
-
function
|
|
62270
|
+
function _toPrimitive15(t, r) {
|
|
62358
62271
|
if ("object" != typeof t || !t) return t;
|
|
62359
62272
|
var e = t[Symbol.toPrimitive];
|
|
62360
62273
|
if (void 0 !== e) {
|
|
@@ -62367,7 +62280,7 @@ function _toPrimitive16(t, r) {
|
|
|
62367
62280
|
var StraightLineModel = class extends ElementModel {
|
|
62368
62281
|
constructor(root, scope) {
|
|
62369
62282
|
super(root, scope);
|
|
62370
|
-
|
|
62283
|
+
_defineProperty15(this, "item", null);
|
|
62371
62284
|
if (!this.root.has("type")) {
|
|
62372
62285
|
this.root.set("type", "line");
|
|
62373
62286
|
}
|
|
@@ -62375,6 +62288,8 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62375
62288
|
this.root.set("points", new Y11.Array());
|
|
62376
62289
|
}
|
|
62377
62290
|
}
|
|
62291
|
+
subDispose() {
|
|
62292
|
+
}
|
|
62378
62293
|
onVectorUpdate() {
|
|
62379
62294
|
if (!this.item) {
|
|
62380
62295
|
return;
|
|
@@ -62448,7 +62363,7 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62448
62363
|
exclude: ["fillColor"]
|
|
62449
62364
|
};
|
|
62450
62365
|
}
|
|
62451
|
-
onStyleKeyUpdate(
|
|
62366
|
+
onStyleKeyUpdate(_key) {
|
|
62452
62367
|
if (!this.item) {
|
|
62453
62368
|
return;
|
|
62454
62369
|
}
|
|
@@ -62457,14 +62372,14 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62457
62372
|
this.item.addSegments(path.segments);
|
|
62458
62373
|
}
|
|
62459
62374
|
};
|
|
62460
|
-
function
|
|
62461
|
-
return (r =
|
|
62375
|
+
function _defineProperty16(e, r, t) {
|
|
62376
|
+
return (r = _toPropertyKey16(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62462
62377
|
}
|
|
62463
|
-
function
|
|
62464
|
-
var i =
|
|
62378
|
+
function _toPropertyKey16(t) {
|
|
62379
|
+
var i = _toPrimitive16(t, "string");
|
|
62465
62380
|
return "symbol" == typeof i ? i : i + "";
|
|
62466
62381
|
}
|
|
62467
|
-
function
|
|
62382
|
+
function _toPrimitive16(t, r) {
|
|
62468
62383
|
if ("object" != typeof t || !t) return t;
|
|
62469
62384
|
var e = t[Symbol.toPrimitive];
|
|
62470
62385
|
if (void 0 !== e) {
|
|
@@ -62480,16 +62395,16 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
62480
62395
|
}
|
|
62481
62396
|
constructor(layerId, shadowEmitter, elements, scope, toolbarModel, userManager, hasPermission) {
|
|
62482
62397
|
super();
|
|
62483
|
-
|
|
62484
|
-
|
|
62485
|
-
|
|
62486
|
-
|
|
62487
|
-
|
|
62488
|
-
|
|
62489
|
-
|
|
62490
|
-
|
|
62491
|
-
|
|
62492
|
-
|
|
62398
|
+
_defineProperty16(this, "scope", void 0);
|
|
62399
|
+
_defineProperty16(this, "toolbarModel", void 0);
|
|
62400
|
+
_defineProperty16(this, "userManager", void 0);
|
|
62401
|
+
_defineProperty16(this, "elementModels", void 0);
|
|
62402
|
+
_defineProperty16(this, "elements", void 0);
|
|
62403
|
+
_defineProperty16(this, "layerId", void 0);
|
|
62404
|
+
_defineProperty16(this, "maxIndex", -1);
|
|
62405
|
+
_defineProperty16(this, "hasPermission", void 0);
|
|
62406
|
+
_defineProperty16(this, "shadowEmitter", void 0);
|
|
62407
|
+
_defineProperty16(this, "onElementsChange", (event) => {
|
|
62493
62408
|
for (const [key, value] of event.changes.keys.entries()) {
|
|
62494
62409
|
if (value.action === "add") {
|
|
62495
62410
|
const root = this.elements.get(key);
|
|
@@ -62668,7 +62583,7 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
62668
62583
|
return segmentsModel;
|
|
62669
62584
|
}
|
|
62670
62585
|
createSelector() {
|
|
62671
|
-
let
|
|
62586
|
+
let _shadow = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
62672
62587
|
if (!this.hasPermission(WhiteboardPermissionFlag.editSelf) && !this.hasPermission(WhiteboardPermissionFlag.deleteOthers)) {
|
|
62673
62588
|
return null;
|
|
62674
62589
|
}
|
|
@@ -62725,7 +62640,11 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
62725
62640
|
});
|
|
62726
62641
|
}
|
|
62727
62642
|
dispose() {
|
|
62643
|
+
this.elements.unobserve(this.onElementsChange);
|
|
62728
62644
|
this.elements.clear();
|
|
62645
|
+
Array.from(this.elementModels.values()).forEach((model) => {
|
|
62646
|
+
model.dispose();
|
|
62647
|
+
});
|
|
62729
62648
|
}
|
|
62730
62649
|
};
|
|
62731
62650
|
var import_lodash8 = __toESM2(require_lodash(), 1);
|
|
@@ -62764,10 +62683,10 @@ var AnglePrecision = Deg2Rad(2);
|
|
|
62764
62683
|
var Phi = 0.5 * (-1 + Math.sqrt(5));
|
|
62765
62684
|
function DollarRecognizer() {
|
|
62766
62685
|
this.Unistrokes = new Array(3);
|
|
62767
|
-
this.Unistrokes[0] = new Unistroke("triangle", new
|
|
62768
|
-
this.Unistrokes[1] = new Unistroke("rectangle", new
|
|
62769
|
-
this.Unistrokes[2] = new Unistroke("circle", new
|
|
62770
|
-
this.Unistrokes[3] = new Unistroke("arrow", new
|
|
62686
|
+
this.Unistrokes[0] = new Unistroke("triangle", [new Point(137, 139), new Point(135, 141), new Point(133, 144), new Point(132, 146), new Point(130, 149), new Point(128, 151), new Point(126, 155), new Point(123, 160), new Point(120, 166), new Point(116, 171), new Point(112, 177), new Point(107, 183), new Point(102, 188), new Point(100, 191), new Point(95, 195), new Point(90, 199), new Point(86, 203), new Point(82, 206), new Point(80, 209), new Point(75, 213), new Point(73, 213), new Point(70, 216), new Point(67, 219), new Point(64, 221), new Point(61, 223), new Point(60, 225), new Point(62, 226), new Point(65, 225), new Point(67, 226), new Point(74, 226), new Point(77, 227), new Point(85, 229), new Point(91, 230), new Point(99, 231), new Point(108, 232), new Point(116, 233), new Point(125, 233), new Point(134, 234), new Point(145, 233), new Point(153, 232), new Point(160, 233), new Point(170, 234), new Point(177, 235), new Point(179, 236), new Point(186, 237), new Point(193, 238), new Point(198, 239), new Point(200, 237), new Point(202, 239), new Point(204, 238), new Point(206, 234), new Point(205, 230), new Point(202, 222), new Point(197, 216), new Point(192, 207), new Point(186, 198), new Point(179, 189), new Point(174, 183), new Point(170, 178), new Point(164, 171), new Point(161, 168), new Point(154, 160), new Point(148, 155), new Point(143, 150), new Point(138, 148), new Point(136, 148)]);
|
|
62687
|
+
this.Unistrokes[1] = new Unistroke("rectangle", [new Point(78, 149), new Point(78, 153), new Point(78, 157), new Point(78, 160), new Point(79, 162), new Point(79, 164), new Point(79, 167), new Point(79, 169), new Point(79, 173), new Point(79, 178), new Point(79, 183), new Point(80, 189), new Point(80, 193), new Point(80, 198), new Point(80, 202), new Point(81, 208), new Point(81, 210), new Point(81, 216), new Point(82, 222), new Point(82, 224), new Point(82, 227), new Point(83, 229), new Point(83, 231), new Point(85, 230), new Point(88, 232), new Point(90, 233), new Point(92, 232), new Point(94, 233), new Point(99, 232), new Point(102, 233), new Point(106, 233), new Point(109, 234), new Point(117, 235), new Point(123, 236), new Point(126, 236), new Point(135, 237), new Point(142, 238), new Point(145, 238), new Point(152, 238), new Point(154, 239), new Point(165, 238), new Point(174, 237), new Point(179, 236), new Point(186, 235), new Point(191, 235), new Point(195, 233), new Point(197, 233), new Point(200, 233), new Point(201, 235), new Point(201, 233), new Point(199, 231), new Point(198, 226), new Point(198, 220), new Point(196, 207), new Point(195, 195), new Point(195, 181), new Point(195, 173), new Point(195, 163), new Point(194, 155), new Point(192, 145), new Point(192, 143), new Point(192, 138), new Point(191, 135), new Point(191, 133), new Point(191, 130), new Point(190, 128), new Point(188, 129), new Point(186, 129), new Point(181, 132), new Point(173, 131), new Point(162, 131), new Point(151, 132), new Point(149, 132), new Point(138, 132), new Point(136, 132), new Point(122, 131), new Point(120, 131), new Point(109, 130), new Point(107, 130), new Point(90, 132), new Point(81, 133), new Point(76, 133)]);
|
|
62688
|
+
this.Unistrokes[2] = new Unistroke("circle", [new Point(127, 141), new Point(124, 140), new Point(120, 139), new Point(118, 139), new Point(116, 139), new Point(111, 140), new Point(109, 141), new Point(104, 144), new Point(100, 147), new Point(96, 152), new Point(93, 157), new Point(90, 163), new Point(87, 169), new Point(85, 175), new Point(83, 181), new Point(82, 190), new Point(82, 195), new Point(83, 200), new Point(84, 205), new Point(88, 213), new Point(91, 216), new Point(96, 219), new Point(103, 222), new Point(108, 224), new Point(111, 224), new Point(120, 224), new Point(133, 223), new Point(142, 222), new Point(152, 218), new Point(160, 214), new Point(167, 210), new Point(173, 204), new Point(178, 198), new Point(179, 196), new Point(182, 188), new Point(182, 177), new Point(178, 167), new Point(170, 150), new Point(163, 138), new Point(152, 130), new Point(143, 129), new Point(140, 131), new Point(129, 136), new Point(126, 139)]);
|
|
62689
|
+
this.Unistrokes[3] = new Unistroke("arrow", [new Point(68, 222), new Point(70, 220), new Point(73, 218), new Point(75, 217), new Point(77, 215), new Point(80, 213), new Point(82, 212), new Point(84, 210), new Point(87, 209), new Point(89, 208), new Point(92, 206), new Point(95, 204), new Point(101, 201), new Point(106, 198), new Point(112, 194), new Point(118, 191), new Point(124, 187), new Point(127, 186), new Point(132, 183), new Point(138, 181), new Point(141, 180), new Point(146, 178), new Point(154, 173), new Point(159, 171), new Point(161, 170), new Point(166, 167), new Point(168, 167), new Point(171, 166), new Point(174, 164), new Point(177, 162), new Point(180, 160), new Point(182, 158), new Point(183, 156), new Point(181, 154), new Point(178, 153), new Point(171, 153), new Point(164, 153), new Point(160, 153), new Point(150, 154), new Point(147, 155), new Point(141, 157), new Point(137, 158), new Point(135, 158), new Point(137, 158), new Point(140, 157), new Point(143, 156), new Point(151, 154), new Point(160, 152), new Point(170, 149), new Point(179, 147), new Point(185, 145), new Point(192, 144), new Point(196, 144), new Point(198, 144), new Point(200, 144), new Point(201, 147), new Point(199, 149), new Point(194, 157), new Point(191, 160), new Point(186, 167), new Point(180, 176), new Point(177, 179), new Point(171, 187), new Point(169, 189), new Point(165, 194), new Point(164, 196)]);
|
|
62771
62690
|
this.Recognize = function(points, useProtractor) {
|
|
62772
62691
|
var t0 = Date.now();
|
|
62773
62692
|
var candidate = new Unistroke("", points);
|
|
@@ -62828,7 +62747,7 @@ function RotateBy(points, radians) {
|
|
|
62828
62747
|
var c = Centroid(points);
|
|
62829
62748
|
var cos = Math.cos(radians);
|
|
62830
62749
|
var sin = Math.sin(radians);
|
|
62831
|
-
var newpoints =
|
|
62750
|
+
var newpoints = [];
|
|
62832
62751
|
for (var i = 0; i < points.length; i++) {
|
|
62833
62752
|
var qx = (points[i].X - c.X) * cos - (points[i].Y - c.Y) * sin + c.X;
|
|
62834
62753
|
var qy = (points[i].X - c.X) * sin + (points[i].Y - c.Y) * cos + c.Y;
|
|
@@ -62838,7 +62757,7 @@ function RotateBy(points, radians) {
|
|
|
62838
62757
|
}
|
|
62839
62758
|
function ScaleTo(points, size) {
|
|
62840
62759
|
var B2 = BoundingBox(points);
|
|
62841
|
-
var newpoints =
|
|
62760
|
+
var newpoints = [];
|
|
62842
62761
|
for (var i = 0; i < points.length; i++) {
|
|
62843
62762
|
var qx = points[i].X * (size / B2.Width);
|
|
62844
62763
|
var qy = points[i].Y * (size / B2.Height);
|
|
@@ -62848,7 +62767,7 @@ function ScaleTo(points, size) {
|
|
|
62848
62767
|
}
|
|
62849
62768
|
function TranslateTo(points, pt) {
|
|
62850
62769
|
var c = Centroid(points);
|
|
62851
|
-
var newpoints =
|
|
62770
|
+
var newpoints = [];
|
|
62852
62771
|
for (var i = 0; i < points.length; i++) {
|
|
62853
62772
|
var qx = points[i].X + pt.X - c.X;
|
|
62854
62773
|
var qy = points[i].Y + pt.Y - c.Y;
|
|
@@ -62858,14 +62777,14 @@ function TranslateTo(points, pt) {
|
|
|
62858
62777
|
}
|
|
62859
62778
|
function Vectorize(points) {
|
|
62860
62779
|
var sum = 0;
|
|
62861
|
-
var vector =
|
|
62862
|
-
for (
|
|
62780
|
+
var vector = [];
|
|
62781
|
+
for (let i = 0; i < points.length; i++) {
|
|
62863
62782
|
vector[vector.length] = points[i].X;
|
|
62864
62783
|
vector[vector.length] = points[i].Y;
|
|
62865
62784
|
sum += points[i].X * points[i].X + points[i].Y * points[i].Y;
|
|
62866
62785
|
}
|
|
62867
62786
|
var magnitude = Math.sqrt(sum);
|
|
62868
|
-
for (
|
|
62787
|
+
for (let i = 0; i < vector.length; i++)
|
|
62869
62788
|
vector[i] /= magnitude;
|
|
62870
62789
|
return vector;
|
|
62871
62790
|
}
|
|
@@ -62945,14 +62864,14 @@ function Distance(p1, p2) {
|
|
|
62945
62864
|
function Deg2Rad(d) {
|
|
62946
62865
|
return d * Math.PI / 180;
|
|
62947
62866
|
}
|
|
62948
|
-
function
|
|
62949
|
-
return (r =
|
|
62867
|
+
function _defineProperty17(e, r, t) {
|
|
62868
|
+
return (r = _toPropertyKey17(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62950
62869
|
}
|
|
62951
|
-
function
|
|
62952
|
-
var i =
|
|
62870
|
+
function _toPropertyKey17(t) {
|
|
62871
|
+
var i = _toPrimitive17(t, "string");
|
|
62953
62872
|
return "symbol" == typeof i ? i : i + "";
|
|
62954
62873
|
}
|
|
62955
|
-
function
|
|
62874
|
+
function _toPrimitive17(t, r) {
|
|
62956
62875
|
if ("object" != typeof t || !t) return t;
|
|
62957
62876
|
var e = t[Symbol.toPrimitive];
|
|
62958
62877
|
if (void 0 !== e) {
|
|
@@ -62964,7 +62883,7 @@ function _toPrimitive18(t, r) {
|
|
|
62964
62883
|
}
|
|
62965
62884
|
var Recognizer = class {
|
|
62966
62885
|
constructor() {
|
|
62967
|
-
|
|
62886
|
+
_defineProperty17(this, "dollar", new DollarRecognizer());
|
|
62968
62887
|
}
|
|
62969
62888
|
recognize(points) {
|
|
62970
62889
|
let minX = Number.MAX_VALUE;
|
|
@@ -62990,14 +62909,14 @@ var Recognizer = class {
|
|
|
62990
62909
|
return null;
|
|
62991
62910
|
}
|
|
62992
62911
|
};
|
|
62993
|
-
function
|
|
62994
|
-
return (r =
|
|
62912
|
+
function _defineProperty18(e, r, t) {
|
|
62913
|
+
return (r = _toPropertyKey18(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62995
62914
|
}
|
|
62996
|
-
function
|
|
62997
|
-
var i =
|
|
62915
|
+
function _toPropertyKey18(t) {
|
|
62916
|
+
var i = _toPrimitive18(t, "string");
|
|
62998
62917
|
return "symbol" == typeof i ? i : i + "";
|
|
62999
62918
|
}
|
|
63000
|
-
function
|
|
62919
|
+
function _toPrimitive18(t, r) {
|
|
63001
62920
|
if ("object" != typeof t || !t) return t;
|
|
63002
62921
|
var e = t[Symbol.toPrimitive];
|
|
63003
62922
|
if (void 0 !== e) {
|
|
@@ -63010,13 +62929,16 @@ function _toPrimitive19(t, r) {
|
|
|
63010
62929
|
var CurveTool = class extends WhiteboardTool {
|
|
63011
62930
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
63012
62931
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
63013
|
-
|
|
63014
|
-
|
|
63015
|
-
|
|
62932
|
+
_defineProperty18(this, "elementModel", null);
|
|
62933
|
+
_defineProperty18(this, "recognizer", new Recognizer());
|
|
62934
|
+
_defineProperty18(this, "pointCount", 0);
|
|
63016
62935
|
this.tool.minDistance = 1;
|
|
63017
62936
|
}
|
|
63018
|
-
onMouseDown(
|
|
62937
|
+
onMouseDown(_event) {
|
|
63019
62938
|
this.pointCount = 0;
|
|
62939
|
+
if (this.elementModel) {
|
|
62940
|
+
this.elementModel.dispose();
|
|
62941
|
+
}
|
|
63020
62942
|
this.elementModel = this.modelGetter().createCurve(true);
|
|
63021
62943
|
}
|
|
63022
62944
|
onMouseDrag(event) {
|
|
@@ -63059,14 +62981,14 @@ var CurveTool = class extends WhiteboardTool {
|
|
|
63059
62981
|
}
|
|
63060
62982
|
}
|
|
63061
62983
|
};
|
|
63062
|
-
function
|
|
63063
|
-
return (r =
|
|
62984
|
+
function _defineProperty19(e, r, t) {
|
|
62985
|
+
return (r = _toPropertyKey19(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63064
62986
|
}
|
|
63065
|
-
function
|
|
63066
|
-
var i =
|
|
62987
|
+
function _toPropertyKey19(t) {
|
|
62988
|
+
var i = _toPrimitive19(t, "string");
|
|
63067
62989
|
return "symbol" == typeof i ? i : i + "";
|
|
63068
62990
|
}
|
|
63069
|
-
function
|
|
62991
|
+
function _toPrimitive19(t, r) {
|
|
63070
62992
|
if ("object" != typeof t || !t) return t;
|
|
63071
62993
|
var e = t[Symbol.toPrimitive];
|
|
63072
62994
|
if (void 0 !== e) {
|
|
@@ -63079,12 +63001,15 @@ function _toPrimitive20(t, r) {
|
|
|
63079
63001
|
var RectangleTool = class extends WhiteboardTool {
|
|
63080
63002
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
63081
63003
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
63082
|
-
|
|
63083
|
-
|
|
63084
|
-
|
|
63004
|
+
_defineProperty19(this, "elementModel", null);
|
|
63005
|
+
_defineProperty19(this, "from", null);
|
|
63006
|
+
_defineProperty19(this, "to", null);
|
|
63085
63007
|
this.tool.minDistance = 1;
|
|
63086
63008
|
}
|
|
63087
63009
|
onMouseDown(event) {
|
|
63010
|
+
if (this.elementModel) {
|
|
63011
|
+
this.elementModel.dispose();
|
|
63012
|
+
}
|
|
63088
63013
|
this.elementModel = this.modelGetter().createRectangle(true);
|
|
63089
63014
|
this.from = event.point.clone();
|
|
63090
63015
|
this.to = event.point.clone();
|
|
@@ -63104,14 +63029,14 @@ var RectangleTool = class extends WhiteboardTool {
|
|
|
63104
63029
|
}
|
|
63105
63030
|
}
|
|
63106
63031
|
};
|
|
63107
|
-
function
|
|
63108
|
-
return (r =
|
|
63032
|
+
function _defineProperty20(e, r, t) {
|
|
63033
|
+
return (r = _toPropertyKey20(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63109
63034
|
}
|
|
63110
|
-
function
|
|
63111
|
-
var i =
|
|
63035
|
+
function _toPropertyKey20(t) {
|
|
63036
|
+
var i = _toPrimitive20(t, "string");
|
|
63112
63037
|
return "symbol" == typeof i ? i : i + "";
|
|
63113
63038
|
}
|
|
63114
|
-
function
|
|
63039
|
+
function _toPrimitive20(t, r) {
|
|
63115
63040
|
if ("object" != typeof t || !t) return t;
|
|
63116
63041
|
var e = t[Symbol.toPrimitive];
|
|
63117
63042
|
if (void 0 !== e) {
|
|
@@ -63130,7 +63055,7 @@ var TOOLBAR_KEYS = {
|
|
|
63130
63055
|
strokeWidth: "strokeWidth",
|
|
63131
63056
|
dashArray: "dashArray"
|
|
63132
63057
|
};
|
|
63133
|
-
var ToolbarModel = class extends
|
|
63058
|
+
var ToolbarModel = class extends import_eventemitter32.default {
|
|
63134
63059
|
get currentTool() {
|
|
63135
63060
|
return this.root.get(TOOLBAR_KEYS.tool);
|
|
63136
63061
|
}
|
|
@@ -63175,8 +63100,8 @@ var ToolbarModel = class extends import_eventemitter33.default {
|
|
|
63175
63100
|
}
|
|
63176
63101
|
constructor(root, defaultStyle) {
|
|
63177
63102
|
super();
|
|
63178
|
-
|
|
63179
|
-
|
|
63103
|
+
_defineProperty20(this, "root", void 0);
|
|
63104
|
+
_defineProperty20(this, "handleRootUpdate", (evt) => {
|
|
63180
63105
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
63181
63106
|
if (Object.keys(TOOLBAR_KEYS).indexOf(key) >= 0 && (value.action === "add" || value.action === "update")) {
|
|
63182
63107
|
this.emit("update", {
|
|
@@ -63199,15 +63124,19 @@ var ToolbarModel = class extends import_eventemitter33.default {
|
|
|
63199
63124
|
}
|
|
63200
63125
|
});
|
|
63201
63126
|
}
|
|
63127
|
+
dispose() {
|
|
63128
|
+
this.root.unobserve(this.handleRootUpdate);
|
|
63129
|
+
this.removeAllListeners();
|
|
63130
|
+
}
|
|
63202
63131
|
};
|
|
63203
|
-
function
|
|
63204
|
-
return (r =
|
|
63132
|
+
function _defineProperty21(e, r, t) {
|
|
63133
|
+
return (r = _toPropertyKey21(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63205
63134
|
}
|
|
63206
|
-
function
|
|
63207
|
-
var i =
|
|
63135
|
+
function _toPropertyKey21(t) {
|
|
63136
|
+
var i = _toPrimitive21(t, "string");
|
|
63208
63137
|
return "symbol" == typeof i ? i : i + "";
|
|
63209
63138
|
}
|
|
63210
|
-
function
|
|
63139
|
+
function _toPrimitive21(t, r) {
|
|
63211
63140
|
if ("object" != typeof t || !t) return t;
|
|
63212
63141
|
var e = t[Symbol.toPrimitive];
|
|
63213
63142
|
if (void 0 !== e) {
|
|
@@ -63220,16 +63149,19 @@ function _toPrimitive22(t, r) {
|
|
|
63220
63149
|
var SelectorTool = class extends WhiteboardTool {
|
|
63221
63150
|
constructor(enableToolEvent, renderableModel, shadowEmitter, scope, selectElementsModel) {
|
|
63222
63151
|
super(enableToolEvent, renderableModel, shadowEmitter, scope);
|
|
63223
|
-
|
|
63224
|
-
|
|
63225
|
-
|
|
63226
|
-
|
|
63227
|
-
|
|
63152
|
+
_defineProperty21(this, "elementModel", null);
|
|
63153
|
+
_defineProperty21(this, "from", null);
|
|
63154
|
+
_defineProperty21(this, "to", null);
|
|
63155
|
+
_defineProperty21(this, "selectElementsModel", void 0);
|
|
63156
|
+
_defineProperty21(this, "selectElements", /* @__PURE__ */ new Map());
|
|
63228
63157
|
this.selectElementsModel = selectElementsModel;
|
|
63229
63158
|
}
|
|
63230
63159
|
onMouseDown(event) {
|
|
63231
63160
|
this.from = null;
|
|
63232
63161
|
this.to = null;
|
|
63162
|
+
if (this.elementModel) {
|
|
63163
|
+
this.elementModel.dispose();
|
|
63164
|
+
}
|
|
63233
63165
|
this.elementModel = this.modelGetter().createSelector();
|
|
63234
63166
|
this.from = event.point.clone();
|
|
63235
63167
|
this.to = event.point.clone();
|
|
@@ -63285,14 +63217,14 @@ var WhiteboardKeys = {
|
|
|
63285
63217
|
viewMatrix: "viewMatrix",
|
|
63286
63218
|
cameraMode: "cameraMode"
|
|
63287
63219
|
};
|
|
63288
|
-
function
|
|
63289
|
-
return (r =
|
|
63220
|
+
function _defineProperty22(e, r, t) {
|
|
63221
|
+
return (r = _toPropertyKey22(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63290
63222
|
}
|
|
63291
|
-
function
|
|
63292
|
-
var i =
|
|
63223
|
+
function _toPropertyKey22(t) {
|
|
63224
|
+
var i = _toPrimitive22(t, "string");
|
|
63293
63225
|
return "symbol" == typeof i ? i : i + "";
|
|
63294
63226
|
}
|
|
63295
|
-
function
|
|
63227
|
+
function _toPrimitive22(t, r) {
|
|
63296
63228
|
if ("object" != typeof t || !t) return t;
|
|
63297
63229
|
var e = t[Symbol.toPrimitive];
|
|
63298
63230
|
if (void 0 !== e) {
|
|
@@ -63302,7 +63234,7 @@ function _toPrimitive23(t, r) {
|
|
|
63302
63234
|
}
|
|
63303
63235
|
return ("string" === r ? String : Number)(t);
|
|
63304
63236
|
}
|
|
63305
|
-
var SelectElementsModel = class extends
|
|
63237
|
+
var SelectElementsModel = class extends import_eventemitter33.default {
|
|
63306
63238
|
get hasEditSelfPermission() {
|
|
63307
63239
|
return this.hasPermission(WhiteboardPermissionFlag.editSelf);
|
|
63308
63240
|
}
|
|
@@ -63311,24 +63243,28 @@ var SelectElementsModel = class extends import_eventemitter34.default {
|
|
|
63311
63243
|
}
|
|
63312
63244
|
constructor(userManager, requestUserMap, hasPermission) {
|
|
63313
63245
|
super();
|
|
63314
|
-
|
|
63315
|
-
|
|
63316
|
-
|
|
63317
|
-
|
|
63318
|
-
|
|
63246
|
+
_defineProperty22(this, "requestUserMap", void 0);
|
|
63247
|
+
_defineProperty22(this, "userManager", void 0);
|
|
63248
|
+
_defineProperty22(this, "hasPermission", void 0);
|
|
63249
|
+
_defineProperty22(this, "observers", /* @__PURE__ */ new Map());
|
|
63250
|
+
_defineProperty22(this, "handleUserLeave", (user) => {
|
|
63319
63251
|
const cb = this.observers.get(user.id);
|
|
63320
63252
|
if (cb) {
|
|
63321
63253
|
this.requestUserMap(user.id).unobserveDeep(cb);
|
|
63254
|
+
this.observers.delete(user.id);
|
|
63322
63255
|
}
|
|
63323
63256
|
});
|
|
63324
|
-
|
|
63257
|
+
_defineProperty22(this, "handleUserJoin", (user) => {
|
|
63325
63258
|
const observer = (evts) => {
|
|
63326
63259
|
this.handleUserSelectElementsChange(user.id, evts);
|
|
63327
63260
|
};
|
|
63261
|
+
if (this.observers.has(user.id)) {
|
|
63262
|
+
this.requestUserMap(user.id).unobserveDeep(this.observers.get(user.id));
|
|
63263
|
+
}
|
|
63328
63264
|
this.requestUserMap(user.id).observeDeep(observer);
|
|
63329
63265
|
this.observers.set(user.id, observer);
|
|
63330
63266
|
});
|
|
63331
|
-
|
|
63267
|
+
_defineProperty22(this, "handleUserSelectElementsChange", (userId, evts) => {
|
|
63332
63268
|
for (const evt of evts) {
|
|
63333
63269
|
if (evt.target.get("inner-map-id") === WhiteboardKeys.selectElements) {
|
|
63334
63270
|
const elementIds = Array.from(evt.target.keys()).filter((v) => v !== "inner-map-id");
|
|
@@ -63344,6 +63280,9 @@ var SelectElementsModel = class extends import_eventemitter34.default {
|
|
|
63344
63280
|
const observer = (evts) => {
|
|
63345
63281
|
this.handleUserSelectElementsChange(userId, evts);
|
|
63346
63282
|
};
|
|
63283
|
+
if (this.observers.has(userId)) {
|
|
63284
|
+
this.requestUserMap(userId).unobserveDeep(this.observers.get(userId));
|
|
63285
|
+
}
|
|
63347
63286
|
this.requestUserMap(userId).observeDeep(observer);
|
|
63348
63287
|
this.observers.set(userId, observer);
|
|
63349
63288
|
});
|
|
@@ -63398,25 +63337,22 @@ var SelectElementsModel = class extends import_eventemitter34.default {
|
|
|
63398
63337
|
});
|
|
63399
63338
|
}
|
|
63400
63339
|
dispose() {
|
|
63401
|
-
this.
|
|
63402
|
-
|
|
63403
|
-
|
|
63404
|
-
this.requestUserMap(userId).unobserveDeep(cb);
|
|
63405
|
-
}
|
|
63406
|
-
});
|
|
63340
|
+
for (const [key, value] of this.observers.entries()) {
|
|
63341
|
+
this.requestUserMap(key).unobserveDeep(value);
|
|
63342
|
+
}
|
|
63407
63343
|
this.observers.clear();
|
|
63408
63344
|
this.userManager.off("leave", this.handleUserLeave);
|
|
63409
63345
|
this.userManager.off("join", this.handleUserJoin);
|
|
63410
63346
|
}
|
|
63411
63347
|
};
|
|
63412
|
-
function
|
|
63413
|
-
return (r =
|
|
63348
|
+
function _defineProperty23(e, r, t) {
|
|
63349
|
+
return (r = _toPropertyKey23(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63414
63350
|
}
|
|
63415
|
-
function
|
|
63416
|
-
var i =
|
|
63351
|
+
function _toPropertyKey23(t) {
|
|
63352
|
+
var i = _toPrimitive23(t, "string");
|
|
63417
63353
|
return "symbol" == typeof i ? i : i + "";
|
|
63418
63354
|
}
|
|
63419
|
-
function
|
|
63355
|
+
function _toPrimitive23(t, r) {
|
|
63420
63356
|
if ("object" != typeof t || !t) return t;
|
|
63421
63357
|
var e = t[Symbol.toPrimitive];
|
|
63422
63358
|
if (void 0 !== e) {
|
|
@@ -63426,31 +63362,31 @@ function _toPrimitive24(t, r) {
|
|
|
63426
63362
|
}
|
|
63427
63363
|
return ("string" === r ? String : Number)(t);
|
|
63428
63364
|
}
|
|
63429
|
-
var TextEditor = class extends
|
|
63365
|
+
var TextEditor = class extends import_eventemitter35.EventEmitter {
|
|
63430
63366
|
constructor(camera) {
|
|
63431
63367
|
super();
|
|
63432
|
-
|
|
63433
|
-
|
|
63434
|
-
|
|
63435
|
-
|
|
63436
|
-
|
|
63437
|
-
|
|
63438
|
-
|
|
63439
|
-
|
|
63368
|
+
_defineProperty23(this, "rootView", void 0);
|
|
63369
|
+
_defineProperty23(this, "content", void 0);
|
|
63370
|
+
_defineProperty23(this, "camera", void 0);
|
|
63371
|
+
_defineProperty23(this, "originX", 0);
|
|
63372
|
+
_defineProperty23(this, "originY", 0);
|
|
63373
|
+
_defineProperty23(this, "rotation", 0);
|
|
63374
|
+
_defineProperty23(this, "scale", 1);
|
|
63375
|
+
_defineProperty23(this, "handleContentInput", () => {
|
|
63440
63376
|
this.emit("change", this.content.textContent ?? "");
|
|
63441
63377
|
this.translateCaretIntoView();
|
|
63442
63378
|
});
|
|
63443
|
-
|
|
63379
|
+
_defineProperty23(this, "handleContentKeydown", (evt) => {
|
|
63444
63380
|
if (/^Arrow/.test(evt.key)) {
|
|
63445
63381
|
setTimeout(() => {
|
|
63446
63382
|
this.translateCaretIntoView();
|
|
63447
63383
|
}, 50);
|
|
63448
63384
|
}
|
|
63449
63385
|
});
|
|
63450
|
-
|
|
63386
|
+
_defineProperty23(this, "handleContentBlur", () => {
|
|
63451
63387
|
this.emit("done", this.content.textContent ?? "");
|
|
63452
63388
|
});
|
|
63453
|
-
|
|
63389
|
+
_defineProperty23(this, "handleRootClick", (evt) => {
|
|
63454
63390
|
if (evt.target === this.rootView) {
|
|
63455
63391
|
evt.stopPropagation();
|
|
63456
63392
|
evt.preventDefault();
|
|
@@ -63459,12 +63395,12 @@ var TextEditor = class extends import_eventemitter36.EventEmitter {
|
|
|
63459
63395
|
});
|
|
63460
63396
|
this.camera = camera;
|
|
63461
63397
|
this.rootView = document.createElement("div");
|
|
63462
|
-
this.rootView.style.cssText =
|
|
63398
|
+
this.rootView.style.cssText = "position:absolute;width:100%;height:100%;top:0;left:0;overflow:hidden;";
|
|
63463
63399
|
this.content = document.createElement("div");
|
|
63464
63400
|
this.content.setAttribute("spellcheck", "false");
|
|
63465
63401
|
this.content.textContent = "";
|
|
63466
63402
|
this.content.setAttribute("contenteditable", "plaintext-only");
|
|
63467
|
-
this.content.style.cssText =
|
|
63403
|
+
this.content.style.cssText = "white-space: nowrap;border:1px solid red;text-wrap:nowrap;caret-color:red;line-height:1.2em;position:absolute;z-index:2;color:transparent;outline:none;";
|
|
63468
63404
|
this.content.style.transformOrigin = "0 0";
|
|
63469
63405
|
this.rootView.appendChild(this.content);
|
|
63470
63406
|
this.content.addEventListener("input", this.handleContentInput);
|
|
@@ -63540,14 +63476,14 @@ var TextEditor = class extends import_eventemitter36.EventEmitter {
|
|
|
63540
63476
|
this.rootView.removeEventListener("pointerdown", this.handleRootClick);
|
|
63541
63477
|
}
|
|
63542
63478
|
};
|
|
63543
|
-
function
|
|
63544
|
-
return (r =
|
|
63479
|
+
function _defineProperty24(e, r, t) {
|
|
63480
|
+
return (r = _toPropertyKey24(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63545
63481
|
}
|
|
63546
|
-
function
|
|
63547
|
-
var i =
|
|
63482
|
+
function _toPropertyKey24(t) {
|
|
63483
|
+
var i = _toPrimitive24(t, "string");
|
|
63548
63484
|
return "symbol" == typeof i ? i : i + "";
|
|
63549
63485
|
}
|
|
63550
|
-
function
|
|
63486
|
+
function _toPrimitive24(t, r) {
|
|
63551
63487
|
if ("object" != typeof t || !t) return t;
|
|
63552
63488
|
var e = t[Symbol.toPrimitive];
|
|
63553
63489
|
if (void 0 !== e) {
|
|
@@ -63567,7 +63503,7 @@ var ANCHOR_STYLE = {
|
|
|
63567
63503
|
b: "cursor:s-resize;bottom:-3px;left:50%;translate:-50%;",
|
|
63568
63504
|
br: "cursor:se-resize;bottom:-3px;right:-3px"
|
|
63569
63505
|
};
|
|
63570
|
-
var Bounds = class extends
|
|
63506
|
+
var Bounds = class extends import_eventemitter34.default {
|
|
63571
63507
|
get width() {
|
|
63572
63508
|
return this.maxX - this.minX;
|
|
63573
63509
|
}
|
|
@@ -63582,12 +63518,12 @@ var Bounds = class extends import_eventemitter35.default {
|
|
|
63582
63518
|
}
|
|
63583
63519
|
constructor(binding, scope) {
|
|
63584
63520
|
super();
|
|
63585
|
-
|
|
63586
|
-
|
|
63587
|
-
|
|
63588
|
-
|
|
63589
|
-
|
|
63590
|
-
|
|
63521
|
+
_defineProperty24(this, "minX", 0);
|
|
63522
|
+
_defineProperty24(this, "minY", 0);
|
|
63523
|
+
_defineProperty24(this, "maxX", 0);
|
|
63524
|
+
_defineProperty24(this, "maxY", 0);
|
|
63525
|
+
_defineProperty24(this, "binding", void 0);
|
|
63526
|
+
_defineProperty24(this, "scope", void 0);
|
|
63591
63527
|
this.binding = binding;
|
|
63592
63528
|
this.scope = scope;
|
|
63593
63529
|
}
|
|
@@ -63706,35 +63642,35 @@ var Bounds = class extends import_eventemitter35.default {
|
|
|
63706
63642
|
this.maxY = maxY;
|
|
63707
63643
|
}
|
|
63708
63644
|
};
|
|
63709
|
-
var Editor = class extends
|
|
63645
|
+
var Editor = class extends import_eventemitter34.default {
|
|
63710
63646
|
constructor(scope, shadowScope, shadowEmitter, canvasElement, camera, initConfig) {
|
|
63711
63647
|
super();
|
|
63712
|
-
|
|
63713
|
-
|
|
63714
|
-
|
|
63715
|
-
|
|
63716
|
-
|
|
63717
|
-
|
|
63718
|
-
|
|
63719
|
-
|
|
63720
|
-
|
|
63721
|
-
|
|
63722
|
-
|
|
63723
|
-
|
|
63724
|
-
|
|
63725
|
-
|
|
63726
|
-
|
|
63727
|
-
|
|
63728
|
-
|
|
63729
|
-
|
|
63730
|
-
|
|
63731
|
-
|
|
63732
|
-
|
|
63733
|
-
|
|
63734
|
-
|
|
63735
|
-
|
|
63736
|
-
|
|
63737
|
-
|
|
63648
|
+
_defineProperty24(this, "rootView", void 0);
|
|
63649
|
+
_defineProperty24(this, "frame", void 0);
|
|
63650
|
+
_defineProperty24(this, "rotator", void 0);
|
|
63651
|
+
_defineProperty24(this, "scope", void 0);
|
|
63652
|
+
_defineProperty24(this, "shadowScope", void 0);
|
|
63653
|
+
_defineProperty24(this, "shadowContainer", void 0);
|
|
63654
|
+
_defineProperty24(this, "ctrlUserMap", void 0);
|
|
63655
|
+
_defineProperty24(this, "viewerId", void 0);
|
|
63656
|
+
_defineProperty24(this, "ctrlId", void 0);
|
|
63657
|
+
_defineProperty24(this, "ctrlNickName", void 0);
|
|
63658
|
+
_defineProperty24(this, "editMode", null);
|
|
63659
|
+
_defineProperty24(this, "editCtrlName", null);
|
|
63660
|
+
_defineProperty24(this, "editAnchor", null);
|
|
63661
|
+
_defineProperty24(this, "lastEditPoint", null);
|
|
63662
|
+
_defineProperty24(this, "bounds", void 0);
|
|
63663
|
+
_defineProperty24(this, "targets", []);
|
|
63664
|
+
_defineProperty24(this, "editorConfig", null);
|
|
63665
|
+
_defineProperty24(this, "aspectRatio", -1);
|
|
63666
|
+
_defineProperty24(this, "uniformScale", false);
|
|
63667
|
+
_defineProperty24(this, "camera", void 0);
|
|
63668
|
+
_defineProperty24(this, "canvasElement", void 0);
|
|
63669
|
+
_defineProperty24(this, "resizeObserver", void 0);
|
|
63670
|
+
_defineProperty24(this, "anchors", []);
|
|
63671
|
+
_defineProperty24(this, "title", null);
|
|
63672
|
+
_defineProperty24(this, "shadowEmitter", void 0);
|
|
63673
|
+
_defineProperty24(this, "handleMatrix", (matrix) => {
|
|
63738
63674
|
if (this.shadowContainer) {
|
|
63739
63675
|
const next = matrix.appended(this.shadowContainer.data.shadowMatrix ?? new this.shadowScope.Matrix());
|
|
63740
63676
|
this.shadowContainer.data.shadowMatrix = next;
|
|
@@ -63744,7 +63680,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63744
63680
|
this.targets.forEach((target) => target.appendPointsMatrix(matrix));
|
|
63745
63681
|
}
|
|
63746
63682
|
});
|
|
63747
|
-
|
|
63683
|
+
_defineProperty24(this, "handlePointerDown", (evt) => {
|
|
63748
63684
|
if (!evt.target) {
|
|
63749
63685
|
return;
|
|
63750
63686
|
}
|
|
@@ -63800,14 +63736,14 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63800
63736
|
};
|
|
63801
63737
|
}
|
|
63802
63738
|
});
|
|
63803
|
-
|
|
63739
|
+
_defineProperty24(this, "handlePointerMove", (evt) => {
|
|
63804
63740
|
evt.preventDefault();
|
|
63805
63741
|
if (!evt.target) {
|
|
63806
63742
|
return;
|
|
63807
63743
|
}
|
|
63808
63744
|
if (this.editMode === "matrix" && this.editAnchor && this.lastEditPoint) {
|
|
63809
63745
|
const offsetX = evt.pageX - this.lastEditPoint.x;
|
|
63810
|
-
|
|
63746
|
+
const offsetY = evt.pageY - this.lastEditPoint.y;
|
|
63811
63747
|
this.bounds.offsetBy(this.editAnchor, offsetX, offsetY, this.uniformScale ? this.aspectRatio : -1);
|
|
63812
63748
|
this.lastEditPoint = {
|
|
63813
63749
|
x: evt.pageX,
|
|
@@ -63832,7 +63768,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63832
63768
|
}
|
|
63833
63769
|
if (this.editMode === "translate" && this.lastEditPoint) {
|
|
63834
63770
|
const offsetX = evt.pageX - this.lastEditPoint.x;
|
|
63835
|
-
|
|
63771
|
+
const offsetY = evt.pageY - this.lastEditPoint.y;
|
|
63836
63772
|
this.bounds.translate(offsetX, offsetY);
|
|
63837
63773
|
this.updateBoundsByShadow();
|
|
63838
63774
|
this.lastEditPoint = {
|
|
@@ -63851,7 +63787,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63851
63787
|
}
|
|
63852
63788
|
}
|
|
63853
63789
|
});
|
|
63854
|
-
|
|
63790
|
+
_defineProperty24(this, "handlePointerUp", (evt) => {
|
|
63855
63791
|
evt.preventDefault();
|
|
63856
63792
|
this.resetShadow();
|
|
63857
63793
|
this.shadowEmitter.setActive(false);
|
|
@@ -63868,7 +63804,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63868
63804
|
this.lastEditPoint = null;
|
|
63869
63805
|
this.uniformScale = false;
|
|
63870
63806
|
});
|
|
63871
|
-
|
|
63807
|
+
_defineProperty24(this, "handleFrameDBClick", (evt) => {
|
|
63872
63808
|
if (evt.target === this.frame && this.targets.length === 1) {
|
|
63873
63809
|
if (this.targets[0].type === "point-text") {
|
|
63874
63810
|
this.frame.style.display = "none";
|
|
@@ -63876,7 +63812,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63876
63812
|
}
|
|
63877
63813
|
}
|
|
63878
63814
|
});
|
|
63879
|
-
|
|
63815
|
+
_defineProperty24(this, "updateBounds", () => {
|
|
63880
63816
|
let minX = Number.MAX_VALUE;
|
|
63881
63817
|
let maxX = -Number.MAX_VALUE;
|
|
63882
63818
|
let minY = Number.MAX_VALUE;
|
|
@@ -63909,7 +63845,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63909
63845
|
this.ctrlId = initConfig.ctrlId;
|
|
63910
63846
|
this.ctrlNickName = initConfig.ctrlNickName;
|
|
63911
63847
|
this.rootView = document.createElement("div");
|
|
63912
|
-
this.rootView.style.cssText =
|
|
63848
|
+
this.rootView.style.cssText = "position:absolute;display:none;width:100%;height:100%;top:50%;left:50%;transform:translate(-50%,-50%);";
|
|
63913
63849
|
this.frame = document.createElement("div");
|
|
63914
63850
|
this.frame.style.position = "absolute";
|
|
63915
63851
|
this.frame.style.padding = "8px";
|
|
@@ -63930,7 +63866,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63930
63866
|
} else {
|
|
63931
63867
|
this.title = document.createElement("div");
|
|
63932
63868
|
this.title.textContent = `${this.ctrlNickName}`;
|
|
63933
|
-
this.title.style.cssText =
|
|
63869
|
+
this.title.style.cssText = "color:#fff;font-size:12px;padding: 0.2em 0.4em;border-radius: 0.4em;position: absolute;top: 0%;left: 0;margin: -0.4em;transform: translate(-100%, -100%);";
|
|
63934
63870
|
this.frame.appendChild(this.title);
|
|
63935
63871
|
this.rootView.style.pointerEvents = "none";
|
|
63936
63872
|
}
|
|
@@ -64126,14 +64062,14 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
64126
64062
|
this.resizeObserver.disconnect();
|
|
64127
64063
|
}
|
|
64128
64064
|
};
|
|
64129
|
-
function
|
|
64130
|
-
return (r =
|
|
64065
|
+
function _defineProperty25(e, r, t) {
|
|
64066
|
+
return (r = _toPropertyKey25(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64131
64067
|
}
|
|
64132
|
-
function
|
|
64133
|
-
var i =
|
|
64068
|
+
function _toPropertyKey25(t) {
|
|
64069
|
+
var i = _toPrimitive25(t, "string");
|
|
64134
64070
|
return "symbol" == typeof i ? i : i + "";
|
|
64135
64071
|
}
|
|
64136
|
-
function
|
|
64072
|
+
function _toPrimitive25(t, r) {
|
|
64137
64073
|
if ("object" != typeof t || !t) return t;
|
|
64138
64074
|
var e = t[Symbol.toPrimitive];
|
|
64139
64075
|
if (void 0 !== e) {
|
|
@@ -64146,13 +64082,13 @@ function _toPrimitive26(t, r) {
|
|
|
64146
64082
|
var TextTool = class extends WhiteboardTool {
|
|
64147
64083
|
constructor(enableToolEvent, model, shadowEmitter, scope, rootView, canvasElement, toolbarModel, camera) {
|
|
64148
64084
|
super(enableToolEvent, model, shadowEmitter, scope);
|
|
64149
|
-
|
|
64150
|
-
|
|
64151
|
-
|
|
64152
|
-
|
|
64153
|
-
|
|
64154
|
-
|
|
64155
|
-
|
|
64085
|
+
_defineProperty25(this, "from", null);
|
|
64086
|
+
_defineProperty25(this, "to", null);
|
|
64087
|
+
_defineProperty25(this, "rootView", void 0);
|
|
64088
|
+
_defineProperty25(this, "canvasElement", void 0);
|
|
64089
|
+
_defineProperty25(this, "elementModel", null);
|
|
64090
|
+
_defineProperty25(this, "toolbarModel", void 0);
|
|
64091
|
+
_defineProperty25(this, "camera", void 0);
|
|
64156
64092
|
this.rootView = rootView;
|
|
64157
64093
|
this.canvasElement = canvasElement;
|
|
64158
64094
|
this.toolbarModel = toolbarModel;
|
|
@@ -64161,7 +64097,7 @@ var TextTool = class extends WhiteboardTool {
|
|
|
64161
64097
|
onMouseDown(event) {
|
|
64162
64098
|
this.from = event.point.clone();
|
|
64163
64099
|
}
|
|
64164
|
-
onMouseDrag(
|
|
64100
|
+
onMouseDrag(_event) {
|
|
64165
64101
|
}
|
|
64166
64102
|
onMouseUp(event) {
|
|
64167
64103
|
this.to = event.point.clone();
|
|
@@ -64173,6 +64109,9 @@ var TextTool = class extends WhiteboardTool {
|
|
|
64173
64109
|
}
|
|
64174
64110
|
}
|
|
64175
64111
|
createPointEditor(x, y) {
|
|
64112
|
+
if (this.elementModel) {
|
|
64113
|
+
this.elementModel.dispose();
|
|
64114
|
+
}
|
|
64176
64115
|
this.elementModel = this.modelGetter().createPointText(x, y, true);
|
|
64177
64116
|
if (this.elementModel === null) {
|
|
64178
64117
|
return;
|
|
@@ -64211,14 +64150,14 @@ var TextTool = class extends WhiteboardTool {
|
|
|
64211
64150
|
}, 30);
|
|
64212
64151
|
}
|
|
64213
64152
|
};
|
|
64214
|
-
function
|
|
64215
|
-
return (r =
|
|
64153
|
+
function _defineProperty26(e, r, t) {
|
|
64154
|
+
return (r = _toPropertyKey26(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64216
64155
|
}
|
|
64217
|
-
function
|
|
64218
|
-
var i =
|
|
64156
|
+
function _toPropertyKey26(t) {
|
|
64157
|
+
var i = _toPrimitive26(t, "string");
|
|
64219
64158
|
return "symbol" == typeof i ? i : i + "";
|
|
64220
64159
|
}
|
|
64221
|
-
function
|
|
64160
|
+
function _toPrimitive26(t, r) {
|
|
64222
64161
|
if ("object" != typeof t || !t) return t;
|
|
64223
64162
|
var e = t[Symbol.toPrimitive];
|
|
64224
64163
|
if (void 0 !== e) {
|
|
@@ -64228,14 +64167,14 @@ function _toPrimitive27(t, r) {
|
|
|
64228
64167
|
}
|
|
64229
64168
|
return ("string" === r ? String : Number)(t);
|
|
64230
64169
|
}
|
|
64231
|
-
var Gesture = class extends
|
|
64170
|
+
var Gesture = class extends import_eventemitter37.default {
|
|
64232
64171
|
constructor(element, scope) {
|
|
64233
64172
|
super();
|
|
64234
|
-
|
|
64235
|
-
|
|
64236
|
-
|
|
64237
|
-
|
|
64238
|
-
|
|
64173
|
+
_defineProperty26(this, "element", void 0);
|
|
64174
|
+
_defineProperty26(this, "scope", void 0);
|
|
64175
|
+
_defineProperty26(this, "lastVector", null);
|
|
64176
|
+
_defineProperty26(this, "lastPoint", null);
|
|
64177
|
+
_defineProperty26(this, "onTouchStart", (evt) => {
|
|
64239
64178
|
if (evt.touches.length > 1) {
|
|
64240
64179
|
evt.preventDefault();
|
|
64241
64180
|
evt.stopPropagation();
|
|
@@ -64248,7 +64187,7 @@ var Gesture = class extends import_eventemitter38.default {
|
|
|
64248
64187
|
this.lastVector = p2.subtract(p1);
|
|
64249
64188
|
this.lastPoint = p1;
|
|
64250
64189
|
});
|
|
64251
|
-
|
|
64190
|
+
_defineProperty26(this, "onTouchMove", (evt) => {
|
|
64252
64191
|
if (this.lastVector && this.lastPoint && evt.touches.length === 2) {
|
|
64253
64192
|
evt.preventDefault();
|
|
64254
64193
|
evt.stopPropagation();
|
|
@@ -64279,7 +64218,7 @@ var Gesture = class extends import_eventemitter38.default {
|
|
|
64279
64218
|
this.lastPoint = null;
|
|
64280
64219
|
}
|
|
64281
64220
|
});
|
|
64282
|
-
|
|
64221
|
+
_defineProperty26(this, "onTouchEnd", () => {
|
|
64283
64222
|
this.lastVector = null;
|
|
64284
64223
|
this.lastPoint = null;
|
|
64285
64224
|
});
|
|
@@ -64290,14 +64229,14 @@ var Gesture = class extends import_eventemitter38.default {
|
|
|
64290
64229
|
this.element.addEventListener("touchend", this.onTouchEnd);
|
|
64291
64230
|
}
|
|
64292
64231
|
};
|
|
64293
|
-
function
|
|
64294
|
-
return (r =
|
|
64232
|
+
function _defineProperty27(e, r, t) {
|
|
64233
|
+
return (r = _toPropertyKey27(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64295
64234
|
}
|
|
64296
|
-
function
|
|
64297
|
-
var i =
|
|
64235
|
+
function _toPropertyKey27(t) {
|
|
64236
|
+
var i = _toPrimitive27(t, "string");
|
|
64298
64237
|
return "symbol" == typeof i ? i : i + "";
|
|
64299
64238
|
}
|
|
64300
|
-
function
|
|
64239
|
+
function _toPrimitive27(t, r) {
|
|
64301
64240
|
if ("object" != typeof t || !t) return t;
|
|
64302
64241
|
var e = t[Symbol.toPrimitive];
|
|
64303
64242
|
if (void 0 !== e) {
|
|
@@ -64307,7 +64246,7 @@ function _toPrimitive28(t, r) {
|
|
|
64307
64246
|
}
|
|
64308
64247
|
return ("string" === r ? String : Number)(t);
|
|
64309
64248
|
}
|
|
64310
|
-
var Camera = class extends
|
|
64249
|
+
var Camera = class extends import_eventemitter36.default {
|
|
64311
64250
|
get inherentMatrix() {
|
|
64312
64251
|
const inherentMatrix = new this.scope.Matrix();
|
|
64313
64252
|
inherentMatrix.scale(this.inherentScale, [0, 0]);
|
|
@@ -64319,31 +64258,31 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64319
64258
|
}
|
|
64320
64259
|
constructor(initSize, maxScale, dom, userManager, scope, whiteboardAttrsMap, hasPermission, requestUserMap, _paperSize, _domSize) {
|
|
64321
64260
|
super();
|
|
64322
|
-
|
|
64323
|
-
|
|
64324
|
-
|
|
64325
|
-
|
|
64261
|
+
_defineProperty27(this, "scope", void 0);
|
|
64262
|
+
_defineProperty27(this, "dom", void 0);
|
|
64263
|
+
_defineProperty27(this, "lastTriggerTime", 0);
|
|
64264
|
+
_defineProperty27(this, "lastDelta", {
|
|
64326
64265
|
x: 0,
|
|
64327
64266
|
y: 0
|
|
64328
64267
|
});
|
|
64329
|
-
|
|
64330
|
-
|
|
64331
|
-
|
|
64332
|
-
|
|
64333
|
-
|
|
64334
|
-
|
|
64335
|
-
|
|
64336
|
-
|
|
64337
|
-
|
|
64338
|
-
|
|
64339
|
-
|
|
64340
|
-
|
|
64341
|
-
|
|
64342
|
-
|
|
64343
|
-
|
|
64344
|
-
|
|
64345
|
-
|
|
64346
|
-
|
|
64268
|
+
_defineProperty27(this, "requestUserMap", void 0);
|
|
64269
|
+
_defineProperty27(this, "userManager", void 0);
|
|
64270
|
+
_defineProperty27(this, "observers", /* @__PURE__ */ new Map());
|
|
64271
|
+
_defineProperty27(this, "whiteboardAttrsMap", void 0);
|
|
64272
|
+
_defineProperty27(this, "paperSize", void 0);
|
|
64273
|
+
_defineProperty27(this, "domSize", void 0);
|
|
64274
|
+
_defineProperty27(this, "hasPermission", void 0);
|
|
64275
|
+
_defineProperty27(this, "gesture", void 0);
|
|
64276
|
+
_defineProperty27(this, "inherentScale", 1);
|
|
64277
|
+
_defineProperty27(this, "maxScale", void 0);
|
|
64278
|
+
_defineProperty27(this, "initSize", void 0);
|
|
64279
|
+
_defineProperty27(this, "bound", void 0);
|
|
64280
|
+
_defineProperty27(this, "boundTiemoutId", void 0);
|
|
64281
|
+
_defineProperty27(this, "enableByMouse", true);
|
|
64282
|
+
_defineProperty27(this, "enableByTouch", true);
|
|
64283
|
+
_defineProperty27(this, "boundaryColor", "#F44336");
|
|
64284
|
+
_defineProperty27(this, "enableBoundaryHighlight", true);
|
|
64285
|
+
_defineProperty27(this, "handleMainCameraChange", (evt) => {
|
|
64347
64286
|
const userMap = this.requestUserMap(this.userManager.selfId);
|
|
64348
64287
|
const cameraMode = userMap.get(WhiteboardKeys.cameraMode);
|
|
64349
64288
|
if (cameraMode !== "main") {
|
|
@@ -64360,20 +64299,23 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64360
64299
|
}
|
|
64361
64300
|
}
|
|
64362
64301
|
});
|
|
64363
|
-
|
|
64302
|
+
_defineProperty27(this, "handleUserLeave", (user) => {
|
|
64364
64303
|
const cb = this.observers.get(user.id);
|
|
64365
64304
|
if (cb) {
|
|
64366
64305
|
this.requestUserMap(user.id).unobserve(cb);
|
|
64367
64306
|
}
|
|
64368
64307
|
});
|
|
64369
|
-
|
|
64308
|
+
_defineProperty27(this, "handleUserJoin", (user) => {
|
|
64370
64309
|
const observer = (evt) => {
|
|
64371
64310
|
this.handleViewMatrixUpdate(user.id, evt);
|
|
64372
64311
|
};
|
|
64312
|
+
if (this.observers.has(user.id)) {
|
|
64313
|
+
this.requestUserMap(user.id).unobserve(observer);
|
|
64314
|
+
}
|
|
64373
64315
|
this.requestUserMap(user.id).observe(observer);
|
|
64374
64316
|
this.observers.set(user.id, observer);
|
|
64375
64317
|
});
|
|
64376
|
-
|
|
64318
|
+
_defineProperty27(this, "handleViewMatrixUpdate", (userId, evt) => {
|
|
64377
64319
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
64378
64320
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
64379
64321
|
if (value.action === "update") {
|
|
@@ -64400,7 +64342,7 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64400
64342
|
}
|
|
64401
64343
|
}
|
|
64402
64344
|
});
|
|
64403
|
-
|
|
64345
|
+
_defineProperty27(this, "handleWheel", (evt) => {
|
|
64404
64346
|
if (!this.enableByMouse) {
|
|
64405
64347
|
return;
|
|
64406
64348
|
}
|
|
@@ -64449,7 +64391,7 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64449
64391
|
});
|
|
64450
64392
|
this.maxScale = maxScale;
|
|
64451
64393
|
this.bound = window.document.createElement("div");
|
|
64452
|
-
this.bound.style.cssText =
|
|
64394
|
+
this.bound.style.cssText = "transition: box-shadow 100ms;pointer-events:none;z-index:99;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);";
|
|
64453
64395
|
this.initSize = initSize;
|
|
64454
64396
|
this.hasPermission = hasPermission;
|
|
64455
64397
|
this.paperSize = _paperSize;
|
|
@@ -64474,6 +64416,9 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64474
64416
|
const observer = (evt) => {
|
|
64475
64417
|
this.handleViewMatrixUpdate(userId, evt);
|
|
64476
64418
|
};
|
|
64419
|
+
if (this.observers.has(userId)) {
|
|
64420
|
+
this.requestUserMap(userId).unobserve(observer);
|
|
64421
|
+
}
|
|
64477
64422
|
this.requestUserMap(userId).observe(observer);
|
|
64478
64423
|
this.observers.set(userId, observer);
|
|
64479
64424
|
});
|
|
@@ -64510,7 +64455,7 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64510
64455
|
this.bound.style.boxShadow = `inset 0px 0px 6px 2px ${this.boundaryColor}`;
|
|
64511
64456
|
window.clearTimeout(this.boundTiemoutId);
|
|
64512
64457
|
this.boundTiemoutId = window.setTimeout(() => {
|
|
64513
|
-
this.bound.style.boxShadow =
|
|
64458
|
+
this.bound.style.boxShadow = "none";
|
|
64514
64459
|
}, 100);
|
|
64515
64460
|
}
|
|
64516
64461
|
}
|
|
@@ -64520,6 +64465,9 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64520
64465
|
updateInherentScale(scale) {
|
|
64521
64466
|
this.inherentScale = scale;
|
|
64522
64467
|
}
|
|
64468
|
+
getInherentScale() {
|
|
64469
|
+
return this.inherentScale;
|
|
64470
|
+
}
|
|
64523
64471
|
getActiveMatrix() {
|
|
64524
64472
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
64525
64473
|
let matrixValue;
|
|
@@ -64662,15 +64610,28 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64662
64610
|
y: 0
|
|
64663
64611
|
};
|
|
64664
64612
|
}
|
|
64613
|
+
dispose() {
|
|
64614
|
+
Array.from(this.observers.keys()).forEach((userId) => {
|
|
64615
|
+
const cb = this.observers.get(userId);
|
|
64616
|
+
if (cb) {
|
|
64617
|
+
this.requestUserMap(userId).unobserve(cb);
|
|
64618
|
+
}
|
|
64619
|
+
});
|
|
64620
|
+
this.whiteboardAttrsMap.unobserve(this.handleMainCameraChange);
|
|
64621
|
+
this.userManager.off("join", this.handleUserJoin);
|
|
64622
|
+
this.userManager.off("leave", this.handleUserLeave);
|
|
64623
|
+
this.gesture.removeAllListeners();
|
|
64624
|
+
this.removeAllListeners();
|
|
64625
|
+
}
|
|
64665
64626
|
};
|
|
64666
|
-
function
|
|
64667
|
-
return (r =
|
|
64627
|
+
function _defineProperty28(e, r, t) {
|
|
64628
|
+
return (r = _toPropertyKey28(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64668
64629
|
}
|
|
64669
|
-
function
|
|
64670
|
-
var i =
|
|
64630
|
+
function _toPropertyKey28(t) {
|
|
64631
|
+
var i = _toPrimitive28(t, "string");
|
|
64671
64632
|
return "symbol" == typeof i ? i : i + "";
|
|
64672
64633
|
}
|
|
64673
|
-
function
|
|
64634
|
+
function _toPrimitive28(t, r) {
|
|
64674
64635
|
if ("object" != typeof t || !t) return t;
|
|
64675
64636
|
var e = t[Symbol.toPrimitive];
|
|
64676
64637
|
if (void 0 !== e) {
|
|
@@ -64683,12 +64644,15 @@ function _toPrimitive29(t, r) {
|
|
|
64683
64644
|
var EllipseTool = class extends WhiteboardTool {
|
|
64684
64645
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
64685
64646
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
64686
|
-
|
|
64687
|
-
|
|
64688
|
-
|
|
64647
|
+
_defineProperty28(this, "elementModel", null);
|
|
64648
|
+
_defineProperty28(this, "from", null);
|
|
64649
|
+
_defineProperty28(this, "to", null);
|
|
64689
64650
|
this.tool.minDistance = 1;
|
|
64690
64651
|
}
|
|
64691
64652
|
onMouseDown(event) {
|
|
64653
|
+
if (this.elementModel) {
|
|
64654
|
+
this.elementModel.dispose();
|
|
64655
|
+
}
|
|
64692
64656
|
this.elementModel = this.modelGetter().createSegmentedPath("ellipse", true);
|
|
64693
64657
|
this.from = event.point.clone();
|
|
64694
64658
|
this.to = event.point.clone();
|
|
@@ -64712,14 +64676,14 @@ var EllipseTool = class extends WhiteboardTool {
|
|
|
64712
64676
|
}
|
|
64713
64677
|
}
|
|
64714
64678
|
};
|
|
64715
|
-
function
|
|
64716
|
-
return (r =
|
|
64679
|
+
function _defineProperty29(e, r, t) {
|
|
64680
|
+
return (r = _toPropertyKey29(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64717
64681
|
}
|
|
64718
|
-
function
|
|
64719
|
-
var i =
|
|
64682
|
+
function _toPropertyKey29(t) {
|
|
64683
|
+
var i = _toPrimitive29(t, "string");
|
|
64720
64684
|
return "symbol" == typeof i ? i : i + "";
|
|
64721
64685
|
}
|
|
64722
|
-
function
|
|
64686
|
+
function _toPrimitive29(t, r) {
|
|
64723
64687
|
if ("object" != typeof t || !t) return t;
|
|
64724
64688
|
var e = t[Symbol.toPrimitive];
|
|
64725
64689
|
if (void 0 !== e) {
|
|
@@ -64732,12 +64696,15 @@ function _toPrimitive30(t, r) {
|
|
|
64732
64696
|
var TriangleTool = class extends WhiteboardTool {
|
|
64733
64697
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
64734
64698
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
64735
|
-
|
|
64736
|
-
|
|
64737
|
-
|
|
64699
|
+
_defineProperty29(this, "elementModel", null);
|
|
64700
|
+
_defineProperty29(this, "from", null);
|
|
64701
|
+
_defineProperty29(this, "to", null);
|
|
64738
64702
|
this.tool.minDistance = 1;
|
|
64739
64703
|
}
|
|
64740
64704
|
onMouseDown(event) {
|
|
64705
|
+
if (this.elementModel) {
|
|
64706
|
+
this.elementModel.dispose();
|
|
64707
|
+
}
|
|
64741
64708
|
this.elementModel = this.modelGetter().createTriangle(true);
|
|
64742
64709
|
this.from = event.point.clone();
|
|
64743
64710
|
this.to = event.point.clone();
|
|
@@ -64757,14 +64724,14 @@ var TriangleTool = class extends WhiteboardTool {
|
|
|
64757
64724
|
}
|
|
64758
64725
|
}
|
|
64759
64726
|
};
|
|
64760
|
-
function
|
|
64761
|
-
return (r =
|
|
64727
|
+
function _defineProperty30(e, r, t) {
|
|
64728
|
+
return (r = _toPropertyKey30(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64762
64729
|
}
|
|
64763
|
-
function
|
|
64764
|
-
var i =
|
|
64730
|
+
function _toPropertyKey30(t) {
|
|
64731
|
+
var i = _toPrimitive30(t, "string");
|
|
64765
64732
|
return "symbol" == typeof i ? i : i + "";
|
|
64766
64733
|
}
|
|
64767
|
-
function
|
|
64734
|
+
function _toPrimitive30(t, r) {
|
|
64768
64735
|
if ("object" != typeof t || !t) return t;
|
|
64769
64736
|
var e = t[Symbol.toPrimitive];
|
|
64770
64737
|
if (void 0 !== e) {
|
|
@@ -64774,63 +64741,63 @@ function _toPrimitive31(t, r) {
|
|
|
64774
64741
|
}
|
|
64775
64742
|
return ("string" === r ? String : Number)(t);
|
|
64776
64743
|
}
|
|
64777
|
-
var Whiteboard = class extends
|
|
64744
|
+
var Whiteboard = class extends import_eventemitter38.default {
|
|
64778
64745
|
// public insertImage!: (src: string) => void;
|
|
64779
64746
|
constructor(view) {
|
|
64780
64747
|
super();
|
|
64781
|
-
|
|
64782
|
-
|
|
64783
|
-
|
|
64784
|
-
|
|
64785
|
-
|
|
64786
|
-
|
|
64787
|
-
|
|
64788
|
-
|
|
64789
|
-
|
|
64790
|
-
|
|
64791
|
-
|
|
64792
|
-
|
|
64793
|
-
|
|
64794
|
-
|
|
64795
|
-
|
|
64796
|
-
|
|
64797
|
-
|
|
64798
|
-
|
|
64799
|
-
|
|
64800
|
-
|
|
64801
|
-
|
|
64802
|
-
|
|
64803
|
-
|
|
64804
|
-
|
|
64805
|
-
|
|
64806
|
-
|
|
64807
|
-
|
|
64808
|
-
|
|
64809
|
-
|
|
64810
|
-
|
|
64811
|
-
|
|
64812
|
-
|
|
64813
|
-
|
|
64814
|
-
|
|
64815
|
-
|
|
64816
|
-
|
|
64817
|
-
|
|
64818
|
-
|
|
64819
|
-
|
|
64820
|
-
|
|
64821
|
-
|
|
64822
|
-
|
|
64748
|
+
_defineProperty30(this, "view", void 0);
|
|
64749
|
+
_defineProperty30(this, "selfUserId", void 0);
|
|
64750
|
+
_defineProperty30(this, "permissions", void 0);
|
|
64751
|
+
_defineProperty30(this, "tool", void 0);
|
|
64752
|
+
_defineProperty30(this, "fontSize", void 0);
|
|
64753
|
+
_defineProperty30(this, "dashArray", void 0);
|
|
64754
|
+
_defineProperty30(this, "fontFamily", void 0);
|
|
64755
|
+
_defineProperty30(this, "strokeColor", void 0);
|
|
64756
|
+
_defineProperty30(this, "fillColor", void 0);
|
|
64757
|
+
_defineProperty30(this, "strokeWidth", void 0);
|
|
64758
|
+
_defineProperty30(this, "enableCameraByMouse", void 0);
|
|
64759
|
+
_defineProperty30(this, "enableCameraByTouch", void 0);
|
|
64760
|
+
_defineProperty30(this, "cameraBoundaryColor", void 0);
|
|
64761
|
+
_defineProperty30(this, "enableCameraBoundaryHighlight", void 0);
|
|
64762
|
+
_defineProperty30(this, "getElementAttribute", void 0);
|
|
64763
|
+
_defineProperty30(this, "setElementAttribute", void 0);
|
|
64764
|
+
_defineProperty30(this, "getCurrentTool", void 0);
|
|
64765
|
+
_defineProperty30(this, "setCurrentTool", void 0);
|
|
64766
|
+
_defineProperty30(this, "setCanvasBackgroundColor", void 0);
|
|
64767
|
+
_defineProperty30(this, "setThemeColor", void 0);
|
|
64768
|
+
_defineProperty30(this, "gotoPage", void 0);
|
|
64769
|
+
_defineProperty30(this, "addPage", void 0);
|
|
64770
|
+
_defineProperty30(this, "deletePage", void 0);
|
|
64771
|
+
_defineProperty30(this, "pageList", void 0);
|
|
64772
|
+
_defineProperty30(this, "currentPageId", void 0);
|
|
64773
|
+
_defineProperty30(this, "clonePage", void 0);
|
|
64774
|
+
_defineProperty30(this, "clearPage", void 0);
|
|
64775
|
+
_defineProperty30(this, "translateCamera", void 0);
|
|
64776
|
+
_defineProperty30(this, "scaleCamera", void 0);
|
|
64777
|
+
_defineProperty30(this, "resetCamera", void 0);
|
|
64778
|
+
_defineProperty30(this, "setFreeModelUserPage", void 0);
|
|
64779
|
+
_defineProperty30(this, "indexedNavigation", void 0);
|
|
64780
|
+
_defineProperty30(this, "setViewModeToFree", void 0);
|
|
64781
|
+
_defineProperty30(this, "setViewModeToFlow", void 0);
|
|
64782
|
+
_defineProperty30(this, "setViewModeToMain", void 0);
|
|
64783
|
+
_defineProperty30(this, "getViewModel", void 0);
|
|
64784
|
+
_defineProperty30(this, "undo", void 0);
|
|
64785
|
+
_defineProperty30(this, "redo", void 0);
|
|
64786
|
+
_defineProperty30(this, "rasterizeViewport", void 0);
|
|
64787
|
+
_defineProperty30(this, "rasterizeElementsBounds", void 0);
|
|
64788
|
+
_defineProperty30(this, "rasterizeMaxBounds", void 0);
|
|
64789
|
+
_defineProperty30(this, "setInputType", void 0);
|
|
64823
64790
|
this.view = view;
|
|
64824
64791
|
}
|
|
64825
64792
|
};
|
|
64826
|
-
function
|
|
64827
|
-
return (r =
|
|
64793
|
+
function _defineProperty31(e, r, t) {
|
|
64794
|
+
return (r = _toPropertyKey31(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64828
64795
|
}
|
|
64829
|
-
function
|
|
64830
|
-
var i =
|
|
64796
|
+
function _toPropertyKey31(t) {
|
|
64797
|
+
var i = _toPrimitive31(t, "string");
|
|
64831
64798
|
return "symbol" == typeof i ? i : i + "";
|
|
64832
64799
|
}
|
|
64833
|
-
function
|
|
64800
|
+
function _toPrimitive31(t, r) {
|
|
64834
64801
|
if ("object" != typeof t || !t) return t;
|
|
64835
64802
|
var e = t[Symbol.toPrimitive];
|
|
64836
64803
|
if (void 0 !== e) {
|
|
@@ -64843,14 +64810,17 @@ function _toPrimitive32(t, r) {
|
|
|
64843
64810
|
var EraserTool = class extends WhiteboardTool {
|
|
64844
64811
|
constructor(enableToolEvent, renderableModel, shadowEmitter, scope, trashedElementsModel) {
|
|
64845
64812
|
super(enableToolEvent, renderableModel, shadowEmitter, scope);
|
|
64846
|
-
|
|
64847
|
-
|
|
64848
|
-
|
|
64813
|
+
_defineProperty31(this, "elementModel", null);
|
|
64814
|
+
_defineProperty31(this, "trashedElementsModel", void 0);
|
|
64815
|
+
_defineProperty31(this, "pointCount", 0);
|
|
64849
64816
|
this.trashedElementsModel = trashedElementsModel;
|
|
64850
64817
|
this.tool.minDistance = 1;
|
|
64851
64818
|
}
|
|
64852
|
-
onMouseDown(
|
|
64819
|
+
onMouseDown(_event) {
|
|
64853
64820
|
this.pointCount = 0;
|
|
64821
|
+
if (this.elementModel) {
|
|
64822
|
+
this.elementModel.dispose();
|
|
64823
|
+
}
|
|
64854
64824
|
this.elementModel = this.modelGetter().createEraser();
|
|
64855
64825
|
}
|
|
64856
64826
|
onMouseDrag(event) {
|
|
@@ -64872,21 +64842,21 @@ var EraserTool = class extends WhiteboardTool {
|
|
|
64872
64842
|
}
|
|
64873
64843
|
});
|
|
64874
64844
|
}
|
|
64875
|
-
onMouseUp(
|
|
64845
|
+
onMouseUp(_event) {
|
|
64876
64846
|
if (this.elementModel) {
|
|
64877
64847
|
this.modelGetter().removeElementItem(this.elementModel.uuid);
|
|
64878
64848
|
}
|
|
64879
64849
|
this.trashedElementsModel.removeAllTrashedElementsForSelf();
|
|
64880
64850
|
}
|
|
64881
64851
|
};
|
|
64882
|
-
function
|
|
64883
|
-
return (r =
|
|
64852
|
+
function _defineProperty32(e, r, t) {
|
|
64853
|
+
return (r = _toPropertyKey32(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64884
64854
|
}
|
|
64885
|
-
function
|
|
64886
|
-
var i =
|
|
64855
|
+
function _toPropertyKey32(t) {
|
|
64856
|
+
var i = _toPrimitive32(t, "string");
|
|
64887
64857
|
return "symbol" == typeof i ? i : i + "";
|
|
64888
64858
|
}
|
|
64889
|
-
function
|
|
64859
|
+
function _toPrimitive32(t, r) {
|
|
64890
64860
|
if ("object" != typeof t || !t) return t;
|
|
64891
64861
|
var e = t[Symbol.toPrimitive];
|
|
64892
64862
|
if (void 0 !== e) {
|
|
@@ -64896,7 +64866,7 @@ function _toPrimitive33(t, r) {
|
|
|
64896
64866
|
}
|
|
64897
64867
|
return ("string" === r ? String : Number)(t);
|
|
64898
64868
|
}
|
|
64899
|
-
var TrashedElementsModel = class extends
|
|
64869
|
+
var TrashedElementsModel = class extends import_eventemitter39.default {
|
|
64900
64870
|
get hasDeleteSelfPermission() {
|
|
64901
64871
|
return this.hasPermission(WhiteboardPermissionFlag.deleteSelf);
|
|
64902
64872
|
}
|
|
@@ -64905,20 +64875,23 @@ var TrashedElementsModel = class extends import_eventemitter310.default {
|
|
|
64905
64875
|
}
|
|
64906
64876
|
constructor(userManager, requestUserMap, hasPermission) {
|
|
64907
64877
|
super();
|
|
64908
|
-
|
|
64909
|
-
|
|
64910
|
-
|
|
64911
|
-
|
|
64912
|
-
|
|
64878
|
+
_defineProperty32(this, "requestUserMap", void 0);
|
|
64879
|
+
_defineProperty32(this, "userManager", void 0);
|
|
64880
|
+
_defineProperty32(this, "hasPermission", void 0);
|
|
64881
|
+
_defineProperty32(this, "observers", /* @__PURE__ */ new Map());
|
|
64882
|
+
_defineProperty32(this, "handleUserLeave", (user) => {
|
|
64913
64883
|
const cb = this.observers.get(user.id);
|
|
64914
64884
|
if (cb) {
|
|
64915
64885
|
this.requestUserMap(user.id).unobserveDeep(cb);
|
|
64916
64886
|
}
|
|
64917
64887
|
});
|
|
64918
|
-
|
|
64888
|
+
_defineProperty32(this, "handleUserJoin", (user) => {
|
|
64919
64889
|
const observer = (evts) => {
|
|
64920
64890
|
this.handleUserTrashElementsChange(user.id, evts);
|
|
64921
64891
|
};
|
|
64892
|
+
if (this.observers.has(user.id)) {
|
|
64893
|
+
this.requestUserMap(user.id).unobserveDeep(this.observers.get(user.id));
|
|
64894
|
+
}
|
|
64922
64895
|
this.requestUserMap(user.id).observeDeep(observer);
|
|
64923
64896
|
this.observers.set(user.id, observer);
|
|
64924
64897
|
});
|
|
@@ -64930,6 +64903,9 @@ var TrashedElementsModel = class extends import_eventemitter310.default {
|
|
|
64930
64903
|
const observer = (evts) => {
|
|
64931
64904
|
this.handleUserTrashElementsChange(userId, evts);
|
|
64932
64905
|
};
|
|
64906
|
+
if (this.observers.has(userId)) {
|
|
64907
|
+
this.requestUserMap(userId).unobserveDeep(this.observers.get(userId));
|
|
64908
|
+
}
|
|
64933
64909
|
this.requestUserMap(userId).observeDeep(observer);
|
|
64934
64910
|
this.observers.set(userId, observer);
|
|
64935
64911
|
});
|
|
@@ -64984,25 +64960,22 @@ var TrashedElementsModel = class extends import_eventemitter310.default {
|
|
|
64984
64960
|
});
|
|
64985
64961
|
}
|
|
64986
64962
|
dispose() {
|
|
64987
|
-
this.
|
|
64988
|
-
|
|
64989
|
-
|
|
64990
|
-
this.requestUserMap(userId).unobserveDeep(cb);
|
|
64991
|
-
}
|
|
64992
|
-
});
|
|
64963
|
+
for (const [key, value] of this.observers.entries()) {
|
|
64964
|
+
this.requestUserMap(key).unobserveDeep(value);
|
|
64965
|
+
}
|
|
64993
64966
|
this.observers.clear();
|
|
64994
64967
|
this.userManager.off("leave", this.handleUserLeave);
|
|
64995
64968
|
this.userManager.off("join", this.handleUserJoin);
|
|
64996
64969
|
}
|
|
64997
64970
|
};
|
|
64998
|
-
function
|
|
64999
|
-
return (r =
|
|
64971
|
+
function _defineProperty33(e, r, t) {
|
|
64972
|
+
return (r = _toPropertyKey33(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65000
64973
|
}
|
|
65001
|
-
function
|
|
65002
|
-
var i =
|
|
64974
|
+
function _toPropertyKey33(t) {
|
|
64975
|
+
var i = _toPrimitive33(t, "string");
|
|
65003
64976
|
return "symbol" == typeof i ? i : i + "";
|
|
65004
64977
|
}
|
|
65005
|
-
function
|
|
64978
|
+
function _toPrimitive33(t, r) {
|
|
65006
64979
|
if ("object" != typeof t || !t) return t;
|
|
65007
64980
|
var e = t[Symbol.toPrimitive];
|
|
65008
64981
|
if (void 0 !== e) {
|
|
@@ -65015,12 +64988,15 @@ function _toPrimitive34(t, r) {
|
|
|
65015
64988
|
var LaserPointerTool = class extends WhiteboardTool {
|
|
65016
64989
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65017
64990
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65018
|
-
|
|
65019
|
-
|
|
64991
|
+
_defineProperty33(this, "elementModel", null);
|
|
64992
|
+
_defineProperty33(this, "pointCount", 0);
|
|
65020
64993
|
this.tool.minDistance = 5;
|
|
65021
64994
|
}
|
|
65022
|
-
onMouseDown(
|
|
64995
|
+
onMouseDown(_event) {
|
|
65023
64996
|
this.pointCount = 0;
|
|
64997
|
+
if (this.elementModel) {
|
|
64998
|
+
this.elementModel.dispose();
|
|
64999
|
+
}
|
|
65024
65000
|
this.elementModel = this.modelGetter().createLaserPointer();
|
|
65025
65001
|
}
|
|
65026
65002
|
onMouseDrag(event) {
|
|
@@ -65032,20 +65008,20 @@ var LaserPointerTool = class extends WhiteboardTool {
|
|
|
65032
65008
|
this.elementModel.appendPoints([event.point.x, event.point.y]);
|
|
65033
65009
|
}
|
|
65034
65010
|
}
|
|
65035
|
-
onMouseUp(
|
|
65011
|
+
onMouseUp(_event) {
|
|
65036
65012
|
if (this.elementModel) {
|
|
65037
65013
|
this.elementModel.beginRemoveAnimate();
|
|
65038
65014
|
}
|
|
65039
65015
|
}
|
|
65040
65016
|
};
|
|
65041
|
-
function
|
|
65042
|
-
return (r =
|
|
65017
|
+
function _defineProperty34(e, r, t) {
|
|
65018
|
+
return (r = _toPropertyKey34(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65043
65019
|
}
|
|
65044
|
-
function
|
|
65045
|
-
var i =
|
|
65020
|
+
function _toPropertyKey34(t) {
|
|
65021
|
+
var i = _toPrimitive34(t, "string");
|
|
65046
65022
|
return "symbol" == typeof i ? i : i + "";
|
|
65047
65023
|
}
|
|
65048
|
-
function
|
|
65024
|
+
function _toPrimitive34(t, r) {
|
|
65049
65025
|
if ("object" != typeof t || !t) return t;
|
|
65050
65026
|
var e = t[Symbol.toPrimitive];
|
|
65051
65027
|
if (void 0 !== e) {
|
|
@@ -65055,25 +65031,25 @@ function _toPrimitive35(t, r) {
|
|
|
65055
65031
|
}
|
|
65056
65032
|
return ("string" === r ? String : Number)(t);
|
|
65057
65033
|
}
|
|
65058
|
-
var PageModel = class extends
|
|
65034
|
+
var PageModel = class extends import_eventemitter310.default {
|
|
65059
65035
|
constructor(whiteboardAttrsMap, userManager, requestUserMap, pageMap, hasPermission) {
|
|
65060
65036
|
super();
|
|
65061
|
-
|
|
65062
|
-
|
|
65063
|
-
|
|
65064
|
-
|
|
65065
|
-
|
|
65066
|
-
|
|
65067
|
-
|
|
65037
|
+
_defineProperty34(this, "whiteboardAttrsMap", void 0);
|
|
65038
|
+
_defineProperty34(this, "pageMap", void 0);
|
|
65039
|
+
_defineProperty34(this, "requestUserMap", void 0);
|
|
65040
|
+
_defineProperty34(this, "userManager", void 0);
|
|
65041
|
+
_defineProperty34(this, "observers", /* @__PURE__ */ new Map());
|
|
65042
|
+
_defineProperty34(this, "hasPermission", void 0);
|
|
65043
|
+
_defineProperty34(this, "handleUserLeave", (user) => {
|
|
65068
65044
|
const cb = this.observers.get(user.id);
|
|
65069
65045
|
if (cb) {
|
|
65070
65046
|
this.requestUserMap(user.id).unobserve(cb);
|
|
65071
65047
|
}
|
|
65072
65048
|
});
|
|
65073
|
-
|
|
65049
|
+
_defineProperty34(this, "handleUserJoin", (user) => {
|
|
65074
65050
|
this.createCurrentPageObserver(user.id);
|
|
65075
65051
|
});
|
|
65076
|
-
|
|
65052
|
+
_defineProperty34(this, "handleMainPageChange", (evt) => {
|
|
65077
65053
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
65078
65054
|
if (key === WhiteboardKeys.currentPage) {
|
|
65079
65055
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
@@ -65081,7 +65057,7 @@ var PageModel = class extends import_eventemitter311.default {
|
|
|
65081
65057
|
if (cameraMode === "main") {
|
|
65082
65058
|
const targetPage = this.whiteboardAttrsMap.get(WhiteboardKeys.currentPage);
|
|
65083
65059
|
if (!this.pageMap.has(targetPage) && targetPage !== "_i_") {
|
|
65084
|
-
(0,
|
|
65060
|
+
(0, import_forge_room3.log)(`main page {${targetPage}} not found.`, {}, "error");
|
|
65085
65061
|
return;
|
|
65086
65062
|
}
|
|
65087
65063
|
this.requestUserMap(this.userManager.selfId).set(WhiteboardKeys.currentPage, targetPage);
|
|
@@ -65091,7 +65067,7 @@ var PageModel = class extends import_eventemitter311.default {
|
|
|
65091
65067
|
}
|
|
65092
65068
|
}
|
|
65093
65069
|
});
|
|
65094
|
-
|
|
65070
|
+
_defineProperty34(this, "handleUserCurrentPageChange", (userId, evt) => {
|
|
65095
65071
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
65096
65072
|
if (key === WhiteboardKeys.currentPage) {
|
|
65097
65073
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
@@ -65108,7 +65084,7 @@ var PageModel = class extends import_eventemitter311.default {
|
|
|
65108
65084
|
}
|
|
65109
65085
|
}
|
|
65110
65086
|
});
|
|
65111
|
-
|
|
65087
|
+
_defineProperty34(this, "handlePageMapChange", () => {
|
|
65112
65088
|
this.emit("pagesChange", Array.from(this.pageMap.keys()));
|
|
65113
65089
|
});
|
|
65114
65090
|
this.hasPermission = hasPermission;
|
|
@@ -65150,11 +65126,11 @@ var PageModel = class extends import_eventemitter311.default {
|
|
|
65150
65126
|
}
|
|
65151
65127
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
65152
65128
|
if (cameraMode !== "main") {
|
|
65153
|
-
console.warn(
|
|
65129
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65154
65130
|
return false;
|
|
65155
65131
|
}
|
|
65156
65132
|
if (!this.hasPermission(WhiteboardPermissionFlag.mainView)) {
|
|
65157
|
-
console.warn(
|
|
65133
|
+
console.warn("cannot modify pages without WhiteboardPermissionFlag.mainView.");
|
|
65158
65134
|
return false;
|
|
65159
65135
|
}
|
|
65160
65136
|
return true;
|
|
@@ -65206,23 +65182,32 @@ var PageModel = class extends import_eventemitter311.default {
|
|
|
65206
65182
|
}
|
|
65207
65183
|
}
|
|
65208
65184
|
}
|
|
65185
|
+
dispose() {
|
|
65186
|
+
for (const entry of this.observers.entries()) {
|
|
65187
|
+
const [userId, observer] = entry;
|
|
65188
|
+
this.requestUserMap(userId).unobserve(observer);
|
|
65189
|
+
}
|
|
65190
|
+
this.userManager.off("join", this.handleUserJoin);
|
|
65191
|
+
this.userManager.off("leave", this.handleUserLeave);
|
|
65192
|
+
this.whiteboardAttrsMap.unobserve(this.handleMainPageChange);
|
|
65193
|
+
this.pageMap.unobserve(this.handlePageMapChange);
|
|
65194
|
+
}
|
|
65209
65195
|
};
|
|
65210
65196
|
var delay = (value) => new Promise((resolve) => setTimeout(resolve, value));
|
|
65211
65197
|
async function waitUntil(fn, timeout) {
|
|
65212
|
-
|
|
65198
|
+
const start = Date.now();
|
|
65213
65199
|
while (!fn() && Date.now() - start < timeout) {
|
|
65214
65200
|
await delay(50);
|
|
65215
|
-
start = Date.now();
|
|
65216
65201
|
}
|
|
65217
65202
|
}
|
|
65218
|
-
function
|
|
65219
|
-
return (r =
|
|
65203
|
+
function _defineProperty35(e, r, t) {
|
|
65204
|
+
return (r = _toPropertyKey35(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65220
65205
|
}
|
|
65221
|
-
function
|
|
65222
|
-
var i =
|
|
65206
|
+
function _toPropertyKey35(t) {
|
|
65207
|
+
var i = _toPrimitive35(t, "string");
|
|
65223
65208
|
return "symbol" == typeof i ? i : i + "";
|
|
65224
65209
|
}
|
|
65225
|
-
function
|
|
65210
|
+
function _toPrimitive35(t, r) {
|
|
65226
65211
|
if ("object" != typeof t || !t) return t;
|
|
65227
65212
|
var e = t[Symbol.toPrimitive];
|
|
65228
65213
|
if (void 0 !== e) {
|
|
@@ -65232,19 +65217,19 @@ function _toPrimitive36(t, r) {
|
|
|
65232
65217
|
}
|
|
65233
65218
|
return ("string" === r ? String : Number)(t);
|
|
65234
65219
|
}
|
|
65235
|
-
var IndexedNavigation = class extends
|
|
65220
|
+
var IndexedNavigation = class extends import_eventemitter311.default {
|
|
65236
65221
|
get idList() {
|
|
65237
65222
|
return this.pageModel.pageList().filter((id) => /^_i_/.test(id));
|
|
65238
65223
|
}
|
|
65239
65224
|
get head() {
|
|
65240
|
-
|
|
65225
|
+
const headId = Object.keys(this.list).find((key) => {
|
|
65241
65226
|
return this.list[key] && this.list[key].prev === "";
|
|
65242
65227
|
});
|
|
65243
65228
|
if (!headId) {
|
|
65244
|
-
(0,
|
|
65229
|
+
(0, import_forge_room4.log)("indexed navigation confusion", {
|
|
65245
65230
|
list: JSON.stringify(this.list)
|
|
65246
65231
|
}, "error");
|
|
65247
|
-
throw new Error(
|
|
65232
|
+
throw new Error("indexed navigation confusion");
|
|
65248
65233
|
}
|
|
65249
65234
|
return headId;
|
|
65250
65235
|
}
|
|
@@ -65259,13 +65244,13 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65259
65244
|
}
|
|
65260
65245
|
constructor(pageModel, userMap, indexedPageMap, hasPermission) {
|
|
65261
65246
|
super();
|
|
65262
|
-
|
|
65263
|
-
|
|
65264
|
-
|
|
65265
|
-
|
|
65266
|
-
|
|
65267
|
-
|
|
65268
|
-
|
|
65247
|
+
_defineProperty35(this, "idPool", /* @__PURE__ */ new Set());
|
|
65248
|
+
_defineProperty35(this, "pageModel", void 0);
|
|
65249
|
+
_defineProperty35(this, "userMap", void 0);
|
|
65250
|
+
_defineProperty35(this, "indexedPageMap", void 0);
|
|
65251
|
+
_defineProperty35(this, "list", {});
|
|
65252
|
+
_defineProperty35(this, "hasPermission", void 0);
|
|
65253
|
+
_defineProperty35(this, "handleIndexedPageMapUpdate", (_evt) => {
|
|
65269
65254
|
this.list = this.indexedPageMap.get("list");
|
|
65270
65255
|
const needRemoveList = this.pageModel.pageList().filter((v) => /^_i_/.test(v) && Object.keys(this.list).indexOf(v) < 0);
|
|
65271
65256
|
const needAddList = Object.keys(this.list).filter((v) => this.pageModel.pageList().indexOf(v) < 0);
|
|
@@ -65320,8 +65305,8 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65320
65305
|
initIndexed() {
|
|
65321
65306
|
return new Promise((resolve) => {
|
|
65322
65307
|
setTimeout(() => {
|
|
65308
|
+
this.pageModel.addPage("_i_");
|
|
65323
65309
|
if (this.pageModel.pageList().length === 0) {
|
|
65324
|
-
this.pageModel.addPage("_i_");
|
|
65325
65310
|
resolve(true);
|
|
65326
65311
|
} else {
|
|
65327
65312
|
resolve(false);
|
|
@@ -65330,15 +65315,15 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65330
65315
|
});
|
|
65331
65316
|
}
|
|
65332
65317
|
/**
|
|
65333
|
-
|
|
65334
|
-
|
|
65335
|
-
|
|
65318
|
+
* 获取总页数
|
|
65319
|
+
* @returns {number}
|
|
65320
|
+
*/
|
|
65336
65321
|
get pageCount() {
|
|
65337
65322
|
return this.idList.length;
|
|
65338
65323
|
}
|
|
65339
65324
|
/**
|
|
65340
|
-
|
|
65341
|
-
|
|
65325
|
+
* 获取当前页索引
|
|
65326
|
+
*/
|
|
65342
65327
|
get currentPageIndex() {
|
|
65343
65328
|
const userPageId = this.userMap.get(WhiteboardKeys.currentPage);
|
|
65344
65329
|
return this.getPageIndex(userPageId);
|
|
@@ -65358,9 +65343,9 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65358
65343
|
return i;
|
|
65359
65344
|
}
|
|
65360
65345
|
/**
|
|
65361
|
-
|
|
65362
|
-
|
|
65363
|
-
|
|
65346
|
+
* 获取指定索引对应的 pageId
|
|
65347
|
+
* @param {number} index
|
|
65348
|
+
*/
|
|
65364
65349
|
getPageId(index) {
|
|
65365
65350
|
const firstKey = this.head;
|
|
65366
65351
|
if (firstKey) {
|
|
@@ -65382,20 +65367,20 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65382
65367
|
modifyDetect() {
|
|
65383
65368
|
const cameraMode = this.userMap.get(WhiteboardKeys.cameraMode);
|
|
65384
65369
|
if (cameraMode !== "main") {
|
|
65385
|
-
console.warn(
|
|
65370
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65386
65371
|
return false;
|
|
65387
65372
|
}
|
|
65388
65373
|
if (!this.hasPermission(WhiteboardPermissionFlag.mainView)) {
|
|
65389
|
-
console.warn(
|
|
65374
|
+
console.warn("cannot modify pages without WhiteboardPermissionFlag.mainView.");
|
|
65390
65375
|
return false;
|
|
65391
65376
|
}
|
|
65392
65377
|
return true;
|
|
65393
65378
|
}
|
|
65394
65379
|
/**
|
|
65395
|
-
|
|
65396
|
-
|
|
65397
|
-
|
|
65398
|
-
|
|
65380
|
+
* 在尾部插入新页面
|
|
65381
|
+
* @param {boolean=} goto 是否跳转到新页面, 默认 true
|
|
65382
|
+
* @return 总页数
|
|
65383
|
+
*/
|
|
65399
65384
|
pushPage() {
|
|
65400
65385
|
let goto = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
65401
65386
|
this.indexedPageMap.doc.transact(() => {
|
|
@@ -65424,11 +65409,11 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65424
65409
|
return this.pageCount;
|
|
65425
65410
|
}
|
|
65426
65411
|
/**
|
|
65427
|
-
|
|
65428
|
-
|
|
65429
|
-
|
|
65430
|
-
|
|
65431
|
-
|
|
65412
|
+
* 在 after 之后插入新页面
|
|
65413
|
+
* @param {number} after 在此页之后插入
|
|
65414
|
+
* @param {boolean=} goto 是否跳转到新页面, 默认 true
|
|
65415
|
+
* @return 总页数
|
|
65416
|
+
*/
|
|
65432
65417
|
insertPage(after) {
|
|
65433
65418
|
let goto = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
65434
65419
|
const afterPageId = this.getPageId(after);
|
|
@@ -65437,7 +65422,7 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65437
65422
|
}
|
|
65438
65423
|
const cameraMode = this.userMap.get(WhiteboardKeys.cameraMode);
|
|
65439
65424
|
if (cameraMode !== "main") {
|
|
65440
|
-
console.warn(
|
|
65425
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65441
65426
|
return this.pageCount;
|
|
65442
65427
|
}
|
|
65443
65428
|
const prev = this.list[afterPageId];
|
|
@@ -65480,8 +65465,8 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65480
65465
|
return this.pageCount;
|
|
65481
65466
|
}
|
|
65482
65467
|
/**
|
|
65483
|
-
|
|
65484
|
-
|
|
65468
|
+
* 跳转至上一页, 并返回跳转后的页面索引.
|
|
65469
|
+
*/
|
|
65485
65470
|
prevPage() {
|
|
65486
65471
|
const currentPageId = this.userMap.get(WhiteboardKeys.currentPage);
|
|
65487
65472
|
const data = this.list[currentPageId];
|
|
@@ -65493,8 +65478,8 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65493
65478
|
return nextIndex;
|
|
65494
65479
|
}
|
|
65495
65480
|
/**
|
|
65496
|
-
|
|
65497
|
-
|
|
65481
|
+
* 跳转至下一页, 并返回跳转后的页面索引.
|
|
65482
|
+
*/
|
|
65498
65483
|
nextPage() {
|
|
65499
65484
|
const currentPageId = this.userMap.get(WhiteboardKeys.currentPage);
|
|
65500
65485
|
const data = this.list[currentPageId];
|
|
@@ -65506,16 +65491,16 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65506
65491
|
return nextIndex;
|
|
65507
65492
|
}
|
|
65508
65493
|
/**
|
|
65509
|
-
|
|
65510
|
-
|
|
65511
|
-
|
|
65494
|
+
* 删除指定页面
|
|
65495
|
+
* @param {number} index
|
|
65496
|
+
*/
|
|
65512
65497
|
removePage(index) {
|
|
65513
65498
|
if (this.pageCount <= 1) {
|
|
65514
65499
|
return this.pageCount;
|
|
65515
65500
|
}
|
|
65516
65501
|
const cameraMode = this.userMap.get(WhiteboardKeys.cameraMode);
|
|
65517
65502
|
if (cameraMode !== "main") {
|
|
65518
|
-
console.warn(
|
|
65503
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65519
65504
|
return this.pageCount;
|
|
65520
65505
|
}
|
|
65521
65506
|
const targetId = this.getPageId(index);
|
|
@@ -65555,15 +65540,20 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65555
65540
|
this.pageModel.gotoPage(targetId);
|
|
65556
65541
|
}
|
|
65557
65542
|
}
|
|
65543
|
+
dispose() {
|
|
65544
|
+
this.indexedPageMap.unobserve(this.handleIndexedPageMapUpdate);
|
|
65545
|
+
this.pageModel.off("switchPage");
|
|
65546
|
+
this.pageModel.off("pagesChange");
|
|
65547
|
+
}
|
|
65558
65548
|
};
|
|
65559
|
-
function
|
|
65560
|
-
return (r =
|
|
65549
|
+
function _defineProperty36(e, r, t) {
|
|
65550
|
+
return (r = _toPropertyKey36(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65561
65551
|
}
|
|
65562
|
-
function
|
|
65563
|
-
var i =
|
|
65552
|
+
function _toPropertyKey36(t) {
|
|
65553
|
+
var i = _toPrimitive36(t, "string");
|
|
65564
65554
|
return "symbol" == typeof i ? i : i + "";
|
|
65565
65555
|
}
|
|
65566
|
-
function
|
|
65556
|
+
function _toPrimitive36(t, r) {
|
|
65567
65557
|
if ("object" != typeof t || !t) return t;
|
|
65568
65558
|
var e = t[Symbol.toPrimitive];
|
|
65569
65559
|
if (void 0 !== e) {
|
|
@@ -65573,10 +65563,10 @@ function _toPrimitive37(t, r) {
|
|
|
65573
65563
|
}
|
|
65574
65564
|
return ("string" === r ? String : Number)(t);
|
|
65575
65565
|
}
|
|
65576
|
-
var ShadowEmitter = class extends
|
|
65566
|
+
var ShadowEmitter = class extends import_eventemitter312.default {
|
|
65577
65567
|
constructor(userMap) {
|
|
65578
65568
|
super();
|
|
65579
|
-
|
|
65569
|
+
_defineProperty36(this, "userMap", void 0);
|
|
65580
65570
|
this.userMap = userMap;
|
|
65581
65571
|
}
|
|
65582
65572
|
getActive() {
|
|
@@ -65586,14 +65576,14 @@ var ShadowEmitter = class extends import_eventemitter313.default {
|
|
|
65586
65576
|
return this.userMap.set("shadowActive", value);
|
|
65587
65577
|
}
|
|
65588
65578
|
};
|
|
65589
|
-
function
|
|
65590
|
-
return (r =
|
|
65579
|
+
function _defineProperty37(e, r, t) {
|
|
65580
|
+
return (r = _toPropertyKey37(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65591
65581
|
}
|
|
65592
|
-
function
|
|
65593
|
-
var i =
|
|
65582
|
+
function _toPropertyKey37(t) {
|
|
65583
|
+
var i = _toPrimitive37(t, "string");
|
|
65594
65584
|
return "symbol" == typeof i ? i : i + "";
|
|
65595
65585
|
}
|
|
65596
|
-
function
|
|
65586
|
+
function _toPrimitive37(t, r) {
|
|
65597
65587
|
if ("object" != typeof t || !t) return t;
|
|
65598
65588
|
var e = t[Symbol.toPrimitive];
|
|
65599
65589
|
if (void 0 !== e) {
|
|
@@ -65606,12 +65596,15 @@ function _toPrimitive38(t, r) {
|
|
|
65606
65596
|
var StraightLineTool = class extends WhiteboardTool {
|
|
65607
65597
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65608
65598
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65609
|
-
|
|
65610
|
-
|
|
65611
|
-
|
|
65599
|
+
_defineProperty37(this, "elementModel", null);
|
|
65600
|
+
_defineProperty37(this, "from", null);
|
|
65601
|
+
_defineProperty37(this, "to", null);
|
|
65612
65602
|
this.tool.minDistance = 1;
|
|
65613
65603
|
}
|
|
65614
65604
|
onMouseDown(event) {
|
|
65605
|
+
if (this.elementModel) {
|
|
65606
|
+
this.elementModel.dispose();
|
|
65607
|
+
}
|
|
65615
65608
|
this.elementModel = this.modelGetter().createStraightLine(true);
|
|
65616
65609
|
this.from = event.point.clone();
|
|
65617
65610
|
this.to = event.point.clone();
|
|
@@ -65631,14 +65624,14 @@ var StraightLineTool = class extends WhiteboardTool {
|
|
|
65631
65624
|
}
|
|
65632
65625
|
}
|
|
65633
65626
|
};
|
|
65634
|
-
function
|
|
65635
|
-
return (r =
|
|
65627
|
+
function _defineProperty38(e, r, t) {
|
|
65628
|
+
return (r = _toPropertyKey38(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65636
65629
|
}
|
|
65637
|
-
function
|
|
65638
|
-
var i =
|
|
65630
|
+
function _toPropertyKey38(t) {
|
|
65631
|
+
var i = _toPrimitive38(t, "string");
|
|
65639
65632
|
return "symbol" == typeof i ? i : i + "";
|
|
65640
65633
|
}
|
|
65641
|
-
function
|
|
65634
|
+
function _toPrimitive38(t, r) {
|
|
65642
65635
|
if ("object" != typeof t || !t) return t;
|
|
65643
65636
|
var e = t[Symbol.toPrimitive];
|
|
65644
65637
|
if (void 0 !== e) {
|
|
@@ -65651,8 +65644,8 @@ function _toPrimitive39(t, r) {
|
|
|
65651
65644
|
var GrabTool = class extends WhiteboardTool {
|
|
65652
65645
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope, camera) {
|
|
65653
65646
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65654
|
-
|
|
65655
|
-
|
|
65647
|
+
_defineProperty38(this, "camera", void 0);
|
|
65648
|
+
_defineProperty38(this, "downPoint", null);
|
|
65656
65649
|
this.camera = camera;
|
|
65657
65650
|
}
|
|
65658
65651
|
onMouseDown(event) {
|
|
@@ -65675,13 +65668,58 @@ var PointerTool = class extends WhiteboardTool {
|
|
|
65675
65668
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65676
65669
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65677
65670
|
}
|
|
65678
|
-
onMouseDown(
|
|
65671
|
+
onMouseDown(_event) {
|
|
65679
65672
|
}
|
|
65680
|
-
onMouseDrag(
|
|
65673
|
+
onMouseDrag(_event) {
|
|
65681
65674
|
}
|
|
65682
65675
|
onMouseUp() {
|
|
65683
65676
|
}
|
|
65684
65677
|
};
|
|
65678
|
+
function _defineProperty39(e, r, t) {
|
|
65679
|
+
return (r = _toPropertyKey39(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65680
|
+
}
|
|
65681
|
+
function _toPropertyKey39(t) {
|
|
65682
|
+
var i = _toPrimitive39(t, "string");
|
|
65683
|
+
return "symbol" == typeof i ? i : i + "";
|
|
65684
|
+
}
|
|
65685
|
+
function _toPrimitive39(t, r) {
|
|
65686
|
+
if ("object" != typeof t || !t) return t;
|
|
65687
|
+
var e = t[Symbol.toPrimitive];
|
|
65688
|
+
if (void 0 !== e) {
|
|
65689
|
+
var i = e.call(t, r || "default");
|
|
65690
|
+
if ("object" != typeof i) return i;
|
|
65691
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
65692
|
+
}
|
|
65693
|
+
return ("string" === r ? String : Number)(t);
|
|
65694
|
+
}
|
|
65695
|
+
var SequenceExecutor = class {
|
|
65696
|
+
constructor() {
|
|
65697
|
+
_defineProperty39(this, "tasks", []);
|
|
65698
|
+
_defineProperty39(this, "isRunning", false);
|
|
65699
|
+
}
|
|
65700
|
+
addTask(task) {
|
|
65701
|
+
this.tasks.push(task);
|
|
65702
|
+
if (!this.isRunning) {
|
|
65703
|
+
this.execute();
|
|
65704
|
+
}
|
|
65705
|
+
}
|
|
65706
|
+
async execute() {
|
|
65707
|
+
if (this.isRunning) {
|
|
65708
|
+
return;
|
|
65709
|
+
}
|
|
65710
|
+
this.isRunning = true;
|
|
65711
|
+
while (this.tasks.length > 0) {
|
|
65712
|
+
const task = this.tasks.shift();
|
|
65713
|
+
if (task) {
|
|
65714
|
+
try {
|
|
65715
|
+
await task();
|
|
65716
|
+
} catch (e) {
|
|
65717
|
+
}
|
|
65718
|
+
}
|
|
65719
|
+
}
|
|
65720
|
+
this.isRunning = false;
|
|
65721
|
+
}
|
|
65722
|
+
};
|
|
65685
65723
|
function _defineProperty40(e, r, t) {
|
|
65686
65724
|
return (r = _toPropertyKey40(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65687
65725
|
}
|
|
@@ -65739,16 +65777,18 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65739
65777
|
_defineProperty40(this, "hasPenInput", null);
|
|
65740
65778
|
_defineProperty40(this, "disableViewModelUpdate", false);
|
|
65741
65779
|
_defineProperty40(this, "internalResizeObserver", true);
|
|
65780
|
+
_defineProperty40(this, "sequenceExecutor", new SequenceExecutor());
|
|
65742
65781
|
_defineProperty40(this, "linkTarget", null);
|
|
65743
65782
|
_defineProperty40(this, "enableToolEvent", () => {
|
|
65744
65783
|
return !(this.inputType === "pen" && !this.isPenEvent);
|
|
65745
65784
|
});
|
|
65746
65785
|
_defineProperty40(this, "handlePageSwitch", (pageId) => {
|
|
65747
|
-
|
|
65748
|
-
editor.
|
|
65749
|
-
|
|
65750
|
-
|
|
65751
|
-
|
|
65786
|
+
this.sequenceExecutor.addTask(async () => {
|
|
65787
|
+
for (const editor of this.editors.values()) {
|
|
65788
|
+
editor.hidden();
|
|
65789
|
+
}
|
|
65790
|
+
this.selectElementsModel.clearSelectElementForSelf();
|
|
65791
|
+
await waitUntil(() => this.layers.has(pageId), 1e3);
|
|
65752
65792
|
if (this.layers.has(pageId)) {
|
|
65753
65793
|
for (const entry of this.layers.entries()) {
|
|
65754
65794
|
entry[1].off("elementInsert", this.handleElementInsert);
|
|
@@ -65760,6 +65800,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65760
65800
|
renderableModel.on("elementRemove", this.handleElementRemove);
|
|
65761
65801
|
renderableModel.on("elementClear", this.handleElementClear);
|
|
65762
65802
|
renderableModel.flushRenderables();
|
|
65803
|
+
this.paperScope.project.activeLayer.data.pageId = pageId;
|
|
65763
65804
|
const others = this.userManager.userIdList().filter((v) => v !== this.userId);
|
|
65764
65805
|
for (const other of others) {
|
|
65765
65806
|
if (this.userMap(other).get(WhiteboardKeys.currentPage) === pageId) {
|
|
@@ -65769,9 +65810,11 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65769
65810
|
}
|
|
65770
65811
|
}
|
|
65771
65812
|
}
|
|
65813
|
+
} else {
|
|
65814
|
+
console.warn(`[@netless/forge-whiteboard] page ${pageId} not found`);
|
|
65815
|
+
(0, import_forge_room.log)(`[@netless/forge-whiteboard] page ${pageId} not found`, {}, "warning");
|
|
65772
65816
|
}
|
|
65773
|
-
|
|
65774
|
-
waitUntil(() => this.undoManagers.has(pageId), 3e3).then(() => {
|
|
65817
|
+
await waitUntil(() => this.undoManagers.has(pageId), 1e3);
|
|
65775
65818
|
if (this.undoManagers.has(pageId)) {
|
|
65776
65819
|
for (const entry of this.undoManagers.entries()) {
|
|
65777
65820
|
entry[1].off("stack-item-added", this.handleStackItemAdded);
|
|
@@ -65779,10 +65822,13 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65779
65822
|
}
|
|
65780
65823
|
this.undoManagers.get(pageId).on("stack-item-added", this.handleStackItemAdded);
|
|
65781
65824
|
this.undoManagers.get(pageId).on("stack-item-popped", this.handleStackItemPopped);
|
|
65825
|
+
} else {
|
|
65826
|
+
console.warn(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`);
|
|
65827
|
+
(0, import_forge_room.log)(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`, {}, "warning");
|
|
65782
65828
|
}
|
|
65829
|
+
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
65830
|
+
this.emitter.emit("undoStackLength", this.undoManager?.undoStack.length ?? 0);
|
|
65783
65831
|
});
|
|
65784
|
-
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
65785
|
-
this.emitter.emit("undoStackLength", this.undoManager?.undoStack.length ?? 0);
|
|
65786
65832
|
});
|
|
65787
65833
|
_defineProperty40(this, "hasPermission", (flag) => {
|
|
65788
65834
|
return this.permissions.hasPermission(flag, this.userId);
|
|
@@ -65812,7 +65858,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65812
65858
|
this.undoManagers.set(id, undoManager);
|
|
65813
65859
|
}
|
|
65814
65860
|
}
|
|
65815
|
-
for (
|
|
65861
|
+
for (const entry of this.layers.entries()) {
|
|
65816
65862
|
if (ids.indexOf(entry[0]) < 0) {
|
|
65817
65863
|
const renderableModel = this.layers.get(entry[0]);
|
|
65818
65864
|
this.layers.delete(entry[0]);
|
|
@@ -65829,7 +65875,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65829
65875
|
}
|
|
65830
65876
|
});
|
|
65831
65877
|
_defineProperty40(this, "getCurrentRenderableModel", () => {
|
|
65832
|
-
|
|
65878
|
+
const layerId = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
65833
65879
|
if (!this.layers.has(layerId)) {
|
|
65834
65880
|
this.emitter.emit("error", 300002, `target page: ${layerId} not found`);
|
|
65835
65881
|
}
|
|
@@ -65910,7 +65956,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65910
65956
|
}).filter((v) => !!v);
|
|
65911
65957
|
editor.setTargets(elementModels);
|
|
65912
65958
|
if (elementModels.length === 1) {
|
|
65913
|
-
|
|
65959
|
+
const model = elementModels[0];
|
|
65914
65960
|
if (model.item) {
|
|
65915
65961
|
const topLeft = this.paperScope.project.view.projectToView(model.item.bounds.topLeft);
|
|
65916
65962
|
const bottomRight = this.paperScope.project.view.projectToView(model.item.bounds.bottomRight);
|
|
@@ -65956,6 +66002,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65956
66002
|
});
|
|
65957
66003
|
requestAnimationFrameHook(this.paperScope);
|
|
65958
66004
|
requestAnimationFrameHook(this.shadowScope);
|
|
66005
|
+
const that = this;
|
|
65959
66006
|
this.rootElement.setAttribute("data-forge-app", "whiteboard");
|
|
65960
66007
|
document.body.addEventListener("pointerdown", (evt) => {
|
|
65961
66008
|
this.isPenEvent = evt.pointerType === "pen";
|
|
@@ -66127,7 +66174,6 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
66127
66174
|
errorMessage
|
|
66128
66175
|
});
|
|
66129
66176
|
});
|
|
66130
|
-
const that = this;
|
|
66131
66177
|
Object.defineProperty(this.emitter, "tool", {
|
|
66132
66178
|
get() {
|
|
66133
66179
|
return that.toolbarModel.currentTool;
|
|
@@ -66224,6 +66270,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
66224
66270
|
this.permissions = new WhiteboardPermissions(this.userManager, (userId) => {
|
|
66225
66271
|
return this.userMap(userId);
|
|
66226
66272
|
});
|
|
66273
|
+
this.permissions.setPermission(WhiteboardPermissionFlag.all);
|
|
66227
66274
|
this.emitter["permissions"] = this.permissions;
|
|
66228
66275
|
this.emitter["selfUserId"] = this.userId;
|
|
66229
66276
|
this.option = option;
|
|
@@ -66475,7 +66522,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
66475
66522
|
if (renderableModel.elementModels.has(key)) {
|
|
66476
66523
|
elementModel = renderableModel.elementModels.get(key) ?? null;
|
|
66477
66524
|
} else {
|
|
66478
|
-
|
|
66525
|
+
const elementMap = renderableModel.elements.get(key);
|
|
66479
66526
|
if (elementMap) {
|
|
66480
66527
|
elementModel = renderableModel.convertToModel(elementMap);
|
|
66481
66528
|
}
|
|
@@ -66562,6 +66609,9 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
66562
66609
|
const size = this.paperScope.view.viewSize;
|
|
66563
66610
|
return [size.width, size.height];
|
|
66564
66611
|
}
|
|
66612
|
+
getInherentScale() {
|
|
66613
|
+
return this.camera.getInherentScale();
|
|
66614
|
+
}
|
|
66565
66615
|
updateInternalResizeObserverStatus(value) {
|
|
66566
66616
|
this.internalResizeObserver = value;
|
|
66567
66617
|
}
|
|
@@ -66581,74 +66631,91 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
66581
66631
|
this.shadowScope.project.clear();
|
|
66582
66632
|
this.snapshotScope.project.clear();
|
|
66583
66633
|
this.resizeObserver.disconnect();
|
|
66634
|
+
this.unlink();
|
|
66635
|
+
for (const entry of this.undoManagers.entries()) {
|
|
66636
|
+
entry[1].off("stack-item-added", this.handleStackItemAdded);
|
|
66637
|
+
entry[1].off("stack-item-popped", this.handleStackItemPopped);
|
|
66638
|
+
}
|
|
66639
|
+
for (const entry of this.layers.entries()) {
|
|
66640
|
+
entry[1].dispose();
|
|
66641
|
+
entry[1].removeAllListeners();
|
|
66642
|
+
}
|
|
66643
|
+
this.camera.dispose();
|
|
66644
|
+
this.pageModel.dispose();
|
|
66645
|
+
this.pageModel.removeAllListeners();
|
|
66646
|
+
for (const entry of this.editors.entries()) {
|
|
66647
|
+
entry[1].dispose();
|
|
66648
|
+
}
|
|
66649
|
+
this.toolbarModel.dispose();
|
|
66650
|
+
this.emitter.indexedNavigation.dispose();
|
|
66651
|
+
this.permissions.dispose();
|
|
66584
66652
|
}
|
|
66585
66653
|
};
|
|
66586
66654
|
_defineProperty40(WhiteboardApplication, "applicationName", WHITEBOARD_APP_NAME);
|
|
66587
66655
|
|
|
66588
66656
|
// src/SlideApplication.ts
|
|
66589
66657
|
var import_slide = __toESM(require_Slide());
|
|
66590
|
-
var
|
|
66658
|
+
var import_forge_room6 = require("@netless/forge-room");
|
|
66591
66659
|
|
|
66592
66660
|
// src/Slide.ts
|
|
66593
|
-
var
|
|
66594
|
-
var SlideForge = class extends
|
|
66661
|
+
var import_eventemitter313 = __toESM(require("eventemitter3"));
|
|
66662
|
+
var SlideForge = class extends import_eventemitter313.default {
|
|
66595
66663
|
view;
|
|
66596
66664
|
permissions;
|
|
66597
66665
|
footView;
|
|
66598
66666
|
sideBarView;
|
|
66599
|
-
whiteboardView;
|
|
66600
66667
|
/**
|
|
66601
|
-
|
|
66602
|
-
|
|
66668
|
+
* 当前页面索引, 从 0 开始
|
|
66669
|
+
*/
|
|
66603
66670
|
pageIndex;
|
|
66604
66671
|
/**
|
|
66605
|
-
|
|
66606
|
-
|
|
66672
|
+
* 总页数
|
|
66673
|
+
*/
|
|
66607
66674
|
pageCount;
|
|
66608
66675
|
/**
|
|
66609
|
-
|
|
66610
|
-
|
|
66611
|
-
|
|
66676
|
+
* 切换到参数指定页面, index 从 0 开始
|
|
66677
|
+
* @param {number} index 页面索引
|
|
66678
|
+
*/
|
|
66612
66679
|
goto;
|
|
66613
66680
|
/**
|
|
66614
|
-
|
|
66615
|
-
|
|
66681
|
+
* 下一步, 如果已经是本页的最后一步, 则切换到下一页
|
|
66682
|
+
*/
|
|
66616
66683
|
nextStep;
|
|
66617
66684
|
/**
|
|
66618
|
-
|
|
66619
|
-
|
|
66685
|
+
* 上一步, 如果已经是本页的第一步, 则切换到上一页
|
|
66686
|
+
*/
|
|
66620
66687
|
prevStep;
|
|
66621
66688
|
/**
|
|
66622
|
-
|
|
66623
|
-
|
|
66689
|
+
* 下一页, 如果是最后一页, 则不执行任何操作
|
|
66690
|
+
*/
|
|
66624
66691
|
nextPage;
|
|
66625
66692
|
/**
|
|
66626
|
-
|
|
66627
|
-
|
|
66693
|
+
* 上一页, 如果是第一页, 则不执行任何操作
|
|
66694
|
+
*/
|
|
66628
66695
|
prevPage;
|
|
66629
66696
|
/**
|
|
66630
|
-
|
|
66631
|
-
|
|
66697
|
+
* 切换侧栏显示状态
|
|
66698
|
+
*/
|
|
66632
66699
|
sideBarToggle;
|
|
66633
66700
|
/**
|
|
66634
|
-
|
|
66635
|
-
|
|
66636
|
-
|
|
66701
|
+
* 获取预览图图片内容, base64 编码
|
|
66702
|
+
* @param {number} index 页面索引
|
|
66703
|
+
*/
|
|
66637
66704
|
imgContent;
|
|
66638
66705
|
/**
|
|
66639
|
-
|
|
66640
|
-
|
|
66641
|
-
|
|
66706
|
+
* 获取预览图图片链接
|
|
66707
|
+
* @param {number} index 页面索引
|
|
66708
|
+
*/
|
|
66642
66709
|
imgUrl;
|
|
66643
66710
|
/**
|
|
66644
|
-
|
|
66645
|
-
|
|
66646
|
-
|
|
66711
|
+
* 获取预览图图片尺寸
|
|
66712
|
+
* @param {number} index 页面索引
|
|
66713
|
+
*/
|
|
66647
66714
|
imgSize;
|
|
66648
66715
|
};
|
|
66649
66716
|
|
|
66650
66717
|
// src/ForgeSlidePermession.ts
|
|
66651
|
-
var
|
|
66718
|
+
var import_forge_room5 = require("@netless/forge-room");
|
|
66652
66719
|
var ForgeSlidePermissionFlag = /* @__PURE__ */ ((ForgeSlidePermissionFlag2) => {
|
|
66653
66720
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["none"] = 0] = "none";
|
|
66654
66721
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["changeStep"] = 1] = "changeStep";
|
|
@@ -66657,58 +66724,12 @@ var ForgeSlidePermissionFlag = /* @__PURE__ */ ((ForgeSlidePermissionFlag2) => {
|
|
|
66657
66724
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["all"] = 7] = "all";
|
|
66658
66725
|
return ForgeSlidePermissionFlag2;
|
|
66659
66726
|
})(ForgeSlidePermissionFlag || {});
|
|
66660
|
-
var ForgeSlidePermissions = class extends
|
|
66661
|
-
requestUserMap;
|
|
66662
|
-
userManager;
|
|
66663
|
-
observers = /* @__PURE__ */ new Map();
|
|
66664
|
-
constructor(userManager, requestUserMap) {
|
|
66665
|
-
super();
|
|
66666
|
-
this.userManager = userManager;
|
|
66667
|
-
this.requestUserMap = requestUserMap;
|
|
66668
|
-
this.createModel(this.userManager.selfId);
|
|
66669
|
-
this.userManager.userIdList().forEach((userId) => {
|
|
66670
|
-
this.addObserve(userId);
|
|
66671
|
-
});
|
|
66672
|
-
this.userManager.on("join", this.handleUserJoin);
|
|
66673
|
-
this.userManager.on("leave", this.handleUserLeave);
|
|
66674
|
-
}
|
|
66675
|
-
handleUserLeave = (user) => {
|
|
66676
|
-
const cb = this.observers.get(user.id);
|
|
66677
|
-
if (cb) {
|
|
66678
|
-
this.requestUserMap(user.id).unobserve(cb);
|
|
66679
|
-
}
|
|
66680
|
-
};
|
|
66681
|
-
handleUserJoin = (user) => {
|
|
66682
|
-
this.addObserve(user.id);
|
|
66683
|
-
};
|
|
66684
|
-
addObserve(userId) {
|
|
66685
|
-
const observer = (evt) => {
|
|
66686
|
-
this.handleUserPermissionChange(userId, evt);
|
|
66687
|
-
};
|
|
66688
|
-
this.observers.set(userId, observer);
|
|
66689
|
-
this.requestUserMap(userId).observe(observer);
|
|
66690
|
-
}
|
|
66691
|
-
createModel(userId) {
|
|
66692
|
-
const userMap = this.requestUserMap(userId);
|
|
66693
|
-
if (!userMap.has("permission")) {
|
|
66694
|
-
userMap.set("permission", 0);
|
|
66695
|
-
}
|
|
66696
|
-
}
|
|
66697
|
-
handleUserPermissionChange(userId, evt) {
|
|
66698
|
-
for (const [key, value] of evt.changes.keys.entries()) {
|
|
66699
|
-
if (key === "permission") {
|
|
66700
|
-
if (value.action === "add" || value.action === "update") {
|
|
66701
|
-
const newValue = this.requestUserMap(userId).get("permission");
|
|
66702
|
-
this.emit("change", userId, this.resolveFlags(newValue), newValue);
|
|
66703
|
-
}
|
|
66704
|
-
}
|
|
66705
|
-
}
|
|
66706
|
-
}
|
|
66727
|
+
var ForgeSlidePermissions = class extends import_forge_room5.AbstractApplicationPermissions {
|
|
66707
66728
|
/**
|
|
66708
|
-
|
|
66709
|
-
|
|
66710
|
-
|
|
66711
|
-
|
|
66729
|
+
* 解析权限列表组合
|
|
66730
|
+
* @param {number} value - 权限数字值
|
|
66731
|
+
* @return {WhiteboardPermissionFlag[]} - 权限列表
|
|
66732
|
+
*/
|
|
66712
66733
|
resolveFlags(value) {
|
|
66713
66734
|
return [
|
|
66714
66735
|
2 /* changePage */,
|
|
@@ -66716,53 +66737,10 @@ var ForgeSlidePermissions = class extends import_eventemitter315.default {
|
|
|
66716
66737
|
4 /* clickAnim */
|
|
66717
66738
|
].filter((v) => (v & value) !== 0);
|
|
66718
66739
|
}
|
|
66719
|
-
/**
|
|
66720
|
-
* 获取权限列表组合对应的数值
|
|
66721
|
-
* @param { string } userId 不传表示获取自己
|
|
66722
|
-
*/
|
|
66723
|
-
getPermissionValue(userId) {
|
|
66724
|
-
return this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
66725
|
-
}
|
|
66726
|
-
/**
|
|
66727
|
-
* 获取权限列表
|
|
66728
|
-
* @param {string=} userId 可选, 不传表示获取自己
|
|
66729
|
-
*/
|
|
66730
|
-
getPermissionFlags(userId) {
|
|
66731
|
-
const value = this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
66732
|
-
return this.resolveFlags(value);
|
|
66733
|
-
}
|
|
66734
|
-
/**
|
|
66735
|
-
* 返回对应 userId 是否有相应权限
|
|
66736
|
-
* @param {string=} userId 可选, 不传表示返回自己是否有相应权限
|
|
66737
|
-
* @param {WhiteboardPermissionFlag} flag
|
|
66738
|
-
*/
|
|
66739
|
-
hasPermission(flag, userId) {
|
|
66740
|
-
return ((this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0) & flag) !== 0;
|
|
66741
|
-
}
|
|
66742
|
-
/**
|
|
66743
|
-
* 添加权限
|
|
66744
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
66745
|
-
* @param {string=} userId 可选, 为 userId 添加权限, 不传表示为自己添加权限
|
|
66746
|
-
*/
|
|
66747
|
-
addPermission(flag, userId) {
|
|
66748
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
66749
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
66750
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue | flag);
|
|
66751
|
-
}
|
|
66752
|
-
/**
|
|
66753
|
-
* 移除权限
|
|
66754
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
66755
|
-
* @param {string=} userId 可选, 为 userId 移除权限, 不传表示为自己移除权限
|
|
66756
|
-
*/
|
|
66757
|
-
removePermission(flag, userId) {
|
|
66758
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
66759
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
66760
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue & ~flag);
|
|
66761
|
-
}
|
|
66762
66740
|
};
|
|
66763
66741
|
|
|
66764
66742
|
// src/FooterView.ts
|
|
66765
|
-
var
|
|
66743
|
+
var import_eventemitter314 = __toESM(require("eventemitter3"));
|
|
66766
66744
|
|
|
66767
66745
|
// src/icons.ts
|
|
66768
66746
|
var prevPage = (color) => `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none">
|
|
@@ -66793,13 +66771,14 @@ var Icons = {
|
|
|
66793
66771
|
|
|
66794
66772
|
// src/FooterView.ts
|
|
66795
66773
|
var EM_COLOR = "#8C8C8C";
|
|
66796
|
-
var FooterView = class extends
|
|
66774
|
+
var FooterView = class extends import_eventemitter314.default {
|
|
66797
66775
|
root;
|
|
66798
66776
|
prevStep;
|
|
66799
66777
|
nextStep;
|
|
66800
66778
|
prevPage;
|
|
66801
66779
|
nextPage;
|
|
66802
66780
|
sideBarToggle;
|
|
66781
|
+
eventMap = /* @__PURE__ */ new Map();
|
|
66803
66782
|
constructor() {
|
|
66804
66783
|
super();
|
|
66805
66784
|
this.root = document.createElement("div");
|
|
@@ -66863,25 +66842,43 @@ var FooterView = class extends import_eventemitter316.default {
|
|
|
66863
66842
|
icon.style.borderRadius = "2px";
|
|
66864
66843
|
icon.style.margin = "6px";
|
|
66865
66844
|
icon.innerHTML = svgContent;
|
|
66866
|
-
|
|
66845
|
+
const onClickHandle = () => {
|
|
66867
66846
|
action();
|
|
66868
|
-
}
|
|
66869
|
-
|
|
66847
|
+
};
|
|
66848
|
+
const onMouseOverHandle = () => {
|
|
66870
66849
|
icon.style.backgroundColor = "#f0f0f0";
|
|
66871
|
-
}
|
|
66872
|
-
|
|
66850
|
+
};
|
|
66851
|
+
const onMouseOutHandle = () => {
|
|
66873
66852
|
icon.style.backgroundColor = "transparent";
|
|
66874
|
-
}
|
|
66853
|
+
};
|
|
66854
|
+
icon.addEventListener("click", onClickHandle);
|
|
66855
|
+
icon.addEventListener("mouseover", onMouseOverHandle);
|
|
66856
|
+
icon.addEventListener("mouseout", onMouseOutHandle);
|
|
66857
|
+
this.eventMap.set(icon, [onClickHandle, onMouseOutHandle, onMouseOverHandle]);
|
|
66875
66858
|
return icon;
|
|
66876
66859
|
}
|
|
66860
|
+
clearHTMLEventListeners() {
|
|
66861
|
+
this.eventMap.forEach((value, key) => {
|
|
66862
|
+
if (key) {
|
|
66863
|
+
const [clickEvent, mouseOutEvent, mouseOverEvent] = value;
|
|
66864
|
+
key.removeEventListener("click", clickEvent);
|
|
66865
|
+
key.removeEventListener("mouseover", mouseOverEvent);
|
|
66866
|
+
key.removeEventListener("mouseout", mouseOutEvent);
|
|
66867
|
+
}
|
|
66868
|
+
});
|
|
66869
|
+
}
|
|
66870
|
+
dispose() {
|
|
66871
|
+
this.removeAllListeners();
|
|
66872
|
+
this.clearHTMLEventListeners();
|
|
66873
|
+
}
|
|
66877
66874
|
};
|
|
66878
66875
|
|
|
66879
66876
|
// src/SiderBarView.ts
|
|
66880
|
-
var
|
|
66881
|
-
var SideBarView = class extends
|
|
66877
|
+
var import_eventemitter315 = __toESM(require("eventemitter3"));
|
|
66878
|
+
var SideBarView = class extends import_eventemitter315.default {
|
|
66882
66879
|
root = document.createElement("div");
|
|
66883
66880
|
isShow = false;
|
|
66884
|
-
|
|
66881
|
+
eventsMap = /* @__PURE__ */ new Map();
|
|
66885
66882
|
constructor() {
|
|
66886
66883
|
super();
|
|
66887
66884
|
this.root.style.backgroundColor = "#eee";
|
|
@@ -66902,19 +66899,9 @@ var SideBarView = class extends import_eventemitter317.default {
|
|
|
66902
66899
|
get isShowSideBar() {
|
|
66903
66900
|
return this.isShow;
|
|
66904
66901
|
}
|
|
66905
|
-
onMouseOver = (itemContainer) => {
|
|
66906
|
-
itemContainer.style.borderColor = "#ccc";
|
|
66907
|
-
};
|
|
66908
|
-
onMouseOut = (itemContainer) => {
|
|
66909
|
-
itemContainer.style.borderColor = "transparent";
|
|
66910
|
-
};
|
|
66911
|
-
onClickHandle = (index) => {
|
|
66912
|
-
this.emit("pageChange", index);
|
|
66913
|
-
};
|
|
66914
66902
|
initialize(slideCount, option) {
|
|
66915
66903
|
for (let i = 1; i <= slideCount; i++) {
|
|
66916
66904
|
const itemContainer = document.createElement("div");
|
|
66917
|
-
this.itemList.push(itemContainer);
|
|
66918
66905
|
itemContainer.style.width = "60%";
|
|
66919
66906
|
itemContainer.style.display = "flex";
|
|
66920
66907
|
itemContainer.style.justifyContent = "center";
|
|
@@ -66923,9 +66910,19 @@ var SideBarView = class extends import_eventemitter317.default {
|
|
|
66923
66910
|
itemContainer.style.borderRadius = "4px";
|
|
66924
66911
|
itemContainer.style.transition = "border-color .3s";
|
|
66925
66912
|
itemContainer.style.marginBottom = "10px";
|
|
66926
|
-
|
|
66927
|
-
|
|
66928
|
-
|
|
66913
|
+
const onMouseOverHandle = () => {
|
|
66914
|
+
itemContainer.style.borderColor = "#ccc";
|
|
66915
|
+
};
|
|
66916
|
+
const onMouseOutHandle = () => {
|
|
66917
|
+
itemContainer.style.borderColor = "transparent";
|
|
66918
|
+
};
|
|
66919
|
+
const onClickHandle = () => {
|
|
66920
|
+
this.emit("pageChange", i);
|
|
66921
|
+
};
|
|
66922
|
+
itemContainer.addEventListener("click", onClickHandle);
|
|
66923
|
+
itemContainer.addEventListener("mouseover", onMouseOverHandle);
|
|
66924
|
+
itemContainer.addEventListener("mouseout", onMouseOutHandle);
|
|
66925
|
+
this.eventsMap.set(itemContainer, [onClickHandle, onMouseOverHandle, onMouseOutHandle]);
|
|
66929
66926
|
const pageIndex = document.createElement("span");
|
|
66930
66927
|
pageIndex.textContent = `${i}`;
|
|
66931
66928
|
pageIndex.style.position = "absolute";
|
|
@@ -66962,9 +66959,12 @@ var SideBarView = class extends import_eventemitter317.default {
|
|
|
66962
66959
|
this.isShow = true;
|
|
66963
66960
|
}
|
|
66964
66961
|
dispose() {
|
|
66965
|
-
this.
|
|
66966
|
-
|
|
66967
|
-
|
|
66962
|
+
this.removeAllListeners();
|
|
66963
|
+
this.eventsMap.forEach((handlers, element) => {
|
|
66964
|
+
const [clickEvent, mouseOverEvent, mouseOutEvent] = handlers;
|
|
66965
|
+
element.removeEventListener("click", clickEvent);
|
|
66966
|
+
element.removeEventListener("mouseover", mouseOverEvent);
|
|
66967
|
+
element.removeEventListener("mouseout", mouseOutEvent);
|
|
66968
66968
|
});
|
|
66969
66969
|
}
|
|
66970
66970
|
};
|
|
@@ -67008,9 +67008,8 @@ async function delay2(time) {
|
|
|
67008
67008
|
}
|
|
67009
67009
|
|
|
67010
67010
|
// src/SlideApplication.ts
|
|
67011
|
-
var import_forge_room5 = require("@netless/forge-room");
|
|
67012
67011
|
var Slide_APP_NAME = "forge_slide";
|
|
67013
|
-
var SlideApplication = class extends
|
|
67012
|
+
var SlideApplication = class extends import_forge_room6.AbstractApplication {
|
|
67014
67013
|
static applicationName = Slide_APP_NAME;
|
|
67015
67014
|
name = Slide_APP_NAME;
|
|
67016
67015
|
emitter = new SlideForge();
|
|
@@ -67103,106 +67102,98 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67103
67102
|
this.emitter.on("renderStart", (pageIndex) => {
|
|
67104
67103
|
this.footer.prevPageState(pageIndex !== 0);
|
|
67105
67104
|
});
|
|
67106
|
-
const propertyConfig = {
|
|
67107
|
-
configurable: false,
|
|
67108
|
-
enumerable: false,
|
|
67109
|
-
writable: false
|
|
67110
|
-
};
|
|
67111
67105
|
const that = this;
|
|
67112
|
-
Object.
|
|
67113
|
-
|
|
67114
|
-
|
|
67115
|
-
|
|
67116
|
-
|
|
67117
|
-
|
|
67118
|
-
|
|
67119
|
-
|
|
67120
|
-
|
|
67121
|
-
|
|
67122
|
-
|
|
67123
|
-
|
|
67124
|
-
|
|
67125
|
-
|
|
67126
|
-
|
|
67127
|
-
|
|
67128
|
-
|
|
67129
|
-
|
|
67130
|
-
|
|
67131
|
-
|
|
67132
|
-
|
|
67133
|
-
|
|
67134
|
-
|
|
67135
|
-
|
|
67136
|
-
|
|
67137
|
-
|
|
67138
|
-
|
|
67139
|
-
|
|
67140
|
-
|
|
67141
|
-
|
|
67142
|
-
|
|
67143
|
-
|
|
67144
|
-
|
|
67145
|
-
|
|
67146
|
-
|
|
67147
|
-
}
|
|
67148
|
-
|
|
67149
|
-
|
|
67150
|
-
|
|
67151
|
-
|
|
67152
|
-
|
|
67153
|
-
|
|
67154
|
-
|
|
67155
|
-
|
|
67156
|
-
|
|
67157
|
-
|
|
67158
|
-
|
|
67159
|
-
|
|
67160
|
-
|
|
67161
|
-
|
|
67162
|
-
|
|
67163
|
-
|
|
67164
|
-
|
|
67165
|
-
|
|
67166
|
-
|
|
67167
|
-
|
|
67168
|
-
|
|
67169
|
-
|
|
67170
|
-
|
|
67171
|
-
|
|
67172
|
-
|
|
67173
|
-
|
|
67174
|
-
|
|
67175
|
-
|
|
67176
|
-
|
|
67177
|
-
|
|
67178
|
-
|
|
67179
|
-
|
|
67180
|
-
|
|
67181
|
-
|
|
67182
|
-
}
|
|
67183
|
-
|
|
67184
|
-
|
|
67185
|
-
|
|
67186
|
-
|
|
67187
|
-
|
|
67188
|
-
|
|
67189
|
-
|
|
67190
|
-
|
|
67191
|
-
|
|
67192
|
-
|
|
67193
|
-
|
|
67194
|
-
|
|
67195
|
-
|
|
67196
|
-
|
|
67197
|
-
|
|
67198
|
-
|
|
67199
|
-
|
|
67200
|
-
|
|
67201
|
-
|
|
67202
|
-
|
|
67203
|
-
value: (pageIndex) => {
|
|
67204
|
-
return this.getImageSize(pageIndex);
|
|
67205
|
-
}
|
|
67106
|
+
Object.defineProperty(this.emitter, "view", {
|
|
67107
|
+
get() {
|
|
67108
|
+
return that.rootView;
|
|
67109
|
+
}
|
|
67110
|
+
});
|
|
67111
|
+
Object.defineProperty(this.emitter, "permissions", {
|
|
67112
|
+
get() {
|
|
67113
|
+
return that.permissions;
|
|
67114
|
+
}
|
|
67115
|
+
});
|
|
67116
|
+
Object.defineProperty(this.emitter, "footView", {
|
|
67117
|
+
get() {
|
|
67118
|
+
return that.footer.root;
|
|
67119
|
+
}
|
|
67120
|
+
});
|
|
67121
|
+
Object.defineProperty(this.emitter, "sidebarView", {
|
|
67122
|
+
get() {
|
|
67123
|
+
return that.sideBar.root;
|
|
67124
|
+
}
|
|
67125
|
+
});
|
|
67126
|
+
Object.defineProperty(this.emitter, "pageIndex", {
|
|
67127
|
+
get() {
|
|
67128
|
+
return that.currentSlideIndex;
|
|
67129
|
+
}
|
|
67130
|
+
});
|
|
67131
|
+
Object.defineProperty(this.emitter, "pageCount", {
|
|
67132
|
+
get() {
|
|
67133
|
+
return that.slideCount;
|
|
67134
|
+
}
|
|
67135
|
+
});
|
|
67136
|
+
Object.defineProperty(this.emitter, "goto", {
|
|
67137
|
+
writable: false,
|
|
67138
|
+
enumerable: false,
|
|
67139
|
+
value: (pageIndex) => {
|
|
67140
|
+
this.sideBar.emit("pageChange", pageIndex);
|
|
67141
|
+
}
|
|
67142
|
+
});
|
|
67143
|
+
Object.defineProperty(this.emitter, "nextStep", {
|
|
67144
|
+
writable: false,
|
|
67145
|
+
enumerable: false,
|
|
67146
|
+
value: () => {
|
|
67147
|
+
this.footer.emit("nextStep");
|
|
67148
|
+
}
|
|
67149
|
+
});
|
|
67150
|
+
Object.defineProperty(this.emitter, "prevStep", {
|
|
67151
|
+
writable: false,
|
|
67152
|
+
enumerable: false,
|
|
67153
|
+
value: () => {
|
|
67154
|
+
this.footer.emit("prevStep");
|
|
67155
|
+
}
|
|
67156
|
+
});
|
|
67157
|
+
Object.defineProperty(this.emitter, "nextPage", {
|
|
67158
|
+
writable: false,
|
|
67159
|
+
enumerable: false,
|
|
67160
|
+
value: () => {
|
|
67161
|
+
this.footer.emit("nextPage");
|
|
67162
|
+
}
|
|
67163
|
+
});
|
|
67164
|
+
Object.defineProperty(this.emitter, "prevPage", {
|
|
67165
|
+
writable: false,
|
|
67166
|
+
enumerable: false,
|
|
67167
|
+
value: () => {
|
|
67168
|
+
this.footer.emit("prevPage");
|
|
67169
|
+
}
|
|
67170
|
+
});
|
|
67171
|
+
Object.defineProperty(this.emitter, "sideBarToggle", {
|
|
67172
|
+
writable: false,
|
|
67173
|
+
enumerable: false,
|
|
67174
|
+
value: () => {
|
|
67175
|
+
this.footer.emit("sideBarToggle");
|
|
67176
|
+
}
|
|
67177
|
+
});
|
|
67178
|
+
Object.defineProperty(this.emitter, "imgContent", {
|
|
67179
|
+
writable: false,
|
|
67180
|
+
enumerable: false,
|
|
67181
|
+
value: (pageIndex) => {
|
|
67182
|
+
return this.getImageContent(pageIndex);
|
|
67183
|
+
}
|
|
67184
|
+
});
|
|
67185
|
+
Object.defineProperty(this.emitter, "imgUrl", {
|
|
67186
|
+
writable: false,
|
|
67187
|
+
enumerable: false,
|
|
67188
|
+
value: (pageIndex) => {
|
|
67189
|
+
return this.getImageUrl(pageIndex);
|
|
67190
|
+
}
|
|
67191
|
+
});
|
|
67192
|
+
Object.defineProperty(this.emitter, "imgSize", {
|
|
67193
|
+
writable: false,
|
|
67194
|
+
enumerable: false,
|
|
67195
|
+
value: (pageIndex) => {
|
|
67196
|
+
return this.getImageSize(pageIndex);
|
|
67206
67197
|
}
|
|
67207
67198
|
});
|
|
67208
67199
|
}
|
|
@@ -67241,7 +67232,7 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67241
67232
|
const imageUrl = this.getPreviewImageUrl(pageIndex);
|
|
67242
67233
|
let preview = null;
|
|
67243
67234
|
try {
|
|
67244
|
-
const result = await
|
|
67235
|
+
const result = await import_forge_room6.kvStore.getItem(imageUrl);
|
|
67245
67236
|
preview = result ? JSON.parse(result) : null;
|
|
67246
67237
|
} catch (e) {
|
|
67247
67238
|
console.warn("kvStore getItem error", e);
|
|
@@ -67250,14 +67241,14 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67250
67241
|
return { width: preview.width, height: preview.height };
|
|
67251
67242
|
}
|
|
67252
67243
|
preview = await this.getPreviewImage(imageUrl);
|
|
67253
|
-
await
|
|
67244
|
+
await import_forge_room6.kvStore.setItem(imageUrl, JSON.stringify(preview));
|
|
67254
67245
|
return { width: preview.width, height: preview.height };
|
|
67255
67246
|
}
|
|
67256
67247
|
async getImageContent(pageIndex) {
|
|
67257
67248
|
const imageUrl = this.getPreviewImageUrl(pageIndex);
|
|
67258
67249
|
let preview = null;
|
|
67259
67250
|
try {
|
|
67260
|
-
const result = await
|
|
67251
|
+
const result = await import_forge_room6.kvStore.getItem(imageUrl);
|
|
67261
67252
|
preview = result ? JSON.parse(result) : null;
|
|
67262
67253
|
} catch (e) {
|
|
67263
67254
|
console.warn("kvStore getItem error", e);
|
|
@@ -67266,7 +67257,7 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67266
67257
|
return preview.src;
|
|
67267
67258
|
}
|
|
67268
67259
|
preview = await this.getPreviewImage(imageUrl);
|
|
67269
|
-
await
|
|
67260
|
+
await import_forge_room6.kvStore.setItem(imageUrl, JSON.stringify(preview));
|
|
67270
67261
|
return preview.src;
|
|
67271
67262
|
}
|
|
67272
67263
|
applySlideState = async (slideState, lastDispatch) => {
|
|
@@ -67306,15 +67297,21 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67306
67297
|
bindKeyBoardEvent() {
|
|
67307
67298
|
document.addEventListener("keydown", this.keyBoardEvents);
|
|
67308
67299
|
}
|
|
67309
|
-
|
|
67300
|
+
unbindKeyBoardEvent() {
|
|
67310
67301
|
document.removeEventListener("keydown", this.keyBoardEvents);
|
|
67311
67302
|
}
|
|
67303
|
+
async onFocusInstance() {
|
|
67304
|
+
this.bindKeyBoardEvent();
|
|
67305
|
+
}
|
|
67306
|
+
onRefocusInstance() {
|
|
67307
|
+
this.unbindKeyBoardEvent();
|
|
67308
|
+
}
|
|
67312
67309
|
async initialize(option) {
|
|
67313
67310
|
this.prefix = option.prefix;
|
|
67314
67311
|
this.taskId = option.taskId;
|
|
67315
67312
|
const whiteboardApp = new WhiteboardApplication();
|
|
67316
67313
|
whiteboardApp.roomDoc = this.roomDoc;
|
|
67317
|
-
whiteboardApp.appId = `${option.taskId}_wb`;
|
|
67314
|
+
whiteboardApp.appId = `${option.taskId}_${this.appId}_wb`;
|
|
67318
67315
|
whiteboardApp.userId = this.userId;
|
|
67319
67316
|
whiteboardApp.userManager = this.userManager;
|
|
67320
67317
|
whiteboardApp.applicationManager = this.applicationManager;
|
|
@@ -67379,12 +67376,19 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67379
67376
|
this.slide.on(import_slide.SLIDE_EVENTS.animateStart, () => {
|
|
67380
67377
|
this.sideBar.hidden();
|
|
67381
67378
|
});
|
|
67379
|
+
this.slide.on(import_slide.SLIDE_EVENTS.renderError, ({ error, index }) => {
|
|
67380
|
+
if (error.errorType === "CANVAS_CRASH") {
|
|
67381
|
+
this.slide.renderSlide(index);
|
|
67382
|
+
}
|
|
67383
|
+
});
|
|
67382
67384
|
this.slide.on(import_slide.SLIDE_EVENTS.renderStart, (slideIndex) => {
|
|
67383
67385
|
this.whiteboardApp.emitter.view.style.opacity = "0";
|
|
67384
67386
|
this.whiteboardApp.emitter.addPage(`${slideIndex}`);
|
|
67385
67387
|
this.whiteboardApp.emitter.gotoPage(`${slideIndex}`);
|
|
67386
|
-
this.emitter.emit("renderStart", slideIndex);
|
|
67387
67388
|
this.sideBar.hidden();
|
|
67389
|
+
const { slideState: slideStateFromServer, dispatch: dispatchFromServer } = this.getMap(this.name).get("syncSlide");
|
|
67390
|
+
this.applySlideState(slideStateFromServer, dispatchFromServer);
|
|
67391
|
+
this.emitter.emit("renderStart", slideIndex);
|
|
67388
67392
|
});
|
|
67389
67393
|
this.slide.on(import_slide.SLIDE_EVENTS.renderEnd, (slideIndex) => {
|
|
67390
67394
|
this.currentSlideIndex = slideIndex;
|
|
@@ -67417,27 +67421,28 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67417
67421
|
}
|
|
67418
67422
|
}
|
|
67419
67423
|
});
|
|
67424
|
+
this.permissions.setPermission(7 /* all */);
|
|
67420
67425
|
this.whiteboardApp.disableViewModel();
|
|
67421
67426
|
if (this.window) {
|
|
67422
67427
|
let prevStatus = "normal";
|
|
67423
67428
|
this.window.on("statusChange", (status) => {
|
|
67424
67429
|
if (prevStatus === "minimized") {
|
|
67425
|
-
this.
|
|
67430
|
+
this.onFocusInstance();
|
|
67426
67431
|
prevStatus = status;
|
|
67427
67432
|
return;
|
|
67428
67433
|
}
|
|
67429
67434
|
prevStatus = status;
|
|
67430
67435
|
if (status === "normal") {
|
|
67431
|
-
this.
|
|
67436
|
+
this.onFocusInstance();
|
|
67432
67437
|
} else if (status === "minimized") {
|
|
67433
|
-
this.
|
|
67438
|
+
this.onRefocusInstance();
|
|
67434
67439
|
}
|
|
67435
67440
|
});
|
|
67436
67441
|
this.window.on("focusedChange", (status) => {
|
|
67437
67442
|
if (status) {
|
|
67438
|
-
this.
|
|
67443
|
+
this.onFocusInstance();
|
|
67439
67444
|
} else {
|
|
67440
|
-
this.
|
|
67445
|
+
this.onRefocusInstance();
|
|
67441
67446
|
}
|
|
67442
67447
|
});
|
|
67443
67448
|
}
|
|
@@ -67454,6 +67459,8 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67454
67459
|
this.slide.destroy();
|
|
67455
67460
|
this.sideBar.dispose();
|
|
67456
67461
|
this.getMap(this.name).unobserve(this.onSlideEventHandler);
|
|
67462
|
+
this.permissions.dispose();
|
|
67463
|
+
this.footer.dispose();
|
|
67457
67464
|
}
|
|
67458
67465
|
};
|
|
67459
67466
|
/*! Bundled license information:
|