@netless/forge-slide 0.1.1-alpha.7 → 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 +7 -6
- package/dist/SiderBarView.d.ts.map +1 -1
- package/dist/Slide.d.ts +29 -29
- package/dist/Slide.d.ts.map +1 -1
- package/dist/SlideApplication.d.ts +8 -3
- 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 +808 -731
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +811 -734
- 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 +93 -71
- package/src/Slide.ts +29 -29
- package/src/SlideApplication.ts +507 -434
- 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.esm.js
CHANGED
|
@@ -35133,7 +35133,7 @@ void main(void){
|
|
|
35133
35133
|
import { AbstractApplication, log as log3 } from "@netless/forge-room";
|
|
35134
35134
|
import * as Y15 from "yjs";
|
|
35135
35135
|
import * as Y12 from "yjs";
|
|
35136
|
-
import
|
|
35136
|
+
import EventEmitter from "eventemitter3";
|
|
35137
35137
|
import { v4 as uuidv4 } from "uuid";
|
|
35138
35138
|
import * as Y2 from "yjs";
|
|
35139
35139
|
import * as Y from "yjs";
|
|
@@ -35145,23 +35145,23 @@ import * as Y7 from "yjs";
|
|
|
35145
35145
|
import * as Y8 from "yjs";
|
|
35146
35146
|
import * as Y9 from "yjs";
|
|
35147
35147
|
import * as Y10 from "yjs";
|
|
35148
|
-
import
|
|
35148
|
+
import { AbstractApplicationPermissions } from "@netless/forge-room";
|
|
35149
35149
|
import * as Y11 from "yjs";
|
|
35150
|
-
import
|
|
35150
|
+
import EventEmitter2 from "eventemitter3";
|
|
35151
35151
|
import * as Y13 from "yjs";
|
|
35152
|
-
import
|
|
35152
|
+
import EventEmitter3 from "eventemitter3";
|
|
35153
|
+
import EventEmitter5 from "eventemitter3";
|
|
35154
|
+
import { EventEmitter as EventEmitter4 } from "eventemitter3";
|
|
35155
|
+
import EventEmitter7 from "eventemitter3";
|
|
35153
35156
|
import EventEmitter6 from "eventemitter3";
|
|
35154
|
-
import { EventEmitter as EventEmitter5 } from "eventemitter3";
|
|
35155
35157
|
import EventEmitter8 from "eventemitter3";
|
|
35156
|
-
import EventEmitter7 from "eventemitter3";
|
|
35157
|
-
import EventEmitter9 from "eventemitter3";
|
|
35158
35158
|
import * as Y14 from "yjs";
|
|
35159
|
+
import EventEmitter9 from "eventemitter3";
|
|
35159
35160
|
import EventEmitter10 from "eventemitter3";
|
|
35160
|
-
import EventEmitter11 from "eventemitter3";
|
|
35161
35161
|
import { log } from "@netless/forge-room";
|
|
35162
|
-
import
|
|
35162
|
+
import EventEmitter11 from "eventemitter3";
|
|
35163
35163
|
import { log as log2 } from "@netless/forge-room";
|
|
35164
|
-
import
|
|
35164
|
+
import EventEmitter12 from "eventemitter3";
|
|
35165
35165
|
var __create2 = Object.create;
|
|
35166
35166
|
var __defProp2 = Object.defineProperty;
|
|
35167
35167
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -60843,6 +60843,10 @@ var ElementModel = class _ElementModel {
|
|
|
60843
60843
|
const ext = this.styleKeys();
|
|
60844
60844
|
return Array.from(new Set(["dashArray", "strokeColor", "fillColor", "strokeWidth"].filter((v) => ext.exclude.indexOf(v) < 0).concat(ext.include)));
|
|
60845
60845
|
}
|
|
60846
|
+
dispose() {
|
|
60847
|
+
this.subDispose();
|
|
60848
|
+
this.root.unobserveDeep(this.handlePropChange);
|
|
60849
|
+
}
|
|
60846
60850
|
};
|
|
60847
60851
|
_defineProperty(ElementModel, "KEYS", {
|
|
60848
60852
|
index: "index",
|
|
@@ -61019,6 +61023,8 @@ var CurveModel = class extends ElementModel {
|
|
|
61019
61023
|
this.item.fillColor = new this.scope.Color(this.strokeColor);
|
|
61020
61024
|
}
|
|
61021
61025
|
}
|
|
61026
|
+
subDispose() {
|
|
61027
|
+
}
|
|
61022
61028
|
};
|
|
61023
61029
|
function _defineProperty4(e, r, t) {
|
|
61024
61030
|
return (r = _toPropertyKey4(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
@@ -61050,14 +61056,12 @@ var SelectorModel = class extends ElementModel {
|
|
|
61050
61056
|
this.root.set("points", initPoints);
|
|
61051
61057
|
}
|
|
61052
61058
|
}
|
|
61059
|
+
subDispose() {
|
|
61060
|
+
}
|
|
61053
61061
|
createPaperRect() {
|
|
61054
61062
|
const scope = this.scope;
|
|
61055
61063
|
const bounds = new scope.Rectangle(new scope.Point(this.points[0], this.points[1]), new scope.Size(this.points[2], this.points[3]));
|
|
61056
|
-
return new scope.Path.Rectangle(
|
|
61057
|
-
bounds,
|
|
61058
|
-
new scope.Point(this.points[4], this.points[4])
|
|
61059
|
-
// 圆角
|
|
61060
|
-
);
|
|
61064
|
+
return new scope.Path.Rectangle(bounds, new scope.Point(this.points[4], this.points[4]));
|
|
61061
61065
|
}
|
|
61062
61066
|
onVectorUpdate() {
|
|
61063
61067
|
if (!this.item) {
|
|
@@ -61083,7 +61087,7 @@ var SelectorModel = class extends ElementModel {
|
|
|
61083
61087
|
exclude: []
|
|
61084
61088
|
};
|
|
61085
61089
|
}
|
|
61086
|
-
onStyleKeyUpdate(
|
|
61090
|
+
onStyleKeyUpdate(_key) {
|
|
61087
61091
|
}
|
|
61088
61092
|
};
|
|
61089
61093
|
var import_lodash2 = __toESM2(require_lodash(), 1);
|
|
@@ -61130,7 +61134,7 @@ var AnimationFrame = class {
|
|
|
61130
61134
|
_defineProperty5(this, "lastTime", 0);
|
|
61131
61135
|
_defineProperty5(this, "fps", 45);
|
|
61132
61136
|
_defineProperty5(this, "handleCallbacks", () => {
|
|
61133
|
-
|
|
61137
|
+
const functions = this.callbacks;
|
|
61134
61138
|
this.callbacks = [];
|
|
61135
61139
|
for (let i = 0, l2 = functions.length; i < l2; i++) {
|
|
61136
61140
|
functions[i]();
|
|
@@ -61181,6 +61185,8 @@ var SegmentsModel = class extends ElementModel {
|
|
|
61181
61185
|
this.root.set("points", new Y4.Array());
|
|
61182
61186
|
}
|
|
61183
61187
|
}
|
|
61188
|
+
subDispose() {
|
|
61189
|
+
}
|
|
61184
61190
|
onVectorUpdate() {
|
|
61185
61191
|
if (!this.item) {
|
|
61186
61192
|
return;
|
|
@@ -61215,7 +61221,7 @@ var SegmentsModel = class extends ElementModel {
|
|
|
61215
61221
|
exclude: []
|
|
61216
61222
|
};
|
|
61217
61223
|
}
|
|
61218
|
-
onStyleKeyUpdate(
|
|
61224
|
+
onStyleKeyUpdate(_key) {
|
|
61219
61225
|
}
|
|
61220
61226
|
};
|
|
61221
61227
|
var import_lodash4 = __toESM2(require_lodash(), 1);
|
|
@@ -61302,6 +61308,9 @@ var LineTool = class extends WhiteboardTool {
|
|
|
61302
61308
|
this.tool.minDistance = 1;
|
|
61303
61309
|
}
|
|
61304
61310
|
onMouseDown(event) {
|
|
61311
|
+
if (this.elementModel) {
|
|
61312
|
+
this.elementModel.dispose();
|
|
61313
|
+
}
|
|
61305
61314
|
this.elementModel = this.modelGetter().createLinePath(true);
|
|
61306
61315
|
this.from = event.point.clone();
|
|
61307
61316
|
this.to = event.point.clone();
|
|
@@ -61375,6 +61384,8 @@ var LineModel = class extends ElementModel {
|
|
|
61375
61384
|
this.root.set("tailArrow", "normal");
|
|
61376
61385
|
}
|
|
61377
61386
|
}
|
|
61387
|
+
subDispose() {
|
|
61388
|
+
}
|
|
61378
61389
|
onVectorUpdate() {
|
|
61379
61390
|
if (!this.item) {
|
|
61380
61391
|
return;
|
|
@@ -61411,7 +61422,7 @@ var LineModel = class extends ElementModel {
|
|
|
61411
61422
|
this.item.addChildren(this.renderLine());
|
|
61412
61423
|
}
|
|
61413
61424
|
createArrow(path) {
|
|
61414
|
-
|
|
61425
|
+
const [headPath, tailPath] = [new this.scope.Path(), new this.scope.Path()];
|
|
61415
61426
|
if (!path) {
|
|
61416
61427
|
return [headPath, tailPath];
|
|
61417
61428
|
}
|
|
@@ -61465,7 +61476,7 @@ var LineModel = class extends ElementModel {
|
|
|
61465
61476
|
exclude: ["fillColor"]
|
|
61466
61477
|
};
|
|
61467
61478
|
}
|
|
61468
|
-
onStyleKeyUpdate(
|
|
61479
|
+
onStyleKeyUpdate(_key) {
|
|
61469
61480
|
this.onVectorUpdate();
|
|
61470
61481
|
}
|
|
61471
61482
|
};
|
|
@@ -61585,6 +61596,9 @@ var PointTextModel = class extends ElementModel {
|
|
|
61585
61596
|
}, 60);
|
|
61586
61597
|
}
|
|
61587
61598
|
}
|
|
61599
|
+
subDispose() {
|
|
61600
|
+
this.root.unobserve(this.handleTextPropChange);
|
|
61601
|
+
}
|
|
61588
61602
|
getInternalMeasurement() {
|
|
61589
61603
|
if (!this.item) {
|
|
61590
61604
|
return null;
|
|
@@ -61687,6 +61701,8 @@ var TriangleModel = class extends ElementModel {
|
|
|
61687
61701
|
this.root.set("points", new Y7.Array());
|
|
61688
61702
|
}
|
|
61689
61703
|
}
|
|
61704
|
+
subDispose() {
|
|
61705
|
+
}
|
|
61690
61706
|
createPaperItem() {
|
|
61691
61707
|
this.item = new this.scope.Path();
|
|
61692
61708
|
this.item.strokeCap = "butt";
|
|
@@ -61743,7 +61759,7 @@ var TriangleModel = class extends ElementModel {
|
|
|
61743
61759
|
exclude: []
|
|
61744
61760
|
};
|
|
61745
61761
|
}
|
|
61746
|
-
onStyleKeyUpdate(
|
|
61762
|
+
onStyleKeyUpdate(_key) {
|
|
61747
61763
|
}
|
|
61748
61764
|
};
|
|
61749
61765
|
function _defineProperty12(e, r, t) {
|
|
@@ -61779,6 +61795,8 @@ var RectangleModel = class extends ElementModel {
|
|
|
61779
61795
|
this.root.set("radius", 0);
|
|
61780
61796
|
}
|
|
61781
61797
|
}
|
|
61798
|
+
subDispose() {
|
|
61799
|
+
}
|
|
61782
61800
|
createSegments() {
|
|
61783
61801
|
const [a2, b2, c, d] = this.points;
|
|
61784
61802
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
@@ -61910,7 +61928,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
61910
61928
|
exclude: []
|
|
61911
61929
|
};
|
|
61912
61930
|
}
|
|
61913
|
-
onStyleKeyUpdate(
|
|
61931
|
+
onStyleKeyUpdate(_key) {
|
|
61914
61932
|
}
|
|
61915
61933
|
};
|
|
61916
61934
|
var elementsUndoOrigin = "elementsUndoOrigin";
|
|
@@ -62046,9 +62064,11 @@ var EraserModel = class extends ElementModel {
|
|
|
62046
62064
|
exclude: []
|
|
62047
62065
|
};
|
|
62048
62066
|
}
|
|
62049
|
-
onStyleKeyUpdate(
|
|
62067
|
+
onStyleKeyUpdate(_key) {
|
|
62050
62068
|
return;
|
|
62051
62069
|
}
|
|
62070
|
+
subDispose() {
|
|
62071
|
+
}
|
|
62052
62072
|
};
|
|
62053
62073
|
var import_lodash6 = __toESM2(require_lodash(), 1);
|
|
62054
62074
|
function _defineProperty14(e, r, t) {
|
|
@@ -62202,27 +62222,12 @@ var LaserPointerModel = class extends ElementModel {
|
|
|
62202
62222
|
exclude: []
|
|
62203
62223
|
};
|
|
62204
62224
|
}
|
|
62205
|
-
onStyleKeyUpdate(
|
|
62225
|
+
onStyleKeyUpdate(_key) {
|
|
62206
62226
|
return;
|
|
62207
62227
|
}
|
|
62208
|
-
|
|
62209
|
-
function _defineProperty15(e, r, t) {
|
|
62210
|
-
return (r = _toPropertyKey15(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62211
|
-
}
|
|
62212
|
-
function _toPropertyKey15(t) {
|
|
62213
|
-
var i = _toPrimitive15(t, "string");
|
|
62214
|
-
return "symbol" == typeof i ? i : i + "";
|
|
62215
|
-
}
|
|
62216
|
-
function _toPrimitive15(t, r) {
|
|
62217
|
-
if ("object" != typeof t || !t) return t;
|
|
62218
|
-
var e = t[Symbol.toPrimitive];
|
|
62219
|
-
if (void 0 !== e) {
|
|
62220
|
-
var i = e.call(t, r || "default");
|
|
62221
|
-
if ("object" != typeof i) return i;
|
|
62222
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
62228
|
+
subDispose() {
|
|
62223
62229
|
}
|
|
62224
|
-
|
|
62225
|
-
}
|
|
62230
|
+
};
|
|
62226
62231
|
var WhiteboardPermissionFlag = function(WhiteboardPermissionFlag2) {
|
|
62227
62232
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["none"] = 0] = "none";
|
|
62228
62233
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["draw"] = 1] = "draw";
|
|
@@ -62235,117 +62240,25 @@ var WhiteboardPermissionFlag = function(WhiteboardPermissionFlag2) {
|
|
|
62235
62240
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["all"] = WhiteboardPermissionFlag2.draw | WhiteboardPermissionFlag2.editSelf | WhiteboardPermissionFlag2.editOthers | WhiteboardPermissionFlag2.deleteSelf | WhiteboardPermissionFlag2.deleteOthers | WhiteboardPermissionFlag2.mainView | WhiteboardPermissionFlag2.setOthersView] = "all";
|
|
62236
62241
|
return WhiteboardPermissionFlag2;
|
|
62237
62242
|
}({});
|
|
62238
|
-
var WhiteboardPermissions = class extends
|
|
62239
|
-
constructor(userManager, requestUserMap) {
|
|
62240
|
-
super();
|
|
62241
|
-
_defineProperty15(this, "requestUserMap", void 0);
|
|
62242
|
-
_defineProperty15(this, "userManager", void 0);
|
|
62243
|
-
_defineProperty15(this, "observers", /* @__PURE__ */ new Map());
|
|
62244
|
-
_defineProperty15(this, "handleUserLeave", (user) => {
|
|
62245
|
-
const cb = this.observers.get(user.id);
|
|
62246
|
-
if (cb) {
|
|
62247
|
-
this.requestUserMap(user.id).unobserve(cb);
|
|
62248
|
-
}
|
|
62249
|
-
});
|
|
62250
|
-
_defineProperty15(this, "handleUserJoin", (user) => {
|
|
62251
|
-
this.addObserve(user.id);
|
|
62252
|
-
});
|
|
62253
|
-
this.userManager = userManager;
|
|
62254
|
-
this.requestUserMap = requestUserMap;
|
|
62255
|
-
this.createModel(this.userManager.selfId);
|
|
62256
|
-
this.userManager.userIdList().forEach((userId) => {
|
|
62257
|
-
this.addObserve(userId);
|
|
62258
|
-
});
|
|
62259
|
-
this.userManager.on("join", this.handleUserJoin);
|
|
62260
|
-
this.userManager.on("leave", this.handleUserLeave);
|
|
62261
|
-
}
|
|
62262
|
-
addObserve(userId) {
|
|
62263
|
-
if (this.observers.has(userId)) {
|
|
62264
|
-
return;
|
|
62265
|
-
}
|
|
62266
|
-
const observer = (evt) => {
|
|
62267
|
-
this.handleUserPermissionChange(userId, evt);
|
|
62268
|
-
};
|
|
62269
|
-
this.observers.set(userId, observer);
|
|
62270
|
-
this.requestUserMap(userId).observe(observer);
|
|
62271
|
-
}
|
|
62272
|
-
createModel(userId) {
|
|
62273
|
-
const userMap = this.requestUserMap(userId);
|
|
62274
|
-
if (!userMap.has("permission")) {
|
|
62275
|
-
userMap.set("permission", 0);
|
|
62276
|
-
}
|
|
62277
|
-
}
|
|
62278
|
-
handleUserPermissionChange(userId, evt) {
|
|
62279
|
-
for (const [key, value] of evt.changes.keys.entries()) {
|
|
62280
|
-
if (key === "permission") {
|
|
62281
|
-
if (value.action === "add" || value.action === "update") {
|
|
62282
|
-
const newValue = this.requestUserMap(userId).get("permission");
|
|
62283
|
-
this.emit("change", userId, this.resolveFlags(newValue), newValue);
|
|
62284
|
-
}
|
|
62285
|
-
}
|
|
62286
|
-
}
|
|
62287
|
-
}
|
|
62243
|
+
var WhiteboardPermissions = class extends AbstractApplicationPermissions {
|
|
62288
62244
|
/**
|
|
62289
|
-
|
|
62290
|
-
|
|
62291
|
-
|
|
62292
|
-
|
|
62245
|
+
* 解析权限列表组合
|
|
62246
|
+
* @param {number} value - 权限数字值
|
|
62247
|
+
* @return {WhiteboardPermissionFlag[]} - 权限列表
|
|
62248
|
+
*/
|
|
62293
62249
|
resolveFlags(value) {
|
|
62294
62250
|
return [WhiteboardPermissionFlag.draw, WhiteboardPermissionFlag.editSelf, WhiteboardPermissionFlag.editOthers, WhiteboardPermissionFlag.deleteSelf, WhiteboardPermissionFlag.deleteOthers, WhiteboardPermissionFlag.mainView, WhiteboardPermissionFlag.setOthersView].filter((v) => (v & value) !== 0);
|
|
62295
62251
|
}
|
|
62296
|
-
/**
|
|
62297
|
-
* 获取权限列表组合对应的数值
|
|
62298
|
-
* @param { string } userId 不传表示获取自己
|
|
62299
|
-
*/
|
|
62300
|
-
getPermissionValue(userId) {
|
|
62301
|
-
return this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
62302
|
-
}
|
|
62303
|
-
/**
|
|
62304
|
-
* 获取权限列表
|
|
62305
|
-
* @param {string=} userId 可选, 不传表示获取自己
|
|
62306
|
-
*/
|
|
62307
|
-
getPermissionFlags(userId) {
|
|
62308
|
-
const value = this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
62309
|
-
return this.resolveFlags(value);
|
|
62310
|
-
}
|
|
62311
|
-
/**
|
|
62312
|
-
* 返回对应 userId 是否有相应权限
|
|
62313
|
-
* @param {string=} userId 可选, 不传表示返回自己是否有相应权限
|
|
62314
|
-
* @param {WhiteboardPermissionFlag} flag
|
|
62315
|
-
*/
|
|
62316
|
-
hasPermission(flag, userId) {
|
|
62317
|
-
return ((this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0) & flag) !== 0;
|
|
62318
|
-
}
|
|
62319
|
-
/**
|
|
62320
|
-
* 添加权限
|
|
62321
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
62322
|
-
* @param {string=} userId 可选, 为 userId 添加权限, 不传表示为自己添加权限
|
|
62323
|
-
*/
|
|
62324
|
-
addPermission(flag, userId) {
|
|
62325
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
62326
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
62327
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue | flag);
|
|
62328
|
-
}
|
|
62329
|
-
/**
|
|
62330
|
-
* 移除权限
|
|
62331
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
62332
|
-
* @param {string=} userId 可选, 为 userId 移除权限, 不传表示为自己移除权限
|
|
62333
|
-
*/
|
|
62334
|
-
removePermission(flag, userId) {
|
|
62335
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
62336
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
62337
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue & ~flag);
|
|
62338
|
-
}
|
|
62339
62252
|
};
|
|
62340
62253
|
var import_lodash7 = __toESM2(require_lodash(), 1);
|
|
62341
|
-
function
|
|
62342
|
-
return (r =
|
|
62254
|
+
function _defineProperty15(e, r, t) {
|
|
62255
|
+
return (r = _toPropertyKey15(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62343
62256
|
}
|
|
62344
|
-
function
|
|
62345
|
-
var i =
|
|
62257
|
+
function _toPropertyKey15(t) {
|
|
62258
|
+
var i = _toPrimitive15(t, "string");
|
|
62346
62259
|
return "symbol" == typeof i ? i : i + "";
|
|
62347
62260
|
}
|
|
62348
|
-
function
|
|
62261
|
+
function _toPrimitive15(t, r) {
|
|
62349
62262
|
if ("object" != typeof t || !t) return t;
|
|
62350
62263
|
var e = t[Symbol.toPrimitive];
|
|
62351
62264
|
if (void 0 !== e) {
|
|
@@ -62358,7 +62271,7 @@ function _toPrimitive16(t, r) {
|
|
|
62358
62271
|
var StraightLineModel = class extends ElementModel {
|
|
62359
62272
|
constructor(root, scope) {
|
|
62360
62273
|
super(root, scope);
|
|
62361
|
-
|
|
62274
|
+
_defineProperty15(this, "item", null);
|
|
62362
62275
|
if (!this.root.has("type")) {
|
|
62363
62276
|
this.root.set("type", "line");
|
|
62364
62277
|
}
|
|
@@ -62366,6 +62279,8 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62366
62279
|
this.root.set("points", new Y11.Array());
|
|
62367
62280
|
}
|
|
62368
62281
|
}
|
|
62282
|
+
subDispose() {
|
|
62283
|
+
}
|
|
62369
62284
|
onVectorUpdate() {
|
|
62370
62285
|
if (!this.item) {
|
|
62371
62286
|
return;
|
|
@@ -62439,7 +62354,7 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62439
62354
|
exclude: ["fillColor"]
|
|
62440
62355
|
};
|
|
62441
62356
|
}
|
|
62442
|
-
onStyleKeyUpdate(
|
|
62357
|
+
onStyleKeyUpdate(_key) {
|
|
62443
62358
|
if (!this.item) {
|
|
62444
62359
|
return;
|
|
62445
62360
|
}
|
|
@@ -62448,14 +62363,14 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62448
62363
|
this.item.addSegments(path.segments);
|
|
62449
62364
|
}
|
|
62450
62365
|
};
|
|
62451
|
-
function
|
|
62452
|
-
return (r =
|
|
62366
|
+
function _defineProperty16(e, r, t) {
|
|
62367
|
+
return (r = _toPropertyKey16(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62453
62368
|
}
|
|
62454
|
-
function
|
|
62455
|
-
var i =
|
|
62369
|
+
function _toPropertyKey16(t) {
|
|
62370
|
+
var i = _toPrimitive16(t, "string");
|
|
62456
62371
|
return "symbol" == typeof i ? i : i + "";
|
|
62457
62372
|
}
|
|
62458
|
-
function
|
|
62373
|
+
function _toPrimitive16(t, r) {
|
|
62459
62374
|
if ("object" != typeof t || !t) return t;
|
|
62460
62375
|
var e = t[Symbol.toPrimitive];
|
|
62461
62376
|
if (void 0 !== e) {
|
|
@@ -62465,22 +62380,22 @@ function _toPrimitive17(t, r) {
|
|
|
62465
62380
|
}
|
|
62466
62381
|
return ("string" === r ? String : Number)(t);
|
|
62467
62382
|
}
|
|
62468
|
-
var RenderableModel = class extends
|
|
62383
|
+
var RenderableModel = class extends EventEmitter {
|
|
62469
62384
|
get uuid() {
|
|
62470
62385
|
return uuidv4();
|
|
62471
62386
|
}
|
|
62472
62387
|
constructor(layerId, shadowEmitter, elements, scope, toolbarModel, userManager, hasPermission) {
|
|
62473
62388
|
super();
|
|
62474
|
-
|
|
62475
|
-
|
|
62476
|
-
|
|
62477
|
-
|
|
62478
|
-
|
|
62479
|
-
|
|
62480
|
-
|
|
62481
|
-
|
|
62482
|
-
|
|
62483
|
-
|
|
62389
|
+
_defineProperty16(this, "scope", void 0);
|
|
62390
|
+
_defineProperty16(this, "toolbarModel", void 0);
|
|
62391
|
+
_defineProperty16(this, "userManager", void 0);
|
|
62392
|
+
_defineProperty16(this, "elementModels", void 0);
|
|
62393
|
+
_defineProperty16(this, "elements", void 0);
|
|
62394
|
+
_defineProperty16(this, "layerId", void 0);
|
|
62395
|
+
_defineProperty16(this, "maxIndex", -1);
|
|
62396
|
+
_defineProperty16(this, "hasPermission", void 0);
|
|
62397
|
+
_defineProperty16(this, "shadowEmitter", void 0);
|
|
62398
|
+
_defineProperty16(this, "onElementsChange", (event) => {
|
|
62484
62399
|
for (const [key, value] of event.changes.keys.entries()) {
|
|
62485
62400
|
if (value.action === "add") {
|
|
62486
62401
|
const root = this.elements.get(key);
|
|
@@ -62659,7 +62574,7 @@ var RenderableModel = class extends EventEmitter2 {
|
|
|
62659
62574
|
return segmentsModel;
|
|
62660
62575
|
}
|
|
62661
62576
|
createSelector() {
|
|
62662
|
-
let
|
|
62577
|
+
let _shadow = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
62663
62578
|
if (!this.hasPermission(WhiteboardPermissionFlag.editSelf) && !this.hasPermission(WhiteboardPermissionFlag.deleteOthers)) {
|
|
62664
62579
|
return null;
|
|
62665
62580
|
}
|
|
@@ -62716,7 +62631,11 @@ var RenderableModel = class extends EventEmitter2 {
|
|
|
62716
62631
|
});
|
|
62717
62632
|
}
|
|
62718
62633
|
dispose() {
|
|
62634
|
+
this.elements.unobserve(this.onElementsChange);
|
|
62719
62635
|
this.elements.clear();
|
|
62636
|
+
Array.from(this.elementModels.values()).forEach((model) => {
|
|
62637
|
+
model.dispose();
|
|
62638
|
+
});
|
|
62720
62639
|
}
|
|
62721
62640
|
};
|
|
62722
62641
|
var import_lodash8 = __toESM2(require_lodash(), 1);
|
|
@@ -62755,10 +62674,10 @@ var AnglePrecision = Deg2Rad(2);
|
|
|
62755
62674
|
var Phi = 0.5 * (-1 + Math.sqrt(5));
|
|
62756
62675
|
function DollarRecognizer() {
|
|
62757
62676
|
this.Unistrokes = new Array(3);
|
|
62758
|
-
this.Unistrokes[0] = new Unistroke("triangle", new
|
|
62759
|
-
this.Unistrokes[1] = new Unistroke("rectangle", new
|
|
62760
|
-
this.Unistrokes[2] = new Unistroke("circle", new
|
|
62761
|
-
this.Unistrokes[3] = new Unistroke("arrow", new
|
|
62677
|
+
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)]);
|
|
62678
|
+
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)]);
|
|
62679
|
+
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)]);
|
|
62680
|
+
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)]);
|
|
62762
62681
|
this.Recognize = function(points, useProtractor) {
|
|
62763
62682
|
var t0 = Date.now();
|
|
62764
62683
|
var candidate = new Unistroke("", points);
|
|
@@ -62819,7 +62738,7 @@ function RotateBy(points, radians) {
|
|
|
62819
62738
|
var c = Centroid(points);
|
|
62820
62739
|
var cos = Math.cos(radians);
|
|
62821
62740
|
var sin = Math.sin(radians);
|
|
62822
|
-
var newpoints =
|
|
62741
|
+
var newpoints = [];
|
|
62823
62742
|
for (var i = 0; i < points.length; i++) {
|
|
62824
62743
|
var qx = (points[i].X - c.X) * cos - (points[i].Y - c.Y) * sin + c.X;
|
|
62825
62744
|
var qy = (points[i].X - c.X) * sin + (points[i].Y - c.Y) * cos + c.Y;
|
|
@@ -62829,7 +62748,7 @@ function RotateBy(points, radians) {
|
|
|
62829
62748
|
}
|
|
62830
62749
|
function ScaleTo(points, size) {
|
|
62831
62750
|
var B2 = BoundingBox(points);
|
|
62832
|
-
var newpoints =
|
|
62751
|
+
var newpoints = [];
|
|
62833
62752
|
for (var i = 0; i < points.length; i++) {
|
|
62834
62753
|
var qx = points[i].X * (size / B2.Width);
|
|
62835
62754
|
var qy = points[i].Y * (size / B2.Height);
|
|
@@ -62839,7 +62758,7 @@ function ScaleTo(points, size) {
|
|
|
62839
62758
|
}
|
|
62840
62759
|
function TranslateTo(points, pt) {
|
|
62841
62760
|
var c = Centroid(points);
|
|
62842
|
-
var newpoints =
|
|
62761
|
+
var newpoints = [];
|
|
62843
62762
|
for (var i = 0; i < points.length; i++) {
|
|
62844
62763
|
var qx = points[i].X + pt.X - c.X;
|
|
62845
62764
|
var qy = points[i].Y + pt.Y - c.Y;
|
|
@@ -62849,14 +62768,14 @@ function TranslateTo(points, pt) {
|
|
|
62849
62768
|
}
|
|
62850
62769
|
function Vectorize(points) {
|
|
62851
62770
|
var sum = 0;
|
|
62852
|
-
var vector =
|
|
62853
|
-
for (
|
|
62771
|
+
var vector = [];
|
|
62772
|
+
for (let i = 0; i < points.length; i++) {
|
|
62854
62773
|
vector[vector.length] = points[i].X;
|
|
62855
62774
|
vector[vector.length] = points[i].Y;
|
|
62856
62775
|
sum += points[i].X * points[i].X + points[i].Y * points[i].Y;
|
|
62857
62776
|
}
|
|
62858
62777
|
var magnitude = Math.sqrt(sum);
|
|
62859
|
-
for (
|
|
62778
|
+
for (let i = 0; i < vector.length; i++)
|
|
62860
62779
|
vector[i] /= magnitude;
|
|
62861
62780
|
return vector;
|
|
62862
62781
|
}
|
|
@@ -62936,14 +62855,14 @@ function Distance(p1, p2) {
|
|
|
62936
62855
|
function Deg2Rad(d) {
|
|
62937
62856
|
return d * Math.PI / 180;
|
|
62938
62857
|
}
|
|
62939
|
-
function
|
|
62940
|
-
return (r =
|
|
62858
|
+
function _defineProperty17(e, r, t) {
|
|
62859
|
+
return (r = _toPropertyKey17(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62941
62860
|
}
|
|
62942
|
-
function
|
|
62943
|
-
var i =
|
|
62861
|
+
function _toPropertyKey17(t) {
|
|
62862
|
+
var i = _toPrimitive17(t, "string");
|
|
62944
62863
|
return "symbol" == typeof i ? i : i + "";
|
|
62945
62864
|
}
|
|
62946
|
-
function
|
|
62865
|
+
function _toPrimitive17(t, r) {
|
|
62947
62866
|
if ("object" != typeof t || !t) return t;
|
|
62948
62867
|
var e = t[Symbol.toPrimitive];
|
|
62949
62868
|
if (void 0 !== e) {
|
|
@@ -62955,7 +62874,7 @@ function _toPrimitive18(t, r) {
|
|
|
62955
62874
|
}
|
|
62956
62875
|
var Recognizer = class {
|
|
62957
62876
|
constructor() {
|
|
62958
|
-
|
|
62877
|
+
_defineProperty17(this, "dollar", new DollarRecognizer());
|
|
62959
62878
|
}
|
|
62960
62879
|
recognize(points) {
|
|
62961
62880
|
let minX = Number.MAX_VALUE;
|
|
@@ -62981,14 +62900,14 @@ var Recognizer = class {
|
|
|
62981
62900
|
return null;
|
|
62982
62901
|
}
|
|
62983
62902
|
};
|
|
62984
|
-
function
|
|
62985
|
-
return (r =
|
|
62903
|
+
function _defineProperty18(e, r, t) {
|
|
62904
|
+
return (r = _toPropertyKey18(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62986
62905
|
}
|
|
62987
|
-
function
|
|
62988
|
-
var i =
|
|
62906
|
+
function _toPropertyKey18(t) {
|
|
62907
|
+
var i = _toPrimitive18(t, "string");
|
|
62989
62908
|
return "symbol" == typeof i ? i : i + "";
|
|
62990
62909
|
}
|
|
62991
|
-
function
|
|
62910
|
+
function _toPrimitive18(t, r) {
|
|
62992
62911
|
if ("object" != typeof t || !t) return t;
|
|
62993
62912
|
var e = t[Symbol.toPrimitive];
|
|
62994
62913
|
if (void 0 !== e) {
|
|
@@ -63001,13 +62920,16 @@ function _toPrimitive19(t, r) {
|
|
|
63001
62920
|
var CurveTool = class extends WhiteboardTool {
|
|
63002
62921
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
63003
62922
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
63004
|
-
|
|
63005
|
-
|
|
63006
|
-
|
|
62923
|
+
_defineProperty18(this, "elementModel", null);
|
|
62924
|
+
_defineProperty18(this, "recognizer", new Recognizer());
|
|
62925
|
+
_defineProperty18(this, "pointCount", 0);
|
|
63007
62926
|
this.tool.minDistance = 1;
|
|
63008
62927
|
}
|
|
63009
|
-
onMouseDown(
|
|
62928
|
+
onMouseDown(_event) {
|
|
63010
62929
|
this.pointCount = 0;
|
|
62930
|
+
if (this.elementModel) {
|
|
62931
|
+
this.elementModel.dispose();
|
|
62932
|
+
}
|
|
63011
62933
|
this.elementModel = this.modelGetter().createCurve(true);
|
|
63012
62934
|
}
|
|
63013
62935
|
onMouseDrag(event) {
|
|
@@ -63050,14 +62972,14 @@ var CurveTool = class extends WhiteboardTool {
|
|
|
63050
62972
|
}
|
|
63051
62973
|
}
|
|
63052
62974
|
};
|
|
63053
|
-
function
|
|
63054
|
-
return (r =
|
|
62975
|
+
function _defineProperty19(e, r, t) {
|
|
62976
|
+
return (r = _toPropertyKey19(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63055
62977
|
}
|
|
63056
|
-
function
|
|
63057
|
-
var i =
|
|
62978
|
+
function _toPropertyKey19(t) {
|
|
62979
|
+
var i = _toPrimitive19(t, "string");
|
|
63058
62980
|
return "symbol" == typeof i ? i : i + "";
|
|
63059
62981
|
}
|
|
63060
|
-
function
|
|
62982
|
+
function _toPrimitive19(t, r) {
|
|
63061
62983
|
if ("object" != typeof t || !t) return t;
|
|
63062
62984
|
var e = t[Symbol.toPrimitive];
|
|
63063
62985
|
if (void 0 !== e) {
|
|
@@ -63070,12 +62992,15 @@ function _toPrimitive20(t, r) {
|
|
|
63070
62992
|
var RectangleTool = class extends WhiteboardTool {
|
|
63071
62993
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
63072
62994
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
63073
|
-
|
|
63074
|
-
|
|
63075
|
-
|
|
62995
|
+
_defineProperty19(this, "elementModel", null);
|
|
62996
|
+
_defineProperty19(this, "from", null);
|
|
62997
|
+
_defineProperty19(this, "to", null);
|
|
63076
62998
|
this.tool.minDistance = 1;
|
|
63077
62999
|
}
|
|
63078
63000
|
onMouseDown(event) {
|
|
63001
|
+
if (this.elementModel) {
|
|
63002
|
+
this.elementModel.dispose();
|
|
63003
|
+
}
|
|
63079
63004
|
this.elementModel = this.modelGetter().createRectangle(true);
|
|
63080
63005
|
this.from = event.point.clone();
|
|
63081
63006
|
this.to = event.point.clone();
|
|
@@ -63095,14 +63020,14 @@ var RectangleTool = class extends WhiteboardTool {
|
|
|
63095
63020
|
}
|
|
63096
63021
|
}
|
|
63097
63022
|
};
|
|
63098
|
-
function
|
|
63099
|
-
return (r =
|
|
63023
|
+
function _defineProperty20(e, r, t) {
|
|
63024
|
+
return (r = _toPropertyKey20(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63100
63025
|
}
|
|
63101
|
-
function
|
|
63102
|
-
var i =
|
|
63026
|
+
function _toPropertyKey20(t) {
|
|
63027
|
+
var i = _toPrimitive20(t, "string");
|
|
63103
63028
|
return "symbol" == typeof i ? i : i + "";
|
|
63104
63029
|
}
|
|
63105
|
-
function
|
|
63030
|
+
function _toPrimitive20(t, r) {
|
|
63106
63031
|
if ("object" != typeof t || !t) return t;
|
|
63107
63032
|
var e = t[Symbol.toPrimitive];
|
|
63108
63033
|
if (void 0 !== e) {
|
|
@@ -63121,7 +63046,7 @@ var TOOLBAR_KEYS = {
|
|
|
63121
63046
|
strokeWidth: "strokeWidth",
|
|
63122
63047
|
dashArray: "dashArray"
|
|
63123
63048
|
};
|
|
63124
|
-
var ToolbarModel = class extends
|
|
63049
|
+
var ToolbarModel = class extends EventEmitter2 {
|
|
63125
63050
|
get currentTool() {
|
|
63126
63051
|
return this.root.get(TOOLBAR_KEYS.tool);
|
|
63127
63052
|
}
|
|
@@ -63166,8 +63091,8 @@ var ToolbarModel = class extends EventEmitter3 {
|
|
|
63166
63091
|
}
|
|
63167
63092
|
constructor(root, defaultStyle) {
|
|
63168
63093
|
super();
|
|
63169
|
-
|
|
63170
|
-
|
|
63094
|
+
_defineProperty20(this, "root", void 0);
|
|
63095
|
+
_defineProperty20(this, "handleRootUpdate", (evt) => {
|
|
63171
63096
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
63172
63097
|
if (Object.keys(TOOLBAR_KEYS).indexOf(key) >= 0 && (value.action === "add" || value.action === "update")) {
|
|
63173
63098
|
this.emit("update", {
|
|
@@ -63190,15 +63115,19 @@ var ToolbarModel = class extends EventEmitter3 {
|
|
|
63190
63115
|
}
|
|
63191
63116
|
});
|
|
63192
63117
|
}
|
|
63118
|
+
dispose() {
|
|
63119
|
+
this.root.unobserve(this.handleRootUpdate);
|
|
63120
|
+
this.removeAllListeners();
|
|
63121
|
+
}
|
|
63193
63122
|
};
|
|
63194
|
-
function
|
|
63195
|
-
return (r =
|
|
63123
|
+
function _defineProperty21(e, r, t) {
|
|
63124
|
+
return (r = _toPropertyKey21(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63196
63125
|
}
|
|
63197
|
-
function
|
|
63198
|
-
var i =
|
|
63126
|
+
function _toPropertyKey21(t) {
|
|
63127
|
+
var i = _toPrimitive21(t, "string");
|
|
63199
63128
|
return "symbol" == typeof i ? i : i + "";
|
|
63200
63129
|
}
|
|
63201
|
-
function
|
|
63130
|
+
function _toPrimitive21(t, r) {
|
|
63202
63131
|
if ("object" != typeof t || !t) return t;
|
|
63203
63132
|
var e = t[Symbol.toPrimitive];
|
|
63204
63133
|
if (void 0 !== e) {
|
|
@@ -63211,16 +63140,19 @@ function _toPrimitive22(t, r) {
|
|
|
63211
63140
|
var SelectorTool = class extends WhiteboardTool {
|
|
63212
63141
|
constructor(enableToolEvent, renderableModel, shadowEmitter, scope, selectElementsModel) {
|
|
63213
63142
|
super(enableToolEvent, renderableModel, shadowEmitter, scope);
|
|
63214
|
-
|
|
63215
|
-
|
|
63216
|
-
|
|
63217
|
-
|
|
63218
|
-
|
|
63143
|
+
_defineProperty21(this, "elementModel", null);
|
|
63144
|
+
_defineProperty21(this, "from", null);
|
|
63145
|
+
_defineProperty21(this, "to", null);
|
|
63146
|
+
_defineProperty21(this, "selectElementsModel", void 0);
|
|
63147
|
+
_defineProperty21(this, "selectElements", /* @__PURE__ */ new Map());
|
|
63219
63148
|
this.selectElementsModel = selectElementsModel;
|
|
63220
63149
|
}
|
|
63221
63150
|
onMouseDown(event) {
|
|
63222
63151
|
this.from = null;
|
|
63223
63152
|
this.to = null;
|
|
63153
|
+
if (this.elementModel) {
|
|
63154
|
+
this.elementModel.dispose();
|
|
63155
|
+
}
|
|
63224
63156
|
this.elementModel = this.modelGetter().createSelector();
|
|
63225
63157
|
this.from = event.point.clone();
|
|
63226
63158
|
this.to = event.point.clone();
|
|
@@ -63276,14 +63208,14 @@ var WhiteboardKeys = {
|
|
|
63276
63208
|
viewMatrix: "viewMatrix",
|
|
63277
63209
|
cameraMode: "cameraMode"
|
|
63278
63210
|
};
|
|
63279
|
-
function
|
|
63280
|
-
return (r =
|
|
63211
|
+
function _defineProperty22(e, r, t) {
|
|
63212
|
+
return (r = _toPropertyKey22(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63281
63213
|
}
|
|
63282
|
-
function
|
|
63283
|
-
var i =
|
|
63214
|
+
function _toPropertyKey22(t) {
|
|
63215
|
+
var i = _toPrimitive22(t, "string");
|
|
63284
63216
|
return "symbol" == typeof i ? i : i + "";
|
|
63285
63217
|
}
|
|
63286
|
-
function
|
|
63218
|
+
function _toPrimitive22(t, r) {
|
|
63287
63219
|
if ("object" != typeof t || !t) return t;
|
|
63288
63220
|
var e = t[Symbol.toPrimitive];
|
|
63289
63221
|
if (void 0 !== e) {
|
|
@@ -63293,7 +63225,7 @@ function _toPrimitive23(t, r) {
|
|
|
63293
63225
|
}
|
|
63294
63226
|
return ("string" === r ? String : Number)(t);
|
|
63295
63227
|
}
|
|
63296
|
-
var SelectElementsModel = class extends
|
|
63228
|
+
var SelectElementsModel = class extends EventEmitter3 {
|
|
63297
63229
|
get hasEditSelfPermission() {
|
|
63298
63230
|
return this.hasPermission(WhiteboardPermissionFlag.editSelf);
|
|
63299
63231
|
}
|
|
@@ -63302,24 +63234,28 @@ var SelectElementsModel = class extends EventEmitter4 {
|
|
|
63302
63234
|
}
|
|
63303
63235
|
constructor(userManager, requestUserMap, hasPermission) {
|
|
63304
63236
|
super();
|
|
63305
|
-
|
|
63306
|
-
|
|
63307
|
-
|
|
63308
|
-
|
|
63309
|
-
|
|
63237
|
+
_defineProperty22(this, "requestUserMap", void 0);
|
|
63238
|
+
_defineProperty22(this, "userManager", void 0);
|
|
63239
|
+
_defineProperty22(this, "hasPermission", void 0);
|
|
63240
|
+
_defineProperty22(this, "observers", /* @__PURE__ */ new Map());
|
|
63241
|
+
_defineProperty22(this, "handleUserLeave", (user) => {
|
|
63310
63242
|
const cb = this.observers.get(user.id);
|
|
63311
63243
|
if (cb) {
|
|
63312
63244
|
this.requestUserMap(user.id).unobserveDeep(cb);
|
|
63245
|
+
this.observers.delete(user.id);
|
|
63313
63246
|
}
|
|
63314
63247
|
});
|
|
63315
|
-
|
|
63248
|
+
_defineProperty22(this, "handleUserJoin", (user) => {
|
|
63316
63249
|
const observer = (evts) => {
|
|
63317
63250
|
this.handleUserSelectElementsChange(user.id, evts);
|
|
63318
63251
|
};
|
|
63252
|
+
if (this.observers.has(user.id)) {
|
|
63253
|
+
this.requestUserMap(user.id).unobserveDeep(this.observers.get(user.id));
|
|
63254
|
+
}
|
|
63319
63255
|
this.requestUserMap(user.id).observeDeep(observer);
|
|
63320
63256
|
this.observers.set(user.id, observer);
|
|
63321
63257
|
});
|
|
63322
|
-
|
|
63258
|
+
_defineProperty22(this, "handleUserSelectElementsChange", (userId, evts) => {
|
|
63323
63259
|
for (const evt of evts) {
|
|
63324
63260
|
if (evt.target.get("inner-map-id") === WhiteboardKeys.selectElements) {
|
|
63325
63261
|
const elementIds = Array.from(evt.target.keys()).filter((v) => v !== "inner-map-id");
|
|
@@ -63335,6 +63271,9 @@ var SelectElementsModel = class extends EventEmitter4 {
|
|
|
63335
63271
|
const observer = (evts) => {
|
|
63336
63272
|
this.handleUserSelectElementsChange(userId, evts);
|
|
63337
63273
|
};
|
|
63274
|
+
if (this.observers.has(userId)) {
|
|
63275
|
+
this.requestUserMap(userId).unobserveDeep(this.observers.get(userId));
|
|
63276
|
+
}
|
|
63338
63277
|
this.requestUserMap(userId).observeDeep(observer);
|
|
63339
63278
|
this.observers.set(userId, observer);
|
|
63340
63279
|
});
|
|
@@ -63389,25 +63328,22 @@ var SelectElementsModel = class extends EventEmitter4 {
|
|
|
63389
63328
|
});
|
|
63390
63329
|
}
|
|
63391
63330
|
dispose() {
|
|
63392
|
-
this.
|
|
63393
|
-
|
|
63394
|
-
|
|
63395
|
-
this.requestUserMap(userId).unobserveDeep(cb);
|
|
63396
|
-
}
|
|
63397
|
-
});
|
|
63331
|
+
for (const [key, value] of this.observers.entries()) {
|
|
63332
|
+
this.requestUserMap(key).unobserveDeep(value);
|
|
63333
|
+
}
|
|
63398
63334
|
this.observers.clear();
|
|
63399
63335
|
this.userManager.off("leave", this.handleUserLeave);
|
|
63400
63336
|
this.userManager.off("join", this.handleUserJoin);
|
|
63401
63337
|
}
|
|
63402
63338
|
};
|
|
63403
|
-
function
|
|
63404
|
-
return (r =
|
|
63339
|
+
function _defineProperty23(e, r, t) {
|
|
63340
|
+
return (r = _toPropertyKey23(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63405
63341
|
}
|
|
63406
|
-
function
|
|
63407
|
-
var i =
|
|
63342
|
+
function _toPropertyKey23(t) {
|
|
63343
|
+
var i = _toPrimitive23(t, "string");
|
|
63408
63344
|
return "symbol" == typeof i ? i : i + "";
|
|
63409
63345
|
}
|
|
63410
|
-
function
|
|
63346
|
+
function _toPrimitive23(t, r) {
|
|
63411
63347
|
if ("object" != typeof t || !t) return t;
|
|
63412
63348
|
var e = t[Symbol.toPrimitive];
|
|
63413
63349
|
if (void 0 !== e) {
|
|
@@ -63417,31 +63353,31 @@ function _toPrimitive24(t, r) {
|
|
|
63417
63353
|
}
|
|
63418
63354
|
return ("string" === r ? String : Number)(t);
|
|
63419
63355
|
}
|
|
63420
|
-
var TextEditor = class extends
|
|
63356
|
+
var TextEditor = class extends EventEmitter4 {
|
|
63421
63357
|
constructor(camera) {
|
|
63422
63358
|
super();
|
|
63423
|
-
|
|
63424
|
-
|
|
63425
|
-
|
|
63426
|
-
|
|
63427
|
-
|
|
63428
|
-
|
|
63429
|
-
|
|
63430
|
-
|
|
63359
|
+
_defineProperty23(this, "rootView", void 0);
|
|
63360
|
+
_defineProperty23(this, "content", void 0);
|
|
63361
|
+
_defineProperty23(this, "camera", void 0);
|
|
63362
|
+
_defineProperty23(this, "originX", 0);
|
|
63363
|
+
_defineProperty23(this, "originY", 0);
|
|
63364
|
+
_defineProperty23(this, "rotation", 0);
|
|
63365
|
+
_defineProperty23(this, "scale", 1);
|
|
63366
|
+
_defineProperty23(this, "handleContentInput", () => {
|
|
63431
63367
|
this.emit("change", this.content.textContent ?? "");
|
|
63432
63368
|
this.translateCaretIntoView();
|
|
63433
63369
|
});
|
|
63434
|
-
|
|
63370
|
+
_defineProperty23(this, "handleContentKeydown", (evt) => {
|
|
63435
63371
|
if (/^Arrow/.test(evt.key)) {
|
|
63436
63372
|
setTimeout(() => {
|
|
63437
63373
|
this.translateCaretIntoView();
|
|
63438
63374
|
}, 50);
|
|
63439
63375
|
}
|
|
63440
63376
|
});
|
|
63441
|
-
|
|
63377
|
+
_defineProperty23(this, "handleContentBlur", () => {
|
|
63442
63378
|
this.emit("done", this.content.textContent ?? "");
|
|
63443
63379
|
});
|
|
63444
|
-
|
|
63380
|
+
_defineProperty23(this, "handleRootClick", (evt) => {
|
|
63445
63381
|
if (evt.target === this.rootView) {
|
|
63446
63382
|
evt.stopPropagation();
|
|
63447
63383
|
evt.preventDefault();
|
|
@@ -63450,12 +63386,12 @@ var TextEditor = class extends EventEmitter5 {
|
|
|
63450
63386
|
});
|
|
63451
63387
|
this.camera = camera;
|
|
63452
63388
|
this.rootView = document.createElement("div");
|
|
63453
|
-
this.rootView.style.cssText =
|
|
63389
|
+
this.rootView.style.cssText = "position:absolute;width:100%;height:100%;top:0;left:0;overflow:hidden;";
|
|
63454
63390
|
this.content = document.createElement("div");
|
|
63455
63391
|
this.content.setAttribute("spellcheck", "false");
|
|
63456
63392
|
this.content.textContent = "";
|
|
63457
63393
|
this.content.setAttribute("contenteditable", "plaintext-only");
|
|
63458
|
-
this.content.style.cssText =
|
|
63394
|
+
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;";
|
|
63459
63395
|
this.content.style.transformOrigin = "0 0";
|
|
63460
63396
|
this.rootView.appendChild(this.content);
|
|
63461
63397
|
this.content.addEventListener("input", this.handleContentInput);
|
|
@@ -63531,14 +63467,14 @@ var TextEditor = class extends EventEmitter5 {
|
|
|
63531
63467
|
this.rootView.removeEventListener("pointerdown", this.handleRootClick);
|
|
63532
63468
|
}
|
|
63533
63469
|
};
|
|
63534
|
-
function
|
|
63535
|
-
return (r =
|
|
63470
|
+
function _defineProperty24(e, r, t) {
|
|
63471
|
+
return (r = _toPropertyKey24(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63536
63472
|
}
|
|
63537
|
-
function
|
|
63538
|
-
var i =
|
|
63473
|
+
function _toPropertyKey24(t) {
|
|
63474
|
+
var i = _toPrimitive24(t, "string");
|
|
63539
63475
|
return "symbol" == typeof i ? i : i + "";
|
|
63540
63476
|
}
|
|
63541
|
-
function
|
|
63477
|
+
function _toPrimitive24(t, r) {
|
|
63542
63478
|
if ("object" != typeof t || !t) return t;
|
|
63543
63479
|
var e = t[Symbol.toPrimitive];
|
|
63544
63480
|
if (void 0 !== e) {
|
|
@@ -63558,7 +63494,7 @@ var ANCHOR_STYLE = {
|
|
|
63558
63494
|
b: "cursor:s-resize;bottom:-3px;left:50%;translate:-50%;",
|
|
63559
63495
|
br: "cursor:se-resize;bottom:-3px;right:-3px"
|
|
63560
63496
|
};
|
|
63561
|
-
var Bounds = class extends
|
|
63497
|
+
var Bounds = class extends EventEmitter5 {
|
|
63562
63498
|
get width() {
|
|
63563
63499
|
return this.maxX - this.minX;
|
|
63564
63500
|
}
|
|
@@ -63573,12 +63509,12 @@ var Bounds = class extends EventEmitter6 {
|
|
|
63573
63509
|
}
|
|
63574
63510
|
constructor(binding, scope) {
|
|
63575
63511
|
super();
|
|
63576
|
-
|
|
63577
|
-
|
|
63578
|
-
|
|
63579
|
-
|
|
63580
|
-
|
|
63581
|
-
|
|
63512
|
+
_defineProperty24(this, "minX", 0);
|
|
63513
|
+
_defineProperty24(this, "minY", 0);
|
|
63514
|
+
_defineProperty24(this, "maxX", 0);
|
|
63515
|
+
_defineProperty24(this, "maxY", 0);
|
|
63516
|
+
_defineProperty24(this, "binding", void 0);
|
|
63517
|
+
_defineProperty24(this, "scope", void 0);
|
|
63582
63518
|
this.binding = binding;
|
|
63583
63519
|
this.scope = scope;
|
|
63584
63520
|
}
|
|
@@ -63697,35 +63633,35 @@ var Bounds = class extends EventEmitter6 {
|
|
|
63697
63633
|
this.maxY = maxY;
|
|
63698
63634
|
}
|
|
63699
63635
|
};
|
|
63700
|
-
var Editor = class extends
|
|
63636
|
+
var Editor = class extends EventEmitter5 {
|
|
63701
63637
|
constructor(scope, shadowScope, shadowEmitter, canvasElement, camera, initConfig) {
|
|
63702
63638
|
super();
|
|
63703
|
-
|
|
63704
|
-
|
|
63705
|
-
|
|
63706
|
-
|
|
63707
|
-
|
|
63708
|
-
|
|
63709
|
-
|
|
63710
|
-
|
|
63711
|
-
|
|
63712
|
-
|
|
63713
|
-
|
|
63714
|
-
|
|
63715
|
-
|
|
63716
|
-
|
|
63717
|
-
|
|
63718
|
-
|
|
63719
|
-
|
|
63720
|
-
|
|
63721
|
-
|
|
63722
|
-
|
|
63723
|
-
|
|
63724
|
-
|
|
63725
|
-
|
|
63726
|
-
|
|
63727
|
-
|
|
63728
|
-
|
|
63639
|
+
_defineProperty24(this, "rootView", void 0);
|
|
63640
|
+
_defineProperty24(this, "frame", void 0);
|
|
63641
|
+
_defineProperty24(this, "rotator", void 0);
|
|
63642
|
+
_defineProperty24(this, "scope", void 0);
|
|
63643
|
+
_defineProperty24(this, "shadowScope", void 0);
|
|
63644
|
+
_defineProperty24(this, "shadowContainer", void 0);
|
|
63645
|
+
_defineProperty24(this, "ctrlUserMap", void 0);
|
|
63646
|
+
_defineProperty24(this, "viewerId", void 0);
|
|
63647
|
+
_defineProperty24(this, "ctrlId", void 0);
|
|
63648
|
+
_defineProperty24(this, "ctrlNickName", void 0);
|
|
63649
|
+
_defineProperty24(this, "editMode", null);
|
|
63650
|
+
_defineProperty24(this, "editCtrlName", null);
|
|
63651
|
+
_defineProperty24(this, "editAnchor", null);
|
|
63652
|
+
_defineProperty24(this, "lastEditPoint", null);
|
|
63653
|
+
_defineProperty24(this, "bounds", void 0);
|
|
63654
|
+
_defineProperty24(this, "targets", []);
|
|
63655
|
+
_defineProperty24(this, "editorConfig", null);
|
|
63656
|
+
_defineProperty24(this, "aspectRatio", -1);
|
|
63657
|
+
_defineProperty24(this, "uniformScale", false);
|
|
63658
|
+
_defineProperty24(this, "camera", void 0);
|
|
63659
|
+
_defineProperty24(this, "canvasElement", void 0);
|
|
63660
|
+
_defineProperty24(this, "resizeObserver", void 0);
|
|
63661
|
+
_defineProperty24(this, "anchors", []);
|
|
63662
|
+
_defineProperty24(this, "title", null);
|
|
63663
|
+
_defineProperty24(this, "shadowEmitter", void 0);
|
|
63664
|
+
_defineProperty24(this, "handleMatrix", (matrix) => {
|
|
63729
63665
|
if (this.shadowContainer) {
|
|
63730
63666
|
const next = matrix.appended(this.shadowContainer.data.shadowMatrix ?? new this.shadowScope.Matrix());
|
|
63731
63667
|
this.shadowContainer.data.shadowMatrix = next;
|
|
@@ -63735,7 +63671,7 @@ var Editor = class extends EventEmitter6 {
|
|
|
63735
63671
|
this.targets.forEach((target) => target.appendPointsMatrix(matrix));
|
|
63736
63672
|
}
|
|
63737
63673
|
});
|
|
63738
|
-
|
|
63674
|
+
_defineProperty24(this, "handlePointerDown", (evt) => {
|
|
63739
63675
|
if (!evt.target) {
|
|
63740
63676
|
return;
|
|
63741
63677
|
}
|
|
@@ -63791,14 +63727,14 @@ var Editor = class extends EventEmitter6 {
|
|
|
63791
63727
|
};
|
|
63792
63728
|
}
|
|
63793
63729
|
});
|
|
63794
|
-
|
|
63730
|
+
_defineProperty24(this, "handlePointerMove", (evt) => {
|
|
63795
63731
|
evt.preventDefault();
|
|
63796
63732
|
if (!evt.target) {
|
|
63797
63733
|
return;
|
|
63798
63734
|
}
|
|
63799
63735
|
if (this.editMode === "matrix" && this.editAnchor && this.lastEditPoint) {
|
|
63800
63736
|
const offsetX = evt.pageX - this.lastEditPoint.x;
|
|
63801
|
-
|
|
63737
|
+
const offsetY = evt.pageY - this.lastEditPoint.y;
|
|
63802
63738
|
this.bounds.offsetBy(this.editAnchor, offsetX, offsetY, this.uniformScale ? this.aspectRatio : -1);
|
|
63803
63739
|
this.lastEditPoint = {
|
|
63804
63740
|
x: evt.pageX,
|
|
@@ -63823,7 +63759,7 @@ var Editor = class extends EventEmitter6 {
|
|
|
63823
63759
|
}
|
|
63824
63760
|
if (this.editMode === "translate" && this.lastEditPoint) {
|
|
63825
63761
|
const offsetX = evt.pageX - this.lastEditPoint.x;
|
|
63826
|
-
|
|
63762
|
+
const offsetY = evt.pageY - this.lastEditPoint.y;
|
|
63827
63763
|
this.bounds.translate(offsetX, offsetY);
|
|
63828
63764
|
this.updateBoundsByShadow();
|
|
63829
63765
|
this.lastEditPoint = {
|
|
@@ -63842,7 +63778,7 @@ var Editor = class extends EventEmitter6 {
|
|
|
63842
63778
|
}
|
|
63843
63779
|
}
|
|
63844
63780
|
});
|
|
63845
|
-
|
|
63781
|
+
_defineProperty24(this, "handlePointerUp", (evt) => {
|
|
63846
63782
|
evt.preventDefault();
|
|
63847
63783
|
this.resetShadow();
|
|
63848
63784
|
this.shadowEmitter.setActive(false);
|
|
@@ -63859,7 +63795,7 @@ var Editor = class extends EventEmitter6 {
|
|
|
63859
63795
|
this.lastEditPoint = null;
|
|
63860
63796
|
this.uniformScale = false;
|
|
63861
63797
|
});
|
|
63862
|
-
|
|
63798
|
+
_defineProperty24(this, "handleFrameDBClick", (evt) => {
|
|
63863
63799
|
if (evt.target === this.frame && this.targets.length === 1) {
|
|
63864
63800
|
if (this.targets[0].type === "point-text") {
|
|
63865
63801
|
this.frame.style.display = "none";
|
|
@@ -63867,7 +63803,7 @@ var Editor = class extends EventEmitter6 {
|
|
|
63867
63803
|
}
|
|
63868
63804
|
}
|
|
63869
63805
|
});
|
|
63870
|
-
|
|
63806
|
+
_defineProperty24(this, "updateBounds", () => {
|
|
63871
63807
|
let minX = Number.MAX_VALUE;
|
|
63872
63808
|
let maxX = -Number.MAX_VALUE;
|
|
63873
63809
|
let minY = Number.MAX_VALUE;
|
|
@@ -63900,7 +63836,7 @@ var Editor = class extends EventEmitter6 {
|
|
|
63900
63836
|
this.ctrlId = initConfig.ctrlId;
|
|
63901
63837
|
this.ctrlNickName = initConfig.ctrlNickName;
|
|
63902
63838
|
this.rootView = document.createElement("div");
|
|
63903
|
-
this.rootView.style.cssText =
|
|
63839
|
+
this.rootView.style.cssText = "position:absolute;display:none;width:100%;height:100%;top:50%;left:50%;transform:translate(-50%,-50%);";
|
|
63904
63840
|
this.frame = document.createElement("div");
|
|
63905
63841
|
this.frame.style.position = "absolute";
|
|
63906
63842
|
this.frame.style.padding = "8px";
|
|
@@ -63921,7 +63857,7 @@ var Editor = class extends EventEmitter6 {
|
|
|
63921
63857
|
} else {
|
|
63922
63858
|
this.title = document.createElement("div");
|
|
63923
63859
|
this.title.textContent = `${this.ctrlNickName}`;
|
|
63924
|
-
this.title.style.cssText =
|
|
63860
|
+
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%);";
|
|
63925
63861
|
this.frame.appendChild(this.title);
|
|
63926
63862
|
this.rootView.style.pointerEvents = "none";
|
|
63927
63863
|
}
|
|
@@ -64117,14 +64053,14 @@ var Editor = class extends EventEmitter6 {
|
|
|
64117
64053
|
this.resizeObserver.disconnect();
|
|
64118
64054
|
}
|
|
64119
64055
|
};
|
|
64120
|
-
function
|
|
64121
|
-
return (r =
|
|
64056
|
+
function _defineProperty25(e, r, t) {
|
|
64057
|
+
return (r = _toPropertyKey25(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64122
64058
|
}
|
|
64123
|
-
function
|
|
64124
|
-
var i =
|
|
64059
|
+
function _toPropertyKey25(t) {
|
|
64060
|
+
var i = _toPrimitive25(t, "string");
|
|
64125
64061
|
return "symbol" == typeof i ? i : i + "";
|
|
64126
64062
|
}
|
|
64127
|
-
function
|
|
64063
|
+
function _toPrimitive25(t, r) {
|
|
64128
64064
|
if ("object" != typeof t || !t) return t;
|
|
64129
64065
|
var e = t[Symbol.toPrimitive];
|
|
64130
64066
|
if (void 0 !== e) {
|
|
@@ -64137,13 +64073,13 @@ function _toPrimitive26(t, r) {
|
|
|
64137
64073
|
var TextTool = class extends WhiteboardTool {
|
|
64138
64074
|
constructor(enableToolEvent, model, shadowEmitter, scope, rootView, canvasElement, toolbarModel, camera) {
|
|
64139
64075
|
super(enableToolEvent, model, shadowEmitter, scope);
|
|
64140
|
-
|
|
64141
|
-
|
|
64142
|
-
|
|
64143
|
-
|
|
64144
|
-
|
|
64145
|
-
|
|
64146
|
-
|
|
64076
|
+
_defineProperty25(this, "from", null);
|
|
64077
|
+
_defineProperty25(this, "to", null);
|
|
64078
|
+
_defineProperty25(this, "rootView", void 0);
|
|
64079
|
+
_defineProperty25(this, "canvasElement", void 0);
|
|
64080
|
+
_defineProperty25(this, "elementModel", null);
|
|
64081
|
+
_defineProperty25(this, "toolbarModel", void 0);
|
|
64082
|
+
_defineProperty25(this, "camera", void 0);
|
|
64147
64083
|
this.rootView = rootView;
|
|
64148
64084
|
this.canvasElement = canvasElement;
|
|
64149
64085
|
this.toolbarModel = toolbarModel;
|
|
@@ -64152,7 +64088,7 @@ var TextTool = class extends WhiteboardTool {
|
|
|
64152
64088
|
onMouseDown(event) {
|
|
64153
64089
|
this.from = event.point.clone();
|
|
64154
64090
|
}
|
|
64155
|
-
onMouseDrag(
|
|
64091
|
+
onMouseDrag(_event) {
|
|
64156
64092
|
}
|
|
64157
64093
|
onMouseUp(event) {
|
|
64158
64094
|
this.to = event.point.clone();
|
|
@@ -64164,6 +64100,9 @@ var TextTool = class extends WhiteboardTool {
|
|
|
64164
64100
|
}
|
|
64165
64101
|
}
|
|
64166
64102
|
createPointEditor(x, y) {
|
|
64103
|
+
if (this.elementModel) {
|
|
64104
|
+
this.elementModel.dispose();
|
|
64105
|
+
}
|
|
64167
64106
|
this.elementModel = this.modelGetter().createPointText(x, y, true);
|
|
64168
64107
|
if (this.elementModel === null) {
|
|
64169
64108
|
return;
|
|
@@ -64202,14 +64141,14 @@ var TextTool = class extends WhiteboardTool {
|
|
|
64202
64141
|
}, 30);
|
|
64203
64142
|
}
|
|
64204
64143
|
};
|
|
64205
|
-
function
|
|
64206
|
-
return (r =
|
|
64144
|
+
function _defineProperty26(e, r, t) {
|
|
64145
|
+
return (r = _toPropertyKey26(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64207
64146
|
}
|
|
64208
|
-
function
|
|
64209
|
-
var i =
|
|
64147
|
+
function _toPropertyKey26(t) {
|
|
64148
|
+
var i = _toPrimitive26(t, "string");
|
|
64210
64149
|
return "symbol" == typeof i ? i : i + "";
|
|
64211
64150
|
}
|
|
64212
|
-
function
|
|
64151
|
+
function _toPrimitive26(t, r) {
|
|
64213
64152
|
if ("object" != typeof t || !t) return t;
|
|
64214
64153
|
var e = t[Symbol.toPrimitive];
|
|
64215
64154
|
if (void 0 !== e) {
|
|
@@ -64219,14 +64158,14 @@ function _toPrimitive27(t, r) {
|
|
|
64219
64158
|
}
|
|
64220
64159
|
return ("string" === r ? String : Number)(t);
|
|
64221
64160
|
}
|
|
64222
|
-
var Gesture = class extends
|
|
64161
|
+
var Gesture = class extends EventEmitter6 {
|
|
64223
64162
|
constructor(element, scope) {
|
|
64224
64163
|
super();
|
|
64225
|
-
|
|
64226
|
-
|
|
64227
|
-
|
|
64228
|
-
|
|
64229
|
-
|
|
64164
|
+
_defineProperty26(this, "element", void 0);
|
|
64165
|
+
_defineProperty26(this, "scope", void 0);
|
|
64166
|
+
_defineProperty26(this, "lastVector", null);
|
|
64167
|
+
_defineProperty26(this, "lastPoint", null);
|
|
64168
|
+
_defineProperty26(this, "onTouchStart", (evt) => {
|
|
64230
64169
|
if (evt.touches.length > 1) {
|
|
64231
64170
|
evt.preventDefault();
|
|
64232
64171
|
evt.stopPropagation();
|
|
@@ -64239,7 +64178,7 @@ var Gesture = class extends EventEmitter7 {
|
|
|
64239
64178
|
this.lastVector = p2.subtract(p1);
|
|
64240
64179
|
this.lastPoint = p1;
|
|
64241
64180
|
});
|
|
64242
|
-
|
|
64181
|
+
_defineProperty26(this, "onTouchMove", (evt) => {
|
|
64243
64182
|
if (this.lastVector && this.lastPoint && evt.touches.length === 2) {
|
|
64244
64183
|
evt.preventDefault();
|
|
64245
64184
|
evt.stopPropagation();
|
|
@@ -64270,7 +64209,7 @@ var Gesture = class extends EventEmitter7 {
|
|
|
64270
64209
|
this.lastPoint = null;
|
|
64271
64210
|
}
|
|
64272
64211
|
});
|
|
64273
|
-
|
|
64212
|
+
_defineProperty26(this, "onTouchEnd", () => {
|
|
64274
64213
|
this.lastVector = null;
|
|
64275
64214
|
this.lastPoint = null;
|
|
64276
64215
|
});
|
|
@@ -64281,14 +64220,14 @@ var Gesture = class extends EventEmitter7 {
|
|
|
64281
64220
|
this.element.addEventListener("touchend", this.onTouchEnd);
|
|
64282
64221
|
}
|
|
64283
64222
|
};
|
|
64284
|
-
function
|
|
64285
|
-
return (r =
|
|
64223
|
+
function _defineProperty27(e, r, t) {
|
|
64224
|
+
return (r = _toPropertyKey27(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64286
64225
|
}
|
|
64287
|
-
function
|
|
64288
|
-
var i =
|
|
64226
|
+
function _toPropertyKey27(t) {
|
|
64227
|
+
var i = _toPrimitive27(t, "string");
|
|
64289
64228
|
return "symbol" == typeof i ? i : i + "";
|
|
64290
64229
|
}
|
|
64291
|
-
function
|
|
64230
|
+
function _toPrimitive27(t, r) {
|
|
64292
64231
|
if ("object" != typeof t || !t) return t;
|
|
64293
64232
|
var e = t[Symbol.toPrimitive];
|
|
64294
64233
|
if (void 0 !== e) {
|
|
@@ -64298,7 +64237,7 @@ function _toPrimitive28(t, r) {
|
|
|
64298
64237
|
}
|
|
64299
64238
|
return ("string" === r ? String : Number)(t);
|
|
64300
64239
|
}
|
|
64301
|
-
var Camera = class extends
|
|
64240
|
+
var Camera = class extends EventEmitter7 {
|
|
64302
64241
|
get inherentMatrix() {
|
|
64303
64242
|
const inherentMatrix = new this.scope.Matrix();
|
|
64304
64243
|
inherentMatrix.scale(this.inherentScale, [0, 0]);
|
|
@@ -64310,31 +64249,31 @@ var Camera = class extends EventEmitter8 {
|
|
|
64310
64249
|
}
|
|
64311
64250
|
constructor(initSize, maxScale, dom, userManager, scope, whiteboardAttrsMap, hasPermission, requestUserMap, _paperSize, _domSize) {
|
|
64312
64251
|
super();
|
|
64313
|
-
|
|
64314
|
-
|
|
64315
|
-
|
|
64316
|
-
|
|
64252
|
+
_defineProperty27(this, "scope", void 0);
|
|
64253
|
+
_defineProperty27(this, "dom", void 0);
|
|
64254
|
+
_defineProperty27(this, "lastTriggerTime", 0);
|
|
64255
|
+
_defineProperty27(this, "lastDelta", {
|
|
64317
64256
|
x: 0,
|
|
64318
64257
|
y: 0
|
|
64319
64258
|
});
|
|
64320
|
-
|
|
64321
|
-
|
|
64322
|
-
|
|
64323
|
-
|
|
64324
|
-
|
|
64325
|
-
|
|
64326
|
-
|
|
64327
|
-
|
|
64328
|
-
|
|
64329
|
-
|
|
64330
|
-
|
|
64331
|
-
|
|
64332
|
-
|
|
64333
|
-
|
|
64334
|
-
|
|
64335
|
-
|
|
64336
|
-
|
|
64337
|
-
|
|
64259
|
+
_defineProperty27(this, "requestUserMap", void 0);
|
|
64260
|
+
_defineProperty27(this, "userManager", void 0);
|
|
64261
|
+
_defineProperty27(this, "observers", /* @__PURE__ */ new Map());
|
|
64262
|
+
_defineProperty27(this, "whiteboardAttrsMap", void 0);
|
|
64263
|
+
_defineProperty27(this, "paperSize", void 0);
|
|
64264
|
+
_defineProperty27(this, "domSize", void 0);
|
|
64265
|
+
_defineProperty27(this, "hasPermission", void 0);
|
|
64266
|
+
_defineProperty27(this, "gesture", void 0);
|
|
64267
|
+
_defineProperty27(this, "inherentScale", 1);
|
|
64268
|
+
_defineProperty27(this, "maxScale", void 0);
|
|
64269
|
+
_defineProperty27(this, "initSize", void 0);
|
|
64270
|
+
_defineProperty27(this, "bound", void 0);
|
|
64271
|
+
_defineProperty27(this, "boundTiemoutId", void 0);
|
|
64272
|
+
_defineProperty27(this, "enableByMouse", true);
|
|
64273
|
+
_defineProperty27(this, "enableByTouch", true);
|
|
64274
|
+
_defineProperty27(this, "boundaryColor", "#F44336");
|
|
64275
|
+
_defineProperty27(this, "enableBoundaryHighlight", true);
|
|
64276
|
+
_defineProperty27(this, "handleMainCameraChange", (evt) => {
|
|
64338
64277
|
const userMap = this.requestUserMap(this.userManager.selfId);
|
|
64339
64278
|
const cameraMode = userMap.get(WhiteboardKeys.cameraMode);
|
|
64340
64279
|
if (cameraMode !== "main") {
|
|
@@ -64351,20 +64290,23 @@ var Camera = class extends EventEmitter8 {
|
|
|
64351
64290
|
}
|
|
64352
64291
|
}
|
|
64353
64292
|
});
|
|
64354
|
-
|
|
64293
|
+
_defineProperty27(this, "handleUserLeave", (user) => {
|
|
64355
64294
|
const cb = this.observers.get(user.id);
|
|
64356
64295
|
if (cb) {
|
|
64357
64296
|
this.requestUserMap(user.id).unobserve(cb);
|
|
64358
64297
|
}
|
|
64359
64298
|
});
|
|
64360
|
-
|
|
64299
|
+
_defineProperty27(this, "handleUserJoin", (user) => {
|
|
64361
64300
|
const observer = (evt) => {
|
|
64362
64301
|
this.handleViewMatrixUpdate(user.id, evt);
|
|
64363
64302
|
};
|
|
64303
|
+
if (this.observers.has(user.id)) {
|
|
64304
|
+
this.requestUserMap(user.id).unobserve(observer);
|
|
64305
|
+
}
|
|
64364
64306
|
this.requestUserMap(user.id).observe(observer);
|
|
64365
64307
|
this.observers.set(user.id, observer);
|
|
64366
64308
|
});
|
|
64367
|
-
|
|
64309
|
+
_defineProperty27(this, "handleViewMatrixUpdate", (userId, evt) => {
|
|
64368
64310
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
64369
64311
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
64370
64312
|
if (value.action === "update") {
|
|
@@ -64391,7 +64333,7 @@ var Camera = class extends EventEmitter8 {
|
|
|
64391
64333
|
}
|
|
64392
64334
|
}
|
|
64393
64335
|
});
|
|
64394
|
-
|
|
64336
|
+
_defineProperty27(this, "handleWheel", (evt) => {
|
|
64395
64337
|
if (!this.enableByMouse) {
|
|
64396
64338
|
return;
|
|
64397
64339
|
}
|
|
@@ -64440,7 +64382,7 @@ var Camera = class extends EventEmitter8 {
|
|
|
64440
64382
|
});
|
|
64441
64383
|
this.maxScale = maxScale;
|
|
64442
64384
|
this.bound = window.document.createElement("div");
|
|
64443
|
-
this.bound.style.cssText =
|
|
64385
|
+
this.bound.style.cssText = "transition: box-shadow 100ms;pointer-events:none;z-index:99;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);";
|
|
64444
64386
|
this.initSize = initSize;
|
|
64445
64387
|
this.hasPermission = hasPermission;
|
|
64446
64388
|
this.paperSize = _paperSize;
|
|
@@ -64465,6 +64407,9 @@ var Camera = class extends EventEmitter8 {
|
|
|
64465
64407
|
const observer = (evt) => {
|
|
64466
64408
|
this.handleViewMatrixUpdate(userId, evt);
|
|
64467
64409
|
};
|
|
64410
|
+
if (this.observers.has(userId)) {
|
|
64411
|
+
this.requestUserMap(userId).unobserve(observer);
|
|
64412
|
+
}
|
|
64468
64413
|
this.requestUserMap(userId).observe(observer);
|
|
64469
64414
|
this.observers.set(userId, observer);
|
|
64470
64415
|
});
|
|
@@ -64501,7 +64446,7 @@ var Camera = class extends EventEmitter8 {
|
|
|
64501
64446
|
this.bound.style.boxShadow = `inset 0px 0px 6px 2px ${this.boundaryColor}`;
|
|
64502
64447
|
window.clearTimeout(this.boundTiemoutId);
|
|
64503
64448
|
this.boundTiemoutId = window.setTimeout(() => {
|
|
64504
|
-
this.bound.style.boxShadow =
|
|
64449
|
+
this.bound.style.boxShadow = "none";
|
|
64505
64450
|
}, 100);
|
|
64506
64451
|
}
|
|
64507
64452
|
}
|
|
@@ -64511,6 +64456,9 @@ var Camera = class extends EventEmitter8 {
|
|
|
64511
64456
|
updateInherentScale(scale) {
|
|
64512
64457
|
this.inherentScale = scale;
|
|
64513
64458
|
}
|
|
64459
|
+
getInherentScale() {
|
|
64460
|
+
return this.inherentScale;
|
|
64461
|
+
}
|
|
64514
64462
|
getActiveMatrix() {
|
|
64515
64463
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
64516
64464
|
let matrixValue;
|
|
@@ -64653,15 +64601,28 @@ var Camera = class extends EventEmitter8 {
|
|
|
64653
64601
|
y: 0
|
|
64654
64602
|
};
|
|
64655
64603
|
}
|
|
64604
|
+
dispose() {
|
|
64605
|
+
Array.from(this.observers.keys()).forEach((userId) => {
|
|
64606
|
+
const cb = this.observers.get(userId);
|
|
64607
|
+
if (cb) {
|
|
64608
|
+
this.requestUserMap(userId).unobserve(cb);
|
|
64609
|
+
}
|
|
64610
|
+
});
|
|
64611
|
+
this.whiteboardAttrsMap.unobserve(this.handleMainCameraChange);
|
|
64612
|
+
this.userManager.off("join", this.handleUserJoin);
|
|
64613
|
+
this.userManager.off("leave", this.handleUserLeave);
|
|
64614
|
+
this.gesture.removeAllListeners();
|
|
64615
|
+
this.removeAllListeners();
|
|
64616
|
+
}
|
|
64656
64617
|
};
|
|
64657
|
-
function
|
|
64658
|
-
return (r =
|
|
64618
|
+
function _defineProperty28(e, r, t) {
|
|
64619
|
+
return (r = _toPropertyKey28(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64659
64620
|
}
|
|
64660
|
-
function
|
|
64661
|
-
var i =
|
|
64621
|
+
function _toPropertyKey28(t) {
|
|
64622
|
+
var i = _toPrimitive28(t, "string");
|
|
64662
64623
|
return "symbol" == typeof i ? i : i + "";
|
|
64663
64624
|
}
|
|
64664
|
-
function
|
|
64625
|
+
function _toPrimitive28(t, r) {
|
|
64665
64626
|
if ("object" != typeof t || !t) return t;
|
|
64666
64627
|
var e = t[Symbol.toPrimitive];
|
|
64667
64628
|
if (void 0 !== e) {
|
|
@@ -64674,12 +64635,15 @@ function _toPrimitive29(t, r) {
|
|
|
64674
64635
|
var EllipseTool = class extends WhiteboardTool {
|
|
64675
64636
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
64676
64637
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
64677
|
-
|
|
64678
|
-
|
|
64679
|
-
|
|
64638
|
+
_defineProperty28(this, "elementModel", null);
|
|
64639
|
+
_defineProperty28(this, "from", null);
|
|
64640
|
+
_defineProperty28(this, "to", null);
|
|
64680
64641
|
this.tool.minDistance = 1;
|
|
64681
64642
|
}
|
|
64682
64643
|
onMouseDown(event) {
|
|
64644
|
+
if (this.elementModel) {
|
|
64645
|
+
this.elementModel.dispose();
|
|
64646
|
+
}
|
|
64683
64647
|
this.elementModel = this.modelGetter().createSegmentedPath("ellipse", true);
|
|
64684
64648
|
this.from = event.point.clone();
|
|
64685
64649
|
this.to = event.point.clone();
|
|
@@ -64703,14 +64667,14 @@ var EllipseTool = class extends WhiteboardTool {
|
|
|
64703
64667
|
}
|
|
64704
64668
|
}
|
|
64705
64669
|
};
|
|
64706
|
-
function
|
|
64707
|
-
return (r =
|
|
64670
|
+
function _defineProperty29(e, r, t) {
|
|
64671
|
+
return (r = _toPropertyKey29(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64708
64672
|
}
|
|
64709
|
-
function
|
|
64710
|
-
var i =
|
|
64673
|
+
function _toPropertyKey29(t) {
|
|
64674
|
+
var i = _toPrimitive29(t, "string");
|
|
64711
64675
|
return "symbol" == typeof i ? i : i + "";
|
|
64712
64676
|
}
|
|
64713
|
-
function
|
|
64677
|
+
function _toPrimitive29(t, r) {
|
|
64714
64678
|
if ("object" != typeof t || !t) return t;
|
|
64715
64679
|
var e = t[Symbol.toPrimitive];
|
|
64716
64680
|
if (void 0 !== e) {
|
|
@@ -64723,12 +64687,15 @@ function _toPrimitive30(t, r) {
|
|
|
64723
64687
|
var TriangleTool = class extends WhiteboardTool {
|
|
64724
64688
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
64725
64689
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
64726
|
-
|
|
64727
|
-
|
|
64728
|
-
|
|
64690
|
+
_defineProperty29(this, "elementModel", null);
|
|
64691
|
+
_defineProperty29(this, "from", null);
|
|
64692
|
+
_defineProperty29(this, "to", null);
|
|
64729
64693
|
this.tool.minDistance = 1;
|
|
64730
64694
|
}
|
|
64731
64695
|
onMouseDown(event) {
|
|
64696
|
+
if (this.elementModel) {
|
|
64697
|
+
this.elementModel.dispose();
|
|
64698
|
+
}
|
|
64732
64699
|
this.elementModel = this.modelGetter().createTriangle(true);
|
|
64733
64700
|
this.from = event.point.clone();
|
|
64734
64701
|
this.to = event.point.clone();
|
|
@@ -64748,14 +64715,14 @@ var TriangleTool = class extends WhiteboardTool {
|
|
|
64748
64715
|
}
|
|
64749
64716
|
}
|
|
64750
64717
|
};
|
|
64751
|
-
function
|
|
64752
|
-
return (r =
|
|
64718
|
+
function _defineProperty30(e, r, t) {
|
|
64719
|
+
return (r = _toPropertyKey30(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64753
64720
|
}
|
|
64754
|
-
function
|
|
64755
|
-
var i =
|
|
64721
|
+
function _toPropertyKey30(t) {
|
|
64722
|
+
var i = _toPrimitive30(t, "string");
|
|
64756
64723
|
return "symbol" == typeof i ? i : i + "";
|
|
64757
64724
|
}
|
|
64758
|
-
function
|
|
64725
|
+
function _toPrimitive30(t, r) {
|
|
64759
64726
|
if ("object" != typeof t || !t) return t;
|
|
64760
64727
|
var e = t[Symbol.toPrimitive];
|
|
64761
64728
|
if (void 0 !== e) {
|
|
@@ -64765,63 +64732,63 @@ function _toPrimitive31(t, r) {
|
|
|
64765
64732
|
}
|
|
64766
64733
|
return ("string" === r ? String : Number)(t);
|
|
64767
64734
|
}
|
|
64768
|
-
var Whiteboard = class extends
|
|
64735
|
+
var Whiteboard = class extends EventEmitter8 {
|
|
64769
64736
|
// public insertImage!: (src: string) => void;
|
|
64770
64737
|
constructor(view) {
|
|
64771
64738
|
super();
|
|
64772
|
-
|
|
64773
|
-
|
|
64774
|
-
|
|
64775
|
-
|
|
64776
|
-
|
|
64777
|
-
|
|
64778
|
-
|
|
64779
|
-
|
|
64780
|
-
|
|
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
|
-
|
|
64739
|
+
_defineProperty30(this, "view", void 0);
|
|
64740
|
+
_defineProperty30(this, "selfUserId", void 0);
|
|
64741
|
+
_defineProperty30(this, "permissions", void 0);
|
|
64742
|
+
_defineProperty30(this, "tool", void 0);
|
|
64743
|
+
_defineProperty30(this, "fontSize", void 0);
|
|
64744
|
+
_defineProperty30(this, "dashArray", void 0);
|
|
64745
|
+
_defineProperty30(this, "fontFamily", void 0);
|
|
64746
|
+
_defineProperty30(this, "strokeColor", void 0);
|
|
64747
|
+
_defineProperty30(this, "fillColor", void 0);
|
|
64748
|
+
_defineProperty30(this, "strokeWidth", void 0);
|
|
64749
|
+
_defineProperty30(this, "enableCameraByMouse", void 0);
|
|
64750
|
+
_defineProperty30(this, "enableCameraByTouch", void 0);
|
|
64751
|
+
_defineProperty30(this, "cameraBoundaryColor", void 0);
|
|
64752
|
+
_defineProperty30(this, "enableCameraBoundaryHighlight", void 0);
|
|
64753
|
+
_defineProperty30(this, "getElementAttribute", void 0);
|
|
64754
|
+
_defineProperty30(this, "setElementAttribute", void 0);
|
|
64755
|
+
_defineProperty30(this, "getCurrentTool", void 0);
|
|
64756
|
+
_defineProperty30(this, "setCurrentTool", void 0);
|
|
64757
|
+
_defineProperty30(this, "setCanvasBackgroundColor", void 0);
|
|
64758
|
+
_defineProperty30(this, "setThemeColor", void 0);
|
|
64759
|
+
_defineProperty30(this, "gotoPage", void 0);
|
|
64760
|
+
_defineProperty30(this, "addPage", void 0);
|
|
64761
|
+
_defineProperty30(this, "deletePage", void 0);
|
|
64762
|
+
_defineProperty30(this, "pageList", void 0);
|
|
64763
|
+
_defineProperty30(this, "currentPageId", void 0);
|
|
64764
|
+
_defineProperty30(this, "clonePage", void 0);
|
|
64765
|
+
_defineProperty30(this, "clearPage", void 0);
|
|
64766
|
+
_defineProperty30(this, "translateCamera", void 0);
|
|
64767
|
+
_defineProperty30(this, "scaleCamera", void 0);
|
|
64768
|
+
_defineProperty30(this, "resetCamera", void 0);
|
|
64769
|
+
_defineProperty30(this, "setFreeModelUserPage", void 0);
|
|
64770
|
+
_defineProperty30(this, "indexedNavigation", void 0);
|
|
64771
|
+
_defineProperty30(this, "setViewModeToFree", void 0);
|
|
64772
|
+
_defineProperty30(this, "setViewModeToFlow", void 0);
|
|
64773
|
+
_defineProperty30(this, "setViewModeToMain", void 0);
|
|
64774
|
+
_defineProperty30(this, "getViewModel", void 0);
|
|
64775
|
+
_defineProperty30(this, "undo", void 0);
|
|
64776
|
+
_defineProperty30(this, "redo", void 0);
|
|
64777
|
+
_defineProperty30(this, "rasterizeViewport", void 0);
|
|
64778
|
+
_defineProperty30(this, "rasterizeElementsBounds", void 0);
|
|
64779
|
+
_defineProperty30(this, "rasterizeMaxBounds", void 0);
|
|
64780
|
+
_defineProperty30(this, "setInputType", void 0);
|
|
64814
64781
|
this.view = view;
|
|
64815
64782
|
}
|
|
64816
64783
|
};
|
|
64817
|
-
function
|
|
64818
|
-
return (r =
|
|
64784
|
+
function _defineProperty31(e, r, t) {
|
|
64785
|
+
return (r = _toPropertyKey31(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64819
64786
|
}
|
|
64820
|
-
function
|
|
64821
|
-
var i =
|
|
64787
|
+
function _toPropertyKey31(t) {
|
|
64788
|
+
var i = _toPrimitive31(t, "string");
|
|
64822
64789
|
return "symbol" == typeof i ? i : i + "";
|
|
64823
64790
|
}
|
|
64824
|
-
function
|
|
64791
|
+
function _toPrimitive31(t, r) {
|
|
64825
64792
|
if ("object" != typeof t || !t) return t;
|
|
64826
64793
|
var e = t[Symbol.toPrimitive];
|
|
64827
64794
|
if (void 0 !== e) {
|
|
@@ -64834,14 +64801,17 @@ function _toPrimitive32(t, r) {
|
|
|
64834
64801
|
var EraserTool = class extends WhiteboardTool {
|
|
64835
64802
|
constructor(enableToolEvent, renderableModel, shadowEmitter, scope, trashedElementsModel) {
|
|
64836
64803
|
super(enableToolEvent, renderableModel, shadowEmitter, scope);
|
|
64837
|
-
|
|
64838
|
-
|
|
64839
|
-
|
|
64804
|
+
_defineProperty31(this, "elementModel", null);
|
|
64805
|
+
_defineProperty31(this, "trashedElementsModel", void 0);
|
|
64806
|
+
_defineProperty31(this, "pointCount", 0);
|
|
64840
64807
|
this.trashedElementsModel = trashedElementsModel;
|
|
64841
64808
|
this.tool.minDistance = 1;
|
|
64842
64809
|
}
|
|
64843
|
-
onMouseDown(
|
|
64810
|
+
onMouseDown(_event) {
|
|
64844
64811
|
this.pointCount = 0;
|
|
64812
|
+
if (this.elementModel) {
|
|
64813
|
+
this.elementModel.dispose();
|
|
64814
|
+
}
|
|
64845
64815
|
this.elementModel = this.modelGetter().createEraser();
|
|
64846
64816
|
}
|
|
64847
64817
|
onMouseDrag(event) {
|
|
@@ -64863,21 +64833,21 @@ var EraserTool = class extends WhiteboardTool {
|
|
|
64863
64833
|
}
|
|
64864
64834
|
});
|
|
64865
64835
|
}
|
|
64866
|
-
onMouseUp(
|
|
64836
|
+
onMouseUp(_event) {
|
|
64867
64837
|
if (this.elementModel) {
|
|
64868
64838
|
this.modelGetter().removeElementItem(this.elementModel.uuid);
|
|
64869
64839
|
}
|
|
64870
64840
|
this.trashedElementsModel.removeAllTrashedElementsForSelf();
|
|
64871
64841
|
}
|
|
64872
64842
|
};
|
|
64873
|
-
function
|
|
64874
|
-
return (r =
|
|
64843
|
+
function _defineProperty32(e, r, t) {
|
|
64844
|
+
return (r = _toPropertyKey32(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64875
64845
|
}
|
|
64876
|
-
function
|
|
64877
|
-
var i =
|
|
64846
|
+
function _toPropertyKey32(t) {
|
|
64847
|
+
var i = _toPrimitive32(t, "string");
|
|
64878
64848
|
return "symbol" == typeof i ? i : i + "";
|
|
64879
64849
|
}
|
|
64880
|
-
function
|
|
64850
|
+
function _toPrimitive32(t, r) {
|
|
64881
64851
|
if ("object" != typeof t || !t) return t;
|
|
64882
64852
|
var e = t[Symbol.toPrimitive];
|
|
64883
64853
|
if (void 0 !== e) {
|
|
@@ -64887,7 +64857,7 @@ function _toPrimitive33(t, r) {
|
|
|
64887
64857
|
}
|
|
64888
64858
|
return ("string" === r ? String : Number)(t);
|
|
64889
64859
|
}
|
|
64890
|
-
var TrashedElementsModel = class extends
|
|
64860
|
+
var TrashedElementsModel = class extends EventEmitter9 {
|
|
64891
64861
|
get hasDeleteSelfPermission() {
|
|
64892
64862
|
return this.hasPermission(WhiteboardPermissionFlag.deleteSelf);
|
|
64893
64863
|
}
|
|
@@ -64896,20 +64866,23 @@ var TrashedElementsModel = class extends EventEmitter10 {
|
|
|
64896
64866
|
}
|
|
64897
64867
|
constructor(userManager, requestUserMap, hasPermission) {
|
|
64898
64868
|
super();
|
|
64899
|
-
|
|
64900
|
-
|
|
64901
|
-
|
|
64902
|
-
|
|
64903
|
-
|
|
64869
|
+
_defineProperty32(this, "requestUserMap", void 0);
|
|
64870
|
+
_defineProperty32(this, "userManager", void 0);
|
|
64871
|
+
_defineProperty32(this, "hasPermission", void 0);
|
|
64872
|
+
_defineProperty32(this, "observers", /* @__PURE__ */ new Map());
|
|
64873
|
+
_defineProperty32(this, "handleUserLeave", (user) => {
|
|
64904
64874
|
const cb = this.observers.get(user.id);
|
|
64905
64875
|
if (cb) {
|
|
64906
64876
|
this.requestUserMap(user.id).unobserveDeep(cb);
|
|
64907
64877
|
}
|
|
64908
64878
|
});
|
|
64909
|
-
|
|
64879
|
+
_defineProperty32(this, "handleUserJoin", (user) => {
|
|
64910
64880
|
const observer = (evts) => {
|
|
64911
64881
|
this.handleUserTrashElementsChange(user.id, evts);
|
|
64912
64882
|
};
|
|
64883
|
+
if (this.observers.has(user.id)) {
|
|
64884
|
+
this.requestUserMap(user.id).unobserveDeep(this.observers.get(user.id));
|
|
64885
|
+
}
|
|
64913
64886
|
this.requestUserMap(user.id).observeDeep(observer);
|
|
64914
64887
|
this.observers.set(user.id, observer);
|
|
64915
64888
|
});
|
|
@@ -64921,6 +64894,9 @@ var TrashedElementsModel = class extends EventEmitter10 {
|
|
|
64921
64894
|
const observer = (evts) => {
|
|
64922
64895
|
this.handleUserTrashElementsChange(userId, evts);
|
|
64923
64896
|
};
|
|
64897
|
+
if (this.observers.has(userId)) {
|
|
64898
|
+
this.requestUserMap(userId).unobserveDeep(this.observers.get(userId));
|
|
64899
|
+
}
|
|
64924
64900
|
this.requestUserMap(userId).observeDeep(observer);
|
|
64925
64901
|
this.observers.set(userId, observer);
|
|
64926
64902
|
});
|
|
@@ -64975,25 +64951,22 @@ var TrashedElementsModel = class extends EventEmitter10 {
|
|
|
64975
64951
|
});
|
|
64976
64952
|
}
|
|
64977
64953
|
dispose() {
|
|
64978
|
-
this.
|
|
64979
|
-
|
|
64980
|
-
|
|
64981
|
-
this.requestUserMap(userId).unobserveDeep(cb);
|
|
64982
|
-
}
|
|
64983
|
-
});
|
|
64954
|
+
for (const [key, value] of this.observers.entries()) {
|
|
64955
|
+
this.requestUserMap(key).unobserveDeep(value);
|
|
64956
|
+
}
|
|
64984
64957
|
this.observers.clear();
|
|
64985
64958
|
this.userManager.off("leave", this.handleUserLeave);
|
|
64986
64959
|
this.userManager.off("join", this.handleUserJoin);
|
|
64987
64960
|
}
|
|
64988
64961
|
};
|
|
64989
|
-
function
|
|
64990
|
-
return (r =
|
|
64962
|
+
function _defineProperty33(e, r, t) {
|
|
64963
|
+
return (r = _toPropertyKey33(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64991
64964
|
}
|
|
64992
|
-
function
|
|
64993
|
-
var i =
|
|
64965
|
+
function _toPropertyKey33(t) {
|
|
64966
|
+
var i = _toPrimitive33(t, "string");
|
|
64994
64967
|
return "symbol" == typeof i ? i : i + "";
|
|
64995
64968
|
}
|
|
64996
|
-
function
|
|
64969
|
+
function _toPrimitive33(t, r) {
|
|
64997
64970
|
if ("object" != typeof t || !t) return t;
|
|
64998
64971
|
var e = t[Symbol.toPrimitive];
|
|
64999
64972
|
if (void 0 !== e) {
|
|
@@ -65006,12 +64979,15 @@ function _toPrimitive34(t, r) {
|
|
|
65006
64979
|
var LaserPointerTool = class extends WhiteboardTool {
|
|
65007
64980
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65008
64981
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65009
|
-
|
|
65010
|
-
|
|
64982
|
+
_defineProperty33(this, "elementModel", null);
|
|
64983
|
+
_defineProperty33(this, "pointCount", 0);
|
|
65011
64984
|
this.tool.minDistance = 5;
|
|
65012
64985
|
}
|
|
65013
|
-
onMouseDown(
|
|
64986
|
+
onMouseDown(_event) {
|
|
65014
64987
|
this.pointCount = 0;
|
|
64988
|
+
if (this.elementModel) {
|
|
64989
|
+
this.elementModel.dispose();
|
|
64990
|
+
}
|
|
65015
64991
|
this.elementModel = this.modelGetter().createLaserPointer();
|
|
65016
64992
|
}
|
|
65017
64993
|
onMouseDrag(event) {
|
|
@@ -65023,20 +64999,20 @@ var LaserPointerTool = class extends WhiteboardTool {
|
|
|
65023
64999
|
this.elementModel.appendPoints([event.point.x, event.point.y]);
|
|
65024
65000
|
}
|
|
65025
65001
|
}
|
|
65026
|
-
onMouseUp(
|
|
65002
|
+
onMouseUp(_event) {
|
|
65027
65003
|
if (this.elementModel) {
|
|
65028
65004
|
this.elementModel.beginRemoveAnimate();
|
|
65029
65005
|
}
|
|
65030
65006
|
}
|
|
65031
65007
|
};
|
|
65032
|
-
function
|
|
65033
|
-
return (r =
|
|
65008
|
+
function _defineProperty34(e, r, t) {
|
|
65009
|
+
return (r = _toPropertyKey34(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65034
65010
|
}
|
|
65035
|
-
function
|
|
65036
|
-
var i =
|
|
65011
|
+
function _toPropertyKey34(t) {
|
|
65012
|
+
var i = _toPrimitive34(t, "string");
|
|
65037
65013
|
return "symbol" == typeof i ? i : i + "";
|
|
65038
65014
|
}
|
|
65039
|
-
function
|
|
65015
|
+
function _toPrimitive34(t, r) {
|
|
65040
65016
|
if ("object" != typeof t || !t) return t;
|
|
65041
65017
|
var e = t[Symbol.toPrimitive];
|
|
65042
65018
|
if (void 0 !== e) {
|
|
@@ -65046,25 +65022,25 @@ function _toPrimitive35(t, r) {
|
|
|
65046
65022
|
}
|
|
65047
65023
|
return ("string" === r ? String : Number)(t);
|
|
65048
65024
|
}
|
|
65049
|
-
var PageModel = class extends
|
|
65025
|
+
var PageModel = class extends EventEmitter10 {
|
|
65050
65026
|
constructor(whiteboardAttrsMap, userManager, requestUserMap, pageMap, hasPermission) {
|
|
65051
65027
|
super();
|
|
65052
|
-
|
|
65053
|
-
|
|
65054
|
-
|
|
65055
|
-
|
|
65056
|
-
|
|
65057
|
-
|
|
65058
|
-
|
|
65028
|
+
_defineProperty34(this, "whiteboardAttrsMap", void 0);
|
|
65029
|
+
_defineProperty34(this, "pageMap", void 0);
|
|
65030
|
+
_defineProperty34(this, "requestUserMap", void 0);
|
|
65031
|
+
_defineProperty34(this, "userManager", void 0);
|
|
65032
|
+
_defineProperty34(this, "observers", /* @__PURE__ */ new Map());
|
|
65033
|
+
_defineProperty34(this, "hasPermission", void 0);
|
|
65034
|
+
_defineProperty34(this, "handleUserLeave", (user) => {
|
|
65059
65035
|
const cb = this.observers.get(user.id);
|
|
65060
65036
|
if (cb) {
|
|
65061
65037
|
this.requestUserMap(user.id).unobserve(cb);
|
|
65062
65038
|
}
|
|
65063
65039
|
});
|
|
65064
|
-
|
|
65040
|
+
_defineProperty34(this, "handleUserJoin", (user) => {
|
|
65065
65041
|
this.createCurrentPageObserver(user.id);
|
|
65066
65042
|
});
|
|
65067
|
-
|
|
65043
|
+
_defineProperty34(this, "handleMainPageChange", (evt) => {
|
|
65068
65044
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
65069
65045
|
if (key === WhiteboardKeys.currentPage) {
|
|
65070
65046
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
@@ -65082,7 +65058,7 @@ var PageModel = class extends EventEmitter11 {
|
|
|
65082
65058
|
}
|
|
65083
65059
|
}
|
|
65084
65060
|
});
|
|
65085
|
-
|
|
65061
|
+
_defineProperty34(this, "handleUserCurrentPageChange", (userId, evt) => {
|
|
65086
65062
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
65087
65063
|
if (key === WhiteboardKeys.currentPage) {
|
|
65088
65064
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
@@ -65099,7 +65075,7 @@ var PageModel = class extends EventEmitter11 {
|
|
|
65099
65075
|
}
|
|
65100
65076
|
}
|
|
65101
65077
|
});
|
|
65102
|
-
|
|
65078
|
+
_defineProperty34(this, "handlePageMapChange", () => {
|
|
65103
65079
|
this.emit("pagesChange", Array.from(this.pageMap.keys()));
|
|
65104
65080
|
});
|
|
65105
65081
|
this.hasPermission = hasPermission;
|
|
@@ -65141,11 +65117,11 @@ var PageModel = class extends EventEmitter11 {
|
|
|
65141
65117
|
}
|
|
65142
65118
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
65143
65119
|
if (cameraMode !== "main") {
|
|
65144
|
-
console.warn(
|
|
65120
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65145
65121
|
return false;
|
|
65146
65122
|
}
|
|
65147
65123
|
if (!this.hasPermission(WhiteboardPermissionFlag.mainView)) {
|
|
65148
|
-
console.warn(
|
|
65124
|
+
console.warn("cannot modify pages without WhiteboardPermissionFlag.mainView.");
|
|
65149
65125
|
return false;
|
|
65150
65126
|
}
|
|
65151
65127
|
return true;
|
|
@@ -65197,23 +65173,32 @@ var PageModel = class extends EventEmitter11 {
|
|
|
65197
65173
|
}
|
|
65198
65174
|
}
|
|
65199
65175
|
}
|
|
65176
|
+
dispose() {
|
|
65177
|
+
for (const entry of this.observers.entries()) {
|
|
65178
|
+
const [userId, observer] = entry;
|
|
65179
|
+
this.requestUserMap(userId).unobserve(observer);
|
|
65180
|
+
}
|
|
65181
|
+
this.userManager.off("join", this.handleUserJoin);
|
|
65182
|
+
this.userManager.off("leave", this.handleUserLeave);
|
|
65183
|
+
this.whiteboardAttrsMap.unobserve(this.handleMainPageChange);
|
|
65184
|
+
this.pageMap.unobserve(this.handlePageMapChange);
|
|
65185
|
+
}
|
|
65200
65186
|
};
|
|
65201
65187
|
var delay = (value) => new Promise((resolve) => setTimeout(resolve, value));
|
|
65202
65188
|
async function waitUntil(fn, timeout) {
|
|
65203
|
-
|
|
65189
|
+
const start = Date.now();
|
|
65204
65190
|
while (!fn() && Date.now() - start < timeout) {
|
|
65205
65191
|
await delay(50);
|
|
65206
|
-
start = Date.now();
|
|
65207
65192
|
}
|
|
65208
65193
|
}
|
|
65209
|
-
function
|
|
65210
|
-
return (r =
|
|
65194
|
+
function _defineProperty35(e, r, t) {
|
|
65195
|
+
return (r = _toPropertyKey35(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65211
65196
|
}
|
|
65212
|
-
function
|
|
65213
|
-
var i =
|
|
65197
|
+
function _toPropertyKey35(t) {
|
|
65198
|
+
var i = _toPrimitive35(t, "string");
|
|
65214
65199
|
return "symbol" == typeof i ? i : i + "";
|
|
65215
65200
|
}
|
|
65216
|
-
function
|
|
65201
|
+
function _toPrimitive35(t, r) {
|
|
65217
65202
|
if ("object" != typeof t || !t) return t;
|
|
65218
65203
|
var e = t[Symbol.toPrimitive];
|
|
65219
65204
|
if (void 0 !== e) {
|
|
@@ -65223,19 +65208,19 @@ function _toPrimitive36(t, r) {
|
|
|
65223
65208
|
}
|
|
65224
65209
|
return ("string" === r ? String : Number)(t);
|
|
65225
65210
|
}
|
|
65226
|
-
var IndexedNavigation = class extends
|
|
65211
|
+
var IndexedNavigation = class extends EventEmitter11 {
|
|
65227
65212
|
get idList() {
|
|
65228
65213
|
return this.pageModel.pageList().filter((id) => /^_i_/.test(id));
|
|
65229
65214
|
}
|
|
65230
65215
|
get head() {
|
|
65231
|
-
|
|
65216
|
+
const headId = Object.keys(this.list).find((key) => {
|
|
65232
65217
|
return this.list[key] && this.list[key].prev === "";
|
|
65233
65218
|
});
|
|
65234
65219
|
if (!headId) {
|
|
65235
|
-
log2(
|
|
65220
|
+
log2("indexed navigation confusion", {
|
|
65236
65221
|
list: JSON.stringify(this.list)
|
|
65237
65222
|
}, "error");
|
|
65238
|
-
throw new Error(
|
|
65223
|
+
throw new Error("indexed navigation confusion");
|
|
65239
65224
|
}
|
|
65240
65225
|
return headId;
|
|
65241
65226
|
}
|
|
@@ -65250,13 +65235,13 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65250
65235
|
}
|
|
65251
65236
|
constructor(pageModel, userMap, indexedPageMap, hasPermission) {
|
|
65252
65237
|
super();
|
|
65253
|
-
|
|
65254
|
-
|
|
65255
|
-
|
|
65256
|
-
|
|
65257
|
-
|
|
65258
|
-
|
|
65259
|
-
|
|
65238
|
+
_defineProperty35(this, "idPool", /* @__PURE__ */ new Set());
|
|
65239
|
+
_defineProperty35(this, "pageModel", void 0);
|
|
65240
|
+
_defineProperty35(this, "userMap", void 0);
|
|
65241
|
+
_defineProperty35(this, "indexedPageMap", void 0);
|
|
65242
|
+
_defineProperty35(this, "list", {});
|
|
65243
|
+
_defineProperty35(this, "hasPermission", void 0);
|
|
65244
|
+
_defineProperty35(this, "handleIndexedPageMapUpdate", (_evt) => {
|
|
65260
65245
|
this.list = this.indexedPageMap.get("list");
|
|
65261
65246
|
const needRemoveList = this.pageModel.pageList().filter((v) => /^_i_/.test(v) && Object.keys(this.list).indexOf(v) < 0);
|
|
65262
65247
|
const needAddList = Object.keys(this.list).filter((v) => this.pageModel.pageList().indexOf(v) < 0);
|
|
@@ -65311,8 +65296,8 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65311
65296
|
initIndexed() {
|
|
65312
65297
|
return new Promise((resolve) => {
|
|
65313
65298
|
setTimeout(() => {
|
|
65299
|
+
this.pageModel.addPage("_i_");
|
|
65314
65300
|
if (this.pageModel.pageList().length === 0) {
|
|
65315
|
-
this.pageModel.addPage("_i_");
|
|
65316
65301
|
resolve(true);
|
|
65317
65302
|
} else {
|
|
65318
65303
|
resolve(false);
|
|
@@ -65321,15 +65306,15 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65321
65306
|
});
|
|
65322
65307
|
}
|
|
65323
65308
|
/**
|
|
65324
|
-
|
|
65325
|
-
|
|
65326
|
-
|
|
65309
|
+
* 获取总页数
|
|
65310
|
+
* @returns {number}
|
|
65311
|
+
*/
|
|
65327
65312
|
get pageCount() {
|
|
65328
65313
|
return this.idList.length;
|
|
65329
65314
|
}
|
|
65330
65315
|
/**
|
|
65331
|
-
|
|
65332
|
-
|
|
65316
|
+
* 获取当前页索引
|
|
65317
|
+
*/
|
|
65333
65318
|
get currentPageIndex() {
|
|
65334
65319
|
const userPageId = this.userMap.get(WhiteboardKeys.currentPage);
|
|
65335
65320
|
return this.getPageIndex(userPageId);
|
|
@@ -65349,9 +65334,9 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65349
65334
|
return i;
|
|
65350
65335
|
}
|
|
65351
65336
|
/**
|
|
65352
|
-
|
|
65353
|
-
|
|
65354
|
-
|
|
65337
|
+
* 获取指定索引对应的 pageId
|
|
65338
|
+
* @param {number} index
|
|
65339
|
+
*/
|
|
65355
65340
|
getPageId(index) {
|
|
65356
65341
|
const firstKey = this.head;
|
|
65357
65342
|
if (firstKey) {
|
|
@@ -65373,20 +65358,20 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65373
65358
|
modifyDetect() {
|
|
65374
65359
|
const cameraMode = this.userMap.get(WhiteboardKeys.cameraMode);
|
|
65375
65360
|
if (cameraMode !== "main") {
|
|
65376
|
-
console.warn(
|
|
65361
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65377
65362
|
return false;
|
|
65378
65363
|
}
|
|
65379
65364
|
if (!this.hasPermission(WhiteboardPermissionFlag.mainView)) {
|
|
65380
|
-
console.warn(
|
|
65365
|
+
console.warn("cannot modify pages without WhiteboardPermissionFlag.mainView.");
|
|
65381
65366
|
return false;
|
|
65382
65367
|
}
|
|
65383
65368
|
return true;
|
|
65384
65369
|
}
|
|
65385
65370
|
/**
|
|
65386
|
-
|
|
65387
|
-
|
|
65388
|
-
|
|
65389
|
-
|
|
65371
|
+
* 在尾部插入新页面
|
|
65372
|
+
* @param {boolean=} goto 是否跳转到新页面, 默认 true
|
|
65373
|
+
* @return 总页数
|
|
65374
|
+
*/
|
|
65390
65375
|
pushPage() {
|
|
65391
65376
|
let goto = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
65392
65377
|
this.indexedPageMap.doc.transact(() => {
|
|
@@ -65415,11 +65400,11 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65415
65400
|
return this.pageCount;
|
|
65416
65401
|
}
|
|
65417
65402
|
/**
|
|
65418
|
-
|
|
65419
|
-
|
|
65420
|
-
|
|
65421
|
-
|
|
65422
|
-
|
|
65403
|
+
* 在 after 之后插入新页面
|
|
65404
|
+
* @param {number} after 在此页之后插入
|
|
65405
|
+
* @param {boolean=} goto 是否跳转到新页面, 默认 true
|
|
65406
|
+
* @return 总页数
|
|
65407
|
+
*/
|
|
65423
65408
|
insertPage(after) {
|
|
65424
65409
|
let goto = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
65425
65410
|
const afterPageId = this.getPageId(after);
|
|
@@ -65428,7 +65413,7 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65428
65413
|
}
|
|
65429
65414
|
const cameraMode = this.userMap.get(WhiteboardKeys.cameraMode);
|
|
65430
65415
|
if (cameraMode !== "main") {
|
|
65431
|
-
console.warn(
|
|
65416
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65432
65417
|
return this.pageCount;
|
|
65433
65418
|
}
|
|
65434
65419
|
const prev = this.list[afterPageId];
|
|
@@ -65471,8 +65456,8 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65471
65456
|
return this.pageCount;
|
|
65472
65457
|
}
|
|
65473
65458
|
/**
|
|
65474
|
-
|
|
65475
|
-
|
|
65459
|
+
* 跳转至上一页, 并返回跳转后的页面索引.
|
|
65460
|
+
*/
|
|
65476
65461
|
prevPage() {
|
|
65477
65462
|
const currentPageId = this.userMap.get(WhiteboardKeys.currentPage);
|
|
65478
65463
|
const data = this.list[currentPageId];
|
|
@@ -65484,8 +65469,8 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65484
65469
|
return nextIndex;
|
|
65485
65470
|
}
|
|
65486
65471
|
/**
|
|
65487
|
-
|
|
65488
|
-
|
|
65472
|
+
* 跳转至下一页, 并返回跳转后的页面索引.
|
|
65473
|
+
*/
|
|
65489
65474
|
nextPage() {
|
|
65490
65475
|
const currentPageId = this.userMap.get(WhiteboardKeys.currentPage);
|
|
65491
65476
|
const data = this.list[currentPageId];
|
|
@@ -65497,16 +65482,16 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65497
65482
|
return nextIndex;
|
|
65498
65483
|
}
|
|
65499
65484
|
/**
|
|
65500
|
-
|
|
65501
|
-
|
|
65502
|
-
|
|
65485
|
+
* 删除指定页面
|
|
65486
|
+
* @param {number} index
|
|
65487
|
+
*/
|
|
65503
65488
|
removePage(index) {
|
|
65504
65489
|
if (this.pageCount <= 1) {
|
|
65505
65490
|
return this.pageCount;
|
|
65506
65491
|
}
|
|
65507
65492
|
const cameraMode = this.userMap.get(WhiteboardKeys.cameraMode);
|
|
65508
65493
|
if (cameraMode !== "main") {
|
|
65509
|
-
console.warn(
|
|
65494
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65510
65495
|
return this.pageCount;
|
|
65511
65496
|
}
|
|
65512
65497
|
const targetId = this.getPageId(index);
|
|
@@ -65546,15 +65531,20 @@ var IndexedNavigation = class extends EventEmitter12 {
|
|
|
65546
65531
|
this.pageModel.gotoPage(targetId);
|
|
65547
65532
|
}
|
|
65548
65533
|
}
|
|
65534
|
+
dispose() {
|
|
65535
|
+
this.indexedPageMap.unobserve(this.handleIndexedPageMapUpdate);
|
|
65536
|
+
this.pageModel.off("switchPage");
|
|
65537
|
+
this.pageModel.off("pagesChange");
|
|
65538
|
+
}
|
|
65549
65539
|
};
|
|
65550
|
-
function
|
|
65551
|
-
return (r =
|
|
65540
|
+
function _defineProperty36(e, r, t) {
|
|
65541
|
+
return (r = _toPropertyKey36(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65552
65542
|
}
|
|
65553
|
-
function
|
|
65554
|
-
var i =
|
|
65543
|
+
function _toPropertyKey36(t) {
|
|
65544
|
+
var i = _toPrimitive36(t, "string");
|
|
65555
65545
|
return "symbol" == typeof i ? i : i + "";
|
|
65556
65546
|
}
|
|
65557
|
-
function
|
|
65547
|
+
function _toPrimitive36(t, r) {
|
|
65558
65548
|
if ("object" != typeof t || !t) return t;
|
|
65559
65549
|
var e = t[Symbol.toPrimitive];
|
|
65560
65550
|
if (void 0 !== e) {
|
|
@@ -65564,10 +65554,10 @@ function _toPrimitive37(t, r) {
|
|
|
65564
65554
|
}
|
|
65565
65555
|
return ("string" === r ? String : Number)(t);
|
|
65566
65556
|
}
|
|
65567
|
-
var ShadowEmitter = class extends
|
|
65557
|
+
var ShadowEmitter = class extends EventEmitter12 {
|
|
65568
65558
|
constructor(userMap) {
|
|
65569
65559
|
super();
|
|
65570
|
-
|
|
65560
|
+
_defineProperty36(this, "userMap", void 0);
|
|
65571
65561
|
this.userMap = userMap;
|
|
65572
65562
|
}
|
|
65573
65563
|
getActive() {
|
|
@@ -65577,14 +65567,14 @@ var ShadowEmitter = class extends EventEmitter13 {
|
|
|
65577
65567
|
return this.userMap.set("shadowActive", value);
|
|
65578
65568
|
}
|
|
65579
65569
|
};
|
|
65580
|
-
function
|
|
65581
|
-
return (r =
|
|
65570
|
+
function _defineProperty37(e, r, t) {
|
|
65571
|
+
return (r = _toPropertyKey37(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65582
65572
|
}
|
|
65583
|
-
function
|
|
65584
|
-
var i =
|
|
65573
|
+
function _toPropertyKey37(t) {
|
|
65574
|
+
var i = _toPrimitive37(t, "string");
|
|
65585
65575
|
return "symbol" == typeof i ? i : i + "";
|
|
65586
65576
|
}
|
|
65587
|
-
function
|
|
65577
|
+
function _toPrimitive37(t, r) {
|
|
65588
65578
|
if ("object" != typeof t || !t) return t;
|
|
65589
65579
|
var e = t[Symbol.toPrimitive];
|
|
65590
65580
|
if (void 0 !== e) {
|
|
@@ -65597,12 +65587,15 @@ function _toPrimitive38(t, r) {
|
|
|
65597
65587
|
var StraightLineTool = class extends WhiteboardTool {
|
|
65598
65588
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65599
65589
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65600
|
-
|
|
65601
|
-
|
|
65602
|
-
|
|
65590
|
+
_defineProperty37(this, "elementModel", null);
|
|
65591
|
+
_defineProperty37(this, "from", null);
|
|
65592
|
+
_defineProperty37(this, "to", null);
|
|
65603
65593
|
this.tool.minDistance = 1;
|
|
65604
65594
|
}
|
|
65605
65595
|
onMouseDown(event) {
|
|
65596
|
+
if (this.elementModel) {
|
|
65597
|
+
this.elementModel.dispose();
|
|
65598
|
+
}
|
|
65606
65599
|
this.elementModel = this.modelGetter().createStraightLine(true);
|
|
65607
65600
|
this.from = event.point.clone();
|
|
65608
65601
|
this.to = event.point.clone();
|
|
@@ -65622,14 +65615,14 @@ var StraightLineTool = class extends WhiteboardTool {
|
|
|
65622
65615
|
}
|
|
65623
65616
|
}
|
|
65624
65617
|
};
|
|
65625
|
-
function
|
|
65626
|
-
return (r =
|
|
65618
|
+
function _defineProperty38(e, r, t) {
|
|
65619
|
+
return (r = _toPropertyKey38(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65627
65620
|
}
|
|
65628
|
-
function
|
|
65629
|
-
var i =
|
|
65621
|
+
function _toPropertyKey38(t) {
|
|
65622
|
+
var i = _toPrimitive38(t, "string");
|
|
65630
65623
|
return "symbol" == typeof i ? i : i + "";
|
|
65631
65624
|
}
|
|
65632
|
-
function
|
|
65625
|
+
function _toPrimitive38(t, r) {
|
|
65633
65626
|
if ("object" != typeof t || !t) return t;
|
|
65634
65627
|
var e = t[Symbol.toPrimitive];
|
|
65635
65628
|
if (void 0 !== e) {
|
|
@@ -65642,8 +65635,8 @@ function _toPrimitive39(t, r) {
|
|
|
65642
65635
|
var GrabTool = class extends WhiteboardTool {
|
|
65643
65636
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope, camera) {
|
|
65644
65637
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65645
|
-
|
|
65646
|
-
|
|
65638
|
+
_defineProperty38(this, "camera", void 0);
|
|
65639
|
+
_defineProperty38(this, "downPoint", null);
|
|
65647
65640
|
this.camera = camera;
|
|
65648
65641
|
}
|
|
65649
65642
|
onMouseDown(event) {
|
|
@@ -65666,13 +65659,58 @@ var PointerTool = class extends WhiteboardTool {
|
|
|
65666
65659
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65667
65660
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65668
65661
|
}
|
|
65669
|
-
onMouseDown(
|
|
65662
|
+
onMouseDown(_event) {
|
|
65670
65663
|
}
|
|
65671
|
-
onMouseDrag(
|
|
65664
|
+
onMouseDrag(_event) {
|
|
65672
65665
|
}
|
|
65673
65666
|
onMouseUp() {
|
|
65674
65667
|
}
|
|
65675
65668
|
};
|
|
65669
|
+
function _defineProperty39(e, r, t) {
|
|
65670
|
+
return (r = _toPropertyKey39(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65671
|
+
}
|
|
65672
|
+
function _toPropertyKey39(t) {
|
|
65673
|
+
var i = _toPrimitive39(t, "string");
|
|
65674
|
+
return "symbol" == typeof i ? i : i + "";
|
|
65675
|
+
}
|
|
65676
|
+
function _toPrimitive39(t, r) {
|
|
65677
|
+
if ("object" != typeof t || !t) return t;
|
|
65678
|
+
var e = t[Symbol.toPrimitive];
|
|
65679
|
+
if (void 0 !== e) {
|
|
65680
|
+
var i = e.call(t, r || "default");
|
|
65681
|
+
if ("object" != typeof i) return i;
|
|
65682
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
65683
|
+
}
|
|
65684
|
+
return ("string" === r ? String : Number)(t);
|
|
65685
|
+
}
|
|
65686
|
+
var SequenceExecutor = class {
|
|
65687
|
+
constructor() {
|
|
65688
|
+
_defineProperty39(this, "tasks", []);
|
|
65689
|
+
_defineProperty39(this, "isRunning", false);
|
|
65690
|
+
}
|
|
65691
|
+
addTask(task) {
|
|
65692
|
+
this.tasks.push(task);
|
|
65693
|
+
if (!this.isRunning) {
|
|
65694
|
+
this.execute();
|
|
65695
|
+
}
|
|
65696
|
+
}
|
|
65697
|
+
async execute() {
|
|
65698
|
+
if (this.isRunning) {
|
|
65699
|
+
return;
|
|
65700
|
+
}
|
|
65701
|
+
this.isRunning = true;
|
|
65702
|
+
while (this.tasks.length > 0) {
|
|
65703
|
+
const task = this.tasks.shift();
|
|
65704
|
+
if (task) {
|
|
65705
|
+
try {
|
|
65706
|
+
await task();
|
|
65707
|
+
} catch (e) {
|
|
65708
|
+
}
|
|
65709
|
+
}
|
|
65710
|
+
}
|
|
65711
|
+
this.isRunning = false;
|
|
65712
|
+
}
|
|
65713
|
+
};
|
|
65676
65714
|
function _defineProperty40(e, r, t) {
|
|
65677
65715
|
return (r = _toPropertyKey40(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65678
65716
|
}
|
|
@@ -65730,16 +65768,18 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65730
65768
|
_defineProperty40(this, "hasPenInput", null);
|
|
65731
65769
|
_defineProperty40(this, "disableViewModelUpdate", false);
|
|
65732
65770
|
_defineProperty40(this, "internalResizeObserver", true);
|
|
65771
|
+
_defineProperty40(this, "sequenceExecutor", new SequenceExecutor());
|
|
65733
65772
|
_defineProperty40(this, "linkTarget", null);
|
|
65734
65773
|
_defineProperty40(this, "enableToolEvent", () => {
|
|
65735
65774
|
return !(this.inputType === "pen" && !this.isPenEvent);
|
|
65736
65775
|
});
|
|
65737
65776
|
_defineProperty40(this, "handlePageSwitch", (pageId) => {
|
|
65738
|
-
|
|
65739
|
-
editor.
|
|
65740
|
-
|
|
65741
|
-
|
|
65742
|
-
|
|
65777
|
+
this.sequenceExecutor.addTask(async () => {
|
|
65778
|
+
for (const editor of this.editors.values()) {
|
|
65779
|
+
editor.hidden();
|
|
65780
|
+
}
|
|
65781
|
+
this.selectElementsModel.clearSelectElementForSelf();
|
|
65782
|
+
await waitUntil(() => this.layers.has(pageId), 1e3);
|
|
65743
65783
|
if (this.layers.has(pageId)) {
|
|
65744
65784
|
for (const entry of this.layers.entries()) {
|
|
65745
65785
|
entry[1].off("elementInsert", this.handleElementInsert);
|
|
@@ -65751,6 +65791,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65751
65791
|
renderableModel.on("elementRemove", this.handleElementRemove);
|
|
65752
65792
|
renderableModel.on("elementClear", this.handleElementClear);
|
|
65753
65793
|
renderableModel.flushRenderables();
|
|
65794
|
+
this.paperScope.project.activeLayer.data.pageId = pageId;
|
|
65754
65795
|
const others = this.userManager.userIdList().filter((v) => v !== this.userId);
|
|
65755
65796
|
for (const other of others) {
|
|
65756
65797
|
if (this.userMap(other).get(WhiteboardKeys.currentPage) === pageId) {
|
|
@@ -65760,9 +65801,11 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65760
65801
|
}
|
|
65761
65802
|
}
|
|
65762
65803
|
}
|
|
65804
|
+
} else {
|
|
65805
|
+
console.warn(`[@netless/forge-whiteboard] page ${pageId} not found`);
|
|
65806
|
+
log3(`[@netless/forge-whiteboard] page ${pageId} not found`, {}, "warning");
|
|
65763
65807
|
}
|
|
65764
|
-
|
|
65765
|
-
waitUntil(() => this.undoManagers.has(pageId), 3e3).then(() => {
|
|
65808
|
+
await waitUntil(() => this.undoManagers.has(pageId), 1e3);
|
|
65766
65809
|
if (this.undoManagers.has(pageId)) {
|
|
65767
65810
|
for (const entry of this.undoManagers.entries()) {
|
|
65768
65811
|
entry[1].off("stack-item-added", this.handleStackItemAdded);
|
|
@@ -65770,10 +65813,13 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65770
65813
|
}
|
|
65771
65814
|
this.undoManagers.get(pageId).on("stack-item-added", this.handleStackItemAdded);
|
|
65772
65815
|
this.undoManagers.get(pageId).on("stack-item-popped", this.handleStackItemPopped);
|
|
65816
|
+
} else {
|
|
65817
|
+
console.warn(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`);
|
|
65818
|
+
log3(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`, {}, "warning");
|
|
65773
65819
|
}
|
|
65820
|
+
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
65821
|
+
this.emitter.emit("undoStackLength", this.undoManager?.undoStack.length ?? 0);
|
|
65774
65822
|
});
|
|
65775
|
-
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
65776
|
-
this.emitter.emit("undoStackLength", this.undoManager?.undoStack.length ?? 0);
|
|
65777
65823
|
});
|
|
65778
65824
|
_defineProperty40(this, "hasPermission", (flag) => {
|
|
65779
65825
|
return this.permissions.hasPermission(flag, this.userId);
|
|
@@ -65803,7 +65849,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65803
65849
|
this.undoManagers.set(id, undoManager);
|
|
65804
65850
|
}
|
|
65805
65851
|
}
|
|
65806
|
-
for (
|
|
65852
|
+
for (const entry of this.layers.entries()) {
|
|
65807
65853
|
if (ids.indexOf(entry[0]) < 0) {
|
|
65808
65854
|
const renderableModel = this.layers.get(entry[0]);
|
|
65809
65855
|
this.layers.delete(entry[0]);
|
|
@@ -65820,7 +65866,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65820
65866
|
}
|
|
65821
65867
|
});
|
|
65822
65868
|
_defineProperty40(this, "getCurrentRenderableModel", () => {
|
|
65823
|
-
|
|
65869
|
+
const layerId = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
65824
65870
|
if (!this.layers.has(layerId)) {
|
|
65825
65871
|
this.emitter.emit("error", 300002, `target page: ${layerId} not found`);
|
|
65826
65872
|
}
|
|
@@ -65901,7 +65947,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65901
65947
|
}).filter((v) => !!v);
|
|
65902
65948
|
editor.setTargets(elementModels);
|
|
65903
65949
|
if (elementModels.length === 1) {
|
|
65904
|
-
|
|
65950
|
+
const model = elementModels[0];
|
|
65905
65951
|
if (model.item) {
|
|
65906
65952
|
const topLeft = this.paperScope.project.view.projectToView(model.item.bounds.topLeft);
|
|
65907
65953
|
const bottomRight = this.paperScope.project.view.projectToView(model.item.bounds.bottomRight);
|
|
@@ -65947,6 +65993,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
65947
65993
|
});
|
|
65948
65994
|
requestAnimationFrameHook(this.paperScope);
|
|
65949
65995
|
requestAnimationFrameHook(this.shadowScope);
|
|
65996
|
+
const that = this;
|
|
65950
65997
|
this.rootElement.setAttribute("data-forge-app", "whiteboard");
|
|
65951
65998
|
document.body.addEventListener("pointerdown", (evt) => {
|
|
65952
65999
|
this.isPenEvent = evt.pointerType === "pen";
|
|
@@ -66118,7 +66165,6 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66118
66165
|
errorMessage
|
|
66119
66166
|
});
|
|
66120
66167
|
});
|
|
66121
|
-
const that = this;
|
|
66122
66168
|
Object.defineProperty(this.emitter, "tool", {
|
|
66123
66169
|
get() {
|
|
66124
66170
|
return that.toolbarModel.currentTool;
|
|
@@ -66215,6 +66261,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66215
66261
|
this.permissions = new WhiteboardPermissions(this.userManager, (userId) => {
|
|
66216
66262
|
return this.userMap(userId);
|
|
66217
66263
|
});
|
|
66264
|
+
this.permissions.setPermission(WhiteboardPermissionFlag.all);
|
|
66218
66265
|
this.emitter["permissions"] = this.permissions;
|
|
66219
66266
|
this.emitter["selfUserId"] = this.userId;
|
|
66220
66267
|
this.option = option;
|
|
@@ -66466,7 +66513,7 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66466
66513
|
if (renderableModel.elementModels.has(key)) {
|
|
66467
66514
|
elementModel = renderableModel.elementModels.get(key) ?? null;
|
|
66468
66515
|
} else {
|
|
66469
|
-
|
|
66516
|
+
const elementMap = renderableModel.elements.get(key);
|
|
66470
66517
|
if (elementMap) {
|
|
66471
66518
|
elementModel = renderableModel.convertToModel(elementMap);
|
|
66472
66519
|
}
|
|
@@ -66553,6 +66600,9 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66553
66600
|
const size = this.paperScope.view.viewSize;
|
|
66554
66601
|
return [size.width, size.height];
|
|
66555
66602
|
}
|
|
66603
|
+
getInherentScale() {
|
|
66604
|
+
return this.camera.getInherentScale();
|
|
66605
|
+
}
|
|
66556
66606
|
updateInternalResizeObserverStatus(value) {
|
|
66557
66607
|
this.internalResizeObserver = value;
|
|
66558
66608
|
}
|
|
@@ -66572,73 +66622,91 @@ var WhiteboardApplication = class extends AbstractApplication {
|
|
|
66572
66622
|
this.shadowScope.project.clear();
|
|
66573
66623
|
this.snapshotScope.project.clear();
|
|
66574
66624
|
this.resizeObserver.disconnect();
|
|
66625
|
+
this.unlink();
|
|
66626
|
+
for (const entry of this.undoManagers.entries()) {
|
|
66627
|
+
entry[1].off("stack-item-added", this.handleStackItemAdded);
|
|
66628
|
+
entry[1].off("stack-item-popped", this.handleStackItemPopped);
|
|
66629
|
+
}
|
|
66630
|
+
for (const entry of this.layers.entries()) {
|
|
66631
|
+
entry[1].dispose();
|
|
66632
|
+
entry[1].removeAllListeners();
|
|
66633
|
+
}
|
|
66634
|
+
this.camera.dispose();
|
|
66635
|
+
this.pageModel.dispose();
|
|
66636
|
+
this.pageModel.removeAllListeners();
|
|
66637
|
+
for (const entry of this.editors.entries()) {
|
|
66638
|
+
entry[1].dispose();
|
|
66639
|
+
}
|
|
66640
|
+
this.toolbarModel.dispose();
|
|
66641
|
+
this.emitter.indexedNavigation.dispose();
|
|
66642
|
+
this.permissions.dispose();
|
|
66575
66643
|
}
|
|
66576
66644
|
};
|
|
66577
66645
|
_defineProperty40(WhiteboardApplication, "applicationName", WHITEBOARD_APP_NAME);
|
|
66578
66646
|
|
|
66579
66647
|
// src/SlideApplication.ts
|
|
66580
66648
|
var import_slide = __toESM(require_Slide());
|
|
66581
|
-
import { AbstractApplication as AbstractApplication2 } from "@netless/forge-room";
|
|
66649
|
+
import { AbstractApplication as AbstractApplication2, kvStore } from "@netless/forge-room";
|
|
66582
66650
|
|
|
66583
66651
|
// src/Slide.ts
|
|
66584
|
-
import
|
|
66585
|
-
var SlideForge = class extends
|
|
66652
|
+
import EventEmitter13 from "eventemitter3";
|
|
66653
|
+
var SlideForge = class extends EventEmitter13 {
|
|
66586
66654
|
view;
|
|
66587
66655
|
permissions;
|
|
66588
66656
|
footView;
|
|
66589
66657
|
sideBarView;
|
|
66590
66658
|
/**
|
|
66591
|
-
|
|
66592
|
-
|
|
66659
|
+
* 当前页面索引, 从 0 开始
|
|
66660
|
+
*/
|
|
66593
66661
|
pageIndex;
|
|
66594
66662
|
/**
|
|
66595
|
-
|
|
66596
|
-
|
|
66663
|
+
* 总页数
|
|
66664
|
+
*/
|
|
66597
66665
|
pageCount;
|
|
66598
66666
|
/**
|
|
66599
|
-
|
|
66600
|
-
|
|
66601
|
-
|
|
66667
|
+
* 切换到参数指定页面, index 从 0 开始
|
|
66668
|
+
* @param {number} index 页面索引
|
|
66669
|
+
*/
|
|
66602
66670
|
goto;
|
|
66603
66671
|
/**
|
|
66604
|
-
|
|
66605
|
-
|
|
66672
|
+
* 下一步, 如果已经是本页的最后一步, 则切换到下一页
|
|
66673
|
+
*/
|
|
66606
66674
|
nextStep;
|
|
66607
66675
|
/**
|
|
66608
|
-
|
|
66609
|
-
|
|
66676
|
+
* 上一步, 如果已经是本页的第一步, 则切换到上一页
|
|
66677
|
+
*/
|
|
66610
66678
|
prevStep;
|
|
66611
66679
|
/**
|
|
66612
|
-
|
|
66613
|
-
|
|
66680
|
+
* 下一页, 如果是最后一页, 则不执行任何操作
|
|
66681
|
+
*/
|
|
66614
66682
|
nextPage;
|
|
66615
66683
|
/**
|
|
66616
|
-
|
|
66617
|
-
|
|
66684
|
+
* 上一页, 如果是第一页, 则不执行任何操作
|
|
66685
|
+
*/
|
|
66618
66686
|
prevPage;
|
|
66619
66687
|
/**
|
|
66620
|
-
|
|
66621
|
-
|
|
66688
|
+
* 切换侧栏显示状态
|
|
66689
|
+
*/
|
|
66622
66690
|
sideBarToggle;
|
|
66623
66691
|
/**
|
|
66624
|
-
|
|
66625
|
-
|
|
66626
|
-
|
|
66692
|
+
* 获取预览图图片内容, base64 编码
|
|
66693
|
+
* @param {number} index 页面索引
|
|
66694
|
+
*/
|
|
66627
66695
|
imgContent;
|
|
66628
66696
|
/**
|
|
66629
|
-
|
|
66630
|
-
|
|
66631
|
-
|
|
66697
|
+
* 获取预览图图片链接
|
|
66698
|
+
* @param {number} index 页面索引
|
|
66699
|
+
*/
|
|
66632
66700
|
imgUrl;
|
|
66633
66701
|
/**
|
|
66634
|
-
|
|
66635
|
-
|
|
66636
|
-
|
|
66702
|
+
* 获取预览图图片尺寸
|
|
66703
|
+
* @param {number} index 页面索引
|
|
66704
|
+
*/
|
|
66637
66705
|
imgSize;
|
|
66638
66706
|
};
|
|
66639
66707
|
|
|
66640
66708
|
// src/ForgeSlidePermession.ts
|
|
66641
|
-
import
|
|
66709
|
+
import { AbstractApplicationPermissions as AbstractApplicationPermissions2 } from "@netless/forge-room";
|
|
66642
66710
|
var ForgeSlidePermissionFlag = /* @__PURE__ */ ((ForgeSlidePermissionFlag2) => {
|
|
66643
66711
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["none"] = 0] = "none";
|
|
66644
66712
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["changeStep"] = 1] = "changeStep";
|
|
@@ -66647,58 +66715,12 @@ var ForgeSlidePermissionFlag = /* @__PURE__ */ ((ForgeSlidePermissionFlag2) => {
|
|
|
66647
66715
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["all"] = 7] = "all";
|
|
66648
66716
|
return ForgeSlidePermissionFlag2;
|
|
66649
66717
|
})(ForgeSlidePermissionFlag || {});
|
|
66650
|
-
var ForgeSlidePermissions = class extends
|
|
66651
|
-
requestUserMap;
|
|
66652
|
-
userManager;
|
|
66653
|
-
observers = /* @__PURE__ */ new Map();
|
|
66654
|
-
constructor(userManager, requestUserMap) {
|
|
66655
|
-
super();
|
|
66656
|
-
this.userManager = userManager;
|
|
66657
|
-
this.requestUserMap = requestUserMap;
|
|
66658
|
-
this.createModel(this.userManager.selfId);
|
|
66659
|
-
this.userManager.userIdList().forEach((userId) => {
|
|
66660
|
-
this.addObserve(userId);
|
|
66661
|
-
});
|
|
66662
|
-
this.userManager.on("join", this.handleUserJoin);
|
|
66663
|
-
this.userManager.on("leave", this.handleUserLeave);
|
|
66664
|
-
}
|
|
66665
|
-
handleUserLeave = (user) => {
|
|
66666
|
-
const cb = this.observers.get(user.id);
|
|
66667
|
-
if (cb) {
|
|
66668
|
-
this.requestUserMap(user.id).unobserve(cb);
|
|
66669
|
-
}
|
|
66670
|
-
};
|
|
66671
|
-
handleUserJoin = (user) => {
|
|
66672
|
-
this.addObserve(user.id);
|
|
66673
|
-
};
|
|
66674
|
-
addObserve(userId) {
|
|
66675
|
-
const observer = (evt) => {
|
|
66676
|
-
this.handleUserPermissionChange(userId, evt);
|
|
66677
|
-
};
|
|
66678
|
-
this.observers.set(userId, observer);
|
|
66679
|
-
this.requestUserMap(userId).observe(observer);
|
|
66680
|
-
}
|
|
66681
|
-
createModel(userId) {
|
|
66682
|
-
const userMap = this.requestUserMap(userId);
|
|
66683
|
-
if (!userMap.has("permission")) {
|
|
66684
|
-
userMap.set("permission", 0);
|
|
66685
|
-
}
|
|
66686
|
-
}
|
|
66687
|
-
handleUserPermissionChange(userId, evt) {
|
|
66688
|
-
for (const [key, value] of evt.changes.keys.entries()) {
|
|
66689
|
-
if (key === "permission") {
|
|
66690
|
-
if (value.action === "add" || value.action === "update") {
|
|
66691
|
-
const newValue = this.requestUserMap(userId).get("permission");
|
|
66692
|
-
this.emit("change", userId, this.resolveFlags(newValue), newValue);
|
|
66693
|
-
}
|
|
66694
|
-
}
|
|
66695
|
-
}
|
|
66696
|
-
}
|
|
66718
|
+
var ForgeSlidePermissions = class extends AbstractApplicationPermissions2 {
|
|
66697
66719
|
/**
|
|
66698
|
-
|
|
66699
|
-
|
|
66700
|
-
|
|
66701
|
-
|
|
66720
|
+
* 解析权限列表组合
|
|
66721
|
+
* @param {number} value - 权限数字值
|
|
66722
|
+
* @return {WhiteboardPermissionFlag[]} - 权限列表
|
|
66723
|
+
*/
|
|
66702
66724
|
resolveFlags(value) {
|
|
66703
66725
|
return [
|
|
66704
66726
|
2 /* changePage */,
|
|
@@ -66706,53 +66728,10 @@ var ForgeSlidePermissions = class extends EventEmitter15 {
|
|
|
66706
66728
|
4 /* clickAnim */
|
|
66707
66729
|
].filter((v) => (v & value) !== 0);
|
|
66708
66730
|
}
|
|
66709
|
-
/**
|
|
66710
|
-
* 获取权限列表组合对应的数值
|
|
66711
|
-
* @param { string } userId 不传表示获取自己
|
|
66712
|
-
*/
|
|
66713
|
-
getPermissionValue(userId) {
|
|
66714
|
-
return this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
66715
|
-
}
|
|
66716
|
-
/**
|
|
66717
|
-
* 获取权限列表
|
|
66718
|
-
* @param {string=} userId 可选, 不传表示获取自己
|
|
66719
|
-
*/
|
|
66720
|
-
getPermissionFlags(userId) {
|
|
66721
|
-
const value = this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
66722
|
-
return this.resolveFlags(value);
|
|
66723
|
-
}
|
|
66724
|
-
/**
|
|
66725
|
-
* 返回对应 userId 是否有相应权限
|
|
66726
|
-
* @param {string=} userId 可选, 不传表示返回自己是否有相应权限
|
|
66727
|
-
* @param {WhiteboardPermissionFlag} flag
|
|
66728
|
-
*/
|
|
66729
|
-
hasPermission(flag, userId) {
|
|
66730
|
-
return ((this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0) & flag) !== 0;
|
|
66731
|
-
}
|
|
66732
|
-
/**
|
|
66733
|
-
* 添加权限
|
|
66734
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
66735
|
-
* @param {string=} userId 可选, 为 userId 添加权限, 不传表示为自己添加权限
|
|
66736
|
-
*/
|
|
66737
|
-
addPermission(flag, userId) {
|
|
66738
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
66739
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
66740
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue | flag);
|
|
66741
|
-
}
|
|
66742
|
-
/**
|
|
66743
|
-
* 移除权限
|
|
66744
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
66745
|
-
* @param {string=} userId 可选, 为 userId 移除权限, 不传表示为自己移除权限
|
|
66746
|
-
*/
|
|
66747
|
-
removePermission(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
66731
|
};
|
|
66753
66732
|
|
|
66754
66733
|
// src/FooterView.ts
|
|
66755
|
-
import
|
|
66734
|
+
import EventEmitter14 from "eventemitter3";
|
|
66756
66735
|
|
|
66757
66736
|
// src/icons.ts
|
|
66758
66737
|
var prevPage = (color) => `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none">
|
|
@@ -66783,13 +66762,14 @@ var Icons = {
|
|
|
66783
66762
|
|
|
66784
66763
|
// src/FooterView.ts
|
|
66785
66764
|
var EM_COLOR = "#8C8C8C";
|
|
66786
|
-
var FooterView = class extends
|
|
66765
|
+
var FooterView = class extends EventEmitter14 {
|
|
66787
66766
|
root;
|
|
66788
66767
|
prevStep;
|
|
66789
66768
|
nextStep;
|
|
66790
66769
|
prevPage;
|
|
66791
66770
|
nextPage;
|
|
66792
66771
|
sideBarToggle;
|
|
66772
|
+
eventMap = /* @__PURE__ */ new Map();
|
|
66793
66773
|
constructor() {
|
|
66794
66774
|
super();
|
|
66795
66775
|
this.root = document.createElement("div");
|
|
@@ -66853,24 +66833,43 @@ var FooterView = class extends EventEmitter16 {
|
|
|
66853
66833
|
icon.style.borderRadius = "2px";
|
|
66854
66834
|
icon.style.margin = "6px";
|
|
66855
66835
|
icon.innerHTML = svgContent;
|
|
66856
|
-
|
|
66836
|
+
const onClickHandle = () => {
|
|
66857
66837
|
action();
|
|
66858
|
-
}
|
|
66859
|
-
|
|
66838
|
+
};
|
|
66839
|
+
const onMouseOverHandle = () => {
|
|
66860
66840
|
icon.style.backgroundColor = "#f0f0f0";
|
|
66861
|
-
}
|
|
66862
|
-
|
|
66841
|
+
};
|
|
66842
|
+
const onMouseOutHandle = () => {
|
|
66863
66843
|
icon.style.backgroundColor = "transparent";
|
|
66864
|
-
}
|
|
66844
|
+
};
|
|
66845
|
+
icon.addEventListener("click", onClickHandle);
|
|
66846
|
+
icon.addEventListener("mouseover", onMouseOverHandle);
|
|
66847
|
+
icon.addEventListener("mouseout", onMouseOutHandle);
|
|
66848
|
+
this.eventMap.set(icon, [onClickHandle, onMouseOutHandle, onMouseOverHandle]);
|
|
66865
66849
|
return icon;
|
|
66866
66850
|
}
|
|
66851
|
+
clearHTMLEventListeners() {
|
|
66852
|
+
this.eventMap.forEach((value, key) => {
|
|
66853
|
+
if (key) {
|
|
66854
|
+
const [clickEvent, mouseOutEvent, mouseOverEvent] = value;
|
|
66855
|
+
key.removeEventListener("click", clickEvent);
|
|
66856
|
+
key.removeEventListener("mouseover", mouseOverEvent);
|
|
66857
|
+
key.removeEventListener("mouseout", mouseOutEvent);
|
|
66858
|
+
}
|
|
66859
|
+
});
|
|
66860
|
+
}
|
|
66861
|
+
dispose() {
|
|
66862
|
+
this.removeAllListeners();
|
|
66863
|
+
this.clearHTMLEventListeners();
|
|
66864
|
+
}
|
|
66867
66865
|
};
|
|
66868
66866
|
|
|
66869
66867
|
// src/SiderBarView.ts
|
|
66870
|
-
import
|
|
66871
|
-
var SideBarView = class extends
|
|
66868
|
+
import EventEmitter15 from "eventemitter3";
|
|
66869
|
+
var SideBarView = class extends EventEmitter15 {
|
|
66872
66870
|
root = document.createElement("div");
|
|
66873
|
-
|
|
66871
|
+
isShow = false;
|
|
66872
|
+
eventsMap = /* @__PURE__ */ new Map();
|
|
66874
66873
|
constructor() {
|
|
66875
66874
|
super();
|
|
66876
66875
|
this.root.style.backgroundColor = "#eee";
|
|
@@ -66883,38 +66882,38 @@ var SideBarView = class extends EventEmitter17 {
|
|
|
66883
66882
|
this.root.style.zIndex = "5";
|
|
66884
66883
|
this.root.style.transition = "left 0.3s ease-in-out";
|
|
66885
66884
|
this.root.style.overflow = "auto";
|
|
66886
|
-
this.root.style.border = "1px solid #ccc";
|
|
66887
|
-
this.root.style.boxShadow = "0 0 10px rgba(0, 0, 0, 0.1)";
|
|
66888
66885
|
this.root.style.display = "flex";
|
|
66889
66886
|
this.root.style.flexDirection = "column";
|
|
66890
66887
|
this.root.style.justifyContent = "flex-start";
|
|
66891
66888
|
this.root.style.alignItems = "center";
|
|
66892
66889
|
}
|
|
66893
|
-
|
|
66894
|
-
|
|
66895
|
-
}
|
|
66896
|
-
onMouseOut = (itemContainer) => {
|
|
66897
|
-
itemContainer.style.borderColor = "transparent";
|
|
66898
|
-
};
|
|
66899
|
-
onClickHandle = (index) => {
|
|
66900
|
-
this.emit("pageChange", index);
|
|
66901
|
-
};
|
|
66890
|
+
get isShowSideBar() {
|
|
66891
|
+
return this.isShow;
|
|
66892
|
+
}
|
|
66902
66893
|
initialize(slideCount, option) {
|
|
66903
66894
|
for (let i = 1; i <= slideCount; i++) {
|
|
66904
66895
|
const itemContainer = document.createElement("div");
|
|
66905
|
-
this.itemList.push(itemContainer);
|
|
66906
66896
|
itemContainer.style.width = "60%";
|
|
66907
66897
|
itemContainer.style.display = "flex";
|
|
66908
66898
|
itemContainer.style.justifyContent = "center";
|
|
66909
66899
|
itemContainer.style.alignItems = "flex-start";
|
|
66910
|
-
itemContainer.style.border = "7px solid transparent";
|
|
66911
66900
|
itemContainer.style.position = "relative";
|
|
66912
66901
|
itemContainer.style.borderRadius = "4px";
|
|
66913
66902
|
itemContainer.style.transition = "border-color .3s";
|
|
66914
66903
|
itemContainer.style.marginBottom = "10px";
|
|
66915
|
-
|
|
66916
|
-
|
|
66917
|
-
|
|
66904
|
+
const onMouseOverHandle = () => {
|
|
66905
|
+
itemContainer.style.borderColor = "#ccc";
|
|
66906
|
+
};
|
|
66907
|
+
const onMouseOutHandle = () => {
|
|
66908
|
+
itemContainer.style.borderColor = "transparent";
|
|
66909
|
+
};
|
|
66910
|
+
const onClickHandle = () => {
|
|
66911
|
+
this.emit("pageChange", i);
|
|
66912
|
+
};
|
|
66913
|
+
itemContainer.addEventListener("click", onClickHandle);
|
|
66914
|
+
itemContainer.addEventListener("mouseover", onMouseOverHandle);
|
|
66915
|
+
itemContainer.addEventListener("mouseout", onMouseOutHandle);
|
|
66916
|
+
this.eventsMap.set(itemContainer, [onClickHandle, onMouseOverHandle, onMouseOutHandle]);
|
|
66918
66917
|
const pageIndex = document.createElement("span");
|
|
66919
66918
|
pageIndex.textContent = `${i}`;
|
|
66920
66919
|
pageIndex.style.position = "absolute";
|
|
@@ -66932,10 +66931,31 @@ var SideBarView = class extends EventEmitter17 {
|
|
|
66932
66931
|
this.root.appendChild(itemContainer);
|
|
66933
66932
|
}
|
|
66934
66933
|
}
|
|
66934
|
+
hidden() {
|
|
66935
|
+
if (!this.root) {
|
|
66936
|
+
return;
|
|
66937
|
+
}
|
|
66938
|
+
this.root.style.left = "-240px";
|
|
66939
|
+
this.root.style.border = "none";
|
|
66940
|
+
this.root.style.boxShadow = "none";
|
|
66941
|
+
this.isShow = false;
|
|
66942
|
+
}
|
|
66943
|
+
show() {
|
|
66944
|
+
if (!this.root) {
|
|
66945
|
+
return;
|
|
66946
|
+
}
|
|
66947
|
+
this.root.style.left = "0";
|
|
66948
|
+
this.root.style.border = "1px solid #ccc";
|
|
66949
|
+
this.root.style.boxShadow = "0 0 10px rgba(0, 0, 0, 0.1)";
|
|
66950
|
+
this.isShow = true;
|
|
66951
|
+
}
|
|
66935
66952
|
dispose() {
|
|
66936
|
-
this.
|
|
66937
|
-
|
|
66938
|
-
|
|
66953
|
+
this.removeAllListeners();
|
|
66954
|
+
this.eventsMap.forEach((handlers, element) => {
|
|
66955
|
+
const [clickEvent, mouseOverEvent, mouseOutEvent] = handlers;
|
|
66956
|
+
element.removeEventListener("click", clickEvent);
|
|
66957
|
+
element.removeEventListener("mouseover", mouseOverEvent);
|
|
66958
|
+
element.removeEventListener("mouseout", mouseOutEvent);
|
|
66939
66959
|
});
|
|
66940
66960
|
}
|
|
66941
66961
|
};
|
|
@@ -66979,7 +66999,6 @@ async function delay2(time) {
|
|
|
66979
66999
|
}
|
|
66980
67000
|
|
|
66981
67001
|
// src/SlideApplication.ts
|
|
66982
|
-
import { kvStore } from "@netless/forge-room";
|
|
66983
67002
|
var Slide_APP_NAME = "forge_slide";
|
|
66984
67003
|
var SlideApplication = class extends AbstractApplication2 {
|
|
66985
67004
|
static applicationName = Slide_APP_NAME;
|
|
@@ -67064,10 +67083,10 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67064
67083
|
if (!this.permissions.hasPermission(2 /* changePage */)) {
|
|
67065
67084
|
return;
|
|
67066
67085
|
}
|
|
67067
|
-
if (this.sideBar.
|
|
67068
|
-
this.sideBar.
|
|
67086
|
+
if (this.sideBar.isShowSideBar) {
|
|
67087
|
+
this.sideBar.hidden();
|
|
67069
67088
|
} else {
|
|
67070
|
-
this.sideBar.
|
|
67089
|
+
this.sideBar.show();
|
|
67071
67090
|
}
|
|
67072
67091
|
});
|
|
67073
67092
|
this.rootView.appendChild(this.contentContainer);
|
|
@@ -67255,12 +67274,35 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67255
67274
|
}
|
|
67256
67275
|
}
|
|
67257
67276
|
};
|
|
67277
|
+
keyBoardEvents = (event) => {
|
|
67278
|
+
if (event.key === "ArrowLeft") {
|
|
67279
|
+
this.footer.emit("prevStep");
|
|
67280
|
+
} else if (event.key === "ArrowRight") {
|
|
67281
|
+
this.footer.emit("nextStep");
|
|
67282
|
+
} else if (event.key === "ArrowUp") {
|
|
67283
|
+
this.footer.emit("prevPage");
|
|
67284
|
+
} else if (event.key === "ArrowDown") {
|
|
67285
|
+
this.footer.emit("nextPage");
|
|
67286
|
+
}
|
|
67287
|
+
};
|
|
67288
|
+
bindKeyBoardEvent() {
|
|
67289
|
+
document.addEventListener("keydown", this.keyBoardEvents);
|
|
67290
|
+
}
|
|
67291
|
+
unbindKeyBoardEvent() {
|
|
67292
|
+
document.removeEventListener("keydown", this.keyBoardEvents);
|
|
67293
|
+
}
|
|
67294
|
+
async onFocusInstance() {
|
|
67295
|
+
this.bindKeyBoardEvent();
|
|
67296
|
+
}
|
|
67297
|
+
onRefocusInstance() {
|
|
67298
|
+
this.unbindKeyBoardEvent();
|
|
67299
|
+
}
|
|
67258
67300
|
async initialize(option) {
|
|
67259
67301
|
this.prefix = option.prefix;
|
|
67260
67302
|
this.taskId = option.taskId;
|
|
67261
67303
|
const whiteboardApp = new WhiteboardApplication();
|
|
67262
67304
|
whiteboardApp.roomDoc = this.roomDoc;
|
|
67263
|
-
whiteboardApp.appId = `${option.taskId}_wb`;
|
|
67305
|
+
whiteboardApp.appId = `${option.taskId}_${this.appId}_wb`;
|
|
67264
67306
|
whiteboardApp.userId = this.userId;
|
|
67265
67307
|
whiteboardApp.userManager = this.userManager;
|
|
67266
67308
|
whiteboardApp.applicationManager = this.applicationManager;
|
|
@@ -67310,30 +67352,41 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67310
67352
|
});
|
|
67311
67353
|
this.slide.setResource(option.taskId, option.prefix);
|
|
67312
67354
|
this.sideBar.initialize(json.slideCount, option);
|
|
67313
|
-
this.slide.on(
|
|
67355
|
+
this.slide.on(import_slide.SLIDE_EVENTS.syncDispatch, (event) => {
|
|
67314
67356
|
this.getMap(this.name).set("syncSlide", {
|
|
67315
67357
|
slideState: this.slide.slideState,
|
|
67316
67358
|
dispatch: event
|
|
67317
67359
|
});
|
|
67318
67360
|
});
|
|
67319
|
-
this.slide.on(
|
|
67361
|
+
this.slide.on(import_slide.SLIDE_EVENTS.mainSeqStepStart, (animateIndex) => {
|
|
67320
67362
|
this.emitter.emit("mainSeqStepStart", animateIndex);
|
|
67321
67363
|
});
|
|
67322
|
-
this.slide.on(
|
|
67364
|
+
this.slide.on(import_slide.SLIDE_EVENTS.mainSeqStepEnd, (animateIndex) => {
|
|
67323
67365
|
this.emitter.emit("mainSeqStepEnd", animateIndex);
|
|
67324
67366
|
});
|
|
67325
|
-
this.slide.on(
|
|
67367
|
+
this.slide.on(import_slide.SLIDE_EVENTS.animateStart, () => {
|
|
67368
|
+
this.sideBar.hidden();
|
|
67369
|
+
});
|
|
67370
|
+
this.slide.on(import_slide.SLIDE_EVENTS.renderError, ({ error, index }) => {
|
|
67371
|
+
if (error.errorType === "CANVAS_CRASH") {
|
|
67372
|
+
this.slide.renderSlide(index);
|
|
67373
|
+
}
|
|
67374
|
+
});
|
|
67375
|
+
this.slide.on(import_slide.SLIDE_EVENTS.renderStart, (slideIndex) => {
|
|
67326
67376
|
this.whiteboardApp.emitter.view.style.opacity = "0";
|
|
67327
67377
|
this.whiteboardApp.emitter.addPage(`${slideIndex}`);
|
|
67328
67378
|
this.whiteboardApp.emitter.gotoPage(`${slideIndex}`);
|
|
67379
|
+
this.sideBar.hidden();
|
|
67380
|
+
const { slideState: slideStateFromServer, dispatch: dispatchFromServer } = this.getMap(this.name).get("syncSlide");
|
|
67381
|
+
this.applySlideState(slideStateFromServer, dispatchFromServer);
|
|
67329
67382
|
this.emitter.emit("renderStart", slideIndex);
|
|
67330
67383
|
});
|
|
67331
|
-
this.slide.on(
|
|
67384
|
+
this.slide.on(import_slide.SLIDE_EVENTS.renderEnd, (slideIndex) => {
|
|
67332
67385
|
this.currentSlideIndex = slideIndex;
|
|
67333
67386
|
this.whiteboardApp.emitter.view.style.opacity = "1";
|
|
67334
67387
|
this.emitter.emit("renderEnd", slideIndex);
|
|
67335
67388
|
});
|
|
67336
|
-
this.slide.on(
|
|
67389
|
+
this.slide.on(import_slide.SLIDE_EVENTS.stateChange, (state) => {
|
|
67337
67390
|
this.getMap(this.name).set("slideState", state);
|
|
67338
67391
|
});
|
|
67339
67392
|
this.getMap(this.name).observe(this.onSlideEventHandler);
|
|
@@ -67359,8 +67412,31 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67359
67412
|
}
|
|
67360
67413
|
}
|
|
67361
67414
|
});
|
|
67362
|
-
this.permissions.
|
|
67415
|
+
this.permissions.setPermission(7 /* all */);
|
|
67363
67416
|
this.whiteboardApp.disableViewModel();
|
|
67417
|
+
if (this.window) {
|
|
67418
|
+
let prevStatus = "normal";
|
|
67419
|
+
this.window.on("statusChange", (status) => {
|
|
67420
|
+
if (prevStatus === "minimized") {
|
|
67421
|
+
this.onFocusInstance();
|
|
67422
|
+
prevStatus = status;
|
|
67423
|
+
return;
|
|
67424
|
+
}
|
|
67425
|
+
prevStatus = status;
|
|
67426
|
+
if (status === "normal") {
|
|
67427
|
+
this.onFocusInstance();
|
|
67428
|
+
} else if (status === "minimized") {
|
|
67429
|
+
this.onRefocusInstance();
|
|
67430
|
+
}
|
|
67431
|
+
});
|
|
67432
|
+
this.window.on("focusedChange", (status) => {
|
|
67433
|
+
if (status) {
|
|
67434
|
+
this.onFocusInstance();
|
|
67435
|
+
} else {
|
|
67436
|
+
this.onRefocusInstance();
|
|
67437
|
+
}
|
|
67438
|
+
});
|
|
67439
|
+
}
|
|
67364
67440
|
window.__forge_slide = this;
|
|
67365
67441
|
window.slidePermissions = this.permissions;
|
|
67366
67442
|
return Promise.resolve(void 0);
|
|
@@ -67374,7 +67450,8 @@ var SlideApplication = class extends AbstractApplication2 {
|
|
|
67374
67450
|
this.slide.destroy();
|
|
67375
67451
|
this.sideBar.dispose();
|
|
67376
67452
|
this.getMap(this.name).unobserve(this.onSlideEventHandler);
|
|
67377
|
-
|
|
67453
|
+
this.permissions.dispose();
|
|
67454
|
+
this.footer.dispose();
|
|
67378
67455
|
}
|
|
67379
67456
|
};
|
|
67380
67457
|
export {
|