@netless/forge-slide 0.1.1-alpha.0 → 0.1.1-alpha.10
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/{FoorerView.d.ts → FooterView.d.ts} +5 -2
- package/dist/FooterView.d.ts.map +1 -0
- 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 +30 -29
- package/dist/Slide.d.ts.map +1 -1
- package/dist/SlideApplication.d.ts +14 -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 +1002 -811
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +1005 -814
- package/dist/index.js.map +4 -4
- package/package.json +7 -7
- package/src/FooterView.ts +132 -0
- package/src/ForgeSlidePermession.ts +13 -120
- package/src/SiderBarView.ts +93 -71
- package/src/Slide.ts +29 -28
- package/src/SlideApplication.ts +534 -422
- 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.map +0 -1
- package/src/FoorerView.ts +0 -109
package/dist/index.js
CHANGED
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// ../../node_modules/.pnpm/@netless+slide@1.4.
|
|
33
|
+
// ../../node_modules/.pnpm/@netless+slide@1.4.21/node_modules/@netless/slide/lib/Slide.js
|
|
34
34
|
var require_Slide = __commonJS({
|
|
35
|
-
"../../node_modules/.pnpm/@netless+slide@1.4.
|
|
35
|
+
"../../node_modules/.pnpm/@netless+slide@1.4.21/node_modules/@netless/slide/lib/Slide.js"(exports, module2) {
|
|
36
36
|
module2.exports = function(t) {
|
|
37
37
|
var e = {};
|
|
38
38
|
function i(n) {
|
|
@@ -5703,7 +5703,7 @@ var require_Slide = __commonJS({
|
|
|
5703
5703
|
}
|
|
5704
5704
|
return void 0 === d && (d = setTimeout(b2, e2)), c;
|
|
5705
5705
|
}
|
|
5706
|
-
return e2 = o(e2) || 0, n(i2) && (m = !!i2.leading, u = (g = "maxWait" in i2) ? s(o(i2.maxWait) || 0, e2) : u, v = "trailing" in i2 ? !!i2.trailing : v), E.cancel = function() {
|
|
5706
|
+
return e2 = o(e2) || 0, n(i2) && (m = !!i2.leading, u = (g = "maxWait" in i2) ? s(o(i2.maxWait) || 0, e2) : u, v = "trailing" in i2 ? !!i2.trailing : v), console.log("max wait", u), E.cancel = function() {
|
|
5707
5707
|
void 0 !== d && clearTimeout(d), f = 0, l2 = p = h = d = void 0;
|
|
5708
5708
|
}, E.flush = function() {
|
|
5709
5709
|
return void 0 === d ? c : T(r());
|
|
@@ -29372,6 +29372,7 @@ void main(void){
|
|
|
29372
29372
|
const r3 = e2[t3], o3 = e2[t3 + 1], [s3, a3] = o3.split(",").map((t4) => Number(t4) / 100);
|
|
29373
29373
|
i2.push(r3), n2.push({ x: s3, y: a3 });
|
|
29374
29374
|
}
|
|
29375
|
+
if (n2.length < 4) return false;
|
|
29375
29376
|
if (this.isSquare(i2, n2)) return true;
|
|
29376
29377
|
for (let t3 = 0; t3 < 3; t3++) {
|
|
29377
29378
|
const e3 = n2[t3], i3 = n2[t3 + 1];
|
|
@@ -29786,7 +29787,9 @@ void main(void){
|
|
|
29786
29787
|
}
|
|
29787
29788
|
this.delayHide();
|
|
29788
29789
|
}
|
|
29789
|
-
}, this.targetId = t2.targetId, this.ctx = t2.ctx, this.height = t2.height, this.width = t2.width, this.target = t2.target, this.media = t2.media, this.info = t2.info, this.shapeId = t2.shapeId, this.canvasElement = t2.canvasElement, "video" === this.media.type && (this.isVideo = true), this.getMedianContainer(), this.createMediaController(), this.info.cut && (this.start = null !== (e2 = this.info.cut.start) && void 0 !== e2 ? e2 : 0, this.end = null !== (i2 = this.info.cut.end) && void 0 !== i2 ? i2 : 0), this.info.bookmarkList && (this.bookmarkList = this.info.bookmarkList.sort((t3, e3) => t3.time - e3.time))
|
|
29790
|
+
}, this.targetId = t2.targetId, this.ctx = t2.ctx, this.height = t2.height, this.width = t2.width, this.target = t2.target, this.media = t2.media, this.info = t2.info, this.shapeId = t2.shapeId, this.canvasElement = t2.canvasElement, "video" === this.media.type && (this.isVideo = true), this.getMedianContainer(), this.createMediaController(), this.info.cut && (this.start = null !== (e2 = this.info.cut.start) && void 0 !== e2 ? e2 : 0, this.end = null !== (i2 = this.info.cut.end) && void 0 !== i2 ? i2 : 0), this.info.bookmarkList && (this.bookmarkList = this.info.bookmarkList.sort((t3, e3) => t3.time - e3.time)), this.ctx.globalEventHub.on("togglePlayStatus", (t3) => {
|
|
29791
|
+
t3 === this.targetId && (this.media.isPlaying ? this.pauseMediaFromCtrl(false) : this.playMediaFromCtrl(false));
|
|
29792
|
+
});
|
|
29790
29793
|
}
|
|
29791
29794
|
getMedianContainer() {
|
|
29792
29795
|
var t2;
|
|
@@ -30307,9 +30310,10 @@ void main(void){
|
|
|
30307
30310
|
const a3 = null === (t2 = this.backgroundGraphics) || void 0 === t2 ? void 0 : t2.getPictureMask();
|
|
30308
30311
|
if ((null === (e2 = this.backgroundGraphics) || void 0 === e2 ? void 0 : e2.isNeedMask(s2.width, s2.height)) && a3 && (s2.mask = a3, this.effectContainer.addChild(a3)), s2.width = this.designWidth, s2.height = this.designHeight, s2 instanceof im && this.ctx.slideScopeEventHub.on("slide-render", this.onSlideRenderPlayGif), this.effectContainer.addChild(s2), this.media) {
|
|
30309
30312
|
let t3 = this.media.src;
|
|
30310
|
-
|
|
30311
|
-
|
|
30312
|
-
|
|
30313
|
+
const [e3, i3] = t3.split("dynamicConvert");
|
|
30314
|
+
if (i3 && (t3 = `${this.ctx.prefix}${i3}`), "audio" === this.media.type && /mp4$/.test(t3) && (t3 = t3.replace(/mp4$/, "mp3")), this.ctx.urlInterrupter) {
|
|
30315
|
+
const e4 = Date.now();
|
|
30316
|
+
t3 = yield this.ctx.urlInterrupter(t3), this.ctx.logger.info("redirect media url by interrupter. time: " + (Date.now() - e4), this.ctx.taskId);
|
|
30313
30317
|
}
|
|
30314
30318
|
this.ctx.loaderDelegate && (t3 = this.ctx.loaderDelegate.redirectMedia(t3), this.ctx.logger.info(`redirect media url to ${t3} by delegate.`, this.ctx.taskId)), this.media.src = t3;
|
|
30315
30319
|
}
|
|
@@ -30759,12 +30763,18 @@ void main(void){
|
|
|
30759
30763
|
if ("num" === e2 && this.timingTarget) {
|
|
30760
30764
|
const e3 = new I_(t4, this.timingTarget);
|
|
30761
30765
|
this.keyFrames.push([t4.time, e3]);
|
|
30766
|
+
} else if ("str" === e2 && this.timingTarget) {
|
|
30767
|
+
const e3 = new R_(t4, this.timingTarget);
|
|
30768
|
+
this.keyFrames.push([t4.time, e3]);
|
|
30762
30769
|
}
|
|
30763
30770
|
}
|
|
30764
30771
|
const t3 = { time: 1, val: { type: "string", value: this.json.to }, fmla: "" };
|
|
30765
30772
|
if ("num" === e2 && this.timingTarget) {
|
|
30766
30773
|
const e3 = new I_(t3, this.timingTarget);
|
|
30767
30774
|
this.keyFrames.push([t3.time, e3]);
|
|
30775
|
+
} else if ("str" === e2 && this.timingTarget) {
|
|
30776
|
+
const e3 = new R_(t3, this.timingTarget);
|
|
30777
|
+
this.keyFrames.push([t3.time, e3]);
|
|
30768
30778
|
}
|
|
30769
30779
|
} else if (this.json.by) {
|
|
30770
30780
|
const i2 = { time: 0, val: { type: "string", value: this.json.cBhvr.attrList[0] }, fmla: "" };
|
|
@@ -31129,7 +31139,8 @@ void main(void){
|
|
|
31129
31139
|
const { json: e2, isIterate: i2, isSub: n2, eventHub: r2, ctx: o2, parent: s2, iterateType: a3, iterateIndex: l3, iterateId: h2, isInInteractiveSeq: u2, fromSeqId: c2 } = t2;
|
|
31130
31140
|
this.json = e2, this.id = e2.cMediaNode.ctn.id, this.commonTimeNode = new Ey({ json: e2.cMediaNode.ctn, isSub: n2, eventHubs: { global: r2, runtime: this.runtimeNodeEventHub }, ctx: o2, parent: s2, isIterate: i2, iterateType: a3, iterateIndex: l3, iterateId: h2, isInInteractiveSeq: u2, fromSeqId: c2 });
|
|
31131
31141
|
let d2 = e2.cMediaNode.tgtEl;
|
|
31132
|
-
|
|
31142
|
+
const [p2, f2] = d2.split("dynamicConvert");
|
|
31143
|
+
f2 && (d2 = `${o2.prefix}${f2}`), o2.loaderDelegate && (d2 = o2.loaderDelegate.redirectMedia(d2), o2.logger.info(`redirect media url from ${e2.cMediaNode.tgtEl} to ${d2} by delegate.`, o2.taskId)), this.audio = new c_(d2, o2.runningAudio, void 0, { enableWebAudio: o2.enableWebAudio }), o2.activeMedia.add(this.audio), this.commonTimeNode.on("timelineStart", () => {
|
|
31133
31144
|
this.audio.volume(o2.volumeAdjuster.volume), this.audio.play();
|
|
31134
31145
|
}), this.commonTimeNode.on("seekToStart", this.stopAudio), this.commonTimeNode.on("seekToEnd", this.stopAudio), this.commonTimeNode.on("timeNodeDestroy", this.destroy), this.ctx = o2, this.ctx.volumeAdjuster.on("update", this.onVolumeUpdate);
|
|
31135
31146
|
}
|
|
@@ -31992,7 +32003,7 @@ void main(void){
|
|
|
31992
32003
|
createCtx(t2) {
|
|
31993
32004
|
const { task: e2 } = this.stageStates[t2];
|
|
31994
32005
|
e2.addMTask(() => Dy(this, void 0, void 0, function* () {
|
|
31995
|
-
const e3 = new Gm(this.loader), i2 = new Za.a(), n2 = { taskId: this.taskId, mode: this.mode, renderer: this.renderer, graphicsTexture: new Km(this.maxResolution), stageWidth: 0, stageHeight: 0, ticker: this.ticker, timingTargets: new $m(i2), eventHub: i2, view: this.view, medias: /* @__PURE__ */ Object.create(null), lastViewedIndex: 0, conflictTimeNodeManager: new Qm(), clock: this.clock, spriteTexture: e3, slideIndex: t2, objectPoolGroup: this.objPoolGroup, hasBackgroundFillShape: false, slideScopeEventHub: new Za.a(), logger: this.logger, sdfManager: this.sdfManager, loaderDelegate: this.loaderDelegate, runningAudio: this.runningAudio, activeMedia: this.activeMedia, isPlayerPaused: this.isPlayerPaused, timingEventHub: new Za.a(), maxResolution: this.maxResolution, animatedIds: /* @__PURE__ */ new Set(), volumeAdjuster: this.volumeAdjuster, forceCanvas: this.forceCanvas, globalEventHub: this.globalEventHub, latestChangeFullscreenTargetId: "", isRendering: false, urlInterrupter: this.urlInterrupter, enableWebAudio: this.enableWebAudio };
|
|
32006
|
+
const e3 = new Gm(this.loader), i2 = new Za.a(), n2 = { taskId: this.taskId, prefix: this.url, mode: this.mode, renderer: this.renderer, graphicsTexture: new Km(this.maxResolution), stageWidth: 0, stageHeight: 0, ticker: this.ticker, timingTargets: new $m(i2), eventHub: i2, view: this.view, medias: /* @__PURE__ */ Object.create(null), lastViewedIndex: 0, conflictTimeNodeManager: new Qm(), clock: this.clock, spriteTexture: e3, slideIndex: t2, objectPoolGroup: this.objPoolGroup, hasBackgroundFillShape: false, slideScopeEventHub: new Za.a(), logger: this.logger, sdfManager: this.sdfManager, loaderDelegate: this.loaderDelegate, runningAudio: this.runningAudio, activeMedia: this.activeMedia, isPlayerPaused: this.isPlayerPaused, timingEventHub: new Za.a(), maxResolution: this.maxResolution, animatedIds: /* @__PURE__ */ new Set(), volumeAdjuster: this.volumeAdjuster, forceCanvas: this.forceCanvas, globalEventHub: this.globalEventHub, latestChangeFullscreenTargetId: "", isRendering: false, urlInterrupter: this.urlInterrupter, enableWebAudio: this.enableWebAudio };
|
|
31996
32007
|
this.stageCtxs[t2] = n2;
|
|
31997
32008
|
}), "@StagePool[createCtx]");
|
|
31998
32009
|
}
|
|
@@ -32288,11 +32299,15 @@ void main(void){
|
|
|
32288
32299
|
this.app.view.addEventListener("mouseover", e4, false);
|
|
32289
32300
|
const r3 = { handleEvent: () => {
|
|
32290
32301
|
this.fullscreenOnMousemove({ index: i3, targetId: n3 });
|
|
32302
|
+
} }, o3 = { handleEvent: () => {
|
|
32303
|
+
var t5;
|
|
32304
|
+
null === (t5 = this.currentStage) || void 0 === t5 || t5.ctx.globalEventHub.emit("togglePlayStatus", n3);
|
|
32291
32305
|
} };
|
|
32292
|
-
this.app.view.addEventListener("mousemove", r3, false), this.cacheFunctionMap.set("mouseover", e4), this.cacheFunctionMap.set("mousemove", r3), this.cacheFunctionMap.set("mouseout", t4);
|
|
32306
|
+
this.app.view.addEventListener("mousemove", r3, false), this.app.view.addEventListener("click", o3, false), this.cacheFunctionMap.set("click", o3), this.cacheFunctionMap.set("mouseover", e4), this.cacheFunctionMap.set("mousemove", r3), this.cacheFunctionMap.set("mouseout", t4);
|
|
32293
32307
|
} else {
|
|
32294
32308
|
const t4 = { handleEvent: () => {
|
|
32295
|
-
|
|
32309
|
+
var t5;
|
|
32310
|
+
this.fullscreenOnMousemove({ index: i3, targetId: n3 }), null === (t5 = this.currentStage) || void 0 === t5 || t5.ctx.globalEventHub.emit("togglePlayStatus", n3);
|
|
32296
32311
|
} };
|
|
32297
32312
|
this.app.view.addEventListener("touchstart", t4, false), this.cacheFunctionMap.set("touchstart", t4);
|
|
32298
32313
|
}
|
|
@@ -32602,7 +32617,7 @@ void main(void){
|
|
|
32602
32617
|
});
|
|
32603
32618
|
}
|
|
32604
32619
|
clearFullscreenEventListenersWithAppView() {
|
|
32605
|
-
["mousemove", "mouseout", "mouseover", "touchstart", "pointerdown"].forEach((t2) => {
|
|
32620
|
+
["mousemove", "click", "mouseout", "mouseover", "touchstart", "pointerdown"].forEach((t2) => {
|
|
32606
32621
|
this.cacheFunctionMap.has(t2) && (this.app.view.removeEventListener(t2, this.cacheFunctionMap.get(t2), false), this.cacheFunctionMap.delete(t2));
|
|
32607
32622
|
});
|
|
32608
32623
|
}
|
|
@@ -34224,23 +34239,44 @@ void main(void){
|
|
|
34224
34239
|
};
|
|
34225
34240
|
}
|
|
34226
34241
|
};
|
|
34227
|
-
function sT(t2, e2, i2, n2) {
|
|
34242
|
+
function sT(t2, e2, i2, n2, r2) {
|
|
34228
34243
|
return rT(this, void 0, void 0, function() {
|
|
34229
|
-
var
|
|
34230
|
-
return oT(this, function(
|
|
34231
|
-
switch (
|
|
34244
|
+
var o2, s2, a3, l3, h2, u2;
|
|
34245
|
+
return oT(this, function(c2) {
|
|
34246
|
+
switch (c2.label) {
|
|
34232
34247
|
case 0:
|
|
34233
|
-
return
|
|
34248
|
+
return o2 = document.createElement("div"), (s2 = new yT({ anchor: o2, renderOptions: { minFPS: 1, maxFPS: 1, resolution: 1, maxResolutionLevel: i2, forceCanvas: true }, mode: "local", interactive: false, useLocalCache: true })).setResource(t2, e2), [4, s2.getSlideCountAsync()];
|
|
34234
34249
|
case 1:
|
|
34235
|
-
|
|
34250
|
+
a3 = c2.sent(), c2.label = 2;
|
|
34236
34251
|
case 2:
|
|
34237
|
-
|
|
34252
|
+
if (c2.trys.push([2, 12, 13, 14]), !(r2 && r2.length > 0)) return [3, 7];
|
|
34253
|
+
l3 = r2.filter(function(t3, e3) {
|
|
34254
|
+
return r2.indexOf(t3) === e3;
|
|
34255
|
+
}), u2 = 0, c2.label = 3;
|
|
34238
34256
|
case 3:
|
|
34239
|
-
l3.
|
|
34257
|
+
return u2 < l3.length ? (h2 = l3[u2]) > 0 && h2 <= a3 ? [4, s2.player.stagePool.preload(h2, true)] : [3, 5] : [3, 6];
|
|
34240
34258
|
case 4:
|
|
34241
|
-
|
|
34259
|
+
c2.sent(), n2(Math.round((u2 + 1) / l3.length * 100) / 100), c2.label = 5;
|
|
34242
34260
|
case 5:
|
|
34243
|
-
return
|
|
34261
|
+
return u2++, [3, 3];
|
|
34262
|
+
case 6:
|
|
34263
|
+
return [3, 11];
|
|
34264
|
+
case 7:
|
|
34265
|
+
u2 = 1, c2.label = 8;
|
|
34266
|
+
case 8:
|
|
34267
|
+
return u2 <= a3 ? [4, s2.player.stagePool.preload(u2, true)] : [3, 11];
|
|
34268
|
+
case 9:
|
|
34269
|
+
c2.sent(), n2(Math.round(u2 / a3 * 100) / 100), c2.label = 10;
|
|
34270
|
+
case 10:
|
|
34271
|
+
return u2++, [3, 8];
|
|
34272
|
+
case 11:
|
|
34273
|
+
return [3, 14];
|
|
34274
|
+
case 12:
|
|
34275
|
+
throw c2.sent();
|
|
34276
|
+
case 13:
|
|
34277
|
+
return s2.destroy(), [7];
|
|
34278
|
+
case 14:
|
|
34279
|
+
return [2];
|
|
34244
34280
|
}
|
|
34245
34281
|
});
|
|
34246
34282
|
});
|
|
@@ -34376,7 +34412,7 @@ void main(void){
|
|
|
34376
34412
|
}
|
|
34377
34413
|
var mT = { syncDispatch: "syncDispatch", syncReceive: "syncReceive", syncEventLag: "syncEventLag", renderStart: "renderStart", renderEnd: "renderEnd", renderError: "renderError", slideChange: "slideChange", mainSeqStepStart: "mainSeqStepStart", mainSeqStepEnd: "mainSeqStepEnd", animateStart: "animateStart", animateEnd: "animateEnd", stateChange: "stateChange", slideStepEnd: "slideEnd", slideStepStart: "slideStart" }, gT = { taskId: "", url: "", currentSlideIndex: -1, mainSeqStep: -1, mainSeqState: null, mediaState: /* @__PURE__ */ Object.create(null), interactiveSeqState: /* @__PURE__ */ Object.create(null) }, vT = "";
|
|
34378
34414
|
try {
|
|
34379
|
-
vT = "1.4.
|
|
34415
|
+
vT = "1.4.20";
|
|
34380
34416
|
} catch (t2) {
|
|
34381
34417
|
vT = "dev";
|
|
34382
34418
|
}
|
|
@@ -34395,7 +34431,7 @@ void main(void){
|
|
|
34395
34431
|
return n3.frameResizeHandler();
|
|
34396
34432
|
}), n3.timestamp = function() {
|
|
34397
34433
|
return Date.now();
|
|
34398
|
-
}, n3.mode = "local", n3.enableGlobalClick = false, n3.lastEmitedState = null, n3.playerController = null, n3.isInitResized = false, n3.cacheImage = document.createElement("img"), n3.isTouchStart = false, n3.touchStartId = void 0, n3.taskId = "", n3.volumeAdjuster = new Hy(), n3.designWidth = 0, n3.designHeight = 0, n3._slideCount = 0, n3._dispatchIncrId = 0, n3._receiveIncrId = 0, n3.resizeView = Ky()(n3._resizeView.bind(n3), 50), n3.handleViewClick = Ky()(n3._handleViewClick.bind(n3), 300), n3.resourceList = [], n3._updateVolumeByStaticAdjuster = function(t3) {
|
|
34434
|
+
}, n3.mode = "local", n3.enableGlobalClick = false, n3.lastEmitedState = null, n3.playerController = null, n3.isInitResized = false, n3.cacheImage = document.createElement("img"), n3.isTouchStart = false, n3.touchStartId = void 0, n3.taskId = "", n3.volumeAdjuster = new Hy(), n3.designWidth = 0, n3.designHeight = 0, n3._slideCount = 0, n3._dispatchIncrId = 0, n3._receiveIncrId = 0, n3.resizeView = Ky()(n3._resizeView.bind(n3), 50), n3.handleViewClick = Ky()(n3._handleViewClick.bind(n3), 300, { leading: true }), n3.resourceList = [], n3._updateVolumeByStaticAdjuster = function(t3) {
|
|
34399
34435
|
n3.volumeAdjuster.volume = t3;
|
|
34400
34436
|
}, n3.recoverHandler = function(t3) {
|
|
34401
34437
|
if ("@slide/_recover_" === t3.data.type && t3.data.slideId === n3.randomId) {
|
|
@@ -34577,7 +34613,7 @@ void main(void){
|
|
|
34577
34613
|
return o2.setInteractive(this.interactive), o2.updateConfig(t3.renderOptions || {}), o2.on(Vy.renderStart, function(t4) {
|
|
34578
34614
|
r2.isLoading = true, r2.emit(mT.renderStart, t4), window.postMessage({ type: "@slide/_render_start_", taskId: r2.taskId, index: t4 }, "*");
|
|
34579
34615
|
}), o2.on(Vy.renderEnd, function(t4) {
|
|
34580
|
-
r2.isLoading = false, r2.player && (r2.designHeight = r2.player.designHeight, r2.designWidth = r2.player.designWidth, r2.cacheImage.style.width = r2.player.designWidth + "px", r2.cacheImage.style.height = r2.player.designHeight + "px", r2._slideCount = r2.player.slideCount), r2.emit(mT.renderEnd, t4), window.postMessage({ type: "@slide/_render_end_", taskId: r2.taskId, index: t4 }, "*");
|
|
34616
|
+
r2.isLoading = false, r2.player && (r2.designHeight = r2.player.designHeight, r2.designWidth = r2.player.designWidth, r2.cacheImage.style.width = r2.player.designWidth + "px", r2.cacheImage.style.height = r2.player.designHeight + "px", r2.cacheImage.style.maxWidth = r2.player.designWidth + "px", r2.cacheImage.style.minWidth = r2.player.designHeight + "px", r2._slideCount = r2.player.slideCount), r2.emit(mT.renderEnd, t4), window.postMessage({ type: "@slide/_render_end_", taskId: r2.taskId, index: t4 }, "*");
|
|
34581
34617
|
}), o2.on(Vy.slideChange, function(t4) {
|
|
34582
34618
|
r2.__slideState.currentSlideIndex = t4, r2.emitStateChange(), r2.emit(mT.slideChange, t4);
|
|
34583
34619
|
}), o2.on(Vy.mainSeqStateChange, function(t4) {
|
|
@@ -35105,22 +35141,27 @@ void main(void){
|
|
|
35105
35141
|
}(Za.a);
|
|
35106
35142
|
null == _T || _T.clear().catch(function() {
|
|
35107
35143
|
}), window.addEventListener("__slide_log__", yT.handleLogDownload), window.addEventListener("message", function(t2) {
|
|
35144
|
+
var e2;
|
|
35108
35145
|
if ("@slide/_request_log_" === t2.data.type) yT.handleLogReport(t2.data.sessionId).catch(function() {
|
|
35109
35146
|
});
|
|
35110
35147
|
else if ("@slide/_request_frozen_" === t2.data.type) yT.handleFrozenAllSlide();
|
|
35111
35148
|
else if ("@slide/_request_release_" === t2.data.type) yT.handleReleaseAllSlide();
|
|
35112
35149
|
else if ("@slide/_update_volume_" === t2.data.type) {
|
|
35113
|
-
var
|
|
35150
|
+
var i2 = 0.5;
|
|
35114
35151
|
try {
|
|
35115
|
-
|
|
35152
|
+
i2 = parseFloat(t2.data.volume.toString());
|
|
35116
35153
|
} catch (t3) {
|
|
35117
35154
|
}
|
|
35118
|
-
yT.volumeAdjuster.volume =
|
|
35119
|
-
} else "@slide/_get_volume_" === t2.data.type
|
|
35120
|
-
|
|
35121
|
-
|
|
35122
|
-
|
|
35123
|
-
|
|
35155
|
+
yT.volumeAdjuster.volume = i2;
|
|
35156
|
+
} else if ("@slide/_get_volume_" === t2.data.type) window.postMessage({ type: "@slide/_report_volume_", volume: yT.volumeAdjuster.volume, customMessage: "@slide/_report_volume_" }, "*");
|
|
35157
|
+
else if ("@slide/_preload_slide_" === t2.data.type) {
|
|
35158
|
+
var n2 = null !== (e2 = t2.data.sessionId) && void 0 !== e2 ? e2 : Math.random().toString(32).substr(2);
|
|
35159
|
+
yT.preloadResource(t2.data.taskId, t2.data.prefix, t2.data.maxResolutionLevel, function(e3) {
|
|
35160
|
+
window.postMessage({ type: "@slide/_preload_slide_progress_", sessionId: n2, taskId: t2.data.taskId, progress: e3 }, "*");
|
|
35161
|
+
}, t2.data.pages).catch(function(e3) {
|
|
35162
|
+
window.postMessage({ type: "@slide/_preload_slide_error_", sessionId: n2, taskId: t2.data.taskId, error: e3 }, "*");
|
|
35163
|
+
});
|
|
35164
|
+
}
|
|
35124
35165
|
}), window.setInterval(function() {
|
|
35125
35166
|
yT.flushLog().catch(function() {
|
|
35126
35167
|
});
|
|
@@ -35154,23 +35195,23 @@ var Y7 = __toESM(require("yjs"), 1);
|
|
|
35154
35195
|
var Y8 = __toESM(require("yjs"), 1);
|
|
35155
35196
|
var Y9 = __toESM(require("yjs"), 1);
|
|
35156
35197
|
var Y10 = __toESM(require("yjs"), 1);
|
|
35157
|
-
var
|
|
35198
|
+
var import_forge_room2 = require("@netless/forge-room");
|
|
35158
35199
|
var Y11 = __toESM(require("yjs"), 1);
|
|
35159
|
-
var
|
|
35200
|
+
var import_eventemitter32 = __toESM(require("eventemitter3"), 1);
|
|
35160
35201
|
var Y13 = __toESM(require("yjs"), 1);
|
|
35202
|
+
var import_eventemitter33 = __toESM(require("eventemitter3"), 1);
|
|
35161
35203
|
var import_eventemitter34 = __toESM(require("eventemitter3"), 1);
|
|
35162
|
-
var import_eventemitter35 =
|
|
35163
|
-
var import_eventemitter36 = require("eventemitter3");
|
|
35204
|
+
var import_eventemitter35 = require("eventemitter3");
|
|
35205
|
+
var import_eventemitter36 = __toESM(require("eventemitter3"), 1);
|
|
35164
35206
|
var import_eventemitter37 = __toESM(require("eventemitter3"), 1);
|
|
35165
35207
|
var import_eventemitter38 = __toESM(require("eventemitter3"), 1);
|
|
35166
|
-
var import_eventemitter39 = __toESM(require("eventemitter3"), 1);
|
|
35167
35208
|
var Y14 = __toESM(require("yjs"), 1);
|
|
35209
|
+
var import_eventemitter39 = __toESM(require("eventemitter3"), 1);
|
|
35168
35210
|
var import_eventemitter310 = __toESM(require("eventemitter3"), 1);
|
|
35211
|
+
var import_forge_room3 = require("@netless/forge-room");
|
|
35169
35212
|
var import_eventemitter311 = __toESM(require("eventemitter3"), 1);
|
|
35170
|
-
var
|
|
35213
|
+
var import_forge_room4 = require("@netless/forge-room");
|
|
35171
35214
|
var import_eventemitter312 = __toESM(require("eventemitter3"), 1);
|
|
35172
|
-
var import_forge_room3 = require("@netless/forge-room");
|
|
35173
|
-
var import_eventemitter313 = __toESM(require("eventemitter3"), 1);
|
|
35174
35215
|
var __create2 = Object.create;
|
|
35175
35216
|
var __defProp2 = Object.defineProperty;
|
|
35176
35217
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -58945,7 +58986,7 @@ var require_lodash = __commonJS2({
|
|
|
58945
58986
|
var defer = baseRest(function(func, args) {
|
|
58946
58987
|
return baseDelay(func, 1, args);
|
|
58947
58988
|
});
|
|
58948
|
-
var
|
|
58989
|
+
var delay2 = baseRest(function(func, wait, args) {
|
|
58949
58990
|
return baseDelay(func, toNumber(wait) || 0, args);
|
|
58950
58991
|
});
|
|
58951
58992
|
function flip(func) {
|
|
@@ -60059,7 +60100,7 @@ var require_lodash = __commonJS2({
|
|
|
60059
60100
|
lodash.defaults = defaults;
|
|
60060
60101
|
lodash.defaultsDeep = defaultsDeep;
|
|
60061
60102
|
lodash.defer = defer;
|
|
60062
|
-
lodash.delay =
|
|
60103
|
+
lodash.delay = delay2;
|
|
60063
60104
|
lodash.difference = difference;
|
|
60064
60105
|
lodash.differenceBy = differenceBy;
|
|
60065
60106
|
lodash.differenceWith = differenceWith;
|
|
@@ -60852,6 +60893,10 @@ var ElementModel = class _ElementModel {
|
|
|
60852
60893
|
const ext = this.styleKeys();
|
|
60853
60894
|
return Array.from(new Set(["dashArray", "strokeColor", "fillColor", "strokeWidth"].filter((v) => ext.exclude.indexOf(v) < 0).concat(ext.include)));
|
|
60854
60895
|
}
|
|
60896
|
+
dispose() {
|
|
60897
|
+
this.subDispose();
|
|
60898
|
+
this.root.unobserveDeep(this.handlePropChange);
|
|
60899
|
+
}
|
|
60855
60900
|
};
|
|
60856
60901
|
_defineProperty(ElementModel, "KEYS", {
|
|
60857
60902
|
index: "index",
|
|
@@ -60921,12 +60966,15 @@ var CurveModel = class extends ElementModel {
|
|
|
60921
60966
|
constructor(root, scope) {
|
|
60922
60967
|
super(root, scope);
|
|
60923
60968
|
_defineProperty3(this, "item", null);
|
|
60969
|
+
_defineProperty3(this, "debugPath", void 0);
|
|
60970
|
+
_defineProperty3(this, "debug", false);
|
|
60924
60971
|
if (!this.root.has("type")) {
|
|
60925
60972
|
this.root.set("type", "curve");
|
|
60926
60973
|
}
|
|
60927
60974
|
if (!this.root.has("points")) {
|
|
60928
60975
|
this.root.set("points", new Y2.Array());
|
|
60929
60976
|
}
|
|
60977
|
+
this.debugPath = new scope.Path();
|
|
60930
60978
|
}
|
|
60931
60979
|
average(a2, b2) {
|
|
60932
60980
|
return (a2 + b2) / 2;
|
|
@@ -60935,23 +60983,23 @@ var CurveModel = class extends ElementModel {
|
|
|
60935
60983
|
const groupPoints = (0, import_lodash.chunk)(points, 2);
|
|
60936
60984
|
return ae(groupPoints, {
|
|
60937
60985
|
size: this.strokeWidth,
|
|
60938
|
-
smoothing: 0,
|
|
60939
|
-
thinning: 0.5,
|
|
60986
|
+
smoothing: 0.5,
|
|
60987
|
+
thinning: -0.5,
|
|
60940
60988
|
streamline: 0.5,
|
|
60941
60989
|
simulatePressure: true,
|
|
60942
60990
|
start: {
|
|
60943
|
-
taper: 10,
|
|
60991
|
+
taper: this.strokeWidth * 10,
|
|
60944
60992
|
cap: true
|
|
60945
60993
|
},
|
|
60946
60994
|
end: {
|
|
60947
|
-
taper:
|
|
60995
|
+
taper: this.strokeWidth * 20,
|
|
60948
60996
|
cap: true
|
|
60949
60997
|
}
|
|
60950
60998
|
});
|
|
60951
60999
|
}
|
|
60952
61000
|
matrixedPoints() {
|
|
60953
|
-
const
|
|
60954
|
-
return
|
|
61001
|
+
const currentPoints = (0, import_lodash.chunk)(this.points, 2);
|
|
61002
|
+
return currentPoints.map((_ref) => {
|
|
60955
61003
|
let [x, y] = _ref;
|
|
60956
61004
|
return new this.scope.Point(x, y);
|
|
60957
61005
|
}).map((p) => p.transform(new this.scope.Matrix(this.pointsMatrix))).reduce((result, next) => {
|
|
@@ -60985,27 +61033,41 @@ var CurveModel = class extends ElementModel {
|
|
|
60985
61033
|
}
|
|
60986
61034
|
return path;
|
|
60987
61035
|
}
|
|
60988
|
-
|
|
60989
|
-
|
|
60990
|
-
const
|
|
60991
|
-
|
|
61036
|
+
updateDebugPath() {
|
|
61037
|
+
this.debugPath = new this.scope.Path();
|
|
61038
|
+
const points = (0, import_lodash.chunk)(this.points, 2);
|
|
61039
|
+
for (let i = 0, len = points.length; i < len; i++) {
|
|
61040
|
+
const point = new this.scope.Point(points[i][0], points[i][1]);
|
|
61041
|
+
if (i === 0) {
|
|
61042
|
+
this.debugPath.moveTo(point);
|
|
61043
|
+
} else {
|
|
61044
|
+
this.debugPath.lineTo(point);
|
|
61045
|
+
}
|
|
61046
|
+
this.debugPath.strokeWidth = 1;
|
|
61047
|
+
this.debugPath.strokeColor = new this.scope.Color(1, 0, 0, 1);
|
|
61048
|
+
}
|
|
60992
61049
|
}
|
|
60993
61050
|
onVectorUpdate() {
|
|
60994
61051
|
if (!this.item) {
|
|
60995
61052
|
return;
|
|
60996
61053
|
}
|
|
61054
|
+
if (this.debug) {
|
|
61055
|
+
this.debugPath.remove();
|
|
61056
|
+
this.updateDebugPath();
|
|
61057
|
+
}
|
|
61058
|
+
const points = this.parsePoints(this.matrixedPoints());
|
|
61059
|
+
const path = this.createPath(points);
|
|
60997
61060
|
this.item.removeSegments();
|
|
60998
|
-
this.item.addSegments(
|
|
60999
|
-
this.
|
|
61061
|
+
this.item.addSegments(path.segments);
|
|
61062
|
+
if (this.debug) {
|
|
61063
|
+
this.item.addChild(this.debugPath);
|
|
61064
|
+
}
|
|
61000
61065
|
}
|
|
61001
61066
|
createPaperItem() {
|
|
61002
61067
|
this.item = new this.scope.Path();
|
|
61003
|
-
this.item.strokeCap = "round";
|
|
61004
|
-
this.item.strokeJoin = "round";
|
|
61005
|
-
this.item.strokeScaling = false;
|
|
61006
61068
|
this.item.strokeColor = new this.scope.Color(this.strokeColor);
|
|
61007
61069
|
this.item.fillColor = new this.scope.Color(this.strokeColor);
|
|
61008
|
-
this.
|
|
61070
|
+
this.onVectorUpdate();
|
|
61009
61071
|
}
|
|
61010
61072
|
editorConfig() {
|
|
61011
61073
|
return new EditorConfig();
|
|
@@ -61015,8 +61077,8 @@ var CurveModel = class extends ElementModel {
|
|
|
61015
61077
|
}
|
|
61016
61078
|
styleKeys() {
|
|
61017
61079
|
return {
|
|
61018
|
-
include: ["strokeColor"],
|
|
61019
|
-
exclude: ["
|
|
61080
|
+
include: ["strokeColor", "strokeWidth"],
|
|
61081
|
+
exclude: ["dashArray", "fillColor"]
|
|
61020
61082
|
};
|
|
61021
61083
|
}
|
|
61022
61084
|
onStyleKeyUpdate(key) {
|
|
@@ -61026,8 +61088,12 @@ var CurveModel = class extends ElementModel {
|
|
|
61026
61088
|
if (key === "strokeColor") {
|
|
61027
61089
|
this.item.strokeColor = new this.scope.Color(this.strokeColor);
|
|
61028
61090
|
this.item.fillColor = new this.scope.Color(this.strokeColor);
|
|
61091
|
+
} else if (key === "strokeWidth") {
|
|
61092
|
+
this.onVectorUpdate();
|
|
61029
61093
|
}
|
|
61030
61094
|
}
|
|
61095
|
+
subDispose() {
|
|
61096
|
+
}
|
|
61031
61097
|
};
|
|
61032
61098
|
function _defineProperty4(e, r, t) {
|
|
61033
61099
|
return (r = _toPropertyKey4(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
@@ -61059,14 +61125,12 @@ var SelectorModel = class extends ElementModel {
|
|
|
61059
61125
|
this.root.set("points", initPoints);
|
|
61060
61126
|
}
|
|
61061
61127
|
}
|
|
61128
|
+
subDispose() {
|
|
61129
|
+
}
|
|
61062
61130
|
createPaperRect() {
|
|
61063
61131
|
const scope = this.scope;
|
|
61064
61132
|
const bounds = new scope.Rectangle(new scope.Point(this.points[0], this.points[1]), new scope.Size(this.points[2], this.points[3]));
|
|
61065
|
-
return new scope.Path.Rectangle(
|
|
61066
|
-
bounds,
|
|
61067
|
-
new scope.Point(this.points[4], this.points[4])
|
|
61068
|
-
// 圆角
|
|
61069
|
-
);
|
|
61133
|
+
return new scope.Path.Rectangle(bounds, new scope.Point(this.points[4], this.points[4]));
|
|
61070
61134
|
}
|
|
61071
61135
|
onVectorUpdate() {
|
|
61072
61136
|
if (!this.item) {
|
|
@@ -61092,7 +61156,7 @@ var SelectorModel = class extends ElementModel {
|
|
|
61092
61156
|
exclude: []
|
|
61093
61157
|
};
|
|
61094
61158
|
}
|
|
61095
|
-
onStyleKeyUpdate(
|
|
61159
|
+
onStyleKeyUpdate(_key) {
|
|
61096
61160
|
}
|
|
61097
61161
|
};
|
|
61098
61162
|
var import_lodash2 = __toESM2(require_lodash(), 1);
|
|
@@ -61139,7 +61203,7 @@ var AnimationFrame = class {
|
|
|
61139
61203
|
_defineProperty5(this, "lastTime", 0);
|
|
61140
61204
|
_defineProperty5(this, "fps", 45);
|
|
61141
61205
|
_defineProperty5(this, "handleCallbacks", () => {
|
|
61142
|
-
|
|
61206
|
+
const functions = this.callbacks;
|
|
61143
61207
|
this.callbacks = [];
|
|
61144
61208
|
for (let i = 0, l2 = functions.length; i < l2; i++) {
|
|
61145
61209
|
functions[i]();
|
|
@@ -61190,6 +61254,8 @@ var SegmentsModel = class extends ElementModel {
|
|
|
61190
61254
|
this.root.set("points", new Y4.Array());
|
|
61191
61255
|
}
|
|
61192
61256
|
}
|
|
61257
|
+
subDispose() {
|
|
61258
|
+
}
|
|
61193
61259
|
onVectorUpdate() {
|
|
61194
61260
|
if (!this.item) {
|
|
61195
61261
|
return;
|
|
@@ -61224,7 +61290,7 @@ var SegmentsModel = class extends ElementModel {
|
|
|
61224
61290
|
exclude: []
|
|
61225
61291
|
};
|
|
61226
61292
|
}
|
|
61227
|
-
onStyleKeyUpdate(
|
|
61293
|
+
onStyleKeyUpdate(_key) {
|
|
61228
61294
|
}
|
|
61229
61295
|
};
|
|
61230
61296
|
var import_lodash4 = __toESM2(require_lodash(), 1);
|
|
@@ -61311,6 +61377,9 @@ var LineTool = class extends WhiteboardTool {
|
|
|
61311
61377
|
this.tool.minDistance = 1;
|
|
61312
61378
|
}
|
|
61313
61379
|
onMouseDown(event) {
|
|
61380
|
+
if (this.elementModel) {
|
|
61381
|
+
this.elementModel.dispose();
|
|
61382
|
+
}
|
|
61314
61383
|
this.elementModel = this.modelGetter().createLinePath(true);
|
|
61315
61384
|
this.from = event.point.clone();
|
|
61316
61385
|
this.to = event.point.clone();
|
|
@@ -61384,6 +61453,8 @@ var LineModel = class extends ElementModel {
|
|
|
61384
61453
|
this.root.set("tailArrow", "normal");
|
|
61385
61454
|
}
|
|
61386
61455
|
}
|
|
61456
|
+
subDispose() {
|
|
61457
|
+
}
|
|
61387
61458
|
onVectorUpdate() {
|
|
61388
61459
|
if (!this.item) {
|
|
61389
61460
|
return;
|
|
@@ -61420,7 +61491,7 @@ var LineModel = class extends ElementModel {
|
|
|
61420
61491
|
this.item.addChildren(this.renderLine());
|
|
61421
61492
|
}
|
|
61422
61493
|
createArrow(path) {
|
|
61423
|
-
|
|
61494
|
+
const [headPath, tailPath] = [new this.scope.Path(), new this.scope.Path()];
|
|
61424
61495
|
if (!path) {
|
|
61425
61496
|
return [headPath, tailPath];
|
|
61426
61497
|
}
|
|
@@ -61474,7 +61545,7 @@ var LineModel = class extends ElementModel {
|
|
|
61474
61545
|
exclude: ["fillColor"]
|
|
61475
61546
|
};
|
|
61476
61547
|
}
|
|
61477
|
-
onStyleKeyUpdate(
|
|
61548
|
+
onStyleKeyUpdate(_key) {
|
|
61478
61549
|
this.onVectorUpdate();
|
|
61479
61550
|
}
|
|
61480
61551
|
};
|
|
@@ -61594,6 +61665,9 @@ var PointTextModel = class extends ElementModel {
|
|
|
61594
61665
|
}, 60);
|
|
61595
61666
|
}
|
|
61596
61667
|
}
|
|
61668
|
+
subDispose() {
|
|
61669
|
+
this.root.unobserve(this.handleTextPropChange);
|
|
61670
|
+
}
|
|
61597
61671
|
getInternalMeasurement() {
|
|
61598
61672
|
if (!this.item) {
|
|
61599
61673
|
return null;
|
|
@@ -61696,6 +61770,8 @@ var TriangleModel = class extends ElementModel {
|
|
|
61696
61770
|
this.root.set("points", new Y7.Array());
|
|
61697
61771
|
}
|
|
61698
61772
|
}
|
|
61773
|
+
subDispose() {
|
|
61774
|
+
}
|
|
61699
61775
|
createPaperItem() {
|
|
61700
61776
|
this.item = new this.scope.Path();
|
|
61701
61777
|
this.item.strokeCap = "butt";
|
|
@@ -61752,7 +61828,7 @@ var TriangleModel = class extends ElementModel {
|
|
|
61752
61828
|
exclude: []
|
|
61753
61829
|
};
|
|
61754
61830
|
}
|
|
61755
|
-
onStyleKeyUpdate(
|
|
61831
|
+
onStyleKeyUpdate(_key) {
|
|
61756
61832
|
}
|
|
61757
61833
|
};
|
|
61758
61834
|
function _defineProperty12(e, r, t) {
|
|
@@ -61788,6 +61864,8 @@ var RectangleModel = class extends ElementModel {
|
|
|
61788
61864
|
this.root.set("radius", 0);
|
|
61789
61865
|
}
|
|
61790
61866
|
}
|
|
61867
|
+
subDispose() {
|
|
61868
|
+
}
|
|
61791
61869
|
createSegments() {
|
|
61792
61870
|
const [a2, b2, c, d] = this.points;
|
|
61793
61871
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
@@ -61919,7 +61997,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
61919
61997
|
exclude: []
|
|
61920
61998
|
};
|
|
61921
61999
|
}
|
|
61922
|
-
onStyleKeyUpdate(
|
|
62000
|
+
onStyleKeyUpdate(_key) {
|
|
61923
62001
|
}
|
|
61924
62002
|
};
|
|
61925
62003
|
var elementsUndoOrigin = "elementsUndoOrigin";
|
|
@@ -62055,9 +62133,11 @@ var EraserModel = class extends ElementModel {
|
|
|
62055
62133
|
exclude: []
|
|
62056
62134
|
};
|
|
62057
62135
|
}
|
|
62058
|
-
onStyleKeyUpdate(
|
|
62136
|
+
onStyleKeyUpdate(_key) {
|
|
62059
62137
|
return;
|
|
62060
62138
|
}
|
|
62139
|
+
subDispose() {
|
|
62140
|
+
}
|
|
62061
62141
|
};
|
|
62062
62142
|
var import_lodash6 = __toESM2(require_lodash(), 1);
|
|
62063
62143
|
function _defineProperty14(e, r, t) {
|
|
@@ -62211,27 +62291,12 @@ var LaserPointerModel = class extends ElementModel {
|
|
|
62211
62291
|
exclude: []
|
|
62212
62292
|
};
|
|
62213
62293
|
}
|
|
62214
|
-
onStyleKeyUpdate(
|
|
62294
|
+
onStyleKeyUpdate(_key) {
|
|
62215
62295
|
return;
|
|
62216
62296
|
}
|
|
62217
|
-
|
|
62218
|
-
function _defineProperty15(e, r, t) {
|
|
62219
|
-
return (r = _toPropertyKey15(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62220
|
-
}
|
|
62221
|
-
function _toPropertyKey15(t) {
|
|
62222
|
-
var i = _toPrimitive15(t, "string");
|
|
62223
|
-
return "symbol" == typeof i ? i : i + "";
|
|
62224
|
-
}
|
|
62225
|
-
function _toPrimitive15(t, r) {
|
|
62226
|
-
if ("object" != typeof t || !t) return t;
|
|
62227
|
-
var e = t[Symbol.toPrimitive];
|
|
62228
|
-
if (void 0 !== e) {
|
|
62229
|
-
var i = e.call(t, r || "default");
|
|
62230
|
-
if ("object" != typeof i) return i;
|
|
62231
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
62297
|
+
subDispose() {
|
|
62232
62298
|
}
|
|
62233
|
-
|
|
62234
|
-
}
|
|
62299
|
+
};
|
|
62235
62300
|
var WhiteboardPermissionFlag = function(WhiteboardPermissionFlag2) {
|
|
62236
62301
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["none"] = 0] = "none";
|
|
62237
62302
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["draw"] = 1] = "draw";
|
|
@@ -62244,117 +62309,25 @@ var WhiteboardPermissionFlag = function(WhiteboardPermissionFlag2) {
|
|
|
62244
62309
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["all"] = WhiteboardPermissionFlag2.draw | WhiteboardPermissionFlag2.editSelf | WhiteboardPermissionFlag2.editOthers | WhiteboardPermissionFlag2.deleteSelf | WhiteboardPermissionFlag2.deleteOthers | WhiteboardPermissionFlag2.mainView | WhiteboardPermissionFlag2.setOthersView] = "all";
|
|
62245
62310
|
return WhiteboardPermissionFlag2;
|
|
62246
62311
|
}({});
|
|
62247
|
-
var WhiteboardPermissions = class extends
|
|
62248
|
-
constructor(userManager, requestUserMap) {
|
|
62249
|
-
super();
|
|
62250
|
-
_defineProperty15(this, "requestUserMap", void 0);
|
|
62251
|
-
_defineProperty15(this, "userManager", void 0);
|
|
62252
|
-
_defineProperty15(this, "observers", /* @__PURE__ */ new Map());
|
|
62253
|
-
_defineProperty15(this, "handleUserLeave", (user) => {
|
|
62254
|
-
const cb = this.observers.get(user.id);
|
|
62255
|
-
if (cb) {
|
|
62256
|
-
this.requestUserMap(user.id).unobserve(cb);
|
|
62257
|
-
}
|
|
62258
|
-
});
|
|
62259
|
-
_defineProperty15(this, "handleUserJoin", (user) => {
|
|
62260
|
-
this.addObserve(user.id);
|
|
62261
|
-
});
|
|
62262
|
-
this.userManager = userManager;
|
|
62263
|
-
this.requestUserMap = requestUserMap;
|
|
62264
|
-
this.createModel(this.userManager.selfId);
|
|
62265
|
-
this.userManager.userIdList().forEach((userId) => {
|
|
62266
|
-
this.addObserve(userId);
|
|
62267
|
-
});
|
|
62268
|
-
this.userManager.on("join", this.handleUserJoin);
|
|
62269
|
-
this.userManager.on("leave", this.handleUserLeave);
|
|
62270
|
-
}
|
|
62271
|
-
addObserve(userId) {
|
|
62272
|
-
if (this.observers.has(userId)) {
|
|
62273
|
-
return;
|
|
62274
|
-
}
|
|
62275
|
-
const observer = (evt) => {
|
|
62276
|
-
this.handleUserPermissionChange(userId, evt);
|
|
62277
|
-
};
|
|
62278
|
-
this.observers.set(userId, observer);
|
|
62279
|
-
this.requestUserMap(userId).observe(observer);
|
|
62280
|
-
}
|
|
62281
|
-
createModel(userId) {
|
|
62282
|
-
const userMap = this.requestUserMap(userId);
|
|
62283
|
-
if (!userMap.has("permission")) {
|
|
62284
|
-
userMap.set("permission", 0);
|
|
62285
|
-
}
|
|
62286
|
-
}
|
|
62287
|
-
handleUserPermissionChange(userId, evt) {
|
|
62288
|
-
for (const [key, value] of evt.changes.keys.entries()) {
|
|
62289
|
-
if (key === "permission") {
|
|
62290
|
-
if (value.action === "add" || value.action === "update") {
|
|
62291
|
-
const newValue = this.requestUserMap(userId).get("permission");
|
|
62292
|
-
this.emit("change", userId, this.resolveFlags(newValue), newValue);
|
|
62293
|
-
}
|
|
62294
|
-
}
|
|
62295
|
-
}
|
|
62296
|
-
}
|
|
62312
|
+
var WhiteboardPermissions = class extends import_forge_room2.AbstractApplicationPermissions {
|
|
62297
62313
|
/**
|
|
62298
|
-
|
|
62299
|
-
|
|
62300
|
-
|
|
62301
|
-
|
|
62314
|
+
* 解析权限列表组合
|
|
62315
|
+
* @param {number} value - 权限数字值
|
|
62316
|
+
* @return {WhiteboardPermissionFlag[]} - 权限列表
|
|
62317
|
+
*/
|
|
62302
62318
|
resolveFlags(value) {
|
|
62303
62319
|
return [WhiteboardPermissionFlag.draw, WhiteboardPermissionFlag.editSelf, WhiteboardPermissionFlag.editOthers, WhiteboardPermissionFlag.deleteSelf, WhiteboardPermissionFlag.deleteOthers, WhiteboardPermissionFlag.mainView, WhiteboardPermissionFlag.setOthersView].filter((v) => (v & value) !== 0);
|
|
62304
62320
|
}
|
|
62305
|
-
/**
|
|
62306
|
-
* 获取权限列表组合对应的数值
|
|
62307
|
-
* @param { string } userId 不传表示获取自己
|
|
62308
|
-
*/
|
|
62309
|
-
getPermissionValue(userId) {
|
|
62310
|
-
return this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
62311
|
-
}
|
|
62312
|
-
/**
|
|
62313
|
-
* 获取权限列表
|
|
62314
|
-
* @param {string=} userId 可选, 不传表示获取自己
|
|
62315
|
-
*/
|
|
62316
|
-
getPermissionFlags(userId) {
|
|
62317
|
-
const value = this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
62318
|
-
return this.resolveFlags(value);
|
|
62319
|
-
}
|
|
62320
|
-
/**
|
|
62321
|
-
* 返回对应 userId 是否有相应权限
|
|
62322
|
-
* @param {string=} userId 可选, 不传表示返回自己是否有相应权限
|
|
62323
|
-
* @param {WhiteboardPermissionFlag} flag
|
|
62324
|
-
*/
|
|
62325
|
-
hasPermission(flag, userId) {
|
|
62326
|
-
return ((this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0) & flag) !== 0;
|
|
62327
|
-
}
|
|
62328
|
-
/**
|
|
62329
|
-
* 添加权限
|
|
62330
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
62331
|
-
* @param {string=} userId 可选, 为 userId 添加权限, 不传表示为自己添加权限
|
|
62332
|
-
*/
|
|
62333
|
-
addPermission(flag, userId) {
|
|
62334
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
62335
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
62336
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue | flag);
|
|
62337
|
-
}
|
|
62338
|
-
/**
|
|
62339
|
-
* 移除权限
|
|
62340
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
62341
|
-
* @param {string=} userId 可选, 为 userId 移除权限, 不传表示为自己移除权限
|
|
62342
|
-
*/
|
|
62343
|
-
removePermission(flag, userId) {
|
|
62344
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
62345
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
62346
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue & ~flag);
|
|
62347
|
-
}
|
|
62348
62321
|
};
|
|
62349
62322
|
var import_lodash7 = __toESM2(require_lodash(), 1);
|
|
62350
|
-
function
|
|
62351
|
-
return (r =
|
|
62323
|
+
function _defineProperty15(e, r, t) {
|
|
62324
|
+
return (r = _toPropertyKey15(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62352
62325
|
}
|
|
62353
|
-
function
|
|
62354
|
-
var i =
|
|
62326
|
+
function _toPropertyKey15(t) {
|
|
62327
|
+
var i = _toPrimitive15(t, "string");
|
|
62355
62328
|
return "symbol" == typeof i ? i : i + "";
|
|
62356
62329
|
}
|
|
62357
|
-
function
|
|
62330
|
+
function _toPrimitive15(t, r) {
|
|
62358
62331
|
if ("object" != typeof t || !t) return t;
|
|
62359
62332
|
var e = t[Symbol.toPrimitive];
|
|
62360
62333
|
if (void 0 !== e) {
|
|
@@ -62367,7 +62340,7 @@ function _toPrimitive16(t, r) {
|
|
|
62367
62340
|
var StraightLineModel = class extends ElementModel {
|
|
62368
62341
|
constructor(root, scope) {
|
|
62369
62342
|
super(root, scope);
|
|
62370
|
-
|
|
62343
|
+
_defineProperty15(this, "item", null);
|
|
62371
62344
|
if (!this.root.has("type")) {
|
|
62372
62345
|
this.root.set("type", "line");
|
|
62373
62346
|
}
|
|
@@ -62375,6 +62348,8 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62375
62348
|
this.root.set("points", new Y11.Array());
|
|
62376
62349
|
}
|
|
62377
62350
|
}
|
|
62351
|
+
subDispose() {
|
|
62352
|
+
}
|
|
62378
62353
|
onVectorUpdate() {
|
|
62379
62354
|
if (!this.item) {
|
|
62380
62355
|
return;
|
|
@@ -62448,7 +62423,7 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62448
62423
|
exclude: ["fillColor"]
|
|
62449
62424
|
};
|
|
62450
62425
|
}
|
|
62451
|
-
onStyleKeyUpdate(
|
|
62426
|
+
onStyleKeyUpdate(_key) {
|
|
62452
62427
|
if (!this.item) {
|
|
62453
62428
|
return;
|
|
62454
62429
|
}
|
|
@@ -62457,14 +62432,14 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62457
62432
|
this.item.addSegments(path.segments);
|
|
62458
62433
|
}
|
|
62459
62434
|
};
|
|
62460
|
-
function
|
|
62461
|
-
return (r =
|
|
62435
|
+
function _defineProperty16(e, r, t) {
|
|
62436
|
+
return (r = _toPropertyKey16(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62462
62437
|
}
|
|
62463
|
-
function
|
|
62464
|
-
var i =
|
|
62438
|
+
function _toPropertyKey16(t) {
|
|
62439
|
+
var i = _toPrimitive16(t, "string");
|
|
62465
62440
|
return "symbol" == typeof i ? i : i + "";
|
|
62466
62441
|
}
|
|
62467
|
-
function
|
|
62442
|
+
function _toPrimitive16(t, r) {
|
|
62468
62443
|
if ("object" != typeof t || !t) return t;
|
|
62469
62444
|
var e = t[Symbol.toPrimitive];
|
|
62470
62445
|
if (void 0 !== e) {
|
|
@@ -62480,16 +62455,16 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
62480
62455
|
}
|
|
62481
62456
|
constructor(layerId, shadowEmitter, elements, scope, toolbarModel, userManager, hasPermission) {
|
|
62482
62457
|
super();
|
|
62483
|
-
|
|
62484
|
-
|
|
62485
|
-
|
|
62486
|
-
|
|
62487
|
-
|
|
62488
|
-
|
|
62489
|
-
|
|
62490
|
-
|
|
62491
|
-
|
|
62492
|
-
|
|
62458
|
+
_defineProperty16(this, "scope", void 0);
|
|
62459
|
+
_defineProperty16(this, "toolbarModel", void 0);
|
|
62460
|
+
_defineProperty16(this, "userManager", void 0);
|
|
62461
|
+
_defineProperty16(this, "elementModels", void 0);
|
|
62462
|
+
_defineProperty16(this, "elements", void 0);
|
|
62463
|
+
_defineProperty16(this, "layerId", void 0);
|
|
62464
|
+
_defineProperty16(this, "maxIndex", -1);
|
|
62465
|
+
_defineProperty16(this, "hasPermission", void 0);
|
|
62466
|
+
_defineProperty16(this, "shadowEmitter", void 0);
|
|
62467
|
+
_defineProperty16(this, "onElementsChange", (event) => {
|
|
62493
62468
|
for (const [key, value] of event.changes.keys.entries()) {
|
|
62494
62469
|
if (value.action === "add") {
|
|
62495
62470
|
const root = this.elements.get(key);
|
|
@@ -62668,7 +62643,7 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
62668
62643
|
return segmentsModel;
|
|
62669
62644
|
}
|
|
62670
62645
|
createSelector() {
|
|
62671
|
-
let
|
|
62646
|
+
let _shadow = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
62672
62647
|
if (!this.hasPermission(WhiteboardPermissionFlag.editSelf) && !this.hasPermission(WhiteboardPermissionFlag.deleteOthers)) {
|
|
62673
62648
|
return null;
|
|
62674
62649
|
}
|
|
@@ -62725,7 +62700,11 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
62725
62700
|
});
|
|
62726
62701
|
}
|
|
62727
62702
|
dispose() {
|
|
62703
|
+
this.elements.unobserve(this.onElementsChange);
|
|
62728
62704
|
this.elements.clear();
|
|
62705
|
+
Array.from(this.elementModels.values()).forEach((model) => {
|
|
62706
|
+
model.dispose();
|
|
62707
|
+
});
|
|
62729
62708
|
}
|
|
62730
62709
|
};
|
|
62731
62710
|
var import_lodash8 = __toESM2(require_lodash(), 1);
|
|
@@ -62764,10 +62743,10 @@ var AnglePrecision = Deg2Rad(2);
|
|
|
62764
62743
|
var Phi = 0.5 * (-1 + Math.sqrt(5));
|
|
62765
62744
|
function DollarRecognizer() {
|
|
62766
62745
|
this.Unistrokes = new Array(3);
|
|
62767
|
-
this.Unistrokes[0] = new Unistroke("triangle", new
|
|
62768
|
-
this.Unistrokes[1] = new Unistroke("rectangle", new
|
|
62769
|
-
this.Unistrokes[2] = new Unistroke("circle", new
|
|
62770
|
-
this.Unistrokes[3] = new Unistroke("arrow", new
|
|
62746
|
+
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)]);
|
|
62747
|
+
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)]);
|
|
62748
|
+
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)]);
|
|
62749
|
+
this.Unistrokes[3] = new Unistroke("arrow", [new Point(68, 222), new Point(70, 220), new Point(73, 218), new Point(75, 217), new Point(77, 215), new Point(80, 213), new Point(82, 212), new Point(84, 210), new Point(87, 209), new Point(89, 208), new Point(92, 206), new Point(95, 204), new Point(101, 201), new Point(106, 198), new Point(112, 194), new Point(118, 191), new Point(124, 187), new Point(127, 186), new Point(132, 183), new Point(138, 181), new Point(141, 180), new Point(146, 178), new Point(154, 173), new Point(159, 171), new Point(161, 170), new Point(166, 167), new Point(168, 167), new Point(171, 166), new Point(174, 164), new Point(177, 162), new Point(180, 160), new Point(182, 158), new Point(183, 156), new Point(181, 154), new Point(178, 153), new Point(171, 153), new Point(164, 153), new Point(160, 153), new Point(150, 154), new Point(147, 155), new Point(141, 157), new Point(137, 158), new Point(135, 158), new Point(137, 158), new Point(140, 157), new Point(143, 156), new Point(151, 154), new Point(160, 152), new Point(170, 149), new Point(179, 147), new Point(185, 145), new Point(192, 144), new Point(196, 144), new Point(198, 144), new Point(200, 144), new Point(201, 147), new Point(199, 149), new Point(194, 157), new Point(191, 160), new Point(186, 167), new Point(180, 176), new Point(177, 179), new Point(171, 187), new Point(169, 189), new Point(165, 194), new Point(164, 196)]);
|
|
62771
62750
|
this.Recognize = function(points, useProtractor) {
|
|
62772
62751
|
var t0 = Date.now();
|
|
62773
62752
|
var candidate = new Unistroke("", points);
|
|
@@ -62828,7 +62807,7 @@ function RotateBy(points, radians) {
|
|
|
62828
62807
|
var c = Centroid(points);
|
|
62829
62808
|
var cos = Math.cos(radians);
|
|
62830
62809
|
var sin = Math.sin(radians);
|
|
62831
|
-
var newpoints =
|
|
62810
|
+
var newpoints = [];
|
|
62832
62811
|
for (var i = 0; i < points.length; i++) {
|
|
62833
62812
|
var qx = (points[i].X - c.X) * cos - (points[i].Y - c.Y) * sin + c.X;
|
|
62834
62813
|
var qy = (points[i].X - c.X) * sin + (points[i].Y - c.Y) * cos + c.Y;
|
|
@@ -62838,7 +62817,7 @@ function RotateBy(points, radians) {
|
|
|
62838
62817
|
}
|
|
62839
62818
|
function ScaleTo(points, size) {
|
|
62840
62819
|
var B2 = BoundingBox(points);
|
|
62841
|
-
var newpoints =
|
|
62820
|
+
var newpoints = [];
|
|
62842
62821
|
for (var i = 0; i < points.length; i++) {
|
|
62843
62822
|
var qx = points[i].X * (size / B2.Width);
|
|
62844
62823
|
var qy = points[i].Y * (size / B2.Height);
|
|
@@ -62848,7 +62827,7 @@ function ScaleTo(points, size) {
|
|
|
62848
62827
|
}
|
|
62849
62828
|
function TranslateTo(points, pt) {
|
|
62850
62829
|
var c = Centroid(points);
|
|
62851
|
-
var newpoints =
|
|
62830
|
+
var newpoints = [];
|
|
62852
62831
|
for (var i = 0; i < points.length; i++) {
|
|
62853
62832
|
var qx = points[i].X + pt.X - c.X;
|
|
62854
62833
|
var qy = points[i].Y + pt.Y - c.Y;
|
|
@@ -62858,14 +62837,14 @@ function TranslateTo(points, pt) {
|
|
|
62858
62837
|
}
|
|
62859
62838
|
function Vectorize(points) {
|
|
62860
62839
|
var sum = 0;
|
|
62861
|
-
var vector =
|
|
62862
|
-
for (
|
|
62840
|
+
var vector = [];
|
|
62841
|
+
for (let i = 0; i < points.length; i++) {
|
|
62863
62842
|
vector[vector.length] = points[i].X;
|
|
62864
62843
|
vector[vector.length] = points[i].Y;
|
|
62865
62844
|
sum += points[i].X * points[i].X + points[i].Y * points[i].Y;
|
|
62866
62845
|
}
|
|
62867
62846
|
var magnitude = Math.sqrt(sum);
|
|
62868
|
-
for (
|
|
62847
|
+
for (let i = 0; i < vector.length; i++)
|
|
62869
62848
|
vector[i] /= magnitude;
|
|
62870
62849
|
return vector;
|
|
62871
62850
|
}
|
|
@@ -62945,14 +62924,14 @@ function Distance(p1, p2) {
|
|
|
62945
62924
|
function Deg2Rad(d) {
|
|
62946
62925
|
return d * Math.PI / 180;
|
|
62947
62926
|
}
|
|
62948
|
-
function
|
|
62949
|
-
return (r =
|
|
62927
|
+
function _defineProperty17(e, r, t) {
|
|
62928
|
+
return (r = _toPropertyKey17(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62950
62929
|
}
|
|
62951
|
-
function
|
|
62952
|
-
var i =
|
|
62930
|
+
function _toPropertyKey17(t) {
|
|
62931
|
+
var i = _toPrimitive17(t, "string");
|
|
62953
62932
|
return "symbol" == typeof i ? i : i + "";
|
|
62954
62933
|
}
|
|
62955
|
-
function
|
|
62934
|
+
function _toPrimitive17(t, r) {
|
|
62956
62935
|
if ("object" != typeof t || !t) return t;
|
|
62957
62936
|
var e = t[Symbol.toPrimitive];
|
|
62958
62937
|
if (void 0 !== e) {
|
|
@@ -62964,7 +62943,7 @@ function _toPrimitive18(t, r) {
|
|
|
62964
62943
|
}
|
|
62965
62944
|
var Recognizer = class {
|
|
62966
62945
|
constructor() {
|
|
62967
|
-
|
|
62946
|
+
_defineProperty17(this, "dollar", new DollarRecognizer());
|
|
62968
62947
|
}
|
|
62969
62948
|
recognize(points) {
|
|
62970
62949
|
let minX = Number.MAX_VALUE;
|
|
@@ -62990,14 +62969,14 @@ var Recognizer = class {
|
|
|
62990
62969
|
return null;
|
|
62991
62970
|
}
|
|
62992
62971
|
};
|
|
62993
|
-
function
|
|
62994
|
-
return (r =
|
|
62972
|
+
function _defineProperty18(e, r, t) {
|
|
62973
|
+
return (r = _toPropertyKey18(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62995
62974
|
}
|
|
62996
|
-
function
|
|
62997
|
-
var i =
|
|
62975
|
+
function _toPropertyKey18(t) {
|
|
62976
|
+
var i = _toPrimitive18(t, "string");
|
|
62998
62977
|
return "symbol" == typeof i ? i : i + "";
|
|
62999
62978
|
}
|
|
63000
|
-
function
|
|
62979
|
+
function _toPrimitive18(t, r) {
|
|
63001
62980
|
if ("object" != typeof t || !t) return t;
|
|
63002
62981
|
var e = t[Symbol.toPrimitive];
|
|
63003
62982
|
if (void 0 !== e) {
|
|
@@ -63010,22 +62989,40 @@ function _toPrimitive19(t, r) {
|
|
|
63010
62989
|
var CurveTool = class extends WhiteboardTool {
|
|
63011
62990
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
63012
62991
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
63013
|
-
|
|
63014
|
-
|
|
63015
|
-
|
|
62992
|
+
_defineProperty18(this, "elementModel", null);
|
|
62993
|
+
_defineProperty18(this, "recognizer", new Recognizer());
|
|
62994
|
+
_defineProperty18(this, "pointCount", 0);
|
|
63016
62995
|
this.tool.minDistance = 1;
|
|
63017
62996
|
}
|
|
63018
|
-
onMouseDown(
|
|
62997
|
+
onMouseDown(_event) {
|
|
63019
62998
|
this.pointCount = 0;
|
|
62999
|
+
if (this.elementModel) {
|
|
63000
|
+
this.elementModel.dispose();
|
|
63001
|
+
}
|
|
63020
63002
|
this.elementModel = this.modelGetter().createCurve(true);
|
|
63021
63003
|
}
|
|
63022
63004
|
onMouseDrag(event) {
|
|
63023
63005
|
if (this.pointCount > 1024) {
|
|
63024
63006
|
return;
|
|
63025
63007
|
}
|
|
63008
|
+
const MIN_DISTANCE = 4;
|
|
63026
63009
|
if (this.elementModel) {
|
|
63027
|
-
this.
|
|
63028
|
-
|
|
63010
|
+
const len = this.elementModel.points.length;
|
|
63011
|
+
let last = {
|
|
63012
|
+
x: 0,
|
|
63013
|
+
y: 0
|
|
63014
|
+
};
|
|
63015
|
+
if (len >= 2) {
|
|
63016
|
+
last = {
|
|
63017
|
+
x: this.elementModel.points[len - 2],
|
|
63018
|
+
y: this.elementModel.points[len - 1]
|
|
63019
|
+
};
|
|
63020
|
+
}
|
|
63021
|
+
const dist = Math.max(Math.abs(last.x - event.point.x), Math.abs(last.y - event.point.y));
|
|
63022
|
+
if (dist >= MIN_DISTANCE) {
|
|
63023
|
+
this.pointCount += 1;
|
|
63024
|
+
this.elementModel.appendPoints([Math.round(event.point.x), Math.round(event.point.y)]);
|
|
63025
|
+
}
|
|
63029
63026
|
}
|
|
63030
63027
|
}
|
|
63031
63028
|
onMouseUp(event) {
|
|
@@ -63059,14 +63056,14 @@ var CurveTool = class extends WhiteboardTool {
|
|
|
63059
63056
|
}
|
|
63060
63057
|
}
|
|
63061
63058
|
};
|
|
63062
|
-
function
|
|
63063
|
-
return (r =
|
|
63059
|
+
function _defineProperty19(e, r, t) {
|
|
63060
|
+
return (r = _toPropertyKey19(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63064
63061
|
}
|
|
63065
|
-
function
|
|
63066
|
-
var i =
|
|
63062
|
+
function _toPropertyKey19(t) {
|
|
63063
|
+
var i = _toPrimitive19(t, "string");
|
|
63067
63064
|
return "symbol" == typeof i ? i : i + "";
|
|
63068
63065
|
}
|
|
63069
|
-
function
|
|
63066
|
+
function _toPrimitive19(t, r) {
|
|
63070
63067
|
if ("object" != typeof t || !t) return t;
|
|
63071
63068
|
var e = t[Symbol.toPrimitive];
|
|
63072
63069
|
if (void 0 !== e) {
|
|
@@ -63079,12 +63076,15 @@ function _toPrimitive20(t, r) {
|
|
|
63079
63076
|
var RectangleTool = class extends WhiteboardTool {
|
|
63080
63077
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
63081
63078
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
63082
|
-
|
|
63083
|
-
|
|
63084
|
-
|
|
63079
|
+
_defineProperty19(this, "elementModel", null);
|
|
63080
|
+
_defineProperty19(this, "from", null);
|
|
63081
|
+
_defineProperty19(this, "to", null);
|
|
63085
63082
|
this.tool.minDistance = 1;
|
|
63086
63083
|
}
|
|
63087
63084
|
onMouseDown(event) {
|
|
63085
|
+
if (this.elementModel) {
|
|
63086
|
+
this.elementModel.dispose();
|
|
63087
|
+
}
|
|
63088
63088
|
this.elementModel = this.modelGetter().createRectangle(true);
|
|
63089
63089
|
this.from = event.point.clone();
|
|
63090
63090
|
this.to = event.point.clone();
|
|
@@ -63104,14 +63104,14 @@ var RectangleTool = class extends WhiteboardTool {
|
|
|
63104
63104
|
}
|
|
63105
63105
|
}
|
|
63106
63106
|
};
|
|
63107
|
-
function
|
|
63108
|
-
return (r =
|
|
63107
|
+
function _defineProperty20(e, r, t) {
|
|
63108
|
+
return (r = _toPropertyKey20(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63109
63109
|
}
|
|
63110
|
-
function
|
|
63111
|
-
var i =
|
|
63110
|
+
function _toPropertyKey20(t) {
|
|
63111
|
+
var i = _toPrimitive20(t, "string");
|
|
63112
63112
|
return "symbol" == typeof i ? i : i + "";
|
|
63113
63113
|
}
|
|
63114
|
-
function
|
|
63114
|
+
function _toPrimitive20(t, r) {
|
|
63115
63115
|
if ("object" != typeof t || !t) return t;
|
|
63116
63116
|
var e = t[Symbol.toPrimitive];
|
|
63117
63117
|
if (void 0 !== e) {
|
|
@@ -63130,7 +63130,7 @@ var TOOLBAR_KEYS = {
|
|
|
63130
63130
|
strokeWidth: "strokeWidth",
|
|
63131
63131
|
dashArray: "dashArray"
|
|
63132
63132
|
};
|
|
63133
|
-
var ToolbarModel = class extends
|
|
63133
|
+
var ToolbarModel = class extends import_eventemitter32.default {
|
|
63134
63134
|
get currentTool() {
|
|
63135
63135
|
return this.root.get(TOOLBAR_KEYS.tool);
|
|
63136
63136
|
}
|
|
@@ -63175,8 +63175,8 @@ var ToolbarModel = class extends import_eventemitter33.default {
|
|
|
63175
63175
|
}
|
|
63176
63176
|
constructor(root, defaultStyle) {
|
|
63177
63177
|
super();
|
|
63178
|
-
|
|
63179
|
-
|
|
63178
|
+
_defineProperty20(this, "root", void 0);
|
|
63179
|
+
_defineProperty20(this, "handleRootUpdate", (evt) => {
|
|
63180
63180
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
63181
63181
|
if (Object.keys(TOOLBAR_KEYS).indexOf(key) >= 0 && (value.action === "add" || value.action === "update")) {
|
|
63182
63182
|
this.emit("update", {
|
|
@@ -63199,15 +63199,19 @@ var ToolbarModel = class extends import_eventemitter33.default {
|
|
|
63199
63199
|
}
|
|
63200
63200
|
});
|
|
63201
63201
|
}
|
|
63202
|
+
dispose() {
|
|
63203
|
+
this.root.unobserve(this.handleRootUpdate);
|
|
63204
|
+
this.removeAllListeners();
|
|
63205
|
+
}
|
|
63202
63206
|
};
|
|
63203
|
-
function
|
|
63204
|
-
return (r =
|
|
63207
|
+
function _defineProperty21(e, r, t) {
|
|
63208
|
+
return (r = _toPropertyKey21(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63205
63209
|
}
|
|
63206
|
-
function
|
|
63207
|
-
var i =
|
|
63210
|
+
function _toPropertyKey21(t) {
|
|
63211
|
+
var i = _toPrimitive21(t, "string");
|
|
63208
63212
|
return "symbol" == typeof i ? i : i + "";
|
|
63209
63213
|
}
|
|
63210
|
-
function
|
|
63214
|
+
function _toPrimitive21(t, r) {
|
|
63211
63215
|
if ("object" != typeof t || !t) return t;
|
|
63212
63216
|
var e = t[Symbol.toPrimitive];
|
|
63213
63217
|
if (void 0 !== e) {
|
|
@@ -63220,16 +63224,19 @@ function _toPrimitive22(t, r) {
|
|
|
63220
63224
|
var SelectorTool = class extends WhiteboardTool {
|
|
63221
63225
|
constructor(enableToolEvent, renderableModel, shadowEmitter, scope, selectElementsModel) {
|
|
63222
63226
|
super(enableToolEvent, renderableModel, shadowEmitter, scope);
|
|
63223
|
-
|
|
63224
|
-
|
|
63225
|
-
|
|
63226
|
-
|
|
63227
|
-
|
|
63227
|
+
_defineProperty21(this, "elementModel", null);
|
|
63228
|
+
_defineProperty21(this, "from", null);
|
|
63229
|
+
_defineProperty21(this, "to", null);
|
|
63230
|
+
_defineProperty21(this, "selectElementsModel", void 0);
|
|
63231
|
+
_defineProperty21(this, "selectElements", /* @__PURE__ */ new Map());
|
|
63228
63232
|
this.selectElementsModel = selectElementsModel;
|
|
63229
63233
|
}
|
|
63230
63234
|
onMouseDown(event) {
|
|
63231
63235
|
this.from = null;
|
|
63232
63236
|
this.to = null;
|
|
63237
|
+
if (this.elementModel) {
|
|
63238
|
+
this.elementModel.dispose();
|
|
63239
|
+
}
|
|
63233
63240
|
this.elementModel = this.modelGetter().createSelector();
|
|
63234
63241
|
this.from = event.point.clone();
|
|
63235
63242
|
this.to = event.point.clone();
|
|
@@ -63285,14 +63292,14 @@ var WhiteboardKeys = {
|
|
|
63285
63292
|
viewMatrix: "viewMatrix",
|
|
63286
63293
|
cameraMode: "cameraMode"
|
|
63287
63294
|
};
|
|
63288
|
-
function
|
|
63289
|
-
return (r =
|
|
63295
|
+
function _defineProperty22(e, r, t) {
|
|
63296
|
+
return (r = _toPropertyKey22(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63290
63297
|
}
|
|
63291
|
-
function
|
|
63292
|
-
var i =
|
|
63298
|
+
function _toPropertyKey22(t) {
|
|
63299
|
+
var i = _toPrimitive22(t, "string");
|
|
63293
63300
|
return "symbol" == typeof i ? i : i + "";
|
|
63294
63301
|
}
|
|
63295
|
-
function
|
|
63302
|
+
function _toPrimitive22(t, r) {
|
|
63296
63303
|
if ("object" != typeof t || !t) return t;
|
|
63297
63304
|
var e = t[Symbol.toPrimitive];
|
|
63298
63305
|
if (void 0 !== e) {
|
|
@@ -63302,7 +63309,7 @@ function _toPrimitive23(t, r) {
|
|
|
63302
63309
|
}
|
|
63303
63310
|
return ("string" === r ? String : Number)(t);
|
|
63304
63311
|
}
|
|
63305
|
-
var SelectElementsModel = class extends
|
|
63312
|
+
var SelectElementsModel = class extends import_eventemitter33.default {
|
|
63306
63313
|
get hasEditSelfPermission() {
|
|
63307
63314
|
return this.hasPermission(WhiteboardPermissionFlag.editSelf);
|
|
63308
63315
|
}
|
|
@@ -63311,24 +63318,28 @@ var SelectElementsModel = class extends import_eventemitter34.default {
|
|
|
63311
63318
|
}
|
|
63312
63319
|
constructor(userManager, requestUserMap, hasPermission) {
|
|
63313
63320
|
super();
|
|
63314
|
-
|
|
63315
|
-
|
|
63316
|
-
|
|
63317
|
-
|
|
63318
|
-
|
|
63321
|
+
_defineProperty22(this, "requestUserMap", void 0);
|
|
63322
|
+
_defineProperty22(this, "userManager", void 0);
|
|
63323
|
+
_defineProperty22(this, "hasPermission", void 0);
|
|
63324
|
+
_defineProperty22(this, "observers", /* @__PURE__ */ new Map());
|
|
63325
|
+
_defineProperty22(this, "handleUserLeave", (user) => {
|
|
63319
63326
|
const cb = this.observers.get(user.id);
|
|
63320
63327
|
if (cb) {
|
|
63321
63328
|
this.requestUserMap(user.id).unobserveDeep(cb);
|
|
63329
|
+
this.observers.delete(user.id);
|
|
63322
63330
|
}
|
|
63323
63331
|
});
|
|
63324
|
-
|
|
63332
|
+
_defineProperty22(this, "handleUserJoin", (user) => {
|
|
63325
63333
|
const observer = (evts) => {
|
|
63326
63334
|
this.handleUserSelectElementsChange(user.id, evts);
|
|
63327
63335
|
};
|
|
63336
|
+
if (this.observers.has(user.id)) {
|
|
63337
|
+
this.requestUserMap(user.id).unobserveDeep(this.observers.get(user.id));
|
|
63338
|
+
}
|
|
63328
63339
|
this.requestUserMap(user.id).observeDeep(observer);
|
|
63329
63340
|
this.observers.set(user.id, observer);
|
|
63330
63341
|
});
|
|
63331
|
-
|
|
63342
|
+
_defineProperty22(this, "handleUserSelectElementsChange", (userId, evts) => {
|
|
63332
63343
|
for (const evt of evts) {
|
|
63333
63344
|
if (evt.target.get("inner-map-id") === WhiteboardKeys.selectElements) {
|
|
63334
63345
|
const elementIds = Array.from(evt.target.keys()).filter((v) => v !== "inner-map-id");
|
|
@@ -63344,6 +63355,9 @@ var SelectElementsModel = class extends import_eventemitter34.default {
|
|
|
63344
63355
|
const observer = (evts) => {
|
|
63345
63356
|
this.handleUserSelectElementsChange(userId, evts);
|
|
63346
63357
|
};
|
|
63358
|
+
if (this.observers.has(userId)) {
|
|
63359
|
+
this.requestUserMap(userId).unobserveDeep(this.observers.get(userId));
|
|
63360
|
+
}
|
|
63347
63361
|
this.requestUserMap(userId).observeDeep(observer);
|
|
63348
63362
|
this.observers.set(userId, observer);
|
|
63349
63363
|
});
|
|
@@ -63398,25 +63412,22 @@ var SelectElementsModel = class extends import_eventemitter34.default {
|
|
|
63398
63412
|
});
|
|
63399
63413
|
}
|
|
63400
63414
|
dispose() {
|
|
63401
|
-
this.
|
|
63402
|
-
|
|
63403
|
-
|
|
63404
|
-
this.requestUserMap(userId).unobserveDeep(cb);
|
|
63405
|
-
}
|
|
63406
|
-
});
|
|
63415
|
+
for (const [key, value] of this.observers.entries()) {
|
|
63416
|
+
this.requestUserMap(key).unobserveDeep(value);
|
|
63417
|
+
}
|
|
63407
63418
|
this.observers.clear();
|
|
63408
63419
|
this.userManager.off("leave", this.handleUserLeave);
|
|
63409
63420
|
this.userManager.off("join", this.handleUserJoin);
|
|
63410
63421
|
}
|
|
63411
63422
|
};
|
|
63412
|
-
function
|
|
63413
|
-
return (r =
|
|
63423
|
+
function _defineProperty23(e, r, t) {
|
|
63424
|
+
return (r = _toPropertyKey23(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63414
63425
|
}
|
|
63415
|
-
function
|
|
63416
|
-
var i =
|
|
63426
|
+
function _toPropertyKey23(t) {
|
|
63427
|
+
var i = _toPrimitive23(t, "string");
|
|
63417
63428
|
return "symbol" == typeof i ? i : i + "";
|
|
63418
63429
|
}
|
|
63419
|
-
function
|
|
63430
|
+
function _toPrimitive23(t, r) {
|
|
63420
63431
|
if ("object" != typeof t || !t) return t;
|
|
63421
63432
|
var e = t[Symbol.toPrimitive];
|
|
63422
63433
|
if (void 0 !== e) {
|
|
@@ -63426,31 +63437,31 @@ function _toPrimitive24(t, r) {
|
|
|
63426
63437
|
}
|
|
63427
63438
|
return ("string" === r ? String : Number)(t);
|
|
63428
63439
|
}
|
|
63429
|
-
var TextEditor = class extends
|
|
63440
|
+
var TextEditor = class extends import_eventemitter35.EventEmitter {
|
|
63430
63441
|
constructor(camera) {
|
|
63431
63442
|
super();
|
|
63432
|
-
|
|
63433
|
-
|
|
63434
|
-
|
|
63435
|
-
|
|
63436
|
-
|
|
63437
|
-
|
|
63438
|
-
|
|
63439
|
-
|
|
63443
|
+
_defineProperty23(this, "rootView", void 0);
|
|
63444
|
+
_defineProperty23(this, "content", void 0);
|
|
63445
|
+
_defineProperty23(this, "camera", void 0);
|
|
63446
|
+
_defineProperty23(this, "originX", 0);
|
|
63447
|
+
_defineProperty23(this, "originY", 0);
|
|
63448
|
+
_defineProperty23(this, "rotation", 0);
|
|
63449
|
+
_defineProperty23(this, "scale", 1);
|
|
63450
|
+
_defineProperty23(this, "handleContentInput", () => {
|
|
63440
63451
|
this.emit("change", this.content.textContent ?? "");
|
|
63441
63452
|
this.translateCaretIntoView();
|
|
63442
63453
|
});
|
|
63443
|
-
|
|
63454
|
+
_defineProperty23(this, "handleContentKeydown", (evt) => {
|
|
63444
63455
|
if (/^Arrow/.test(evt.key)) {
|
|
63445
63456
|
setTimeout(() => {
|
|
63446
63457
|
this.translateCaretIntoView();
|
|
63447
63458
|
}, 50);
|
|
63448
63459
|
}
|
|
63449
63460
|
});
|
|
63450
|
-
|
|
63461
|
+
_defineProperty23(this, "handleContentBlur", () => {
|
|
63451
63462
|
this.emit("done", this.content.textContent ?? "");
|
|
63452
63463
|
});
|
|
63453
|
-
|
|
63464
|
+
_defineProperty23(this, "handleRootClick", (evt) => {
|
|
63454
63465
|
if (evt.target === this.rootView) {
|
|
63455
63466
|
evt.stopPropagation();
|
|
63456
63467
|
evt.preventDefault();
|
|
@@ -63459,12 +63470,12 @@ var TextEditor = class extends import_eventemitter36.EventEmitter {
|
|
|
63459
63470
|
});
|
|
63460
63471
|
this.camera = camera;
|
|
63461
63472
|
this.rootView = document.createElement("div");
|
|
63462
|
-
this.rootView.style.cssText =
|
|
63473
|
+
this.rootView.style.cssText = "position:absolute;width:100%;height:100%;top:0;left:0;overflow:hidden;";
|
|
63463
63474
|
this.content = document.createElement("div");
|
|
63464
63475
|
this.content.setAttribute("spellcheck", "false");
|
|
63465
63476
|
this.content.textContent = "";
|
|
63466
63477
|
this.content.setAttribute("contenteditable", "plaintext-only");
|
|
63467
|
-
this.content.style.cssText =
|
|
63478
|
+
this.content.style.cssText = "white-space: nowrap;border:1px solid red;text-wrap:nowrap;caret-color:red;line-height:1.2em;position:absolute;z-index:2;color:transparent;outline:none;";
|
|
63468
63479
|
this.content.style.transformOrigin = "0 0";
|
|
63469
63480
|
this.rootView.appendChild(this.content);
|
|
63470
63481
|
this.content.addEventListener("input", this.handleContentInput);
|
|
@@ -63540,14 +63551,14 @@ var TextEditor = class extends import_eventemitter36.EventEmitter {
|
|
|
63540
63551
|
this.rootView.removeEventListener("pointerdown", this.handleRootClick);
|
|
63541
63552
|
}
|
|
63542
63553
|
};
|
|
63543
|
-
function
|
|
63544
|
-
return (r =
|
|
63554
|
+
function _defineProperty24(e, r, t) {
|
|
63555
|
+
return (r = _toPropertyKey24(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
63545
63556
|
}
|
|
63546
|
-
function
|
|
63547
|
-
var i =
|
|
63557
|
+
function _toPropertyKey24(t) {
|
|
63558
|
+
var i = _toPrimitive24(t, "string");
|
|
63548
63559
|
return "symbol" == typeof i ? i : i + "";
|
|
63549
63560
|
}
|
|
63550
|
-
function
|
|
63561
|
+
function _toPrimitive24(t, r) {
|
|
63551
63562
|
if ("object" != typeof t || !t) return t;
|
|
63552
63563
|
var e = t[Symbol.toPrimitive];
|
|
63553
63564
|
if (void 0 !== e) {
|
|
@@ -63567,7 +63578,7 @@ var ANCHOR_STYLE = {
|
|
|
63567
63578
|
b: "cursor:s-resize;bottom:-3px;left:50%;translate:-50%;",
|
|
63568
63579
|
br: "cursor:se-resize;bottom:-3px;right:-3px"
|
|
63569
63580
|
};
|
|
63570
|
-
var Bounds = class extends
|
|
63581
|
+
var Bounds = class extends import_eventemitter34.default {
|
|
63571
63582
|
get width() {
|
|
63572
63583
|
return this.maxX - this.minX;
|
|
63573
63584
|
}
|
|
@@ -63582,12 +63593,12 @@ var Bounds = class extends import_eventemitter35.default {
|
|
|
63582
63593
|
}
|
|
63583
63594
|
constructor(binding, scope) {
|
|
63584
63595
|
super();
|
|
63585
|
-
|
|
63586
|
-
|
|
63587
|
-
|
|
63588
|
-
|
|
63589
|
-
|
|
63590
|
-
|
|
63596
|
+
_defineProperty24(this, "minX", 0);
|
|
63597
|
+
_defineProperty24(this, "minY", 0);
|
|
63598
|
+
_defineProperty24(this, "maxX", 0);
|
|
63599
|
+
_defineProperty24(this, "maxY", 0);
|
|
63600
|
+
_defineProperty24(this, "binding", void 0);
|
|
63601
|
+
_defineProperty24(this, "scope", void 0);
|
|
63591
63602
|
this.binding = binding;
|
|
63592
63603
|
this.scope = scope;
|
|
63593
63604
|
}
|
|
@@ -63706,35 +63717,35 @@ var Bounds = class extends import_eventemitter35.default {
|
|
|
63706
63717
|
this.maxY = maxY;
|
|
63707
63718
|
}
|
|
63708
63719
|
};
|
|
63709
|
-
var Editor = class extends
|
|
63720
|
+
var Editor = class extends import_eventemitter34.default {
|
|
63710
63721
|
constructor(scope, shadowScope, shadowEmitter, canvasElement, camera, initConfig) {
|
|
63711
63722
|
super();
|
|
63712
|
-
|
|
63713
|
-
|
|
63714
|
-
|
|
63715
|
-
|
|
63716
|
-
|
|
63717
|
-
|
|
63718
|
-
|
|
63719
|
-
|
|
63720
|
-
|
|
63721
|
-
|
|
63722
|
-
|
|
63723
|
-
|
|
63724
|
-
|
|
63725
|
-
|
|
63726
|
-
|
|
63727
|
-
|
|
63728
|
-
|
|
63729
|
-
|
|
63730
|
-
|
|
63731
|
-
|
|
63732
|
-
|
|
63733
|
-
|
|
63734
|
-
|
|
63735
|
-
|
|
63736
|
-
|
|
63737
|
-
|
|
63723
|
+
_defineProperty24(this, "rootView", void 0);
|
|
63724
|
+
_defineProperty24(this, "frame", void 0);
|
|
63725
|
+
_defineProperty24(this, "rotator", void 0);
|
|
63726
|
+
_defineProperty24(this, "scope", void 0);
|
|
63727
|
+
_defineProperty24(this, "shadowScope", void 0);
|
|
63728
|
+
_defineProperty24(this, "shadowContainer", void 0);
|
|
63729
|
+
_defineProperty24(this, "ctrlUserMap", void 0);
|
|
63730
|
+
_defineProperty24(this, "viewerId", void 0);
|
|
63731
|
+
_defineProperty24(this, "ctrlId", void 0);
|
|
63732
|
+
_defineProperty24(this, "ctrlNickName", void 0);
|
|
63733
|
+
_defineProperty24(this, "editMode", null);
|
|
63734
|
+
_defineProperty24(this, "editCtrlName", null);
|
|
63735
|
+
_defineProperty24(this, "editAnchor", null);
|
|
63736
|
+
_defineProperty24(this, "lastEditPoint", null);
|
|
63737
|
+
_defineProperty24(this, "bounds", void 0);
|
|
63738
|
+
_defineProperty24(this, "targets", []);
|
|
63739
|
+
_defineProperty24(this, "editorConfig", null);
|
|
63740
|
+
_defineProperty24(this, "aspectRatio", -1);
|
|
63741
|
+
_defineProperty24(this, "uniformScale", false);
|
|
63742
|
+
_defineProperty24(this, "camera", void 0);
|
|
63743
|
+
_defineProperty24(this, "canvasElement", void 0);
|
|
63744
|
+
_defineProperty24(this, "resizeObserver", void 0);
|
|
63745
|
+
_defineProperty24(this, "anchors", []);
|
|
63746
|
+
_defineProperty24(this, "title", null);
|
|
63747
|
+
_defineProperty24(this, "shadowEmitter", void 0);
|
|
63748
|
+
_defineProperty24(this, "handleMatrix", (matrix) => {
|
|
63738
63749
|
if (this.shadowContainer) {
|
|
63739
63750
|
const next = matrix.appended(this.shadowContainer.data.shadowMatrix ?? new this.shadowScope.Matrix());
|
|
63740
63751
|
this.shadowContainer.data.shadowMatrix = next;
|
|
@@ -63744,7 +63755,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63744
63755
|
this.targets.forEach((target) => target.appendPointsMatrix(matrix));
|
|
63745
63756
|
}
|
|
63746
63757
|
});
|
|
63747
|
-
|
|
63758
|
+
_defineProperty24(this, "handlePointerDown", (evt) => {
|
|
63748
63759
|
if (!evt.target) {
|
|
63749
63760
|
return;
|
|
63750
63761
|
}
|
|
@@ -63800,14 +63811,14 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63800
63811
|
};
|
|
63801
63812
|
}
|
|
63802
63813
|
});
|
|
63803
|
-
|
|
63814
|
+
_defineProperty24(this, "handlePointerMove", (evt) => {
|
|
63804
63815
|
evt.preventDefault();
|
|
63805
63816
|
if (!evt.target) {
|
|
63806
63817
|
return;
|
|
63807
63818
|
}
|
|
63808
63819
|
if (this.editMode === "matrix" && this.editAnchor && this.lastEditPoint) {
|
|
63809
63820
|
const offsetX = evt.pageX - this.lastEditPoint.x;
|
|
63810
|
-
|
|
63821
|
+
const offsetY = evt.pageY - this.lastEditPoint.y;
|
|
63811
63822
|
this.bounds.offsetBy(this.editAnchor, offsetX, offsetY, this.uniformScale ? this.aspectRatio : -1);
|
|
63812
63823
|
this.lastEditPoint = {
|
|
63813
63824
|
x: evt.pageX,
|
|
@@ -63832,7 +63843,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63832
63843
|
}
|
|
63833
63844
|
if (this.editMode === "translate" && this.lastEditPoint) {
|
|
63834
63845
|
const offsetX = evt.pageX - this.lastEditPoint.x;
|
|
63835
|
-
|
|
63846
|
+
const offsetY = evt.pageY - this.lastEditPoint.y;
|
|
63836
63847
|
this.bounds.translate(offsetX, offsetY);
|
|
63837
63848
|
this.updateBoundsByShadow();
|
|
63838
63849
|
this.lastEditPoint = {
|
|
@@ -63851,7 +63862,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63851
63862
|
}
|
|
63852
63863
|
}
|
|
63853
63864
|
});
|
|
63854
|
-
|
|
63865
|
+
_defineProperty24(this, "handlePointerUp", (evt) => {
|
|
63855
63866
|
evt.preventDefault();
|
|
63856
63867
|
this.resetShadow();
|
|
63857
63868
|
this.shadowEmitter.setActive(false);
|
|
@@ -63868,7 +63879,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63868
63879
|
this.lastEditPoint = null;
|
|
63869
63880
|
this.uniformScale = false;
|
|
63870
63881
|
});
|
|
63871
|
-
|
|
63882
|
+
_defineProperty24(this, "handleFrameDBClick", (evt) => {
|
|
63872
63883
|
if (evt.target === this.frame && this.targets.length === 1) {
|
|
63873
63884
|
if (this.targets[0].type === "point-text") {
|
|
63874
63885
|
this.frame.style.display = "none";
|
|
@@ -63876,7 +63887,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63876
63887
|
}
|
|
63877
63888
|
}
|
|
63878
63889
|
});
|
|
63879
|
-
|
|
63890
|
+
_defineProperty24(this, "updateBounds", () => {
|
|
63880
63891
|
let minX = Number.MAX_VALUE;
|
|
63881
63892
|
let maxX = -Number.MAX_VALUE;
|
|
63882
63893
|
let minY = Number.MAX_VALUE;
|
|
@@ -63909,7 +63920,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63909
63920
|
this.ctrlId = initConfig.ctrlId;
|
|
63910
63921
|
this.ctrlNickName = initConfig.ctrlNickName;
|
|
63911
63922
|
this.rootView = document.createElement("div");
|
|
63912
|
-
this.rootView.style.cssText =
|
|
63923
|
+
this.rootView.style.cssText = "position:absolute;display:none;width:100%;height:100%;top:50%;left:50%;transform:translate(-50%,-50%);";
|
|
63913
63924
|
this.frame = document.createElement("div");
|
|
63914
63925
|
this.frame.style.position = "absolute";
|
|
63915
63926
|
this.frame.style.padding = "8px";
|
|
@@ -63930,7 +63941,7 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
63930
63941
|
} else {
|
|
63931
63942
|
this.title = document.createElement("div");
|
|
63932
63943
|
this.title.textContent = `${this.ctrlNickName}`;
|
|
63933
|
-
this.title.style.cssText =
|
|
63944
|
+
this.title.style.cssText = "color:#fff;font-size:12px;padding: 0.2em 0.4em;border-radius: 0.4em;position: absolute;top: 0%;left: 0;margin: -0.4em;transform: translate(-100%, -100%);";
|
|
63934
63945
|
this.frame.appendChild(this.title);
|
|
63935
63946
|
this.rootView.style.pointerEvents = "none";
|
|
63936
63947
|
}
|
|
@@ -64126,14 +64137,14 @@ var Editor = class extends import_eventemitter35.default {
|
|
|
64126
64137
|
this.resizeObserver.disconnect();
|
|
64127
64138
|
}
|
|
64128
64139
|
};
|
|
64129
|
-
function
|
|
64130
|
-
return (r =
|
|
64140
|
+
function _defineProperty25(e, r, t) {
|
|
64141
|
+
return (r = _toPropertyKey25(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64131
64142
|
}
|
|
64132
|
-
function
|
|
64133
|
-
var i =
|
|
64143
|
+
function _toPropertyKey25(t) {
|
|
64144
|
+
var i = _toPrimitive25(t, "string");
|
|
64134
64145
|
return "symbol" == typeof i ? i : i + "";
|
|
64135
64146
|
}
|
|
64136
|
-
function
|
|
64147
|
+
function _toPrimitive25(t, r) {
|
|
64137
64148
|
if ("object" != typeof t || !t) return t;
|
|
64138
64149
|
var e = t[Symbol.toPrimitive];
|
|
64139
64150
|
if (void 0 !== e) {
|
|
@@ -64146,13 +64157,13 @@ function _toPrimitive26(t, r) {
|
|
|
64146
64157
|
var TextTool = class extends WhiteboardTool {
|
|
64147
64158
|
constructor(enableToolEvent, model, shadowEmitter, scope, rootView, canvasElement, toolbarModel, camera) {
|
|
64148
64159
|
super(enableToolEvent, model, shadowEmitter, scope);
|
|
64149
|
-
|
|
64150
|
-
|
|
64151
|
-
|
|
64152
|
-
|
|
64153
|
-
|
|
64154
|
-
|
|
64155
|
-
|
|
64160
|
+
_defineProperty25(this, "from", null);
|
|
64161
|
+
_defineProperty25(this, "to", null);
|
|
64162
|
+
_defineProperty25(this, "rootView", void 0);
|
|
64163
|
+
_defineProperty25(this, "canvasElement", void 0);
|
|
64164
|
+
_defineProperty25(this, "elementModel", null);
|
|
64165
|
+
_defineProperty25(this, "toolbarModel", void 0);
|
|
64166
|
+
_defineProperty25(this, "camera", void 0);
|
|
64156
64167
|
this.rootView = rootView;
|
|
64157
64168
|
this.canvasElement = canvasElement;
|
|
64158
64169
|
this.toolbarModel = toolbarModel;
|
|
@@ -64161,7 +64172,7 @@ var TextTool = class extends WhiteboardTool {
|
|
|
64161
64172
|
onMouseDown(event) {
|
|
64162
64173
|
this.from = event.point.clone();
|
|
64163
64174
|
}
|
|
64164
|
-
onMouseDrag(
|
|
64175
|
+
onMouseDrag(_event) {
|
|
64165
64176
|
}
|
|
64166
64177
|
onMouseUp(event) {
|
|
64167
64178
|
this.to = event.point.clone();
|
|
@@ -64173,6 +64184,9 @@ var TextTool = class extends WhiteboardTool {
|
|
|
64173
64184
|
}
|
|
64174
64185
|
}
|
|
64175
64186
|
createPointEditor(x, y) {
|
|
64187
|
+
if (this.elementModel) {
|
|
64188
|
+
this.elementModel.dispose();
|
|
64189
|
+
}
|
|
64176
64190
|
this.elementModel = this.modelGetter().createPointText(x, y, true);
|
|
64177
64191
|
if (this.elementModel === null) {
|
|
64178
64192
|
return;
|
|
@@ -64211,14 +64225,14 @@ var TextTool = class extends WhiteboardTool {
|
|
|
64211
64225
|
}, 30);
|
|
64212
64226
|
}
|
|
64213
64227
|
};
|
|
64214
|
-
function
|
|
64215
|
-
return (r =
|
|
64228
|
+
function _defineProperty26(e, r, t) {
|
|
64229
|
+
return (r = _toPropertyKey26(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64216
64230
|
}
|
|
64217
|
-
function
|
|
64218
|
-
var i =
|
|
64231
|
+
function _toPropertyKey26(t) {
|
|
64232
|
+
var i = _toPrimitive26(t, "string");
|
|
64219
64233
|
return "symbol" == typeof i ? i : i + "";
|
|
64220
64234
|
}
|
|
64221
|
-
function
|
|
64235
|
+
function _toPrimitive26(t, r) {
|
|
64222
64236
|
if ("object" != typeof t || !t) return t;
|
|
64223
64237
|
var e = t[Symbol.toPrimitive];
|
|
64224
64238
|
if (void 0 !== e) {
|
|
@@ -64228,14 +64242,14 @@ function _toPrimitive27(t, r) {
|
|
|
64228
64242
|
}
|
|
64229
64243
|
return ("string" === r ? String : Number)(t);
|
|
64230
64244
|
}
|
|
64231
|
-
var Gesture = class extends
|
|
64245
|
+
var Gesture = class extends import_eventemitter37.default {
|
|
64232
64246
|
constructor(element, scope) {
|
|
64233
64247
|
super();
|
|
64234
|
-
|
|
64235
|
-
|
|
64236
|
-
|
|
64237
|
-
|
|
64238
|
-
|
|
64248
|
+
_defineProperty26(this, "element", void 0);
|
|
64249
|
+
_defineProperty26(this, "scope", void 0);
|
|
64250
|
+
_defineProperty26(this, "lastVector", null);
|
|
64251
|
+
_defineProperty26(this, "lastPoint", null);
|
|
64252
|
+
_defineProperty26(this, "onTouchStart", (evt) => {
|
|
64239
64253
|
if (evt.touches.length > 1) {
|
|
64240
64254
|
evt.preventDefault();
|
|
64241
64255
|
evt.stopPropagation();
|
|
@@ -64248,7 +64262,7 @@ var Gesture = class extends import_eventemitter38.default {
|
|
|
64248
64262
|
this.lastVector = p2.subtract(p1);
|
|
64249
64263
|
this.lastPoint = p1;
|
|
64250
64264
|
});
|
|
64251
|
-
|
|
64265
|
+
_defineProperty26(this, "onTouchMove", (evt) => {
|
|
64252
64266
|
if (this.lastVector && this.lastPoint && evt.touches.length === 2) {
|
|
64253
64267
|
evt.preventDefault();
|
|
64254
64268
|
evt.stopPropagation();
|
|
@@ -64279,7 +64293,7 @@ var Gesture = class extends import_eventemitter38.default {
|
|
|
64279
64293
|
this.lastPoint = null;
|
|
64280
64294
|
}
|
|
64281
64295
|
});
|
|
64282
|
-
|
|
64296
|
+
_defineProperty26(this, "onTouchEnd", () => {
|
|
64283
64297
|
this.lastVector = null;
|
|
64284
64298
|
this.lastPoint = null;
|
|
64285
64299
|
});
|
|
@@ -64290,14 +64304,14 @@ var Gesture = class extends import_eventemitter38.default {
|
|
|
64290
64304
|
this.element.addEventListener("touchend", this.onTouchEnd);
|
|
64291
64305
|
}
|
|
64292
64306
|
};
|
|
64293
|
-
function
|
|
64294
|
-
return (r =
|
|
64307
|
+
function _defineProperty27(e, r, t) {
|
|
64308
|
+
return (r = _toPropertyKey27(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64295
64309
|
}
|
|
64296
|
-
function
|
|
64297
|
-
var i =
|
|
64310
|
+
function _toPropertyKey27(t) {
|
|
64311
|
+
var i = _toPrimitive27(t, "string");
|
|
64298
64312
|
return "symbol" == typeof i ? i : i + "";
|
|
64299
64313
|
}
|
|
64300
|
-
function
|
|
64314
|
+
function _toPrimitive27(t, r) {
|
|
64301
64315
|
if ("object" != typeof t || !t) return t;
|
|
64302
64316
|
var e = t[Symbol.toPrimitive];
|
|
64303
64317
|
if (void 0 !== e) {
|
|
@@ -64307,7 +64321,7 @@ function _toPrimitive28(t, r) {
|
|
|
64307
64321
|
}
|
|
64308
64322
|
return ("string" === r ? String : Number)(t);
|
|
64309
64323
|
}
|
|
64310
|
-
var Camera = class extends
|
|
64324
|
+
var Camera = class extends import_eventemitter36.default {
|
|
64311
64325
|
get inherentMatrix() {
|
|
64312
64326
|
const inherentMatrix = new this.scope.Matrix();
|
|
64313
64327
|
inherentMatrix.scale(this.inherentScale, [0, 0]);
|
|
@@ -64319,31 +64333,31 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64319
64333
|
}
|
|
64320
64334
|
constructor(initSize, maxScale, dom, userManager, scope, whiteboardAttrsMap, hasPermission, requestUserMap, _paperSize, _domSize) {
|
|
64321
64335
|
super();
|
|
64322
|
-
|
|
64323
|
-
|
|
64324
|
-
|
|
64325
|
-
|
|
64336
|
+
_defineProperty27(this, "scope", void 0);
|
|
64337
|
+
_defineProperty27(this, "dom", void 0);
|
|
64338
|
+
_defineProperty27(this, "lastTriggerTime", 0);
|
|
64339
|
+
_defineProperty27(this, "lastDelta", {
|
|
64326
64340
|
x: 0,
|
|
64327
64341
|
y: 0
|
|
64328
64342
|
});
|
|
64329
|
-
|
|
64330
|
-
|
|
64331
|
-
|
|
64332
|
-
|
|
64333
|
-
|
|
64334
|
-
|
|
64335
|
-
|
|
64336
|
-
|
|
64337
|
-
|
|
64338
|
-
|
|
64339
|
-
|
|
64340
|
-
|
|
64341
|
-
|
|
64342
|
-
|
|
64343
|
-
|
|
64344
|
-
|
|
64345
|
-
|
|
64346
|
-
|
|
64343
|
+
_defineProperty27(this, "requestUserMap", void 0);
|
|
64344
|
+
_defineProperty27(this, "userManager", void 0);
|
|
64345
|
+
_defineProperty27(this, "observers", /* @__PURE__ */ new Map());
|
|
64346
|
+
_defineProperty27(this, "whiteboardAttrsMap", void 0);
|
|
64347
|
+
_defineProperty27(this, "paperSize", void 0);
|
|
64348
|
+
_defineProperty27(this, "domSize", void 0);
|
|
64349
|
+
_defineProperty27(this, "hasPermission", void 0);
|
|
64350
|
+
_defineProperty27(this, "gesture", void 0);
|
|
64351
|
+
_defineProperty27(this, "inherentScale", 1);
|
|
64352
|
+
_defineProperty27(this, "maxScale", void 0);
|
|
64353
|
+
_defineProperty27(this, "initSize", void 0);
|
|
64354
|
+
_defineProperty27(this, "bound", void 0);
|
|
64355
|
+
_defineProperty27(this, "boundTiemoutId", void 0);
|
|
64356
|
+
_defineProperty27(this, "enableByMouse", true);
|
|
64357
|
+
_defineProperty27(this, "enableByTouch", true);
|
|
64358
|
+
_defineProperty27(this, "boundaryColor", "#F44336");
|
|
64359
|
+
_defineProperty27(this, "enableBoundaryHighlight", true);
|
|
64360
|
+
_defineProperty27(this, "handleMainCameraChange", (evt) => {
|
|
64347
64361
|
const userMap = this.requestUserMap(this.userManager.selfId);
|
|
64348
64362
|
const cameraMode = userMap.get(WhiteboardKeys.cameraMode);
|
|
64349
64363
|
if (cameraMode !== "main") {
|
|
@@ -64360,20 +64374,23 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64360
64374
|
}
|
|
64361
64375
|
}
|
|
64362
64376
|
});
|
|
64363
|
-
|
|
64377
|
+
_defineProperty27(this, "handleUserLeave", (user) => {
|
|
64364
64378
|
const cb = this.observers.get(user.id);
|
|
64365
64379
|
if (cb) {
|
|
64366
64380
|
this.requestUserMap(user.id).unobserve(cb);
|
|
64367
64381
|
}
|
|
64368
64382
|
});
|
|
64369
|
-
|
|
64383
|
+
_defineProperty27(this, "handleUserJoin", (user) => {
|
|
64370
64384
|
const observer = (evt) => {
|
|
64371
64385
|
this.handleViewMatrixUpdate(user.id, evt);
|
|
64372
64386
|
};
|
|
64387
|
+
if (this.observers.has(user.id)) {
|
|
64388
|
+
this.requestUserMap(user.id).unobserve(observer);
|
|
64389
|
+
}
|
|
64373
64390
|
this.requestUserMap(user.id).observe(observer);
|
|
64374
64391
|
this.observers.set(user.id, observer);
|
|
64375
64392
|
});
|
|
64376
|
-
|
|
64393
|
+
_defineProperty27(this, "handleViewMatrixUpdate", (userId, evt) => {
|
|
64377
64394
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
64378
64395
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
64379
64396
|
if (value.action === "update") {
|
|
@@ -64400,7 +64417,7 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64400
64417
|
}
|
|
64401
64418
|
}
|
|
64402
64419
|
});
|
|
64403
|
-
|
|
64420
|
+
_defineProperty27(this, "handleWheel", (evt) => {
|
|
64404
64421
|
if (!this.enableByMouse) {
|
|
64405
64422
|
return;
|
|
64406
64423
|
}
|
|
@@ -64449,7 +64466,7 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64449
64466
|
});
|
|
64450
64467
|
this.maxScale = maxScale;
|
|
64451
64468
|
this.bound = window.document.createElement("div");
|
|
64452
|
-
this.bound.style.cssText =
|
|
64469
|
+
this.bound.style.cssText = "transition: box-shadow 100ms;pointer-events:none;z-index:99;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);";
|
|
64453
64470
|
this.initSize = initSize;
|
|
64454
64471
|
this.hasPermission = hasPermission;
|
|
64455
64472
|
this.paperSize = _paperSize;
|
|
@@ -64474,6 +64491,9 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64474
64491
|
const observer = (evt) => {
|
|
64475
64492
|
this.handleViewMatrixUpdate(userId, evt);
|
|
64476
64493
|
};
|
|
64494
|
+
if (this.observers.has(userId)) {
|
|
64495
|
+
this.requestUserMap(userId).unobserve(observer);
|
|
64496
|
+
}
|
|
64477
64497
|
this.requestUserMap(userId).observe(observer);
|
|
64478
64498
|
this.observers.set(userId, observer);
|
|
64479
64499
|
});
|
|
@@ -64510,7 +64530,7 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64510
64530
|
this.bound.style.boxShadow = `inset 0px 0px 6px 2px ${this.boundaryColor}`;
|
|
64511
64531
|
window.clearTimeout(this.boundTiemoutId);
|
|
64512
64532
|
this.boundTiemoutId = window.setTimeout(() => {
|
|
64513
|
-
this.bound.style.boxShadow =
|
|
64533
|
+
this.bound.style.boxShadow = "none";
|
|
64514
64534
|
}, 100);
|
|
64515
64535
|
}
|
|
64516
64536
|
}
|
|
@@ -64520,6 +64540,9 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64520
64540
|
updateInherentScale(scale) {
|
|
64521
64541
|
this.inherentScale = scale;
|
|
64522
64542
|
}
|
|
64543
|
+
getInherentScale() {
|
|
64544
|
+
return this.inherentScale;
|
|
64545
|
+
}
|
|
64523
64546
|
getActiveMatrix() {
|
|
64524
64547
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
64525
64548
|
let matrixValue;
|
|
@@ -64662,15 +64685,28 @@ var Camera = class extends import_eventemitter37.default {
|
|
|
64662
64685
|
y: 0
|
|
64663
64686
|
};
|
|
64664
64687
|
}
|
|
64688
|
+
dispose() {
|
|
64689
|
+
Array.from(this.observers.keys()).forEach((userId) => {
|
|
64690
|
+
const cb = this.observers.get(userId);
|
|
64691
|
+
if (cb) {
|
|
64692
|
+
this.requestUserMap(userId).unobserve(cb);
|
|
64693
|
+
}
|
|
64694
|
+
});
|
|
64695
|
+
this.whiteboardAttrsMap.unobserve(this.handleMainCameraChange);
|
|
64696
|
+
this.userManager.off("join", this.handleUserJoin);
|
|
64697
|
+
this.userManager.off("leave", this.handleUserLeave);
|
|
64698
|
+
this.gesture.removeAllListeners();
|
|
64699
|
+
this.removeAllListeners();
|
|
64700
|
+
}
|
|
64665
64701
|
};
|
|
64666
|
-
function
|
|
64667
|
-
return (r =
|
|
64702
|
+
function _defineProperty28(e, r, t) {
|
|
64703
|
+
return (r = _toPropertyKey28(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64668
64704
|
}
|
|
64669
|
-
function
|
|
64670
|
-
var i =
|
|
64705
|
+
function _toPropertyKey28(t) {
|
|
64706
|
+
var i = _toPrimitive28(t, "string");
|
|
64671
64707
|
return "symbol" == typeof i ? i : i + "";
|
|
64672
64708
|
}
|
|
64673
|
-
function
|
|
64709
|
+
function _toPrimitive28(t, r) {
|
|
64674
64710
|
if ("object" != typeof t || !t) return t;
|
|
64675
64711
|
var e = t[Symbol.toPrimitive];
|
|
64676
64712
|
if (void 0 !== e) {
|
|
@@ -64683,12 +64719,15 @@ function _toPrimitive29(t, r) {
|
|
|
64683
64719
|
var EllipseTool = class extends WhiteboardTool {
|
|
64684
64720
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
64685
64721
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
64686
|
-
|
|
64687
|
-
|
|
64688
|
-
|
|
64722
|
+
_defineProperty28(this, "elementModel", null);
|
|
64723
|
+
_defineProperty28(this, "from", null);
|
|
64724
|
+
_defineProperty28(this, "to", null);
|
|
64689
64725
|
this.tool.minDistance = 1;
|
|
64690
64726
|
}
|
|
64691
64727
|
onMouseDown(event) {
|
|
64728
|
+
if (this.elementModel) {
|
|
64729
|
+
this.elementModel.dispose();
|
|
64730
|
+
}
|
|
64692
64731
|
this.elementModel = this.modelGetter().createSegmentedPath("ellipse", true);
|
|
64693
64732
|
this.from = event.point.clone();
|
|
64694
64733
|
this.to = event.point.clone();
|
|
@@ -64712,14 +64751,14 @@ var EllipseTool = class extends WhiteboardTool {
|
|
|
64712
64751
|
}
|
|
64713
64752
|
}
|
|
64714
64753
|
};
|
|
64715
|
-
function
|
|
64716
|
-
return (r =
|
|
64754
|
+
function _defineProperty29(e, r, t) {
|
|
64755
|
+
return (r = _toPropertyKey29(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64717
64756
|
}
|
|
64718
|
-
function
|
|
64719
|
-
var i =
|
|
64757
|
+
function _toPropertyKey29(t) {
|
|
64758
|
+
var i = _toPrimitive29(t, "string");
|
|
64720
64759
|
return "symbol" == typeof i ? i : i + "";
|
|
64721
64760
|
}
|
|
64722
|
-
function
|
|
64761
|
+
function _toPrimitive29(t, r) {
|
|
64723
64762
|
if ("object" != typeof t || !t) return t;
|
|
64724
64763
|
var e = t[Symbol.toPrimitive];
|
|
64725
64764
|
if (void 0 !== e) {
|
|
@@ -64732,12 +64771,15 @@ function _toPrimitive30(t, r) {
|
|
|
64732
64771
|
var TriangleTool = class extends WhiteboardTool {
|
|
64733
64772
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
64734
64773
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
64735
|
-
|
|
64736
|
-
|
|
64737
|
-
|
|
64774
|
+
_defineProperty29(this, "elementModel", null);
|
|
64775
|
+
_defineProperty29(this, "from", null);
|
|
64776
|
+
_defineProperty29(this, "to", null);
|
|
64738
64777
|
this.tool.minDistance = 1;
|
|
64739
64778
|
}
|
|
64740
64779
|
onMouseDown(event) {
|
|
64780
|
+
if (this.elementModel) {
|
|
64781
|
+
this.elementModel.dispose();
|
|
64782
|
+
}
|
|
64741
64783
|
this.elementModel = this.modelGetter().createTriangle(true);
|
|
64742
64784
|
this.from = event.point.clone();
|
|
64743
64785
|
this.to = event.point.clone();
|
|
@@ -64757,14 +64799,14 @@ var TriangleTool = class extends WhiteboardTool {
|
|
|
64757
64799
|
}
|
|
64758
64800
|
}
|
|
64759
64801
|
};
|
|
64760
|
-
function
|
|
64761
|
-
return (r =
|
|
64802
|
+
function _defineProperty30(e, r, t) {
|
|
64803
|
+
return (r = _toPropertyKey30(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64762
64804
|
}
|
|
64763
|
-
function
|
|
64764
|
-
var i =
|
|
64805
|
+
function _toPropertyKey30(t) {
|
|
64806
|
+
var i = _toPrimitive30(t, "string");
|
|
64765
64807
|
return "symbol" == typeof i ? i : i + "";
|
|
64766
64808
|
}
|
|
64767
|
-
function
|
|
64809
|
+
function _toPrimitive30(t, r) {
|
|
64768
64810
|
if ("object" != typeof t || !t) return t;
|
|
64769
64811
|
var e = t[Symbol.toPrimitive];
|
|
64770
64812
|
if (void 0 !== e) {
|
|
@@ -64774,63 +64816,63 @@ function _toPrimitive31(t, r) {
|
|
|
64774
64816
|
}
|
|
64775
64817
|
return ("string" === r ? String : Number)(t);
|
|
64776
64818
|
}
|
|
64777
|
-
var Whiteboard = class extends
|
|
64819
|
+
var Whiteboard = class extends import_eventemitter38.default {
|
|
64778
64820
|
// public insertImage!: (src: string) => void;
|
|
64779
64821
|
constructor(view) {
|
|
64780
64822
|
super();
|
|
64781
|
-
|
|
64782
|
-
|
|
64783
|
-
|
|
64784
|
-
|
|
64785
|
-
|
|
64786
|
-
|
|
64787
|
-
|
|
64788
|
-
|
|
64789
|
-
|
|
64790
|
-
|
|
64791
|
-
|
|
64792
|
-
|
|
64793
|
-
|
|
64794
|
-
|
|
64795
|
-
|
|
64796
|
-
|
|
64797
|
-
|
|
64798
|
-
|
|
64799
|
-
|
|
64800
|
-
|
|
64801
|
-
|
|
64802
|
-
|
|
64803
|
-
|
|
64804
|
-
|
|
64805
|
-
|
|
64806
|
-
|
|
64807
|
-
|
|
64808
|
-
|
|
64809
|
-
|
|
64810
|
-
|
|
64811
|
-
|
|
64812
|
-
|
|
64813
|
-
|
|
64814
|
-
|
|
64815
|
-
|
|
64816
|
-
|
|
64817
|
-
|
|
64818
|
-
|
|
64819
|
-
|
|
64820
|
-
|
|
64821
|
-
|
|
64822
|
-
|
|
64823
|
+
_defineProperty30(this, "view", void 0);
|
|
64824
|
+
_defineProperty30(this, "selfUserId", void 0);
|
|
64825
|
+
_defineProperty30(this, "permissions", void 0);
|
|
64826
|
+
_defineProperty30(this, "tool", void 0);
|
|
64827
|
+
_defineProperty30(this, "fontSize", void 0);
|
|
64828
|
+
_defineProperty30(this, "dashArray", void 0);
|
|
64829
|
+
_defineProperty30(this, "fontFamily", void 0);
|
|
64830
|
+
_defineProperty30(this, "strokeColor", void 0);
|
|
64831
|
+
_defineProperty30(this, "fillColor", void 0);
|
|
64832
|
+
_defineProperty30(this, "strokeWidth", void 0);
|
|
64833
|
+
_defineProperty30(this, "enableCameraByMouse", void 0);
|
|
64834
|
+
_defineProperty30(this, "enableCameraByTouch", void 0);
|
|
64835
|
+
_defineProperty30(this, "cameraBoundaryColor", void 0);
|
|
64836
|
+
_defineProperty30(this, "enableCameraBoundaryHighlight", void 0);
|
|
64837
|
+
_defineProperty30(this, "getElementAttribute", void 0);
|
|
64838
|
+
_defineProperty30(this, "setElementAttribute", void 0);
|
|
64839
|
+
_defineProperty30(this, "getCurrentTool", void 0);
|
|
64840
|
+
_defineProperty30(this, "setCurrentTool", void 0);
|
|
64841
|
+
_defineProperty30(this, "setCanvasBackgroundColor", void 0);
|
|
64842
|
+
_defineProperty30(this, "setThemeColor", void 0);
|
|
64843
|
+
_defineProperty30(this, "gotoPage", void 0);
|
|
64844
|
+
_defineProperty30(this, "addPage", void 0);
|
|
64845
|
+
_defineProperty30(this, "deletePage", void 0);
|
|
64846
|
+
_defineProperty30(this, "pageList", void 0);
|
|
64847
|
+
_defineProperty30(this, "currentPageId", void 0);
|
|
64848
|
+
_defineProperty30(this, "clonePage", void 0);
|
|
64849
|
+
_defineProperty30(this, "clearPage", void 0);
|
|
64850
|
+
_defineProperty30(this, "translateCamera", void 0);
|
|
64851
|
+
_defineProperty30(this, "scaleCamera", void 0);
|
|
64852
|
+
_defineProperty30(this, "resetCamera", void 0);
|
|
64853
|
+
_defineProperty30(this, "setFreeModelUserPage", void 0);
|
|
64854
|
+
_defineProperty30(this, "indexedNavigation", void 0);
|
|
64855
|
+
_defineProperty30(this, "setViewModeToFree", void 0);
|
|
64856
|
+
_defineProperty30(this, "setViewModeToFlow", void 0);
|
|
64857
|
+
_defineProperty30(this, "setViewModeToMain", void 0);
|
|
64858
|
+
_defineProperty30(this, "getViewModel", void 0);
|
|
64859
|
+
_defineProperty30(this, "undo", void 0);
|
|
64860
|
+
_defineProperty30(this, "redo", void 0);
|
|
64861
|
+
_defineProperty30(this, "rasterizeViewport", void 0);
|
|
64862
|
+
_defineProperty30(this, "rasterizeElementsBounds", void 0);
|
|
64863
|
+
_defineProperty30(this, "rasterizeMaxBounds", void 0);
|
|
64864
|
+
_defineProperty30(this, "setInputType", void 0);
|
|
64823
64865
|
this.view = view;
|
|
64824
64866
|
}
|
|
64825
64867
|
};
|
|
64826
|
-
function
|
|
64827
|
-
return (r =
|
|
64868
|
+
function _defineProperty31(e, r, t) {
|
|
64869
|
+
return (r = _toPropertyKey31(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64828
64870
|
}
|
|
64829
|
-
function
|
|
64830
|
-
var i =
|
|
64871
|
+
function _toPropertyKey31(t) {
|
|
64872
|
+
var i = _toPrimitive31(t, "string");
|
|
64831
64873
|
return "symbol" == typeof i ? i : i + "";
|
|
64832
64874
|
}
|
|
64833
|
-
function
|
|
64875
|
+
function _toPrimitive31(t, r) {
|
|
64834
64876
|
if ("object" != typeof t || !t) return t;
|
|
64835
64877
|
var e = t[Symbol.toPrimitive];
|
|
64836
64878
|
if (void 0 !== e) {
|
|
@@ -64843,14 +64885,17 @@ function _toPrimitive32(t, r) {
|
|
|
64843
64885
|
var EraserTool = class extends WhiteboardTool {
|
|
64844
64886
|
constructor(enableToolEvent, renderableModel, shadowEmitter, scope, trashedElementsModel) {
|
|
64845
64887
|
super(enableToolEvent, renderableModel, shadowEmitter, scope);
|
|
64846
|
-
|
|
64847
|
-
|
|
64848
|
-
|
|
64888
|
+
_defineProperty31(this, "elementModel", null);
|
|
64889
|
+
_defineProperty31(this, "trashedElementsModel", void 0);
|
|
64890
|
+
_defineProperty31(this, "pointCount", 0);
|
|
64849
64891
|
this.trashedElementsModel = trashedElementsModel;
|
|
64850
64892
|
this.tool.minDistance = 1;
|
|
64851
64893
|
}
|
|
64852
|
-
onMouseDown(
|
|
64894
|
+
onMouseDown(_event) {
|
|
64853
64895
|
this.pointCount = 0;
|
|
64896
|
+
if (this.elementModel) {
|
|
64897
|
+
this.elementModel.dispose();
|
|
64898
|
+
}
|
|
64854
64899
|
this.elementModel = this.modelGetter().createEraser();
|
|
64855
64900
|
}
|
|
64856
64901
|
onMouseDrag(event) {
|
|
@@ -64872,21 +64917,21 @@ var EraserTool = class extends WhiteboardTool {
|
|
|
64872
64917
|
}
|
|
64873
64918
|
});
|
|
64874
64919
|
}
|
|
64875
|
-
onMouseUp(
|
|
64920
|
+
onMouseUp(_event) {
|
|
64876
64921
|
if (this.elementModel) {
|
|
64877
64922
|
this.modelGetter().removeElementItem(this.elementModel.uuid);
|
|
64878
64923
|
}
|
|
64879
64924
|
this.trashedElementsModel.removeAllTrashedElementsForSelf();
|
|
64880
64925
|
}
|
|
64881
64926
|
};
|
|
64882
|
-
function
|
|
64883
|
-
return (r =
|
|
64927
|
+
function _defineProperty32(e, r, t) {
|
|
64928
|
+
return (r = _toPropertyKey32(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
64884
64929
|
}
|
|
64885
|
-
function
|
|
64886
|
-
var i =
|
|
64930
|
+
function _toPropertyKey32(t) {
|
|
64931
|
+
var i = _toPrimitive32(t, "string");
|
|
64887
64932
|
return "symbol" == typeof i ? i : i + "";
|
|
64888
64933
|
}
|
|
64889
|
-
function
|
|
64934
|
+
function _toPrimitive32(t, r) {
|
|
64890
64935
|
if ("object" != typeof t || !t) return t;
|
|
64891
64936
|
var e = t[Symbol.toPrimitive];
|
|
64892
64937
|
if (void 0 !== e) {
|
|
@@ -64896,7 +64941,7 @@ function _toPrimitive33(t, r) {
|
|
|
64896
64941
|
}
|
|
64897
64942
|
return ("string" === r ? String : Number)(t);
|
|
64898
64943
|
}
|
|
64899
|
-
var TrashedElementsModel = class extends
|
|
64944
|
+
var TrashedElementsModel = class extends import_eventemitter39.default {
|
|
64900
64945
|
get hasDeleteSelfPermission() {
|
|
64901
64946
|
return this.hasPermission(WhiteboardPermissionFlag.deleteSelf);
|
|
64902
64947
|
}
|
|
@@ -64905,20 +64950,23 @@ var TrashedElementsModel = class extends import_eventemitter310.default {
|
|
|
64905
64950
|
}
|
|
64906
64951
|
constructor(userManager, requestUserMap, hasPermission) {
|
|
64907
64952
|
super();
|
|
64908
|
-
|
|
64909
|
-
|
|
64910
|
-
|
|
64911
|
-
|
|
64912
|
-
|
|
64953
|
+
_defineProperty32(this, "requestUserMap", void 0);
|
|
64954
|
+
_defineProperty32(this, "userManager", void 0);
|
|
64955
|
+
_defineProperty32(this, "hasPermission", void 0);
|
|
64956
|
+
_defineProperty32(this, "observers", /* @__PURE__ */ new Map());
|
|
64957
|
+
_defineProperty32(this, "handleUserLeave", (user) => {
|
|
64913
64958
|
const cb = this.observers.get(user.id);
|
|
64914
64959
|
if (cb) {
|
|
64915
64960
|
this.requestUserMap(user.id).unobserveDeep(cb);
|
|
64916
64961
|
}
|
|
64917
64962
|
});
|
|
64918
|
-
|
|
64963
|
+
_defineProperty32(this, "handleUserJoin", (user) => {
|
|
64919
64964
|
const observer = (evts) => {
|
|
64920
64965
|
this.handleUserTrashElementsChange(user.id, evts);
|
|
64921
64966
|
};
|
|
64967
|
+
if (this.observers.has(user.id)) {
|
|
64968
|
+
this.requestUserMap(user.id).unobserveDeep(this.observers.get(user.id));
|
|
64969
|
+
}
|
|
64922
64970
|
this.requestUserMap(user.id).observeDeep(observer);
|
|
64923
64971
|
this.observers.set(user.id, observer);
|
|
64924
64972
|
});
|
|
@@ -64930,6 +64978,9 @@ var TrashedElementsModel = class extends import_eventemitter310.default {
|
|
|
64930
64978
|
const observer = (evts) => {
|
|
64931
64979
|
this.handleUserTrashElementsChange(userId, evts);
|
|
64932
64980
|
};
|
|
64981
|
+
if (this.observers.has(userId)) {
|
|
64982
|
+
this.requestUserMap(userId).unobserveDeep(this.observers.get(userId));
|
|
64983
|
+
}
|
|
64933
64984
|
this.requestUserMap(userId).observeDeep(observer);
|
|
64934
64985
|
this.observers.set(userId, observer);
|
|
64935
64986
|
});
|
|
@@ -64984,25 +65035,22 @@ var TrashedElementsModel = class extends import_eventemitter310.default {
|
|
|
64984
65035
|
});
|
|
64985
65036
|
}
|
|
64986
65037
|
dispose() {
|
|
64987
|
-
this.
|
|
64988
|
-
|
|
64989
|
-
|
|
64990
|
-
this.requestUserMap(userId).unobserveDeep(cb);
|
|
64991
|
-
}
|
|
64992
|
-
});
|
|
65038
|
+
for (const [key, value] of this.observers.entries()) {
|
|
65039
|
+
this.requestUserMap(key).unobserveDeep(value);
|
|
65040
|
+
}
|
|
64993
65041
|
this.observers.clear();
|
|
64994
65042
|
this.userManager.off("leave", this.handleUserLeave);
|
|
64995
65043
|
this.userManager.off("join", this.handleUserJoin);
|
|
64996
65044
|
}
|
|
64997
65045
|
};
|
|
64998
|
-
function
|
|
64999
|
-
return (r =
|
|
65046
|
+
function _defineProperty33(e, r, t) {
|
|
65047
|
+
return (r = _toPropertyKey33(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65000
65048
|
}
|
|
65001
|
-
function
|
|
65002
|
-
var i =
|
|
65049
|
+
function _toPropertyKey33(t) {
|
|
65050
|
+
var i = _toPrimitive33(t, "string");
|
|
65003
65051
|
return "symbol" == typeof i ? i : i + "";
|
|
65004
65052
|
}
|
|
65005
|
-
function
|
|
65053
|
+
function _toPrimitive33(t, r) {
|
|
65006
65054
|
if ("object" != typeof t || !t) return t;
|
|
65007
65055
|
var e = t[Symbol.toPrimitive];
|
|
65008
65056
|
if (void 0 !== e) {
|
|
@@ -65015,12 +65063,15 @@ function _toPrimitive34(t, r) {
|
|
|
65015
65063
|
var LaserPointerTool = class extends WhiteboardTool {
|
|
65016
65064
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65017
65065
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65018
|
-
|
|
65019
|
-
|
|
65066
|
+
_defineProperty33(this, "elementModel", null);
|
|
65067
|
+
_defineProperty33(this, "pointCount", 0);
|
|
65020
65068
|
this.tool.minDistance = 5;
|
|
65021
65069
|
}
|
|
65022
|
-
onMouseDown(
|
|
65070
|
+
onMouseDown(_event) {
|
|
65023
65071
|
this.pointCount = 0;
|
|
65072
|
+
if (this.elementModel) {
|
|
65073
|
+
this.elementModel.dispose();
|
|
65074
|
+
}
|
|
65024
65075
|
this.elementModel = this.modelGetter().createLaserPointer();
|
|
65025
65076
|
}
|
|
65026
65077
|
onMouseDrag(event) {
|
|
@@ -65032,20 +65083,20 @@ var LaserPointerTool = class extends WhiteboardTool {
|
|
|
65032
65083
|
this.elementModel.appendPoints([event.point.x, event.point.y]);
|
|
65033
65084
|
}
|
|
65034
65085
|
}
|
|
65035
|
-
onMouseUp(
|
|
65086
|
+
onMouseUp(_event) {
|
|
65036
65087
|
if (this.elementModel) {
|
|
65037
65088
|
this.elementModel.beginRemoveAnimate();
|
|
65038
65089
|
}
|
|
65039
65090
|
}
|
|
65040
65091
|
};
|
|
65041
|
-
function
|
|
65042
|
-
return (r =
|
|
65092
|
+
function _defineProperty34(e, r, t) {
|
|
65093
|
+
return (r = _toPropertyKey34(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65043
65094
|
}
|
|
65044
|
-
function
|
|
65045
|
-
var i =
|
|
65095
|
+
function _toPropertyKey34(t) {
|
|
65096
|
+
var i = _toPrimitive34(t, "string");
|
|
65046
65097
|
return "symbol" == typeof i ? i : i + "";
|
|
65047
65098
|
}
|
|
65048
|
-
function
|
|
65099
|
+
function _toPrimitive34(t, r) {
|
|
65049
65100
|
if ("object" != typeof t || !t) return t;
|
|
65050
65101
|
var e = t[Symbol.toPrimitive];
|
|
65051
65102
|
if (void 0 !== e) {
|
|
@@ -65055,25 +65106,25 @@ function _toPrimitive35(t, r) {
|
|
|
65055
65106
|
}
|
|
65056
65107
|
return ("string" === r ? String : Number)(t);
|
|
65057
65108
|
}
|
|
65058
|
-
var PageModel = class extends
|
|
65109
|
+
var PageModel = class extends import_eventemitter310.default {
|
|
65059
65110
|
constructor(whiteboardAttrsMap, userManager, requestUserMap, pageMap, hasPermission) {
|
|
65060
65111
|
super();
|
|
65061
|
-
|
|
65062
|
-
|
|
65063
|
-
|
|
65064
|
-
|
|
65065
|
-
|
|
65066
|
-
|
|
65067
|
-
|
|
65112
|
+
_defineProperty34(this, "whiteboardAttrsMap", void 0);
|
|
65113
|
+
_defineProperty34(this, "pageMap", void 0);
|
|
65114
|
+
_defineProperty34(this, "requestUserMap", void 0);
|
|
65115
|
+
_defineProperty34(this, "userManager", void 0);
|
|
65116
|
+
_defineProperty34(this, "observers", /* @__PURE__ */ new Map());
|
|
65117
|
+
_defineProperty34(this, "hasPermission", void 0);
|
|
65118
|
+
_defineProperty34(this, "handleUserLeave", (user) => {
|
|
65068
65119
|
const cb = this.observers.get(user.id);
|
|
65069
65120
|
if (cb) {
|
|
65070
65121
|
this.requestUserMap(user.id).unobserve(cb);
|
|
65071
65122
|
}
|
|
65072
65123
|
});
|
|
65073
|
-
|
|
65124
|
+
_defineProperty34(this, "handleUserJoin", (user) => {
|
|
65074
65125
|
this.createCurrentPageObserver(user.id);
|
|
65075
65126
|
});
|
|
65076
|
-
|
|
65127
|
+
_defineProperty34(this, "handleMainPageChange", (evt) => {
|
|
65077
65128
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
65078
65129
|
if (key === WhiteboardKeys.currentPage) {
|
|
65079
65130
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
@@ -65081,7 +65132,7 @@ var PageModel = class extends import_eventemitter311.default {
|
|
|
65081
65132
|
if (cameraMode === "main") {
|
|
65082
65133
|
const targetPage = this.whiteboardAttrsMap.get(WhiteboardKeys.currentPage);
|
|
65083
65134
|
if (!this.pageMap.has(targetPage) && targetPage !== "_i_") {
|
|
65084
|
-
(0,
|
|
65135
|
+
(0, import_forge_room3.log)(`main page {${targetPage}} not found.`, {}, "error");
|
|
65085
65136
|
return;
|
|
65086
65137
|
}
|
|
65087
65138
|
this.requestUserMap(this.userManager.selfId).set(WhiteboardKeys.currentPage, targetPage);
|
|
@@ -65091,7 +65142,7 @@ var PageModel = class extends import_eventemitter311.default {
|
|
|
65091
65142
|
}
|
|
65092
65143
|
}
|
|
65093
65144
|
});
|
|
65094
|
-
|
|
65145
|
+
_defineProperty34(this, "handleUserCurrentPageChange", (userId, evt) => {
|
|
65095
65146
|
for (const [key, value] of evt.changes.keys.entries()) {
|
|
65096
65147
|
if (key === WhiteboardKeys.currentPage) {
|
|
65097
65148
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
@@ -65108,7 +65159,7 @@ var PageModel = class extends import_eventemitter311.default {
|
|
|
65108
65159
|
}
|
|
65109
65160
|
}
|
|
65110
65161
|
});
|
|
65111
|
-
|
|
65162
|
+
_defineProperty34(this, "handlePageMapChange", () => {
|
|
65112
65163
|
this.emit("pagesChange", Array.from(this.pageMap.keys()));
|
|
65113
65164
|
});
|
|
65114
65165
|
this.hasPermission = hasPermission;
|
|
@@ -65150,11 +65201,11 @@ var PageModel = class extends import_eventemitter311.default {
|
|
|
65150
65201
|
}
|
|
65151
65202
|
const cameraMode = this.requestUserMap(this.userManager.selfId).get(WhiteboardKeys.cameraMode);
|
|
65152
65203
|
if (cameraMode !== "main") {
|
|
65153
|
-
console.warn(
|
|
65204
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65154
65205
|
return false;
|
|
65155
65206
|
}
|
|
65156
65207
|
if (!this.hasPermission(WhiteboardPermissionFlag.mainView)) {
|
|
65157
|
-
console.warn(
|
|
65208
|
+
console.warn("cannot modify pages without WhiteboardPermissionFlag.mainView.");
|
|
65158
65209
|
return false;
|
|
65159
65210
|
}
|
|
65160
65211
|
return true;
|
|
@@ -65206,23 +65257,32 @@ var PageModel = class extends import_eventemitter311.default {
|
|
|
65206
65257
|
}
|
|
65207
65258
|
}
|
|
65208
65259
|
}
|
|
65260
|
+
dispose() {
|
|
65261
|
+
for (const entry of this.observers.entries()) {
|
|
65262
|
+
const [userId, observer] = entry;
|
|
65263
|
+
this.requestUserMap(userId).unobserve(observer);
|
|
65264
|
+
}
|
|
65265
|
+
this.userManager.off("join", this.handleUserJoin);
|
|
65266
|
+
this.userManager.off("leave", this.handleUserLeave);
|
|
65267
|
+
this.whiteboardAttrsMap.unobserve(this.handleMainPageChange);
|
|
65268
|
+
this.pageMap.unobserve(this.handlePageMapChange);
|
|
65269
|
+
}
|
|
65209
65270
|
};
|
|
65210
65271
|
var delay = (value) => new Promise((resolve) => setTimeout(resolve, value));
|
|
65211
65272
|
async function waitUntil(fn, timeout) {
|
|
65212
|
-
|
|
65273
|
+
const start = Date.now();
|
|
65213
65274
|
while (!fn() && Date.now() - start < timeout) {
|
|
65214
65275
|
await delay(50);
|
|
65215
|
-
start = Date.now();
|
|
65216
65276
|
}
|
|
65217
65277
|
}
|
|
65218
|
-
function
|
|
65219
|
-
return (r =
|
|
65278
|
+
function _defineProperty35(e, r, t) {
|
|
65279
|
+
return (r = _toPropertyKey35(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65220
65280
|
}
|
|
65221
|
-
function
|
|
65222
|
-
var i =
|
|
65281
|
+
function _toPropertyKey35(t) {
|
|
65282
|
+
var i = _toPrimitive35(t, "string");
|
|
65223
65283
|
return "symbol" == typeof i ? i : i + "";
|
|
65224
65284
|
}
|
|
65225
|
-
function
|
|
65285
|
+
function _toPrimitive35(t, r) {
|
|
65226
65286
|
if ("object" != typeof t || !t) return t;
|
|
65227
65287
|
var e = t[Symbol.toPrimitive];
|
|
65228
65288
|
if (void 0 !== e) {
|
|
@@ -65232,19 +65292,19 @@ function _toPrimitive36(t, r) {
|
|
|
65232
65292
|
}
|
|
65233
65293
|
return ("string" === r ? String : Number)(t);
|
|
65234
65294
|
}
|
|
65235
|
-
var IndexedNavigation = class extends
|
|
65295
|
+
var IndexedNavigation = class extends import_eventemitter311.default {
|
|
65236
65296
|
get idList() {
|
|
65237
65297
|
return this.pageModel.pageList().filter((id) => /^_i_/.test(id));
|
|
65238
65298
|
}
|
|
65239
65299
|
get head() {
|
|
65240
|
-
|
|
65300
|
+
const headId = Object.keys(this.list).find((key) => {
|
|
65241
65301
|
return this.list[key] && this.list[key].prev === "";
|
|
65242
65302
|
});
|
|
65243
65303
|
if (!headId) {
|
|
65244
|
-
(0,
|
|
65304
|
+
(0, import_forge_room4.log)("indexed navigation confusion", {
|
|
65245
65305
|
list: JSON.stringify(this.list)
|
|
65246
65306
|
}, "error");
|
|
65247
|
-
throw new Error(
|
|
65307
|
+
throw new Error("indexed navigation confusion");
|
|
65248
65308
|
}
|
|
65249
65309
|
return headId;
|
|
65250
65310
|
}
|
|
@@ -65259,13 +65319,13 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65259
65319
|
}
|
|
65260
65320
|
constructor(pageModel, userMap, indexedPageMap, hasPermission) {
|
|
65261
65321
|
super();
|
|
65262
|
-
|
|
65263
|
-
|
|
65264
|
-
|
|
65265
|
-
|
|
65266
|
-
|
|
65267
|
-
|
|
65268
|
-
|
|
65322
|
+
_defineProperty35(this, "idPool", /* @__PURE__ */ new Set());
|
|
65323
|
+
_defineProperty35(this, "pageModel", void 0);
|
|
65324
|
+
_defineProperty35(this, "userMap", void 0);
|
|
65325
|
+
_defineProperty35(this, "indexedPageMap", void 0);
|
|
65326
|
+
_defineProperty35(this, "list", {});
|
|
65327
|
+
_defineProperty35(this, "hasPermission", void 0);
|
|
65328
|
+
_defineProperty35(this, "handleIndexedPageMapUpdate", (_evt) => {
|
|
65269
65329
|
this.list = this.indexedPageMap.get("list");
|
|
65270
65330
|
const needRemoveList = this.pageModel.pageList().filter((v) => /^_i_/.test(v) && Object.keys(this.list).indexOf(v) < 0);
|
|
65271
65331
|
const needAddList = Object.keys(this.list).filter((v) => this.pageModel.pageList().indexOf(v) < 0);
|
|
@@ -65320,8 +65380,8 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65320
65380
|
initIndexed() {
|
|
65321
65381
|
return new Promise((resolve) => {
|
|
65322
65382
|
setTimeout(() => {
|
|
65383
|
+
this.pageModel.addPage("_i_");
|
|
65323
65384
|
if (this.pageModel.pageList().length === 0) {
|
|
65324
|
-
this.pageModel.addPage("_i_");
|
|
65325
65385
|
resolve(true);
|
|
65326
65386
|
} else {
|
|
65327
65387
|
resolve(false);
|
|
@@ -65330,15 +65390,15 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65330
65390
|
});
|
|
65331
65391
|
}
|
|
65332
65392
|
/**
|
|
65333
|
-
|
|
65334
|
-
|
|
65335
|
-
|
|
65393
|
+
* 获取总页数
|
|
65394
|
+
* @returns {number}
|
|
65395
|
+
*/
|
|
65336
65396
|
get pageCount() {
|
|
65337
65397
|
return this.idList.length;
|
|
65338
65398
|
}
|
|
65339
65399
|
/**
|
|
65340
|
-
|
|
65341
|
-
|
|
65400
|
+
* 获取当前页索引
|
|
65401
|
+
*/
|
|
65342
65402
|
get currentPageIndex() {
|
|
65343
65403
|
const userPageId = this.userMap.get(WhiteboardKeys.currentPage);
|
|
65344
65404
|
return this.getPageIndex(userPageId);
|
|
@@ -65358,9 +65418,9 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65358
65418
|
return i;
|
|
65359
65419
|
}
|
|
65360
65420
|
/**
|
|
65361
|
-
|
|
65362
|
-
|
|
65363
|
-
|
|
65421
|
+
* 获取指定索引对应的 pageId
|
|
65422
|
+
* @param {number} index
|
|
65423
|
+
*/
|
|
65364
65424
|
getPageId(index) {
|
|
65365
65425
|
const firstKey = this.head;
|
|
65366
65426
|
if (firstKey) {
|
|
@@ -65382,20 +65442,20 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65382
65442
|
modifyDetect() {
|
|
65383
65443
|
const cameraMode = this.userMap.get(WhiteboardKeys.cameraMode);
|
|
65384
65444
|
if (cameraMode !== "main") {
|
|
65385
|
-
console.warn(
|
|
65445
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65386
65446
|
return false;
|
|
65387
65447
|
}
|
|
65388
65448
|
if (!this.hasPermission(WhiteboardPermissionFlag.mainView)) {
|
|
65389
|
-
console.warn(
|
|
65449
|
+
console.warn("cannot modify pages without WhiteboardPermissionFlag.mainView.");
|
|
65390
65450
|
return false;
|
|
65391
65451
|
}
|
|
65392
65452
|
return true;
|
|
65393
65453
|
}
|
|
65394
65454
|
/**
|
|
65395
|
-
|
|
65396
|
-
|
|
65397
|
-
|
|
65398
|
-
|
|
65455
|
+
* 在尾部插入新页面
|
|
65456
|
+
* @param {boolean=} goto 是否跳转到新页面, 默认 true
|
|
65457
|
+
* @return 总页数
|
|
65458
|
+
*/
|
|
65399
65459
|
pushPage() {
|
|
65400
65460
|
let goto = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
65401
65461
|
this.indexedPageMap.doc.transact(() => {
|
|
@@ -65424,11 +65484,11 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65424
65484
|
return this.pageCount;
|
|
65425
65485
|
}
|
|
65426
65486
|
/**
|
|
65427
|
-
|
|
65428
|
-
|
|
65429
|
-
|
|
65430
|
-
|
|
65431
|
-
|
|
65487
|
+
* 在 after 之后插入新页面
|
|
65488
|
+
* @param {number} after 在此页之后插入
|
|
65489
|
+
* @param {boolean=} goto 是否跳转到新页面, 默认 true
|
|
65490
|
+
* @return 总页数
|
|
65491
|
+
*/
|
|
65432
65492
|
insertPage(after) {
|
|
65433
65493
|
let goto = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
65434
65494
|
const afterPageId = this.getPageId(after);
|
|
@@ -65437,7 +65497,7 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65437
65497
|
}
|
|
65438
65498
|
const cameraMode = this.userMap.get(WhiteboardKeys.cameraMode);
|
|
65439
65499
|
if (cameraMode !== "main") {
|
|
65440
|
-
console.warn(
|
|
65500
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65441
65501
|
return this.pageCount;
|
|
65442
65502
|
}
|
|
65443
65503
|
const prev = this.list[afterPageId];
|
|
@@ -65480,8 +65540,8 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65480
65540
|
return this.pageCount;
|
|
65481
65541
|
}
|
|
65482
65542
|
/**
|
|
65483
|
-
|
|
65484
|
-
|
|
65543
|
+
* 跳转至上一页, 并返回跳转后的页面索引.
|
|
65544
|
+
*/
|
|
65485
65545
|
prevPage() {
|
|
65486
65546
|
const currentPageId = this.userMap.get(WhiteboardKeys.currentPage);
|
|
65487
65547
|
const data = this.list[currentPageId];
|
|
@@ -65493,8 +65553,8 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65493
65553
|
return nextIndex;
|
|
65494
65554
|
}
|
|
65495
65555
|
/**
|
|
65496
|
-
|
|
65497
|
-
|
|
65556
|
+
* 跳转至下一页, 并返回跳转后的页面索引.
|
|
65557
|
+
*/
|
|
65498
65558
|
nextPage() {
|
|
65499
65559
|
const currentPageId = this.userMap.get(WhiteboardKeys.currentPage);
|
|
65500
65560
|
const data = this.list[currentPageId];
|
|
@@ -65506,16 +65566,16 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65506
65566
|
return nextIndex;
|
|
65507
65567
|
}
|
|
65508
65568
|
/**
|
|
65509
|
-
|
|
65510
|
-
|
|
65511
|
-
|
|
65569
|
+
* 删除指定页面
|
|
65570
|
+
* @param {number} index
|
|
65571
|
+
*/
|
|
65512
65572
|
removePage(index) {
|
|
65513
65573
|
if (this.pageCount <= 1) {
|
|
65514
65574
|
return this.pageCount;
|
|
65515
65575
|
}
|
|
65516
65576
|
const cameraMode = this.userMap.get(WhiteboardKeys.cameraMode);
|
|
65517
65577
|
if (cameraMode !== "main") {
|
|
65518
|
-
console.warn(
|
|
65578
|
+
console.warn("cannot modify pages in non-main view mode.");
|
|
65519
65579
|
return this.pageCount;
|
|
65520
65580
|
}
|
|
65521
65581
|
const targetId = this.getPageId(index);
|
|
@@ -65555,15 +65615,20 @@ var IndexedNavigation = class extends import_eventemitter312.default {
|
|
|
65555
65615
|
this.pageModel.gotoPage(targetId);
|
|
65556
65616
|
}
|
|
65557
65617
|
}
|
|
65618
|
+
dispose() {
|
|
65619
|
+
this.indexedPageMap.unobserve(this.handleIndexedPageMapUpdate);
|
|
65620
|
+
this.pageModel.off("switchPage");
|
|
65621
|
+
this.pageModel.off("pagesChange");
|
|
65622
|
+
}
|
|
65558
65623
|
};
|
|
65559
|
-
function
|
|
65560
|
-
return (r =
|
|
65624
|
+
function _defineProperty36(e, r, t) {
|
|
65625
|
+
return (r = _toPropertyKey36(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65561
65626
|
}
|
|
65562
|
-
function
|
|
65563
|
-
var i =
|
|
65627
|
+
function _toPropertyKey36(t) {
|
|
65628
|
+
var i = _toPrimitive36(t, "string");
|
|
65564
65629
|
return "symbol" == typeof i ? i : i + "";
|
|
65565
65630
|
}
|
|
65566
|
-
function
|
|
65631
|
+
function _toPrimitive36(t, r) {
|
|
65567
65632
|
if ("object" != typeof t || !t) return t;
|
|
65568
65633
|
var e = t[Symbol.toPrimitive];
|
|
65569
65634
|
if (void 0 !== e) {
|
|
@@ -65573,10 +65638,10 @@ function _toPrimitive37(t, r) {
|
|
|
65573
65638
|
}
|
|
65574
65639
|
return ("string" === r ? String : Number)(t);
|
|
65575
65640
|
}
|
|
65576
|
-
var ShadowEmitter = class extends
|
|
65641
|
+
var ShadowEmitter = class extends import_eventemitter312.default {
|
|
65577
65642
|
constructor(userMap) {
|
|
65578
65643
|
super();
|
|
65579
|
-
|
|
65644
|
+
_defineProperty36(this, "userMap", void 0);
|
|
65580
65645
|
this.userMap = userMap;
|
|
65581
65646
|
}
|
|
65582
65647
|
getActive() {
|
|
@@ -65586,14 +65651,14 @@ var ShadowEmitter = class extends import_eventemitter313.default {
|
|
|
65586
65651
|
return this.userMap.set("shadowActive", value);
|
|
65587
65652
|
}
|
|
65588
65653
|
};
|
|
65589
|
-
function
|
|
65590
|
-
return (r =
|
|
65654
|
+
function _defineProperty37(e, r, t) {
|
|
65655
|
+
return (r = _toPropertyKey37(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65591
65656
|
}
|
|
65592
|
-
function
|
|
65593
|
-
var i =
|
|
65657
|
+
function _toPropertyKey37(t) {
|
|
65658
|
+
var i = _toPrimitive37(t, "string");
|
|
65594
65659
|
return "symbol" == typeof i ? i : i + "";
|
|
65595
65660
|
}
|
|
65596
|
-
function
|
|
65661
|
+
function _toPrimitive37(t, r) {
|
|
65597
65662
|
if ("object" != typeof t || !t) return t;
|
|
65598
65663
|
var e = t[Symbol.toPrimitive];
|
|
65599
65664
|
if (void 0 !== e) {
|
|
@@ -65606,12 +65671,15 @@ function _toPrimitive38(t, r) {
|
|
|
65606
65671
|
var StraightLineTool = class extends WhiteboardTool {
|
|
65607
65672
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65608
65673
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65609
|
-
|
|
65610
|
-
|
|
65611
|
-
|
|
65674
|
+
_defineProperty37(this, "elementModel", null);
|
|
65675
|
+
_defineProperty37(this, "from", null);
|
|
65676
|
+
_defineProperty37(this, "to", null);
|
|
65612
65677
|
this.tool.minDistance = 1;
|
|
65613
65678
|
}
|
|
65614
65679
|
onMouseDown(event) {
|
|
65680
|
+
if (this.elementModel) {
|
|
65681
|
+
this.elementModel.dispose();
|
|
65682
|
+
}
|
|
65615
65683
|
this.elementModel = this.modelGetter().createStraightLine(true);
|
|
65616
65684
|
this.from = event.point.clone();
|
|
65617
65685
|
this.to = event.point.clone();
|
|
@@ -65631,14 +65699,14 @@ var StraightLineTool = class extends WhiteboardTool {
|
|
|
65631
65699
|
}
|
|
65632
65700
|
}
|
|
65633
65701
|
};
|
|
65634
|
-
function
|
|
65635
|
-
return (r =
|
|
65702
|
+
function _defineProperty38(e, r, t) {
|
|
65703
|
+
return (r = _toPropertyKey38(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65636
65704
|
}
|
|
65637
|
-
function
|
|
65638
|
-
var i =
|
|
65705
|
+
function _toPropertyKey38(t) {
|
|
65706
|
+
var i = _toPrimitive38(t, "string");
|
|
65639
65707
|
return "symbol" == typeof i ? i : i + "";
|
|
65640
65708
|
}
|
|
65641
|
-
function
|
|
65709
|
+
function _toPrimitive38(t, r) {
|
|
65642
65710
|
if ("object" != typeof t || !t) return t;
|
|
65643
65711
|
var e = t[Symbol.toPrimitive];
|
|
65644
65712
|
if (void 0 !== e) {
|
|
@@ -65651,8 +65719,8 @@ function _toPrimitive39(t, r) {
|
|
|
65651
65719
|
var GrabTool = class extends WhiteboardTool {
|
|
65652
65720
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope, camera) {
|
|
65653
65721
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65654
|
-
|
|
65655
|
-
|
|
65722
|
+
_defineProperty38(this, "camera", void 0);
|
|
65723
|
+
_defineProperty38(this, "downPoint", null);
|
|
65656
65724
|
this.camera = camera;
|
|
65657
65725
|
}
|
|
65658
65726
|
onMouseDown(event) {
|
|
@@ -65675,13 +65743,58 @@ var PointerTool = class extends WhiteboardTool {
|
|
|
65675
65743
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
65676
65744
|
super(enableToolEvent, modelGetter, shadowEmitter, scope);
|
|
65677
65745
|
}
|
|
65678
|
-
onMouseDown(
|
|
65746
|
+
onMouseDown(_event) {
|
|
65679
65747
|
}
|
|
65680
|
-
onMouseDrag(
|
|
65748
|
+
onMouseDrag(_event) {
|
|
65681
65749
|
}
|
|
65682
65750
|
onMouseUp() {
|
|
65683
65751
|
}
|
|
65684
65752
|
};
|
|
65753
|
+
function _defineProperty39(e, r, t) {
|
|
65754
|
+
return (r = _toPropertyKey39(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65755
|
+
}
|
|
65756
|
+
function _toPropertyKey39(t) {
|
|
65757
|
+
var i = _toPrimitive39(t, "string");
|
|
65758
|
+
return "symbol" == typeof i ? i : i + "";
|
|
65759
|
+
}
|
|
65760
|
+
function _toPrimitive39(t, r) {
|
|
65761
|
+
if ("object" != typeof t || !t) return t;
|
|
65762
|
+
var e = t[Symbol.toPrimitive];
|
|
65763
|
+
if (void 0 !== e) {
|
|
65764
|
+
var i = e.call(t, r || "default");
|
|
65765
|
+
if ("object" != typeof i) return i;
|
|
65766
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
65767
|
+
}
|
|
65768
|
+
return ("string" === r ? String : Number)(t);
|
|
65769
|
+
}
|
|
65770
|
+
var SequenceExecutor = class {
|
|
65771
|
+
constructor() {
|
|
65772
|
+
_defineProperty39(this, "tasks", []);
|
|
65773
|
+
_defineProperty39(this, "isRunning", false);
|
|
65774
|
+
}
|
|
65775
|
+
addTask(task) {
|
|
65776
|
+
this.tasks.push(task);
|
|
65777
|
+
if (!this.isRunning) {
|
|
65778
|
+
this.execute();
|
|
65779
|
+
}
|
|
65780
|
+
}
|
|
65781
|
+
async execute() {
|
|
65782
|
+
if (this.isRunning) {
|
|
65783
|
+
return;
|
|
65784
|
+
}
|
|
65785
|
+
this.isRunning = true;
|
|
65786
|
+
while (this.tasks.length > 0) {
|
|
65787
|
+
const task = this.tasks.shift();
|
|
65788
|
+
if (task) {
|
|
65789
|
+
try {
|
|
65790
|
+
await task();
|
|
65791
|
+
} catch (e) {
|
|
65792
|
+
}
|
|
65793
|
+
}
|
|
65794
|
+
}
|
|
65795
|
+
this.isRunning = false;
|
|
65796
|
+
}
|
|
65797
|
+
};
|
|
65685
65798
|
function _defineProperty40(e, r, t) {
|
|
65686
65799
|
return (r = _toPropertyKey40(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
65687
65800
|
}
|
|
@@ -65739,16 +65852,18 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65739
65852
|
_defineProperty40(this, "hasPenInput", null);
|
|
65740
65853
|
_defineProperty40(this, "disableViewModelUpdate", false);
|
|
65741
65854
|
_defineProperty40(this, "internalResizeObserver", true);
|
|
65855
|
+
_defineProperty40(this, "sequenceExecutor", new SequenceExecutor());
|
|
65742
65856
|
_defineProperty40(this, "linkTarget", null);
|
|
65743
65857
|
_defineProperty40(this, "enableToolEvent", () => {
|
|
65744
65858
|
return !(this.inputType === "pen" && !this.isPenEvent);
|
|
65745
65859
|
});
|
|
65746
65860
|
_defineProperty40(this, "handlePageSwitch", (pageId) => {
|
|
65747
|
-
|
|
65748
|
-
editor.
|
|
65749
|
-
|
|
65750
|
-
|
|
65751
|
-
|
|
65861
|
+
this.sequenceExecutor.addTask(async () => {
|
|
65862
|
+
for (const editor of this.editors.values()) {
|
|
65863
|
+
editor.hidden();
|
|
65864
|
+
}
|
|
65865
|
+
this.selectElementsModel.clearSelectElementForSelf();
|
|
65866
|
+
await waitUntil(() => this.layers.has(pageId), 1e3);
|
|
65752
65867
|
if (this.layers.has(pageId)) {
|
|
65753
65868
|
for (const entry of this.layers.entries()) {
|
|
65754
65869
|
entry[1].off("elementInsert", this.handleElementInsert);
|
|
@@ -65760,6 +65875,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65760
65875
|
renderableModel.on("elementRemove", this.handleElementRemove);
|
|
65761
65876
|
renderableModel.on("elementClear", this.handleElementClear);
|
|
65762
65877
|
renderableModel.flushRenderables();
|
|
65878
|
+
this.paperScope.project.activeLayer.data.pageId = pageId;
|
|
65763
65879
|
const others = this.userManager.userIdList().filter((v) => v !== this.userId);
|
|
65764
65880
|
for (const other of others) {
|
|
65765
65881
|
if (this.userMap(other).get(WhiteboardKeys.currentPage) === pageId) {
|
|
@@ -65769,9 +65885,11 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65769
65885
|
}
|
|
65770
65886
|
}
|
|
65771
65887
|
}
|
|
65888
|
+
} else {
|
|
65889
|
+
console.warn(`[@netless/forge-whiteboard] page ${pageId} not found`);
|
|
65890
|
+
(0, import_forge_room.log)(`[@netless/forge-whiteboard] page ${pageId} not found`, {}, "warning");
|
|
65772
65891
|
}
|
|
65773
|
-
|
|
65774
|
-
waitUntil(() => this.undoManagers.has(pageId), 3e3).then(() => {
|
|
65892
|
+
await waitUntil(() => this.undoManagers.has(pageId), 1e3);
|
|
65775
65893
|
if (this.undoManagers.has(pageId)) {
|
|
65776
65894
|
for (const entry of this.undoManagers.entries()) {
|
|
65777
65895
|
entry[1].off("stack-item-added", this.handleStackItemAdded);
|
|
@@ -65779,10 +65897,13 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65779
65897
|
}
|
|
65780
65898
|
this.undoManagers.get(pageId).on("stack-item-added", this.handleStackItemAdded);
|
|
65781
65899
|
this.undoManagers.get(pageId).on("stack-item-popped", this.handleStackItemPopped);
|
|
65900
|
+
} else {
|
|
65901
|
+
console.warn(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`);
|
|
65902
|
+
(0, import_forge_room.log)(`[@netless/forge-whiteboard] undo manager for page ${pageId} not found`, {}, "warning");
|
|
65782
65903
|
}
|
|
65904
|
+
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
65905
|
+
this.emitter.emit("undoStackLength", this.undoManager?.undoStack.length ?? 0);
|
|
65783
65906
|
});
|
|
65784
|
-
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
65785
|
-
this.emitter.emit("undoStackLength", this.undoManager?.undoStack.length ?? 0);
|
|
65786
65907
|
});
|
|
65787
65908
|
_defineProperty40(this, "hasPermission", (flag) => {
|
|
65788
65909
|
return this.permissions.hasPermission(flag, this.userId);
|
|
@@ -65812,7 +65933,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65812
65933
|
this.undoManagers.set(id, undoManager);
|
|
65813
65934
|
}
|
|
65814
65935
|
}
|
|
65815
|
-
for (
|
|
65936
|
+
for (const entry of this.layers.entries()) {
|
|
65816
65937
|
if (ids.indexOf(entry[0]) < 0) {
|
|
65817
65938
|
const renderableModel = this.layers.get(entry[0]);
|
|
65818
65939
|
this.layers.delete(entry[0]);
|
|
@@ -65829,7 +65950,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65829
65950
|
}
|
|
65830
65951
|
});
|
|
65831
65952
|
_defineProperty40(this, "getCurrentRenderableModel", () => {
|
|
65832
|
-
|
|
65953
|
+
const layerId = this.userMap(this.userId).get(WhiteboardKeys.currentPage);
|
|
65833
65954
|
if (!this.layers.has(layerId)) {
|
|
65834
65955
|
this.emitter.emit("error", 300002, `target page: ${layerId} not found`);
|
|
65835
65956
|
}
|
|
@@ -65910,7 +66031,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65910
66031
|
}).filter((v) => !!v);
|
|
65911
66032
|
editor.setTargets(elementModels);
|
|
65912
66033
|
if (elementModels.length === 1) {
|
|
65913
|
-
|
|
66034
|
+
const model = elementModels[0];
|
|
65914
66035
|
if (model.item) {
|
|
65915
66036
|
const topLeft = this.paperScope.project.view.projectToView(model.item.bounds.topLeft);
|
|
65916
66037
|
const bottomRight = this.paperScope.project.view.projectToView(model.item.bounds.bottomRight);
|
|
@@ -65956,6 +66077,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
65956
66077
|
});
|
|
65957
66078
|
requestAnimationFrameHook(this.paperScope);
|
|
65958
66079
|
requestAnimationFrameHook(this.shadowScope);
|
|
66080
|
+
const that = this;
|
|
65959
66081
|
this.rootElement.setAttribute("data-forge-app", "whiteboard");
|
|
65960
66082
|
document.body.addEventListener("pointerdown", (evt) => {
|
|
65961
66083
|
this.isPenEvent = evt.pointerType === "pen";
|
|
@@ -66127,7 +66249,6 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
66127
66249
|
errorMessage
|
|
66128
66250
|
});
|
|
66129
66251
|
});
|
|
66130
|
-
const that = this;
|
|
66131
66252
|
Object.defineProperty(this.emitter, "tool", {
|
|
66132
66253
|
get() {
|
|
66133
66254
|
return that.toolbarModel.currentTool;
|
|
@@ -66224,6 +66345,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
66224
66345
|
this.permissions = new WhiteboardPermissions(this.userManager, (userId) => {
|
|
66225
66346
|
return this.userMap(userId);
|
|
66226
66347
|
});
|
|
66348
|
+
this.permissions.setPermission(WhiteboardPermissionFlag.all);
|
|
66227
66349
|
this.emitter["permissions"] = this.permissions;
|
|
66228
66350
|
this.emitter["selfUserId"] = this.userId;
|
|
66229
66351
|
this.option = option;
|
|
@@ -66475,7 +66597,7 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
66475
66597
|
if (renderableModel.elementModels.has(key)) {
|
|
66476
66598
|
elementModel = renderableModel.elementModels.get(key) ?? null;
|
|
66477
66599
|
} else {
|
|
66478
|
-
|
|
66600
|
+
const elementMap = renderableModel.elements.get(key);
|
|
66479
66601
|
if (elementMap) {
|
|
66480
66602
|
elementModel = renderableModel.convertToModel(elementMap);
|
|
66481
66603
|
}
|
|
@@ -66562,6 +66684,9 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
66562
66684
|
const size = this.paperScope.view.viewSize;
|
|
66563
66685
|
return [size.width, size.height];
|
|
66564
66686
|
}
|
|
66687
|
+
getInherentScale() {
|
|
66688
|
+
return this.camera.getInherentScale();
|
|
66689
|
+
}
|
|
66565
66690
|
updateInternalResizeObserverStatus(value) {
|
|
66566
66691
|
this.internalResizeObserver = value;
|
|
66567
66692
|
}
|
|
@@ -66581,72 +66706,91 @@ var WhiteboardApplication = class extends import_forge_room.AbstractApplication
|
|
|
66581
66706
|
this.shadowScope.project.clear();
|
|
66582
66707
|
this.snapshotScope.project.clear();
|
|
66583
66708
|
this.resizeObserver.disconnect();
|
|
66709
|
+
this.unlink();
|
|
66710
|
+
for (const entry of this.undoManagers.entries()) {
|
|
66711
|
+
entry[1].off("stack-item-added", this.handleStackItemAdded);
|
|
66712
|
+
entry[1].off("stack-item-popped", this.handleStackItemPopped);
|
|
66713
|
+
}
|
|
66714
|
+
for (const entry of this.layers.entries()) {
|
|
66715
|
+
entry[1].dispose();
|
|
66716
|
+
entry[1].removeAllListeners();
|
|
66717
|
+
}
|
|
66718
|
+
this.camera.dispose();
|
|
66719
|
+
this.pageModel.dispose();
|
|
66720
|
+
this.pageModel.removeAllListeners();
|
|
66721
|
+
for (const entry of this.editors.entries()) {
|
|
66722
|
+
entry[1].dispose();
|
|
66723
|
+
}
|
|
66724
|
+
this.toolbarModel.dispose();
|
|
66725
|
+
this.emitter.indexedNavigation.dispose();
|
|
66726
|
+
this.permissions.dispose();
|
|
66584
66727
|
}
|
|
66585
66728
|
};
|
|
66586
66729
|
_defineProperty40(WhiteboardApplication, "applicationName", WHITEBOARD_APP_NAME);
|
|
66587
66730
|
|
|
66588
66731
|
// src/SlideApplication.ts
|
|
66589
66732
|
var import_slide = __toESM(require_Slide());
|
|
66590
|
-
var
|
|
66733
|
+
var import_forge_room6 = require("@netless/forge-room");
|
|
66591
66734
|
|
|
66592
66735
|
// src/Slide.ts
|
|
66593
|
-
var
|
|
66594
|
-
var SlideForge = class extends
|
|
66736
|
+
var import_eventemitter313 = __toESM(require("eventemitter3"));
|
|
66737
|
+
var SlideForge = class extends import_eventemitter313.default {
|
|
66595
66738
|
view;
|
|
66596
66739
|
permissions;
|
|
66597
66740
|
footView;
|
|
66741
|
+
sideBarView;
|
|
66598
66742
|
/**
|
|
66599
|
-
|
|
66600
|
-
|
|
66743
|
+
* 当前页面索引, 从 0 开始
|
|
66744
|
+
*/
|
|
66601
66745
|
pageIndex;
|
|
66602
66746
|
/**
|
|
66603
|
-
|
|
66604
|
-
|
|
66747
|
+
* 总页数
|
|
66748
|
+
*/
|
|
66605
66749
|
pageCount;
|
|
66606
66750
|
/**
|
|
66607
|
-
|
|
66608
|
-
|
|
66609
|
-
|
|
66751
|
+
* 切换到参数指定页面, index 从 0 开始
|
|
66752
|
+
* @param {number} index 页面索引
|
|
66753
|
+
*/
|
|
66610
66754
|
goto;
|
|
66611
66755
|
/**
|
|
66612
|
-
|
|
66613
|
-
|
|
66756
|
+
* 下一步, 如果已经是本页的最后一步, 则切换到下一页
|
|
66757
|
+
*/
|
|
66614
66758
|
nextStep;
|
|
66615
66759
|
/**
|
|
66616
|
-
|
|
66617
|
-
|
|
66760
|
+
* 上一步, 如果已经是本页的第一步, 则切换到上一页
|
|
66761
|
+
*/
|
|
66618
66762
|
prevStep;
|
|
66619
66763
|
/**
|
|
66620
|
-
|
|
66621
|
-
|
|
66764
|
+
* 下一页, 如果是最后一页, 则不执行任何操作
|
|
66765
|
+
*/
|
|
66622
66766
|
nextPage;
|
|
66623
66767
|
/**
|
|
66624
|
-
|
|
66625
|
-
|
|
66768
|
+
* 上一页, 如果是第一页, 则不执行任何操作
|
|
66769
|
+
*/
|
|
66626
66770
|
prevPage;
|
|
66627
66771
|
/**
|
|
66628
|
-
|
|
66629
|
-
|
|
66772
|
+
* 切换侧栏显示状态
|
|
66773
|
+
*/
|
|
66630
66774
|
sideBarToggle;
|
|
66631
66775
|
/**
|
|
66632
|
-
|
|
66633
|
-
|
|
66634
|
-
|
|
66776
|
+
* 获取预览图图片内容, base64 编码
|
|
66777
|
+
* @param {number} index 页面索引
|
|
66778
|
+
*/
|
|
66635
66779
|
imgContent;
|
|
66636
66780
|
/**
|
|
66637
|
-
|
|
66638
|
-
|
|
66639
|
-
|
|
66781
|
+
* 获取预览图图片链接
|
|
66782
|
+
* @param {number} index 页面索引
|
|
66783
|
+
*/
|
|
66640
66784
|
imgUrl;
|
|
66641
66785
|
/**
|
|
66642
|
-
|
|
66643
|
-
|
|
66644
|
-
|
|
66786
|
+
* 获取预览图图片尺寸
|
|
66787
|
+
* @param {number} index 页面索引
|
|
66788
|
+
*/
|
|
66645
66789
|
imgSize;
|
|
66646
66790
|
};
|
|
66647
66791
|
|
|
66648
66792
|
// src/ForgeSlidePermession.ts
|
|
66649
|
-
var
|
|
66793
|
+
var import_forge_room5 = require("@netless/forge-room");
|
|
66650
66794
|
var ForgeSlidePermissionFlag = /* @__PURE__ */ ((ForgeSlidePermissionFlag2) => {
|
|
66651
66795
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["none"] = 0] = "none";
|
|
66652
66796
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["changeStep"] = 1] = "changeStep";
|
|
@@ -66655,58 +66799,12 @@ var ForgeSlidePermissionFlag = /* @__PURE__ */ ((ForgeSlidePermissionFlag2) => {
|
|
|
66655
66799
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["all"] = 7] = "all";
|
|
66656
66800
|
return ForgeSlidePermissionFlag2;
|
|
66657
66801
|
})(ForgeSlidePermissionFlag || {});
|
|
66658
|
-
var ForgeSlidePermissions = class extends
|
|
66659
|
-
requestUserMap;
|
|
66660
|
-
userManager;
|
|
66661
|
-
observers = /* @__PURE__ */ new Map();
|
|
66662
|
-
constructor(userManager, requestUserMap) {
|
|
66663
|
-
super();
|
|
66664
|
-
this.userManager = userManager;
|
|
66665
|
-
this.requestUserMap = requestUserMap;
|
|
66666
|
-
this.createModel(this.userManager.selfId);
|
|
66667
|
-
this.userManager.userIdList().forEach((userId) => {
|
|
66668
|
-
this.addObserve(userId);
|
|
66669
|
-
});
|
|
66670
|
-
this.userManager.on("join", this.handleUserJoin);
|
|
66671
|
-
this.userManager.on("leave", this.handleUserLeave);
|
|
66672
|
-
}
|
|
66673
|
-
handleUserLeave = (user) => {
|
|
66674
|
-
const cb = this.observers.get(user.id);
|
|
66675
|
-
if (cb) {
|
|
66676
|
-
this.requestUserMap(user.id).unobserve(cb);
|
|
66677
|
-
}
|
|
66678
|
-
};
|
|
66679
|
-
handleUserJoin = (user) => {
|
|
66680
|
-
this.addObserve(user.id);
|
|
66681
|
-
};
|
|
66682
|
-
addObserve(userId) {
|
|
66683
|
-
const observer = (evt) => {
|
|
66684
|
-
this.handleUserPermissionChange(userId, evt);
|
|
66685
|
-
};
|
|
66686
|
-
this.observers.set(userId, observer);
|
|
66687
|
-
this.requestUserMap(userId).observe(observer);
|
|
66688
|
-
}
|
|
66689
|
-
createModel(userId) {
|
|
66690
|
-
const userMap = this.requestUserMap(userId);
|
|
66691
|
-
if (!userMap.has("permission")) {
|
|
66692
|
-
userMap.set("permission", 0);
|
|
66693
|
-
}
|
|
66694
|
-
}
|
|
66695
|
-
handleUserPermissionChange(userId, evt) {
|
|
66696
|
-
for (const [key, value] of evt.changes.keys.entries()) {
|
|
66697
|
-
if (key === "permission") {
|
|
66698
|
-
if (value.action === "add" || value.action === "update") {
|
|
66699
|
-
const newValue = this.requestUserMap(userId).get("permission");
|
|
66700
|
-
this.emit("change", userId, this.resolveFlags(newValue), newValue);
|
|
66701
|
-
}
|
|
66702
|
-
}
|
|
66703
|
-
}
|
|
66704
|
-
}
|
|
66802
|
+
var ForgeSlidePermissions = class extends import_forge_room5.AbstractApplicationPermissions {
|
|
66705
66803
|
/**
|
|
66706
|
-
|
|
66707
|
-
|
|
66708
|
-
|
|
66709
|
-
|
|
66804
|
+
* 解析权限列表组合
|
|
66805
|
+
* @param {number} value - 权限数字值
|
|
66806
|
+
* @return {WhiteboardPermissionFlag[]} - 权限列表
|
|
66807
|
+
*/
|
|
66710
66808
|
resolveFlags(value) {
|
|
66711
66809
|
return [
|
|
66712
66810
|
2 /* changePage */,
|
|
@@ -66714,53 +66812,10 @@ var ForgeSlidePermissions = class extends import_eventemitter315.default {
|
|
|
66714
66812
|
4 /* clickAnim */
|
|
66715
66813
|
].filter((v) => (v & value) !== 0);
|
|
66716
66814
|
}
|
|
66717
|
-
/**
|
|
66718
|
-
* 获取权限列表组合对应的数值
|
|
66719
|
-
* @param { string } userId 不传表示获取自己
|
|
66720
|
-
*/
|
|
66721
|
-
getPermissionValue(userId) {
|
|
66722
|
-
return this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
66723
|
-
}
|
|
66724
|
-
/**
|
|
66725
|
-
* 获取权限列表
|
|
66726
|
-
* @param {string=} userId 可选, 不传表示获取自己
|
|
66727
|
-
*/
|
|
66728
|
-
getPermissionFlags(userId) {
|
|
66729
|
-
const value = this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0;
|
|
66730
|
-
return this.resolveFlags(value);
|
|
66731
|
-
}
|
|
66732
|
-
/**
|
|
66733
|
-
* 返回对应 userId 是否有相应权限
|
|
66734
|
-
* @param {string=} userId 可选, 不传表示返回自己是否有相应权限
|
|
66735
|
-
* @param {WhiteboardPermissionFlag} flag
|
|
66736
|
-
*/
|
|
66737
|
-
hasPermission(flag, userId) {
|
|
66738
|
-
return ((this.requestUserMap(userId ?? this.userManager.selfId).get("permission") ?? 0) & flag) !== 0;
|
|
66739
|
-
}
|
|
66740
|
-
/**
|
|
66741
|
-
* 添加权限
|
|
66742
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
66743
|
-
* @param {string=} userId 可选, 为 userId 添加权限, 不传表示为自己添加权限
|
|
66744
|
-
*/
|
|
66745
|
-
addPermission(flag, userId) {
|
|
66746
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
66747
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
66748
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue | flag);
|
|
66749
|
-
}
|
|
66750
|
-
/**
|
|
66751
|
-
* 移除权限
|
|
66752
|
-
* @param {WhiteboardPermissionFlag} flag 权限标记
|
|
66753
|
-
* @param {string=} userId 可选, 为 userId 移除权限, 不传表示为自己移除权限
|
|
66754
|
-
*/
|
|
66755
|
-
removePermission(flag, userId) {
|
|
66756
|
-
const userMap = this.requestUserMap(userId ?? this.userManager.selfId);
|
|
66757
|
-
const oldValue = userMap.get("permission") ?? 0;
|
|
66758
|
-
this.requestUserMap(userId ?? this.userManager.selfId).set("permission", oldValue & ~flag);
|
|
66759
|
-
}
|
|
66760
66815
|
};
|
|
66761
66816
|
|
|
66762
|
-
// src/
|
|
66763
|
-
var
|
|
66817
|
+
// src/FooterView.ts
|
|
66818
|
+
var import_eventemitter314 = __toESM(require("eventemitter3"));
|
|
66764
66819
|
|
|
66765
66820
|
// src/icons.ts
|
|
66766
66821
|
var prevPage = (color) => `<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none">
|
|
@@ -66789,18 +66844,20 @@ var Icons = {
|
|
|
66789
66844
|
sideBar
|
|
66790
66845
|
};
|
|
66791
66846
|
|
|
66792
|
-
// src/
|
|
66847
|
+
// src/FooterView.ts
|
|
66793
66848
|
var EM_COLOR = "#8C8C8C";
|
|
66794
|
-
var FooterView = class extends
|
|
66849
|
+
var FooterView = class extends import_eventemitter314.default {
|
|
66795
66850
|
root;
|
|
66796
66851
|
prevStep;
|
|
66797
66852
|
nextStep;
|
|
66798
66853
|
prevPage;
|
|
66799
66854
|
nextPage;
|
|
66800
66855
|
sideBarToggle;
|
|
66856
|
+
eventMap = /* @__PURE__ */ new Map();
|
|
66801
66857
|
constructor() {
|
|
66802
66858
|
super();
|
|
66803
66859
|
this.root = document.createElement("div");
|
|
66860
|
+
this.root.classList.add("forge-slide-footer");
|
|
66804
66861
|
this.root.style.height = "24px";
|
|
66805
66862
|
this.root.style.zIndex = "6";
|
|
66806
66863
|
this.root.style.display = "flex";
|
|
@@ -66860,28 +66917,47 @@ var FooterView = class extends import_eventemitter316.default {
|
|
|
66860
66917
|
icon.style.borderRadius = "2px";
|
|
66861
66918
|
icon.style.margin = "6px";
|
|
66862
66919
|
icon.innerHTML = svgContent;
|
|
66863
|
-
|
|
66920
|
+
const onClickHandle = () => {
|
|
66864
66921
|
action();
|
|
66865
|
-
}
|
|
66866
|
-
|
|
66922
|
+
};
|
|
66923
|
+
const onMouseOverHandle = () => {
|
|
66867
66924
|
icon.style.backgroundColor = "#f0f0f0";
|
|
66868
|
-
}
|
|
66869
|
-
|
|
66925
|
+
};
|
|
66926
|
+
const onMouseOutHandle = () => {
|
|
66870
66927
|
icon.style.backgroundColor = "transparent";
|
|
66871
|
-
}
|
|
66928
|
+
};
|
|
66929
|
+
icon.addEventListener("click", onClickHandle);
|
|
66930
|
+
icon.addEventListener("mouseover", onMouseOverHandle);
|
|
66931
|
+
icon.addEventListener("mouseout", onMouseOutHandle);
|
|
66932
|
+
this.eventMap.set(icon, [onClickHandle, onMouseOutHandle, onMouseOverHandle]);
|
|
66872
66933
|
return icon;
|
|
66873
66934
|
}
|
|
66935
|
+
clearHTMLEventListeners() {
|
|
66936
|
+
this.eventMap.forEach((value, key) => {
|
|
66937
|
+
if (key) {
|
|
66938
|
+
const [clickEvent, mouseOutEvent, mouseOverEvent] = value;
|
|
66939
|
+
key.removeEventListener("click", clickEvent);
|
|
66940
|
+
key.removeEventListener("mouseover", mouseOverEvent);
|
|
66941
|
+
key.removeEventListener("mouseout", mouseOutEvent);
|
|
66942
|
+
}
|
|
66943
|
+
});
|
|
66944
|
+
}
|
|
66945
|
+
dispose() {
|
|
66946
|
+
this.removeAllListeners();
|
|
66947
|
+
this.clearHTMLEventListeners();
|
|
66948
|
+
}
|
|
66874
66949
|
};
|
|
66875
66950
|
|
|
66876
66951
|
// src/SiderBarView.ts
|
|
66877
|
-
var
|
|
66878
|
-
var SideBarView = class extends
|
|
66952
|
+
var import_eventemitter315 = __toESM(require("eventemitter3"));
|
|
66953
|
+
var SideBarView = class extends import_eventemitter315.default {
|
|
66879
66954
|
root = document.createElement("div");
|
|
66880
|
-
|
|
66955
|
+
isShow = false;
|
|
66956
|
+
eventsMap = /* @__PURE__ */ new Map();
|
|
66881
66957
|
constructor() {
|
|
66882
66958
|
super();
|
|
66883
66959
|
this.root.style.backgroundColor = "#eee";
|
|
66884
|
-
this.root.className = "slide-sidebar";
|
|
66960
|
+
this.root.className = "forge-slide-sidebar";
|
|
66885
66961
|
this.root.style.width = "240px";
|
|
66886
66962
|
this.root.style.height = "100%";
|
|
66887
66963
|
this.root.style.position = "absolute";
|
|
@@ -66890,38 +66966,38 @@ var SideBarView = class extends import_eventemitter317.default {
|
|
|
66890
66966
|
this.root.style.zIndex = "5";
|
|
66891
66967
|
this.root.style.transition = "left 0.3s ease-in-out";
|
|
66892
66968
|
this.root.style.overflow = "auto";
|
|
66893
|
-
this.root.style.border = "1px solid #ccc";
|
|
66894
|
-
this.root.style.boxShadow = "0 0 10px rgba(0, 0, 0, 0.1)";
|
|
66895
66969
|
this.root.style.display = "flex";
|
|
66896
66970
|
this.root.style.flexDirection = "column";
|
|
66897
66971
|
this.root.style.justifyContent = "flex-start";
|
|
66898
66972
|
this.root.style.alignItems = "center";
|
|
66899
66973
|
}
|
|
66900
|
-
|
|
66901
|
-
|
|
66902
|
-
}
|
|
66903
|
-
onMouseOut = (itemContainer) => {
|
|
66904
|
-
itemContainer.style.borderColor = "transparent";
|
|
66905
|
-
};
|
|
66906
|
-
onClickHandle = (index) => {
|
|
66907
|
-
this.emit("pageChange", index);
|
|
66908
|
-
};
|
|
66974
|
+
get isShowSideBar() {
|
|
66975
|
+
return this.isShow;
|
|
66976
|
+
}
|
|
66909
66977
|
initialize(slideCount, option) {
|
|
66910
66978
|
for (let i = 1; i <= slideCount; i++) {
|
|
66911
66979
|
const itemContainer = document.createElement("div");
|
|
66912
|
-
this.itemList.push(itemContainer);
|
|
66913
66980
|
itemContainer.style.width = "60%";
|
|
66914
66981
|
itemContainer.style.display = "flex";
|
|
66915
66982
|
itemContainer.style.justifyContent = "center";
|
|
66916
66983
|
itemContainer.style.alignItems = "flex-start";
|
|
66917
|
-
itemContainer.style.border = "7px solid transparent";
|
|
66918
66984
|
itemContainer.style.position = "relative";
|
|
66919
66985
|
itemContainer.style.borderRadius = "4px";
|
|
66920
66986
|
itemContainer.style.transition = "border-color .3s";
|
|
66921
66987
|
itemContainer.style.marginBottom = "10px";
|
|
66922
|
-
|
|
66923
|
-
|
|
66924
|
-
|
|
66988
|
+
const onMouseOverHandle = () => {
|
|
66989
|
+
itemContainer.style.borderColor = "#ccc";
|
|
66990
|
+
};
|
|
66991
|
+
const onMouseOutHandle = () => {
|
|
66992
|
+
itemContainer.style.borderColor = "transparent";
|
|
66993
|
+
};
|
|
66994
|
+
const onClickHandle = () => {
|
|
66995
|
+
this.emit("pageChange", i);
|
|
66996
|
+
};
|
|
66997
|
+
itemContainer.addEventListener("click", onClickHandle);
|
|
66998
|
+
itemContainer.addEventListener("mouseover", onMouseOverHandle);
|
|
66999
|
+
itemContainer.addEventListener("mouseout", onMouseOutHandle);
|
|
67000
|
+
this.eventsMap.set(itemContainer, [onClickHandle, onMouseOverHandle, onMouseOutHandle]);
|
|
66925
67001
|
const pageIndex = document.createElement("span");
|
|
66926
67002
|
pageIndex.textContent = `${i}`;
|
|
66927
67003
|
pageIndex.style.position = "absolute";
|
|
@@ -66939,10 +67015,31 @@ var SideBarView = class extends import_eventemitter317.default {
|
|
|
66939
67015
|
this.root.appendChild(itemContainer);
|
|
66940
67016
|
}
|
|
66941
67017
|
}
|
|
67018
|
+
hidden() {
|
|
67019
|
+
if (!this.root) {
|
|
67020
|
+
return;
|
|
67021
|
+
}
|
|
67022
|
+
this.root.style.left = "-240px";
|
|
67023
|
+
this.root.style.border = "none";
|
|
67024
|
+
this.root.style.boxShadow = "none";
|
|
67025
|
+
this.isShow = false;
|
|
67026
|
+
}
|
|
67027
|
+
show() {
|
|
67028
|
+
if (!this.root) {
|
|
67029
|
+
return;
|
|
67030
|
+
}
|
|
67031
|
+
this.root.style.left = "0";
|
|
67032
|
+
this.root.style.border = "1px solid #ccc";
|
|
67033
|
+
this.root.style.boxShadow = "0 0 10px rgba(0, 0, 0, 0.1)";
|
|
67034
|
+
this.isShow = true;
|
|
67035
|
+
}
|
|
66942
67036
|
dispose() {
|
|
66943
|
-
this.
|
|
66944
|
-
|
|
66945
|
-
|
|
67037
|
+
this.removeAllListeners();
|
|
67038
|
+
this.eventsMap.forEach((handlers, element) => {
|
|
67039
|
+
const [clickEvent, mouseOverEvent, mouseOutEvent] = handlers;
|
|
67040
|
+
element.removeEventListener("click", clickEvent);
|
|
67041
|
+
element.removeEventListener("mouseover", mouseOverEvent);
|
|
67042
|
+
element.removeEventListener("mouseout", mouseOutEvent);
|
|
66946
67043
|
});
|
|
66947
67044
|
}
|
|
66948
67045
|
};
|
|
@@ -66981,14 +67078,10 @@ function arrayEqual(arr1, arr2) {
|
|
|
66981
67078
|
}
|
|
66982
67079
|
return true;
|
|
66983
67080
|
}
|
|
66984
|
-
async function delay2(time) {
|
|
66985
|
-
return new Promise((resolve) => setTimeout(resolve, time));
|
|
66986
|
-
}
|
|
66987
67081
|
|
|
66988
67082
|
// src/SlideApplication.ts
|
|
66989
|
-
var import_forge_room5 = require("@netless/forge-room");
|
|
66990
67083
|
var Slide_APP_NAME = "forge_slide";
|
|
66991
|
-
var SlideApplication = class extends
|
|
67084
|
+
var SlideApplication = class extends import_forge_room6.AbstractApplication {
|
|
66992
67085
|
static applicationName = Slide_APP_NAME;
|
|
66993
67086
|
name = Slide_APP_NAME;
|
|
66994
67087
|
emitter = new SlideForge();
|
|
@@ -67005,6 +67098,10 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67005
67098
|
currentSlideIndex = 0;
|
|
67006
67099
|
taskId = "";
|
|
67007
67100
|
prefix = "";
|
|
67101
|
+
slideCount = 0;
|
|
67102
|
+
lastDispatchUuid = "";
|
|
67103
|
+
syncMessageQueue = [];
|
|
67104
|
+
isSyncing = false;
|
|
67008
67105
|
constructor() {
|
|
67009
67106
|
super();
|
|
67010
67107
|
window.emitter = this.emitter;
|
|
@@ -67020,7 +67117,7 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67020
67117
|
this.footer = new FooterView();
|
|
67021
67118
|
this.sideBar = new SideBarView();
|
|
67022
67119
|
this.sideBar.on("pageChange", (index) => {
|
|
67023
|
-
if (index > 0 && index <= this.
|
|
67120
|
+
if (index > 0 && index <= this.slideCount) {
|
|
67024
67121
|
this.slide.renderSlide(index);
|
|
67025
67122
|
}
|
|
67026
67123
|
});
|
|
@@ -67062,7 +67159,7 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67062
67159
|
if (!this.permissions.hasPermission(2 /* changePage */)) {
|
|
67063
67160
|
return;
|
|
67064
67161
|
}
|
|
67065
|
-
if (this.currentSlideIndex < this.
|
|
67162
|
+
if (this.currentSlideIndex < this.slideCount) {
|
|
67066
67163
|
this.slide.renderSlide(this.currentSlideIndex + 1);
|
|
67067
67164
|
}
|
|
67068
67165
|
});
|
|
@@ -67070,16 +67167,13 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67070
67167
|
if (!this.permissions.hasPermission(2 /* changePage */)) {
|
|
67071
67168
|
return;
|
|
67072
67169
|
}
|
|
67073
|
-
if (this.sideBar.
|
|
67074
|
-
this.sideBar.
|
|
67170
|
+
if (this.sideBar.isShowSideBar) {
|
|
67171
|
+
this.sideBar.hidden();
|
|
67075
67172
|
} else {
|
|
67076
|
-
this.sideBar.
|
|
67173
|
+
this.sideBar.show();
|
|
67077
67174
|
}
|
|
67078
67175
|
});
|
|
67079
67176
|
this.rootView.appendChild(this.contentContainer);
|
|
67080
|
-
this.permissions.on("change", (userId, flags, value) => {
|
|
67081
|
-
this.emitter.emit("permissionChange", userId, flags, value);
|
|
67082
|
-
});
|
|
67083
67177
|
this.emitter.on("renderStart", (pageIndex) => {
|
|
67084
67178
|
this.footer.prevPageState(pageIndex !== 0);
|
|
67085
67179
|
});
|
|
@@ -67099,6 +67193,11 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67099
67193
|
return that.footer.root;
|
|
67100
67194
|
}
|
|
67101
67195
|
});
|
|
67196
|
+
Object.defineProperty(this.emitter, "sidebarView", {
|
|
67197
|
+
get() {
|
|
67198
|
+
return that.sideBar.root;
|
|
67199
|
+
}
|
|
67200
|
+
});
|
|
67102
67201
|
Object.defineProperty(this.emitter, "pageIndex", {
|
|
67103
67202
|
get() {
|
|
67104
67203
|
return that.currentSlideIndex;
|
|
@@ -67106,7 +67205,7 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67106
67205
|
});
|
|
67107
67206
|
Object.defineProperty(this.emitter, "pageCount", {
|
|
67108
67207
|
get() {
|
|
67109
|
-
return that.
|
|
67208
|
+
return that.slideCount;
|
|
67110
67209
|
}
|
|
67111
67210
|
});
|
|
67112
67211
|
Object.defineProperty(this.emitter, "goto", {
|
|
@@ -67172,6 +67271,13 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67172
67271
|
return this.getImageSize(pageIndex);
|
|
67173
67272
|
}
|
|
67174
67273
|
});
|
|
67274
|
+
this.applySlideState();
|
|
67275
|
+
}
|
|
67276
|
+
getPreviewImageUrl(pageIndex) {
|
|
67277
|
+
if (pageIndex < 1 || pageIndex > this.slideCount) {
|
|
67278
|
+
throw new Error("pageIndex out of range");
|
|
67279
|
+
}
|
|
67280
|
+
return `${this.prefix}/${this.taskId}/preview/${pageIndex}.png`;
|
|
67175
67281
|
}
|
|
67176
67282
|
async getPreviewImage(imageUrl) {
|
|
67177
67283
|
const image = fetch(imageUrl);
|
|
@@ -67196,13 +67302,13 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67196
67302
|
});
|
|
67197
67303
|
}
|
|
67198
67304
|
async getImageUrl(pageIndex) {
|
|
67199
|
-
return
|
|
67305
|
+
return this.getPreviewImageUrl(pageIndex);
|
|
67200
67306
|
}
|
|
67201
67307
|
async getImageSize(pageIndex) {
|
|
67202
|
-
const imageUrl =
|
|
67308
|
+
const imageUrl = this.getPreviewImageUrl(pageIndex);
|
|
67203
67309
|
let preview = null;
|
|
67204
67310
|
try {
|
|
67205
|
-
const result = await
|
|
67311
|
+
const result = await import_forge_room6.kvStore.getItem(imageUrl);
|
|
67206
67312
|
preview = result ? JSON.parse(result) : null;
|
|
67207
67313
|
} catch (e) {
|
|
67208
67314
|
console.warn("kvStore getItem error", e);
|
|
@@ -67211,14 +67317,14 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67211
67317
|
return { width: preview.width, height: preview.height };
|
|
67212
67318
|
}
|
|
67213
67319
|
preview = await this.getPreviewImage(imageUrl);
|
|
67214
|
-
await
|
|
67320
|
+
await import_forge_room6.kvStore.setItem(imageUrl, JSON.stringify(preview));
|
|
67215
67321
|
return { width: preview.width, height: preview.height };
|
|
67216
67322
|
}
|
|
67217
67323
|
async getImageContent(pageIndex) {
|
|
67218
|
-
const imageUrl =
|
|
67324
|
+
const imageUrl = this.getPreviewImageUrl(pageIndex);
|
|
67219
67325
|
let preview = null;
|
|
67220
67326
|
try {
|
|
67221
|
-
const result = await
|
|
67327
|
+
const result = await import_forge_room6.kvStore.getItem(imageUrl);
|
|
67222
67328
|
preview = result ? JSON.parse(result) : null;
|
|
67223
67329
|
} catch (e) {
|
|
67224
67330
|
console.warn("kvStore getItem error", e);
|
|
@@ -67227,42 +67333,91 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67227
67333
|
return preview.src;
|
|
67228
67334
|
}
|
|
67229
67335
|
preview = await this.getPreviewImage(imageUrl);
|
|
67230
|
-
await
|
|
67336
|
+
await import_forge_room6.kvStore.setItem(imageUrl, JSON.stringify(preview));
|
|
67231
67337
|
return preview.src;
|
|
67232
67338
|
}
|
|
67233
|
-
|
|
67234
|
-
|
|
67235
|
-
|
|
67339
|
+
nextTick = () => {
|
|
67340
|
+
this.isSyncing = false;
|
|
67341
|
+
requestAnimationFrame(() => {
|
|
67342
|
+
this.applySlideState().catch((error) => {
|
|
67343
|
+
console.error("Error in applySlideState:", error);
|
|
67344
|
+
});
|
|
67345
|
+
});
|
|
67346
|
+
};
|
|
67347
|
+
applySlideState = async () => {
|
|
67348
|
+
if (this.isSyncing) {
|
|
67236
67349
|
return;
|
|
67237
67350
|
}
|
|
67238
|
-
|
|
67239
|
-
|
|
67351
|
+
const lastSyncMessage = this.syncMessageQueue.pop();
|
|
67352
|
+
if (!lastSyncMessage) {
|
|
67353
|
+
return this.nextTick();
|
|
67354
|
+
}
|
|
67355
|
+
this.syncMessageQueue = [];
|
|
67356
|
+
this.isSyncing = true;
|
|
67357
|
+
const { state, dispatch } = lastSyncMessage;
|
|
67358
|
+
if (this.slide.slideState.currentSlideIndex < 0) {
|
|
67359
|
+
await this.slide.receiveSyncHandler(dispatch);
|
|
67360
|
+
return this.nextTick();
|
|
67361
|
+
} else if (!deepEqual(this.slide.slideState, state)) {
|
|
67362
|
+
await this.slide.setSlideState(state);
|
|
67363
|
+
await this.slide.receiveSyncHandler(dispatch);
|
|
67240
67364
|
} else {
|
|
67241
|
-
|
|
67242
|
-
await delay2(200);
|
|
67243
|
-
this.slide.emit(import_slide.SLIDE_EVENTS.syncReceive, lastDispatch);
|
|
67365
|
+
this.slide.emit(import_slide.SLIDE_EVENTS.syncReceive, dispatch);
|
|
67244
67366
|
}
|
|
67367
|
+
return this.nextTick();
|
|
67245
67368
|
};
|
|
67246
67369
|
onSlideEventHandler = async (event) => {
|
|
67247
67370
|
for (const [key, value] of event.changes.keys.entries()) {
|
|
67248
67371
|
if (key === "syncSlide") {
|
|
67249
67372
|
if (value.action === "add" || value.action === "update") {
|
|
67250
67373
|
const { slideState: slideStateFromServer, dispatch: dispatchFromServer } = this.getMap(this.name).get("syncSlide");
|
|
67251
|
-
this.
|
|
67374
|
+
if (this.lastDispatchUuid === dispatchFromServer.uuid) {
|
|
67375
|
+
return;
|
|
67376
|
+
}
|
|
67377
|
+
this.lastDispatchUuid = dispatchFromServer.uuid;
|
|
67378
|
+
this.syncMessageQueue.push({
|
|
67379
|
+
state: slideStateFromServer,
|
|
67380
|
+
dispatch: dispatchFromServer
|
|
67381
|
+
});
|
|
67382
|
+
this.applySlideState();
|
|
67252
67383
|
}
|
|
67253
67384
|
}
|
|
67254
67385
|
}
|
|
67255
67386
|
};
|
|
67387
|
+
keyBoardEvents = (event) => {
|
|
67388
|
+
if (event.key === "ArrowLeft") {
|
|
67389
|
+
this.footer.emit("prevStep");
|
|
67390
|
+
} else if (event.key === "ArrowRight") {
|
|
67391
|
+
this.footer.emit("nextStep");
|
|
67392
|
+
} else if (event.key === "ArrowUp") {
|
|
67393
|
+
this.footer.emit("prevPage");
|
|
67394
|
+
} else if (event.key === "ArrowDown") {
|
|
67395
|
+
this.footer.emit("nextPage");
|
|
67396
|
+
}
|
|
67397
|
+
};
|
|
67398
|
+
bindKeyBoardEvent() {
|
|
67399
|
+
document.addEventListener("keydown", this.keyBoardEvents);
|
|
67400
|
+
}
|
|
67401
|
+
unbindKeyBoardEvent() {
|
|
67402
|
+
document.removeEventListener("keydown", this.keyBoardEvents);
|
|
67403
|
+
}
|
|
67404
|
+
async onFocusInstance() {
|
|
67405
|
+
this.bindKeyBoardEvent();
|
|
67406
|
+
}
|
|
67407
|
+
onRefocusInstance() {
|
|
67408
|
+
this.unbindKeyBoardEvent();
|
|
67409
|
+
}
|
|
67256
67410
|
async initialize(option) {
|
|
67257
67411
|
this.prefix = option.prefix;
|
|
67258
67412
|
this.taskId = option.taskId;
|
|
67259
67413
|
const whiteboardApp = new WhiteboardApplication();
|
|
67260
67414
|
whiteboardApp.roomDoc = this.roomDoc;
|
|
67261
|
-
whiteboardApp.appId = `${option.taskId}_wb`;
|
|
67415
|
+
whiteboardApp.appId = `${option.taskId}_${this.appId}_wb`;
|
|
67262
67416
|
whiteboardApp.userId = this.userId;
|
|
67263
67417
|
whiteboardApp.userManager = this.userManager;
|
|
67264
67418
|
whiteboardApp.applicationManager = this.applicationManager;
|
|
67265
67419
|
const json = await fetch(`${option.prefix}/${option.taskId}/jsonOutput/slide-1.json`).then((res) => res.json());
|
|
67420
|
+
this.slideCount = json.slideCount;
|
|
67266
67421
|
await whiteboardApp.initialize({
|
|
67267
67422
|
width: json.width,
|
|
67268
67423
|
height: json.height
|
|
@@ -67277,11 +67432,13 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67277
67432
|
this.whiteboard.view.style.top = "0";
|
|
67278
67433
|
this.whiteboard.view.style.left = "0";
|
|
67279
67434
|
this.whiteboard.view.style.zIndex = "4";
|
|
67435
|
+
this.whiteboard.view.classList.add("slide-whiteboard");
|
|
67280
67436
|
this.whiteboard.permissions.addPermission(WhiteboardPermissionFlag.all);
|
|
67281
67437
|
this.whiteboard.setCanvasBackgroundColor("#f0f0f000");
|
|
67282
67438
|
this.whiteboardContainer.style.position = "relative";
|
|
67283
67439
|
this.whiteboardContainer.style.flex = "0 0 auto";
|
|
67284
67440
|
this.whiteboardContainer.style.height = "calc(100% - 24px)";
|
|
67441
|
+
this.whiteboardContainer.classList.add("forge-slide-whiteboard-container");
|
|
67285
67442
|
this.whiteboardContainer.appendChild(this.whiteboard.view);
|
|
67286
67443
|
this.whiteboardContainer.appendChild(this.slideContainer);
|
|
67287
67444
|
this.contentContainer.appendChild(this.whiteboardContainer);
|
|
@@ -67305,30 +67462,39 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67305
67462
|
});
|
|
67306
67463
|
this.slide.setResource(option.taskId, option.prefix);
|
|
67307
67464
|
this.sideBar.initialize(json.slideCount, option);
|
|
67308
|
-
this.slide.on(
|
|
67465
|
+
this.slide.on(import_slide.SLIDE_EVENTS.syncDispatch, (event) => {
|
|
67309
67466
|
this.getMap(this.name).set("syncSlide", {
|
|
67310
67467
|
slideState: this.slide.slideState,
|
|
67311
67468
|
dispatch: event
|
|
67312
67469
|
});
|
|
67313
67470
|
});
|
|
67314
|
-
this.slide.on(
|
|
67471
|
+
this.slide.on(import_slide.SLIDE_EVENTS.mainSeqStepStart, (animateIndex) => {
|
|
67315
67472
|
this.emitter.emit("mainSeqStepStart", animateIndex);
|
|
67316
67473
|
});
|
|
67317
|
-
this.slide.on(
|
|
67474
|
+
this.slide.on(import_slide.SLIDE_EVENTS.mainSeqStepEnd, (animateIndex) => {
|
|
67318
67475
|
this.emitter.emit("mainSeqStepEnd", animateIndex);
|
|
67319
67476
|
});
|
|
67320
|
-
this.slide.on(
|
|
67477
|
+
this.slide.on(import_slide.SLIDE_EVENTS.animateStart, () => {
|
|
67478
|
+
this.sideBar.hidden();
|
|
67479
|
+
});
|
|
67480
|
+
this.slide.on(import_slide.SLIDE_EVENTS.renderError, ({ error, index }) => {
|
|
67481
|
+
if (error.errorType === "CANVAS_CRASH") {
|
|
67482
|
+
this.slide.renderSlide(index);
|
|
67483
|
+
}
|
|
67484
|
+
});
|
|
67485
|
+
this.slide.on(import_slide.SLIDE_EVENTS.renderStart, (slideIndex) => {
|
|
67321
67486
|
this.whiteboardApp.emitter.view.style.opacity = "0";
|
|
67322
67487
|
this.whiteboardApp.emitter.addPage(`${slideIndex}`);
|
|
67323
67488
|
this.whiteboardApp.emitter.gotoPage(`${slideIndex}`);
|
|
67489
|
+
this.sideBar.hidden();
|
|
67324
67490
|
this.emitter.emit("renderStart", slideIndex);
|
|
67325
67491
|
});
|
|
67326
|
-
this.slide.on(
|
|
67492
|
+
this.slide.on(import_slide.SLIDE_EVENTS.renderEnd, (slideIndex) => {
|
|
67327
67493
|
this.currentSlideIndex = slideIndex;
|
|
67328
67494
|
this.whiteboardApp.emitter.view.style.opacity = "1";
|
|
67329
67495
|
this.emitter.emit("renderEnd", slideIndex);
|
|
67330
67496
|
});
|
|
67331
|
-
this.slide.on(
|
|
67497
|
+
this.slide.on(import_slide.SLIDE_EVENTS.stateChange, (state) => {
|
|
67332
67498
|
this.getMap(this.name).set("slideState", state);
|
|
67333
67499
|
});
|
|
67334
67500
|
this.getMap(this.name).observe(this.onSlideEventHandler);
|
|
@@ -67337,7 +67503,7 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67337
67503
|
window.forgeSlide = this;
|
|
67338
67504
|
const syncSlide = this.getMap(this.name).get("slideState");
|
|
67339
67505
|
if (syncSlide && syncSlide.taskId === option.taskId) {
|
|
67340
|
-
|
|
67506
|
+
this.slide.setSlideState(syncSlide);
|
|
67341
67507
|
} else {
|
|
67342
67508
|
this.slide.renderSlide(1);
|
|
67343
67509
|
}
|
|
@@ -67345,6 +67511,7 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67345
67511
|
return this.userMap(userId);
|
|
67346
67512
|
});
|
|
67347
67513
|
this.permissions.on("change", (userId, flags, value) => {
|
|
67514
|
+
this.emitter.emit("permissionChange", userId, flags, value);
|
|
67348
67515
|
if (this.userId === userId) {
|
|
67349
67516
|
if (flags.includes(4 /* clickAnim */)) {
|
|
67350
67517
|
this.slideContainer.style.pointerEvents = "auto";
|
|
@@ -67353,8 +67520,31 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67353
67520
|
}
|
|
67354
67521
|
}
|
|
67355
67522
|
});
|
|
67356
|
-
this.permissions.
|
|
67523
|
+
this.permissions.setPermission(7 /* all */);
|
|
67357
67524
|
this.whiteboardApp.disableViewModel();
|
|
67525
|
+
if (this.window) {
|
|
67526
|
+
let prevStatus = "normal";
|
|
67527
|
+
this.window.on("statusChange", (status) => {
|
|
67528
|
+
if (prevStatus === "minimized") {
|
|
67529
|
+
this.onFocusInstance();
|
|
67530
|
+
prevStatus = status;
|
|
67531
|
+
return;
|
|
67532
|
+
}
|
|
67533
|
+
prevStatus = status;
|
|
67534
|
+
if (status === "normal") {
|
|
67535
|
+
this.onFocusInstance();
|
|
67536
|
+
} else if (status === "minimized") {
|
|
67537
|
+
this.onRefocusInstance();
|
|
67538
|
+
}
|
|
67539
|
+
});
|
|
67540
|
+
this.window.on("focusedChange", (status) => {
|
|
67541
|
+
if (status) {
|
|
67542
|
+
this.onFocusInstance();
|
|
67543
|
+
} else {
|
|
67544
|
+
this.onRefocusInstance();
|
|
67545
|
+
}
|
|
67546
|
+
});
|
|
67547
|
+
}
|
|
67358
67548
|
window.__forge_slide = this;
|
|
67359
67549
|
window.slidePermissions = this.permissions;
|
|
67360
67550
|
return Promise.resolve(void 0);
|
|
@@ -67368,7 +67558,8 @@ var SlideApplication = class extends import_forge_room4.AbstractApplication {
|
|
|
67368
67558
|
this.slide.destroy();
|
|
67369
67559
|
this.sideBar.dispose();
|
|
67370
67560
|
this.getMap(this.name).unobserve(this.onSlideEventHandler);
|
|
67371
|
-
|
|
67561
|
+
this.permissions.dispose();
|
|
67562
|
+
this.footer.dispose();
|
|
67372
67563
|
}
|
|
67373
67564
|
};
|
|
67374
67565
|
/*! Bundled license information:
|