@netless/forge-slide 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/slide.esm.js +633 -237
- package/dist/slide.esm.js.map +3 -3
- package/dist/slide.js +679 -283
- package/dist/slide.js.map +3 -3
- package/package.json +3 -3
package/dist/slide.js
CHANGED
|
@@ -35313,36 +35313,37 @@ var Y = __toESM(require("yjs"), 1);
|
|
|
35313
35313
|
var import_forge_room3 = require("@netless/forge-room");
|
|
35314
35314
|
var Y3 = __toESM(require("yjs"), 1);
|
|
35315
35315
|
var Y4 = __toESM(require("yjs"), 1);
|
|
35316
|
+
var import_forge_room4 = require("@netless/forge-room");
|
|
35316
35317
|
var Y5 = __toESM(require("yjs"), 1);
|
|
35317
35318
|
var Y6 = __toESM(require("yjs"), 1);
|
|
35318
|
-
var
|
|
35319
|
+
var import_forge_room5 = require("@netless/forge-room");
|
|
35319
35320
|
var Y7 = __toESM(require("yjs"), 1);
|
|
35320
35321
|
var Y8 = __toESM(require("yjs"), 1);
|
|
35321
35322
|
var Y9 = __toESM(require("yjs"), 1);
|
|
35322
35323
|
var Y10 = __toESM(require("yjs"), 1);
|
|
35323
|
-
var
|
|
35324
|
+
var import_forge_room6 = require("@netless/forge-room");
|
|
35324
35325
|
var Y11 = __toESM(require("yjs"), 1);
|
|
35325
35326
|
var import_eventemitter32 = __toESM(require("eventemitter3"), 1);
|
|
35326
|
-
var
|
|
35327
|
+
var import_forge_room7 = require("@netless/forge-room");
|
|
35327
35328
|
var Y13 = __toESM(require("yjs"), 1);
|
|
35328
35329
|
var import_eventemitter33 = __toESM(require("eventemitter3"), 1);
|
|
35329
|
-
var
|
|
35330
|
+
var import_forge_room8 = require("@netless/forge-room");
|
|
35330
35331
|
var import_eventemitter34 = __toESM(require("eventemitter3"), 1);
|
|
35331
35332
|
var import_eventemitter35 = require("eventemitter3");
|
|
35332
35333
|
var import_eventemitter36 = __toESM(require("eventemitter3"), 1);
|
|
35333
35334
|
var import_eventemitter37 = __toESM(require("eventemitter3"), 1);
|
|
35334
|
-
var
|
|
35335
|
+
var import_forge_room9 = require("@netless/forge-room");
|
|
35335
35336
|
var import_eventemitter38 = __toESM(require("eventemitter3"), 1);
|
|
35336
35337
|
var Y14 = __toESM(require("yjs"), 1);
|
|
35337
35338
|
var import_eventemitter39 = __toESM(require("eventemitter3"), 1);
|
|
35338
|
-
var import_forge_room9 = require("@netless/forge-room");
|
|
35339
|
-
var import_eventemitter310 = __toESM(require("eventemitter3"), 1);
|
|
35340
35339
|
var import_forge_room10 = require("@netless/forge-room");
|
|
35341
|
-
var
|
|
35340
|
+
var import_eventemitter310 = __toESM(require("eventemitter3"), 1);
|
|
35342
35341
|
var import_forge_room11 = require("@netless/forge-room");
|
|
35342
|
+
var import_eventemitter311 = __toESM(require("eventemitter3"), 1);
|
|
35343
35343
|
var import_forge_room12 = require("@netless/forge-room");
|
|
35344
|
-
var import_eventemitter312 = __toESM(require("eventemitter3"), 1);
|
|
35345
35344
|
var import_forge_room13 = require("@netless/forge-room");
|
|
35345
|
+
var import_eventemitter312 = __toESM(require("eventemitter3"), 1);
|
|
35346
|
+
var import_forge_room14 = require("@netless/forge-room");
|
|
35346
35347
|
var __create2 = Object.create;
|
|
35347
35348
|
var __defProp2 = Object.defineProperty;
|
|
35348
35349
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -56174,8 +56175,8 @@ var require_lodash = __commonJS2({
|
|
|
56174
56175
|
}
|
|
56175
56176
|
var runInContext = function runInContext2(context) {
|
|
56176
56177
|
context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
|
|
56177
|
-
var
|
|
56178
|
-
var arrayProto =
|
|
56178
|
+
var Array14 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
|
|
56179
|
+
var arrayProto = Array14.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
|
|
56179
56180
|
var coreJsData = context["__core-js_shared__"];
|
|
56180
56181
|
var funcToString = funcProto.toString;
|
|
56181
56182
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
@@ -56598,7 +56599,7 @@ var require_lodash = __commonJS2({
|
|
|
56598
56599
|
}
|
|
56599
56600
|
}
|
|
56600
56601
|
function baseAt(object, paths) {
|
|
56601
|
-
var index = -1, length = paths.length, result2 =
|
|
56602
|
+
var index = -1, length = paths.length, result2 = Array14(length), skip = object == null;
|
|
56602
56603
|
while (++index < length) {
|
|
56603
56604
|
result2[index] = skip ? undefined2 : get(object, paths[index]);
|
|
56604
56605
|
}
|
|
@@ -56844,7 +56845,7 @@ var require_lodash = __commonJS2({
|
|
|
56844
56845
|
return number >= nativeMin(start, end) && number < nativeMax(start, end);
|
|
56845
56846
|
}
|
|
56846
56847
|
function baseIntersection(arrays, iteratee2, comparator) {
|
|
56847
|
-
var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches =
|
|
56848
|
+
var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array14(othLength), maxLength = Infinity, result2 = [];
|
|
56848
56849
|
while (othIndex--) {
|
|
56849
56850
|
var array = arrays[othIndex];
|
|
56850
56851
|
if (othIndex && iteratee2) {
|
|
@@ -57025,7 +57026,7 @@ var require_lodash = __commonJS2({
|
|
|
57025
57026
|
return value < other;
|
|
57026
57027
|
}
|
|
57027
57028
|
function baseMap(collection, iteratee2) {
|
|
57028
|
-
var index = -1, result2 = isArrayLike(collection) ?
|
|
57029
|
+
var index = -1, result2 = isArrayLike(collection) ? Array14(collection.length) : [];
|
|
57029
57030
|
baseEach(collection, function(value, key, collection2) {
|
|
57030
57031
|
result2[++index] = iteratee2(value, key, collection2);
|
|
57031
57032
|
});
|
|
@@ -57200,7 +57201,7 @@ var require_lodash = __commonJS2({
|
|
|
57200
57201
|
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
|
|
57201
57202
|
}
|
|
57202
57203
|
function baseRange(start, end, step, fromRight) {
|
|
57203
|
-
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 =
|
|
57204
|
+
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array14(length);
|
|
57204
57205
|
while (length--) {
|
|
57205
57206
|
result2[fromRight ? length : ++index] = start;
|
|
57206
57207
|
start += step;
|
|
@@ -57282,7 +57283,7 @@ var require_lodash = __commonJS2({
|
|
|
57282
57283
|
}
|
|
57283
57284
|
length = start > end ? 0 : end - start >>> 0;
|
|
57284
57285
|
start >>>= 0;
|
|
57285
|
-
var result2 =
|
|
57286
|
+
var result2 = Array14(length);
|
|
57286
57287
|
while (++index < length) {
|
|
57287
57288
|
result2[index] = array[index + start];
|
|
57288
57289
|
}
|
|
@@ -57442,7 +57443,7 @@ var require_lodash = __commonJS2({
|
|
|
57442
57443
|
if (length < 2) {
|
|
57443
57444
|
return length ? baseUniq(arrays[0]) : [];
|
|
57444
57445
|
}
|
|
57445
|
-
var index = -1, result2 =
|
|
57446
|
+
var index = -1, result2 = Array14(length);
|
|
57446
57447
|
while (++index < length) {
|
|
57447
57448
|
var array = arrays[index], othIndex = -1;
|
|
57448
57449
|
while (++othIndex < length) {
|
|
@@ -57539,7 +57540,7 @@ var require_lodash = __commonJS2({
|
|
|
57539
57540
|
return object.index - other.index;
|
|
57540
57541
|
}
|
|
57541
57542
|
function composeArgs(args, partials, holders, isCurried) {
|
|
57542
|
-
var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 =
|
|
57543
|
+
var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array14(leftLength + rangeLength), isUncurried = !isCurried;
|
|
57543
57544
|
while (++leftIndex < leftLength) {
|
|
57544
57545
|
result2[leftIndex] = partials[leftIndex];
|
|
57545
57546
|
}
|
|
@@ -57554,7 +57555,7 @@ var require_lodash = __commonJS2({
|
|
|
57554
57555
|
return result2;
|
|
57555
57556
|
}
|
|
57556
57557
|
function composeArgsRight(args, partials, holders, isCurried) {
|
|
57557
|
-
var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 =
|
|
57558
|
+
var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 = Array14(rangeLength + rightLength), isUncurried = !isCurried;
|
|
57558
57559
|
while (++argsIndex < rangeLength) {
|
|
57559
57560
|
result2[argsIndex] = args[argsIndex];
|
|
57560
57561
|
}
|
|
@@ -57571,7 +57572,7 @@ var require_lodash = __commonJS2({
|
|
|
57571
57572
|
}
|
|
57572
57573
|
function copyArray(source, array) {
|
|
57573
57574
|
var index = -1, length = source.length;
|
|
57574
|
-
array || (array =
|
|
57575
|
+
array || (array = Array14(length));
|
|
57575
57576
|
while (++index < length) {
|
|
57576
57577
|
array[index] = source[index];
|
|
57577
57578
|
}
|
|
@@ -57704,7 +57705,7 @@ var require_lodash = __commonJS2({
|
|
|
57704
57705
|
function createCurry(func, bitmask, arity) {
|
|
57705
57706
|
var Ctor = createCtor(func);
|
|
57706
57707
|
function wrapper() {
|
|
57707
|
-
var length = arguments.length, args =
|
|
57708
|
+
var length = arguments.length, args = Array14(length), index = length, placeholder = getHolder(wrapper);
|
|
57708
57709
|
while (index--) {
|
|
57709
57710
|
args[index] = arguments[index];
|
|
57710
57711
|
}
|
|
@@ -57784,7 +57785,7 @@ var require_lodash = __commonJS2({
|
|
|
57784
57785
|
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
|
|
57785
57786
|
var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
|
|
57786
57787
|
function wrapper() {
|
|
57787
|
-
var length = arguments.length, args =
|
|
57788
|
+
var length = arguments.length, args = Array14(length), index = length;
|
|
57788
57789
|
while (index--) {
|
|
57789
57790
|
args[index] = arguments[index];
|
|
57790
57791
|
}
|
|
@@ -57883,7 +57884,7 @@ var require_lodash = __commonJS2({
|
|
|
57883
57884
|
function createPartial(func, bitmask, thisArg, partials) {
|
|
57884
57885
|
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
|
|
57885
57886
|
function wrapper() {
|
|
57886
|
-
var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args =
|
|
57887
|
+
var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array14(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
|
|
57887
57888
|
while (++leftIndex < leftLength) {
|
|
57888
57889
|
args[leftIndex] = partials[leftIndex];
|
|
57889
57890
|
}
|
|
@@ -58496,12 +58497,12 @@ var require_lodash = __commonJS2({
|
|
|
58496
58497
|
function overRest(func, start, transform2) {
|
|
58497
58498
|
start = nativeMax(start === undefined2 ? func.length - 1 : start, 0);
|
|
58498
58499
|
return function() {
|
|
58499
|
-
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array =
|
|
58500
|
+
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array14(length);
|
|
58500
58501
|
while (++index < length) {
|
|
58501
58502
|
array[index] = args[start + index];
|
|
58502
58503
|
}
|
|
58503
58504
|
index = -1;
|
|
58504
|
-
var otherArgs =
|
|
58505
|
+
var otherArgs = Array14(start + 1);
|
|
58505
58506
|
while (++index < start) {
|
|
58506
58507
|
otherArgs[index] = args[index];
|
|
58507
58508
|
}
|
|
@@ -58613,7 +58614,7 @@ var require_lodash = __commonJS2({
|
|
|
58613
58614
|
result2.__values__ = wrapper.__values__;
|
|
58614
58615
|
return result2;
|
|
58615
58616
|
}
|
|
58616
|
-
function
|
|
58617
|
+
function chunk7(array, size2, guard) {
|
|
58617
58618
|
if (guard ? isIterateeCall(array, size2, guard) : size2 === undefined2) {
|
|
58618
58619
|
size2 = 1;
|
|
58619
58620
|
} else {
|
|
@@ -58623,7 +58624,7 @@ var require_lodash = __commonJS2({
|
|
|
58623
58624
|
if (!length || size2 < 1) {
|
|
58624
58625
|
return [];
|
|
58625
58626
|
}
|
|
58626
|
-
var index = 0, resIndex = 0, result2 =
|
|
58627
|
+
var index = 0, resIndex = 0, result2 = Array14(nativeCeil(length / size2));
|
|
58627
58628
|
while (index < length) {
|
|
58628
58629
|
result2[resIndex++] = baseSlice(array, index, index += size2);
|
|
58629
58630
|
}
|
|
@@ -58644,7 +58645,7 @@ var require_lodash = __commonJS2({
|
|
|
58644
58645
|
if (!length) {
|
|
58645
58646
|
return [];
|
|
58646
58647
|
}
|
|
58647
|
-
var args =
|
|
58648
|
+
var args = Array14(length - 1), array = arguments[0], index = length;
|
|
58648
58649
|
while (index--) {
|
|
58649
58650
|
args[index - 1] = arguments[index];
|
|
58650
58651
|
}
|
|
@@ -59146,7 +59147,7 @@ var require_lodash = __commonJS2({
|
|
|
59146
59147
|
return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
|
|
59147
59148
|
}
|
|
59148
59149
|
var invokeMap = baseRest(function(collection, path, args) {
|
|
59149
|
-
var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ?
|
|
59150
|
+
var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array14(collection.length) : [];
|
|
59150
59151
|
baseEach(collection, function(value) {
|
|
59151
59152
|
result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
|
|
59152
59153
|
});
|
|
@@ -59529,7 +59530,7 @@ var require_lodash = __commonJS2({
|
|
|
59529
59530
|
}()) ? baseIsArguments : function(value) {
|
|
59530
59531
|
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
59531
59532
|
};
|
|
59532
|
-
var isArray =
|
|
59533
|
+
var isArray = Array14.isArray;
|
|
59533
59534
|
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
|
|
59534
59535
|
function isArrayLike(value) {
|
|
59535
59536
|
return value != null && isLength(value.length) && !isFunction(value);
|
|
@@ -60485,7 +60486,7 @@ var require_lodash = __commonJS2({
|
|
|
60485
60486
|
lodash.bindKey = bindKey;
|
|
60486
60487
|
lodash.castArray = castArray;
|
|
60487
60488
|
lodash.chain = chain;
|
|
60488
|
-
lodash.chunk =
|
|
60489
|
+
lodash.chunk = chunk7;
|
|
60489
60490
|
lodash.compact = compact;
|
|
60490
60491
|
lodash.concat = concat;
|
|
60491
60492
|
lodash.cond = cond;
|
|
@@ -61109,7 +61110,6 @@ function me(e, t = {}) {
|
|
|
61109
61110
|
function ae(e, t = {}) {
|
|
61110
61111
|
return ce(me(e, t), t);
|
|
61111
61112
|
}
|
|
61112
|
-
var import_lodash = __toESM2(require_lodash(), 1);
|
|
61113
61113
|
function _defineProperty(e, r, t) {
|
|
61114
61114
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
61115
61115
|
}
|
|
@@ -61194,12 +61194,23 @@ var ElementModel = class _ElementModel {
|
|
|
61194
61194
|
set shadow(value) {
|
|
61195
61195
|
this.root.set(_ElementModel.KEYS.shadow, value);
|
|
61196
61196
|
}
|
|
61197
|
-
|
|
61197
|
+
get isPerformanceEnvironment() {
|
|
61198
|
+
return this.isPerformanceMode() && this.shouldUseLocalPoints;
|
|
61199
|
+
}
|
|
61200
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
61198
61201
|
_defineProperty(this, "shadowEmitter", null);
|
|
61199
61202
|
_defineProperty(this, "root", void 0);
|
|
61200
61203
|
_defineProperty(this, "scope", void 0);
|
|
61201
61204
|
_defineProperty(this, "item", void 0);
|
|
61205
|
+
_defineProperty(this, "clearLocalPointsWhenYPointsChange", void 0);
|
|
61206
|
+
_defineProperty(this, "shouldUseLocalPoints", void 0);
|
|
61207
|
+
_defineProperty(this, "localPointsPick", void 0);
|
|
61202
61208
|
_defineProperty(this, "liveCursor", void 0);
|
|
61209
|
+
_defineProperty(this, "appendPointsTimer", null);
|
|
61210
|
+
_defineProperty(this, "setPointsTimer", null);
|
|
61211
|
+
_defineProperty(this, "pointsUpdateTimer", null);
|
|
61212
|
+
_defineProperty(this, "isPerformanceMode", void 0);
|
|
61213
|
+
_defineProperty(this, "localPoints", []);
|
|
61203
61214
|
_defineProperty(this, "handlePropChange", (events) => {
|
|
61204
61215
|
if (!this.item) {
|
|
61205
61216
|
return;
|
|
@@ -61238,24 +61249,68 @@ var ElementModel = class _ElementModel {
|
|
|
61238
61249
|
}
|
|
61239
61250
|
}
|
|
61240
61251
|
} else if (event.target === this.root.get(_ElementModel.KEYS.points)) {
|
|
61241
|
-
this.
|
|
61242
|
-
|
|
61243
|
-
|
|
61244
|
-
|
|
61245
|
-
this.liveCursor.updateCursorPosition(liveCursorPoint, this.root.get(_ElementModel.KEYS.ownerId));
|
|
61252
|
+
if (this.isPerformanceEnvironment) {
|
|
61253
|
+
this.handlePointsChangePerformance();
|
|
61254
|
+
} else {
|
|
61255
|
+
this.handlePointsChangeDirect();
|
|
61246
61256
|
}
|
|
61247
61257
|
} else {
|
|
61248
61258
|
}
|
|
61249
61259
|
}
|
|
61250
61260
|
});
|
|
61261
|
+
_defineProperty(this, "onPointsArrayChange", (points) => {
|
|
61262
|
+
if (this.localPoints.length >= points.length) {
|
|
61263
|
+
return;
|
|
61264
|
+
}
|
|
61265
|
+
const pointsChunk = points.slice(this.localPoints.length, this.localPoints.length + this.localPointsPick);
|
|
61266
|
+
this.localPoints = this.localPoints.concat(pointsChunk);
|
|
61267
|
+
this.onVectorUpdate();
|
|
61268
|
+
this.pointsUpdateTimer = window.requestAnimationFrame(() => {
|
|
61269
|
+
this.onPointsArrayChange(points);
|
|
61270
|
+
});
|
|
61271
|
+
});
|
|
61272
|
+
this.isPerformanceMode = isPerformanceMode;
|
|
61251
61273
|
this.scope = scope;
|
|
61252
61274
|
this.liveCursor = liveCursor;
|
|
61253
61275
|
this.root = root;
|
|
61254
|
-
if (
|
|
61276
|
+
if (this.root.doc) {
|
|
61277
|
+
if (!this.root.has(_ElementModel.KEYS.pointsMatrix)) {
|
|
61278
|
+
this.root.set(_ElementModel.KEYS.pointsMatrix, [1, 0, 0, 1, 0, 0]);
|
|
61279
|
+
}
|
|
61280
|
+
} else {
|
|
61255
61281
|
this.root.set(_ElementModel.KEYS.pointsMatrix, [1, 0, 0, 1, 0, 0]);
|
|
61256
61282
|
}
|
|
61257
61283
|
this.root.observeDeep(this.handlePropChange);
|
|
61258
61284
|
}
|
|
61285
|
+
handlePointsChangeDirect() {
|
|
61286
|
+
this.onVectorUpdate();
|
|
61287
|
+
const liveCursorPoint = this.liveCursorPoint();
|
|
61288
|
+
const ownerId = this.root.get(_ElementModel.KEYS.ownerId);
|
|
61289
|
+
if (liveCursorPoint && ownerId) {
|
|
61290
|
+
this.liveCursor.updateCursorPosition(liveCursorPoint, this.root.get(_ElementModel.KEYS.ownerId));
|
|
61291
|
+
}
|
|
61292
|
+
}
|
|
61293
|
+
handlePointsChangePerformance() {
|
|
61294
|
+
const liveCursorPoint = this.liveCursorPoint();
|
|
61295
|
+
const ownerId = this.root.get(_ElementModel.KEYS.ownerId);
|
|
61296
|
+
if (liveCursorPoint && ownerId) {
|
|
61297
|
+
this.liveCursor.updateCursorPosition(liveCursorPoint, this.root.get(_ElementModel.KEYS.ownerId));
|
|
61298
|
+
}
|
|
61299
|
+
if (this.liveCursor.userManager.selfId !== ownerId || this.localPoints.length === 0) {
|
|
61300
|
+
if (this.pointsUpdateTimer) {
|
|
61301
|
+
window.cancelAnimationFrame(this.pointsUpdateTimer);
|
|
61302
|
+
}
|
|
61303
|
+
if (this.shadow == "") {
|
|
61304
|
+
this.localPoints = this.points;
|
|
61305
|
+
this.onVectorUpdate();
|
|
61306
|
+
} else {
|
|
61307
|
+
if (this.clearLocalPointsWhenYPointsChange) {
|
|
61308
|
+
this.localPoints = [];
|
|
61309
|
+
}
|
|
61310
|
+
this.onPointsArrayChange(this.points);
|
|
61311
|
+
}
|
|
61312
|
+
}
|
|
61313
|
+
}
|
|
61259
61314
|
createPaperElement() {
|
|
61260
61315
|
this.createPaperItem();
|
|
61261
61316
|
if (this.item) {
|
|
@@ -61267,14 +61322,48 @@ var ElementModel = class _ElementModel {
|
|
|
61267
61322
|
}
|
|
61268
61323
|
}
|
|
61269
61324
|
appendPoints(points) {
|
|
61325
|
+
if (this.isPerformanceEnvironment) {
|
|
61326
|
+
this.appendPointsPerformance(points);
|
|
61327
|
+
} else {
|
|
61328
|
+
this.appendPointsDirect(points);
|
|
61329
|
+
}
|
|
61330
|
+
}
|
|
61331
|
+
appendPointsDirect(points) {
|
|
61270
61332
|
this.root.get(_ElementModel.KEYS.points).push(points);
|
|
61271
61333
|
}
|
|
61334
|
+
appendPointsPerformance(points) {
|
|
61335
|
+
this.localPoints = this.localPoints.concat(points);
|
|
61336
|
+
this.onVectorUpdate();
|
|
61337
|
+
if (this.appendPointsTimer) {
|
|
61338
|
+
window.clearTimeout(this.appendPointsTimer);
|
|
61339
|
+
}
|
|
61340
|
+
if (this.localPoints.length % 80 === 0) {
|
|
61341
|
+
const yArray = this.root.get(_ElementModel.KEYS.points);
|
|
61342
|
+
yArray?.push(this.localPoints.slice(yArray.length));
|
|
61343
|
+
}
|
|
61344
|
+
this.appendPointsTimer = window.setTimeout(() => {
|
|
61345
|
+
this.appendPointsTimer = null;
|
|
61346
|
+
if (this.localPoints.length > 0) {
|
|
61347
|
+
const yArray = this.root.get(_ElementModel.KEYS.points);
|
|
61348
|
+
yArray?.push(this.localPoints.slice(yArray.length));
|
|
61349
|
+
}
|
|
61350
|
+
}, 100);
|
|
61351
|
+
}
|
|
61272
61352
|
setPoints(points) {
|
|
61353
|
+
if (this.isPerformanceEnvironment) {
|
|
61354
|
+
this.setPointsPerformance(points);
|
|
61355
|
+
} else {
|
|
61356
|
+
this.setPointsDirect(points);
|
|
61357
|
+
}
|
|
61358
|
+
}
|
|
61359
|
+
setPointsDirect(points) {
|
|
61273
61360
|
if (this.root.doc) {
|
|
61274
61361
|
this.root.doc.transact(() => {
|
|
61275
61362
|
const yArray = this.root.get(_ElementModel.KEYS.points);
|
|
61276
|
-
|
|
61277
|
-
|
|
61363
|
+
if (yArray) {
|
|
61364
|
+
yArray.delete(0, yArray.length);
|
|
61365
|
+
yArray.push(points);
|
|
61366
|
+
}
|
|
61278
61367
|
});
|
|
61279
61368
|
} else {
|
|
61280
61369
|
const yArray = this.root.get(_ElementModel.KEYS.points) || new Y.Array();
|
|
@@ -61283,6 +61372,29 @@ var ElementModel = class _ElementModel {
|
|
|
61283
61372
|
this.root.set(_ElementModel.KEYS.points, yArray);
|
|
61284
61373
|
}
|
|
61285
61374
|
}
|
|
61375
|
+
setPointsPerformance(points) {
|
|
61376
|
+
this.localPoints = points;
|
|
61377
|
+
this.onVectorUpdate();
|
|
61378
|
+
if (this.setPointsTimer) {
|
|
61379
|
+
window.clearTimeout(this.setPointsTimer);
|
|
61380
|
+
}
|
|
61381
|
+
this.setPointsTimer = window.setTimeout(() => {
|
|
61382
|
+
if (this.root.doc) {
|
|
61383
|
+
this.root.doc.transact(() => {
|
|
61384
|
+
const yArray = this.root.get(_ElementModel.KEYS.points);
|
|
61385
|
+
if (yArray) {
|
|
61386
|
+
yArray.delete(0, yArray.length);
|
|
61387
|
+
yArray.push(points);
|
|
61388
|
+
}
|
|
61389
|
+
});
|
|
61390
|
+
} else {
|
|
61391
|
+
const yArray = this.root.get(_ElementModel.KEYS.points) || new Y.Array();
|
|
61392
|
+
yArray.delete(0, yArray.length);
|
|
61393
|
+
yArray.push(points);
|
|
61394
|
+
this.root.set(_ElementModel.KEYS.points, yArray);
|
|
61395
|
+
}
|
|
61396
|
+
}, 100);
|
|
61397
|
+
}
|
|
61286
61398
|
appendPointsMatrix(matrix) {
|
|
61287
61399
|
const current = new this.scope.Matrix(this.pointsMatrix);
|
|
61288
61400
|
const next = matrix.appended(current);
|
|
@@ -61377,47 +61489,53 @@ function _toPrimitive3(t, r) {
|
|
|
61377
61489
|
return ("string" === r ? String : Number)(t);
|
|
61378
61490
|
}
|
|
61379
61491
|
var CurveModel = class extends ElementModel {
|
|
61380
|
-
constructor(root, scope, liveCursor) {
|
|
61381
|
-
super(root, scope, liveCursor);
|
|
61492
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
61493
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
61382
61494
|
_defineProperty3(this, "item", null);
|
|
61383
|
-
_defineProperty3(this, "debugPath", void 0);
|
|
61384
61495
|
_defineProperty3(this, "debug", false);
|
|
61385
|
-
|
|
61496
|
+
_defineProperty3(this, "clearLocalPointsWhenYPointsChange", false);
|
|
61497
|
+
_defineProperty3(this, "shouldUseLocalPoints", true);
|
|
61498
|
+
_defineProperty3(this, "localPointsPick", 6);
|
|
61499
|
+
if (!this.root.doc || !this.root.has("type")) {
|
|
61386
61500
|
this.root.set("type", "curve");
|
|
61387
61501
|
}
|
|
61388
|
-
if (!this.root.has("points")) {
|
|
61502
|
+
if (!this.root.doc || !this.root.has("points")) {
|
|
61389
61503
|
this.root.set("points", new Y2.Array());
|
|
61390
61504
|
}
|
|
61391
|
-
this.debugPath = new scope.Path();
|
|
61392
61505
|
}
|
|
61393
61506
|
average(a2, b2) {
|
|
61394
61507
|
return (a2 + b2) / 2;
|
|
61395
61508
|
}
|
|
61396
61509
|
parsePoints(points) {
|
|
61510
|
+
const hasRealPressure = points.some((p) => p.length >= 3 && p[2] > 0);
|
|
61511
|
+
const viewScale = this.scope.project.view.matrix.scaling.x || 1;
|
|
61512
|
+
const taper = this.strokeWidth * 5 / viewScale;
|
|
61513
|
+
const streamline = Math.min(0.7, 0.7 * viewScale);
|
|
61397
61514
|
return ae(points, {
|
|
61398
61515
|
size: this.strokeWidth,
|
|
61399
|
-
smoothing: 0.
|
|
61400
|
-
thinning:
|
|
61401
|
-
streamline
|
|
61402
|
-
simulatePressure:
|
|
61516
|
+
smoothing: 0.7,
|
|
61517
|
+
thinning: 0.5,
|
|
61518
|
+
streamline,
|
|
61519
|
+
simulatePressure: !hasRealPressure,
|
|
61403
61520
|
start: {
|
|
61404
|
-
taper
|
|
61521
|
+
taper,
|
|
61405
61522
|
cap: true
|
|
61406
61523
|
},
|
|
61407
61524
|
end: {
|
|
61408
|
-
taper
|
|
61525
|
+
taper,
|
|
61409
61526
|
cap: true
|
|
61410
61527
|
}
|
|
61411
61528
|
});
|
|
61412
61529
|
}
|
|
61413
61530
|
matrixedPoints() {
|
|
61414
|
-
const points = this.points;
|
|
61531
|
+
const points = this.localPoints.length === 0 ? this.points : this.localPoints;
|
|
61415
61532
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61416
61533
|
const output = [];
|
|
61417
|
-
for (let i = 0, len = points.length; i < len; i +=
|
|
61534
|
+
for (let i = 0, len = points.length; i < len; i += 3) {
|
|
61418
61535
|
const p = new this.scope.Point(points[i], points[i + 1]);
|
|
61419
61536
|
const tp = p.transform(matrix);
|
|
61420
|
-
|
|
61537
|
+
const pressure = points[i + 2] ?? 0;
|
|
61538
|
+
output.push([tp.x, tp.y, pressure]);
|
|
61421
61539
|
}
|
|
61422
61540
|
return output;
|
|
61423
61541
|
}
|
|
@@ -61446,34 +61564,30 @@ var CurveModel = class extends ElementModel {
|
|
|
61446
61564
|
}
|
|
61447
61565
|
return path;
|
|
61448
61566
|
}
|
|
61449
|
-
updateDebugPath() {
|
|
61450
|
-
this.debugPath = new this.scope.Path();
|
|
61451
|
-
const points = (0, import_lodash.chunk)(this.points, 2);
|
|
61452
|
-
for (let i = 0, len = points.length; i < len; i++) {
|
|
61453
|
-
const point = new this.scope.Point(points[i][0], points[i][1]);
|
|
61454
|
-
if (i === 0) {
|
|
61455
|
-
this.debugPath.moveTo(point);
|
|
61456
|
-
} else {
|
|
61457
|
-
this.debugPath.lineTo(point);
|
|
61458
|
-
}
|
|
61459
|
-
this.debugPath.strokeWidth = 1;
|
|
61460
|
-
this.debugPath.strokeColor = new this.scope.Color(1, 0, 0, 1);
|
|
61461
|
-
}
|
|
61462
|
-
}
|
|
61463
61567
|
onVectorUpdate() {
|
|
61464
61568
|
if (!this.item) {
|
|
61465
61569
|
return;
|
|
61466
61570
|
}
|
|
61571
|
+
const matrixedPts = this.matrixedPoints();
|
|
61467
61572
|
if (this.debug) {
|
|
61468
|
-
this.
|
|
61469
|
-
|
|
61470
|
-
|
|
61471
|
-
|
|
61472
|
-
|
|
61473
|
-
|
|
61474
|
-
|
|
61475
|
-
|
|
61476
|
-
|
|
61573
|
+
const path = new this.scope.Path();
|
|
61574
|
+
for (let i = 0; i < matrixedPts.length; i++) {
|
|
61575
|
+
const p = new this.scope.Point(matrixedPts[i][0], matrixedPts[i][1]);
|
|
61576
|
+
if (i === 0) {
|
|
61577
|
+
path.moveTo(p);
|
|
61578
|
+
} else {
|
|
61579
|
+
path.lineTo(p);
|
|
61580
|
+
}
|
|
61581
|
+
}
|
|
61582
|
+
this.item.removeSegments();
|
|
61583
|
+
this.item.addSegments(path.segments);
|
|
61584
|
+
this.item.fillColor = null;
|
|
61585
|
+
this.item.strokeWidth = this.strokeWidth;
|
|
61586
|
+
} else {
|
|
61587
|
+
const points = this.parsePoints(matrixedPts);
|
|
61588
|
+
const path = this.createPath(points);
|
|
61589
|
+
this.item.removeSegments();
|
|
61590
|
+
this.item.addSegments(path.segments);
|
|
61477
61591
|
}
|
|
61478
61592
|
}
|
|
61479
61593
|
createPaperItem() {
|
|
@@ -61496,11 +61610,11 @@ var CurveModel = class extends ElementModel {
|
|
|
61496
61610
|
}
|
|
61497
61611
|
liveCursorPoint() {
|
|
61498
61612
|
const yArray = this.root.get(ElementModel.KEYS.points);
|
|
61499
|
-
if (yArray.length <
|
|
61613
|
+
if (yArray.length < 3) {
|
|
61500
61614
|
return null;
|
|
61501
61615
|
}
|
|
61502
61616
|
const len = yArray.length;
|
|
61503
|
-
const point = new this.scope.Point(yArray.get(len -
|
|
61617
|
+
const point = new this.scope.Point(yArray.get(len - 3), yArray.get(len - 2));
|
|
61504
61618
|
return point.transform(new this.scope.Matrix(this.pointsMatrix));
|
|
61505
61619
|
}
|
|
61506
61620
|
onStyleKeyUpdate(key) {
|
|
@@ -61535,15 +61649,24 @@ function _toPrimitive4(t, r) {
|
|
|
61535
61649
|
return ("string" === r ? String : Number)(t);
|
|
61536
61650
|
}
|
|
61537
61651
|
var SelectorModel = class extends ElementModel {
|
|
61538
|
-
|
|
61539
|
-
|
|
61652
|
+
get drawPoints() {
|
|
61653
|
+
if (this.localPoints.length >= 4) {
|
|
61654
|
+
return this.localPoints;
|
|
61655
|
+
}
|
|
61656
|
+
return this.points;
|
|
61657
|
+
}
|
|
61658
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
61659
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
61540
61660
|
_defineProperty4(this, "item", null);
|
|
61541
|
-
|
|
61661
|
+
_defineProperty4(this, "clearLocalPointsWhenYPointsChange", true);
|
|
61662
|
+
_defineProperty4(this, "shouldUseLocalPoints", true);
|
|
61663
|
+
_defineProperty4(this, "localPointsPick", 4);
|
|
61664
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
61542
61665
|
this.root.set("type", "selector");
|
|
61543
61666
|
}
|
|
61544
|
-
if (!this.root.has("points")) {
|
|
61667
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
61545
61668
|
const initPoints = new Y3.Array();
|
|
61546
|
-
initPoints.push([0, 0, 0, 0
|
|
61669
|
+
initPoints.push([0, 0, 0, 0]);
|
|
61547
61670
|
this.root.set("points", initPoints);
|
|
61548
61671
|
}
|
|
61549
61672
|
}
|
|
@@ -61554,8 +61677,8 @@ var SelectorModel = class extends ElementModel {
|
|
|
61554
61677
|
}
|
|
61555
61678
|
createPaperRect() {
|
|
61556
61679
|
const scope = this.scope;
|
|
61557
|
-
const bounds = new scope.Rectangle(new scope.Point(this.
|
|
61558
|
-
return new scope.Path.Rectangle(bounds
|
|
61680
|
+
const bounds = new scope.Rectangle(new scope.Point(this.drawPoints[0], this.drawPoints[1]), new scope.Size(this.drawPoints[2], this.drawPoints[3]));
|
|
61681
|
+
return new scope.Path.Rectangle(bounds);
|
|
61559
61682
|
}
|
|
61560
61683
|
onVectorUpdate() {
|
|
61561
61684
|
if (!this.item) {
|
|
@@ -61584,7 +61707,7 @@ var SelectorModel = class extends ElementModel {
|
|
|
61584
61707
|
onStyleKeyUpdate(_key) {
|
|
61585
61708
|
}
|
|
61586
61709
|
};
|
|
61587
|
-
var
|
|
61710
|
+
var import_lodash = __toESM2(require_lodash(), 1);
|
|
61588
61711
|
function _defineProperty5(e, r, t) {
|
|
61589
61712
|
return (r = _toPropertyKey5(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
61590
61713
|
}
|
|
@@ -61617,7 +61740,7 @@ function serializePath(path) {
|
|
|
61617
61740
|
}, []);
|
|
61618
61741
|
}
|
|
61619
61742
|
function deserializePath(points, scope, matrix) {
|
|
61620
|
-
const segmentGroup = (0,
|
|
61743
|
+
const segmentGroup = (0, import_lodash.chunk)(points, 6);
|
|
61621
61744
|
const path = new scope.Path();
|
|
61622
61745
|
path.segments = segmentGroup.map((v) => deserializeSegment(v, scope, matrix));
|
|
61623
61746
|
return path;
|
|
@@ -61627,7 +61750,27 @@ var AnimationFrame = class {
|
|
|
61627
61750
|
_defineProperty5(this, "callbacks", []);
|
|
61628
61751
|
_defineProperty5(this, "lastTime", 0);
|
|
61629
61752
|
_defineProperty5(this, "fps", 45);
|
|
61753
|
+
_defineProperty5(this, "lastCallbackTime", 0);
|
|
61754
|
+
_defineProperty5(this, "fpsBuffer", []);
|
|
61755
|
+
_defineProperty5(this, "FPS_REPORT_INTERVAL", 2700);
|
|
61630
61756
|
_defineProperty5(this, "handleCallbacks", () => {
|
|
61757
|
+
const now = performance.now();
|
|
61758
|
+
if (this.lastCallbackTime > 0) {
|
|
61759
|
+
const actualFps = 1e3 / (now - this.lastCallbackTime);
|
|
61760
|
+
this.fpsBuffer.push(actualFps);
|
|
61761
|
+
if (this.fpsBuffer.length >= this.FPS_REPORT_INTERVAL) {
|
|
61762
|
+
const avg = this.fpsBuffer.reduce((a2, b2) => a2 + b2, 0) / this.fpsBuffer.length;
|
|
61763
|
+
const min = Math.min(...this.fpsBuffer);
|
|
61764
|
+
const sorted = [...this.fpsBuffer].sort((a2, b2) => a2 - b2);
|
|
61765
|
+
const p90 = sorted[Math.floor(sorted.length * 0.9)];
|
|
61766
|
+
(0, import_forge_room4.metrics)().gauge("fps", Math.round(avg), {
|
|
61767
|
+
min: Math.round(min),
|
|
61768
|
+
p90: Math.round(p90)
|
|
61769
|
+
});
|
|
61770
|
+
this.fpsBuffer = [];
|
|
61771
|
+
}
|
|
61772
|
+
}
|
|
61773
|
+
this.lastCallbackTime = now;
|
|
61631
61774
|
const functions = this.callbacks;
|
|
61632
61775
|
this.callbacks = [];
|
|
61633
61776
|
for (let i = 0, l2 = functions.length; i < l2; i++) {
|
|
@@ -61669,13 +61812,22 @@ function _toPrimitive6(t, r) {
|
|
|
61669
61812
|
return ("string" === r ? String : Number)(t);
|
|
61670
61813
|
}
|
|
61671
61814
|
var SegmentsModel = class extends ElementModel {
|
|
61672
|
-
|
|
61673
|
-
|
|
61815
|
+
get drawPoints() {
|
|
61816
|
+
if (this.localPoints.length >= 4) {
|
|
61817
|
+
return this.localPoints;
|
|
61818
|
+
}
|
|
61819
|
+
return this.points;
|
|
61820
|
+
}
|
|
61821
|
+
constructor(root, scope, type, liveCursor, isPerformanceMode) {
|
|
61822
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
61674
61823
|
_defineProperty6(this, "item", null);
|
|
61675
|
-
|
|
61824
|
+
_defineProperty6(this, "clearLocalPointsWhenYPointsChange", true);
|
|
61825
|
+
_defineProperty6(this, "shouldUseLocalPoints", true);
|
|
61826
|
+
_defineProperty6(this, "localPointsPick", 24);
|
|
61827
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
61676
61828
|
this.root.set("type", type);
|
|
61677
61829
|
}
|
|
61678
|
-
if (!this.root.has("points")) {
|
|
61830
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
61679
61831
|
this.root.set("points", new Y4.Array());
|
|
61680
61832
|
}
|
|
61681
61833
|
}
|
|
@@ -61695,13 +61847,13 @@ var SegmentsModel = class extends ElementModel {
|
|
|
61695
61847
|
}
|
|
61696
61848
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61697
61849
|
this.item.removeSegments();
|
|
61698
|
-
const next = deserializePath(this.
|
|
61850
|
+
const next = deserializePath(this.drawPoints, this.scope, matrix);
|
|
61699
61851
|
this.item.addSegments(next.segments);
|
|
61700
61852
|
this.item.closePath();
|
|
61701
61853
|
}
|
|
61702
61854
|
createPaperItem() {
|
|
61703
61855
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61704
|
-
this.item = deserializePath(this.
|
|
61856
|
+
this.item = deserializePath(this.drawPoints, this.scope, matrix);
|
|
61705
61857
|
this.item.strokeColor = new this.scope.Color(this.strokeColor);
|
|
61706
61858
|
this.item.dashArray = this.dashArray;
|
|
61707
61859
|
this.item.strokeWidth = this.strokeWidth;
|
|
@@ -61726,7 +61878,7 @@ var SegmentsModel = class extends ElementModel {
|
|
|
61726
61878
|
onStyleKeyUpdate(_key) {
|
|
61727
61879
|
}
|
|
61728
61880
|
};
|
|
61729
|
-
var
|
|
61881
|
+
var import_lodash3 = __toESM2(require_lodash(), 1);
|
|
61730
61882
|
function _defineProperty7(e, r, t) {
|
|
61731
61883
|
return (r = _toPropertyKey7(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
61732
61884
|
}
|
|
@@ -61744,6 +61896,8 @@ function _toPrimitive7(t, r) {
|
|
|
61744
61896
|
}
|
|
61745
61897
|
return ("string" === r ? String : Number)(t);
|
|
61746
61898
|
}
|
|
61899
|
+
var DRAG_FPS = 10;
|
|
61900
|
+
var DRAG_FRAME_MS = 1e3 / DRAG_FPS;
|
|
61747
61901
|
var WhiteboardTool = class {
|
|
61748
61902
|
constructor(enableToolEvent, modelGetter, shadowEmitter, scope) {
|
|
61749
61903
|
_defineProperty7(this, "modelGetter", void 0);
|
|
@@ -61752,24 +61906,60 @@ var WhiteboardTool = class {
|
|
|
61752
61906
|
_defineProperty7(this, "shadowEmitter", void 0);
|
|
61753
61907
|
_defineProperty7(this, "enableToolEvent", void 0);
|
|
61754
61908
|
_defineProperty7(this, "eventAvailable", false);
|
|
61909
|
+
_defineProperty7(this, "lastDragTime", 0);
|
|
61910
|
+
_defineProperty7(this, "dragRafId", 0);
|
|
61911
|
+
_defineProperty7(this, "pendingDragEvent", null);
|
|
61755
61912
|
_defineProperty7(this, "onMouseDownSelf", (event) => {
|
|
61756
61913
|
this.eventAvailable = this.enableToolEvent();
|
|
61757
61914
|
if (!this.eventAvailable) {
|
|
61758
61915
|
return;
|
|
61759
61916
|
}
|
|
61917
|
+
this.lastDragTime = 0;
|
|
61918
|
+
if (this.dragRafId) {
|
|
61919
|
+
cancelAnimationFrame(this.dragRafId);
|
|
61920
|
+
this.dragRafId = 0;
|
|
61921
|
+
}
|
|
61922
|
+
this.pendingDragEvent = null;
|
|
61760
61923
|
this.shadowEmitter.setActive(true);
|
|
61761
61924
|
this.onMouseDown(event);
|
|
61762
61925
|
});
|
|
61926
|
+
_defineProperty7(this, "flushPendingDrag", () => {
|
|
61927
|
+
this.dragRafId = 0;
|
|
61928
|
+
if (this.pendingDragEvent) {
|
|
61929
|
+
this.lastDragTime = performance.now();
|
|
61930
|
+
const event = this.pendingDragEvent;
|
|
61931
|
+
this.pendingDragEvent = null;
|
|
61932
|
+
this.onMouseDrag(event);
|
|
61933
|
+
}
|
|
61934
|
+
});
|
|
61763
61935
|
_defineProperty7(this, "onMouseDragSelf", (event) => {
|
|
61764
61936
|
if (!this.eventAvailable) {
|
|
61765
61937
|
return;
|
|
61766
61938
|
}
|
|
61767
|
-
|
|
61939
|
+
const now = performance.now();
|
|
61940
|
+
if (now - this.lastDragTime >= DRAG_FRAME_MS) {
|
|
61941
|
+
this.lastDragTime = now;
|
|
61942
|
+
this.pendingDragEvent = null;
|
|
61943
|
+
this.onMouseDrag(event);
|
|
61944
|
+
} else {
|
|
61945
|
+
this.pendingDragEvent = event;
|
|
61946
|
+
if (!this.dragRafId) {
|
|
61947
|
+
this.dragRafId = requestAnimationFrame(this.flushPendingDrag);
|
|
61948
|
+
}
|
|
61949
|
+
}
|
|
61768
61950
|
});
|
|
61769
61951
|
_defineProperty7(this, "onMouseUpSelf", (event) => {
|
|
61770
61952
|
if (!this.eventAvailable) {
|
|
61771
61953
|
return;
|
|
61772
61954
|
}
|
|
61955
|
+
if (this.dragRafId) {
|
|
61956
|
+
cancelAnimationFrame(this.dragRafId);
|
|
61957
|
+
this.dragRafId = 0;
|
|
61958
|
+
}
|
|
61959
|
+
if (this.pendingDragEvent) {
|
|
61960
|
+
this.onMouseDrag(this.pendingDragEvent);
|
|
61961
|
+
this.pendingDragEvent = null;
|
|
61962
|
+
}
|
|
61773
61963
|
this.onMouseUp(event);
|
|
61774
61964
|
this.shadowEmitter.setActive(false);
|
|
61775
61965
|
});
|
|
@@ -61783,7 +61973,7 @@ var WhiteboardTool = class {
|
|
|
61783
61973
|
this.tool.onMouseUp = this.onMouseUpSelf;
|
|
61784
61974
|
}
|
|
61785
61975
|
};
|
|
61786
|
-
var
|
|
61976
|
+
var import_lodash2 = __toESM2(require_lodash(), 1);
|
|
61787
61977
|
function _defineProperty8(e, r, t) {
|
|
61788
61978
|
return (r = _toPropertyKey8(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
61789
61979
|
}
|
|
@@ -61832,7 +62022,7 @@ var LineTool = class extends WhiteboardTool {
|
|
|
61832
62022
|
const point = path.getPointAt(distance);
|
|
61833
62023
|
return [point.x, point.y];
|
|
61834
62024
|
});
|
|
61835
|
-
this.elementModel.setPoints((0,
|
|
62025
|
+
this.elementModel.setPoints((0, import_lodash2.flattenDeep)(points));
|
|
61836
62026
|
}
|
|
61837
62027
|
}
|
|
61838
62028
|
onMouseUp(_event) {
|
|
@@ -61860,6 +62050,12 @@ function _toPrimitive9(t, r) {
|
|
|
61860
62050
|
return ("string" === r ? String : Number)(t);
|
|
61861
62051
|
}
|
|
61862
62052
|
var LineModel = class extends ElementModel {
|
|
62053
|
+
get drawPoints() {
|
|
62054
|
+
if (this.localPoints.length > 0) {
|
|
62055
|
+
return this.localPoints;
|
|
62056
|
+
}
|
|
62057
|
+
return this.points;
|
|
62058
|
+
}
|
|
61863
62059
|
get arrowSize() {
|
|
61864
62060
|
return this.strokeWidth * 5 + 15;
|
|
61865
62061
|
}
|
|
@@ -61875,20 +62071,23 @@ var LineModel = class extends ElementModel {
|
|
|
61875
62071
|
set tailArrow(value) {
|
|
61876
62072
|
this.root.set("tailArrow", value);
|
|
61877
62073
|
}
|
|
61878
|
-
constructor(root, scope, liveCursor) {
|
|
61879
|
-
super(root, scope, liveCursor);
|
|
62074
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
62075
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
61880
62076
|
_defineProperty9(this, "controlledPoints", []);
|
|
62077
|
+
_defineProperty9(this, "clearLocalPointsWhenYPointsChange", true);
|
|
62078
|
+
_defineProperty9(this, "shouldUseLocalPoints", true);
|
|
62079
|
+
_defineProperty9(this, "localPointsPick", 99);
|
|
61881
62080
|
_defineProperty9(this, "item", null);
|
|
61882
|
-
if (!this.root.has("type")) {
|
|
62081
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
61883
62082
|
this.root.set("type", "arrow");
|
|
61884
62083
|
}
|
|
61885
|
-
if (!this.root.has("points")) {
|
|
62084
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
61886
62085
|
this.root.set("points", new Y5.Array());
|
|
61887
62086
|
}
|
|
61888
|
-
if (!this.root.has("headArrow")) {
|
|
62087
|
+
if (this.root.doc && !this.root.has("headArrow")) {
|
|
61889
62088
|
this.root.set("headArrow", "none");
|
|
61890
62089
|
}
|
|
61891
|
-
if (!this.root.has("tailArrow")) {
|
|
62090
|
+
if (this.root.doc && !this.root.has("tailArrow")) {
|
|
61892
62091
|
this.root.set("tailArrow", "normal");
|
|
61893
62092
|
}
|
|
61894
62093
|
}
|
|
@@ -61904,7 +62103,7 @@ var LineModel = class extends ElementModel {
|
|
|
61904
62103
|
}
|
|
61905
62104
|
renderLine() {
|
|
61906
62105
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61907
|
-
const papperPoints = (0,
|
|
62106
|
+
const papperPoints = (0, import_lodash3.chunk)(this.drawPoints, 2).map((item) => {
|
|
61908
62107
|
return new this.scope.Point(item[0], item[1]).transform(matrix);
|
|
61909
62108
|
});
|
|
61910
62109
|
const path = new this.scope.Path();
|
|
@@ -62018,13 +62217,14 @@ var LineControlPoint = class {
|
|
|
62018
62217
|
if (this.position) {
|
|
62019
62218
|
return this.model.scope.project.view.projectToView(this.position.transform(matrix));
|
|
62020
62219
|
}
|
|
62220
|
+
const points = this.model["drawPoints"];
|
|
62021
62221
|
const from = {
|
|
62022
|
-
x:
|
|
62023
|
-
y:
|
|
62222
|
+
x: points[0],
|
|
62223
|
+
y: points[1]
|
|
62024
62224
|
};
|
|
62025
62225
|
const to = {
|
|
62026
|
-
x:
|
|
62027
|
-
y:
|
|
62226
|
+
x: points[points.length - 2],
|
|
62227
|
+
y: points[points.length - 1]
|
|
62028
62228
|
};
|
|
62029
62229
|
const clonedPath = new this.scope.Path.Line(from, to);
|
|
62030
62230
|
this.position = clonedPath.getPointAt(clonedPath.length * distance);
|
|
@@ -62037,9 +62237,9 @@ var LineControlPoint = class {
|
|
|
62037
62237
|
}
|
|
62038
62238
|
const pointsMatrix = new this.model.scope.Matrix(this.model.pointsMatrix);
|
|
62039
62239
|
const invertedPoint = point.transform(pointsMatrix.inverted());
|
|
62040
|
-
const points = this.model
|
|
62240
|
+
const points = this.model["drawPoints"];
|
|
62041
62241
|
this.position = invertedPoint;
|
|
62042
|
-
const clonedPoints = (0,
|
|
62242
|
+
const clonedPoints = (0, import_lodash3.cloneDeep)(points);
|
|
62043
62243
|
clonedPoints[this.options.index * 2] = invertedPoint.x;
|
|
62044
62244
|
clonedPoints[this.options.index * 2 + 1] = invertedPoint.y;
|
|
62045
62245
|
this.model.setPoints(clonedPoints);
|
|
@@ -62081,9 +62281,18 @@ var PointTextModel = class extends ElementModel {
|
|
|
62081
62281
|
set fontFamily(value) {
|
|
62082
62282
|
this.root.set("font-family", value);
|
|
62083
62283
|
}
|
|
62084
|
-
|
|
62085
|
-
|
|
62284
|
+
get drawPoints() {
|
|
62285
|
+
if (this.localPoints.length > 1) {
|
|
62286
|
+
return this.localPoints;
|
|
62287
|
+
}
|
|
62288
|
+
return this.points;
|
|
62289
|
+
}
|
|
62290
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
62291
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62086
62292
|
_defineProperty10(this, "item", null);
|
|
62293
|
+
_defineProperty10(this, "clearLocalPointsWhenYPointsChange", true);
|
|
62294
|
+
_defineProperty10(this, "shouldUseLocalPoints", false);
|
|
62295
|
+
_defineProperty10(this, "localPointsPick", 2);
|
|
62087
62296
|
_defineProperty10(this, "handleTextPropChange", (event) => {
|
|
62088
62297
|
if (!this.item) {
|
|
62089
62298
|
return;
|
|
@@ -62100,21 +62309,23 @@ var PointTextModel = class extends ElementModel {
|
|
|
62100
62309
|
}
|
|
62101
62310
|
}
|
|
62102
62311
|
});
|
|
62103
|
-
if (!this.root.has("type")) {
|
|
62312
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62104
62313
|
this.root.set("type", "point-text");
|
|
62105
62314
|
}
|
|
62106
|
-
if (!this.root.has(ElementModel.KEYS.points)) {
|
|
62315
|
+
if (this.root.doc && !this.root.has(ElementModel.KEYS.points)) {
|
|
62107
62316
|
this.root.set(ElementModel.KEYS.points, new Y6.Array());
|
|
62108
62317
|
}
|
|
62109
62318
|
this.root.observe(this.handleTextPropChange);
|
|
62110
|
-
|
|
62111
|
-
|
|
62112
|
-
|
|
62113
|
-
|
|
62114
|
-
|
|
62319
|
+
setTimeout(() => {
|
|
62320
|
+
if (this.root && this.root.has("font-size")) {
|
|
62321
|
+
setTimeout(() => {
|
|
62322
|
+
this.updateTextPosition();
|
|
62323
|
+
}, 60);
|
|
62324
|
+
}
|
|
62325
|
+
}, 60);
|
|
62115
62326
|
}
|
|
62116
62327
|
subDispose() {
|
|
62117
|
-
(0,
|
|
62328
|
+
(0, import_forge_room5.removeObserver)(this.root, this.handleTextPropChange);
|
|
62118
62329
|
}
|
|
62119
62330
|
liveCursorPoint() {
|
|
62120
62331
|
const points = this.points;
|
|
@@ -62129,10 +62340,11 @@ var PointTextModel = class extends ElementModel {
|
|
|
62129
62340
|
if (!this.item) {
|
|
62130
62341
|
return null;
|
|
62131
62342
|
}
|
|
62343
|
+
console.log("[][][] drawPoints", this.drawPoints);
|
|
62132
62344
|
const bounds = this.item.internalBounds;
|
|
62133
62345
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62134
|
-
const topLeft = new this.scope.Point(this.
|
|
62135
|
-
const topRight = new this.scope.Point(this.
|
|
62346
|
+
const topLeft = new this.scope.Point(this.drawPoints[0], this.drawPoints[1]).transform(matrix);
|
|
62347
|
+
const topRight = new this.scope.Point(this.drawPoints[0] + bounds.width, this.drawPoints[1]).transform(matrix);
|
|
62136
62348
|
let scaleX = topRight.getDistance(topLeft) / bounds.width;
|
|
62137
62349
|
scaleX = Number.isNaN(scaleX) ? 1 : scaleX;
|
|
62138
62350
|
const angle = topRight.subtract(topLeft).angle;
|
|
@@ -62217,13 +62429,22 @@ function _toPrimitive11(t, r) {
|
|
|
62217
62429
|
return ("string" === r ? String : Number)(t);
|
|
62218
62430
|
}
|
|
62219
62431
|
var TriangleModel = class extends ElementModel {
|
|
62220
|
-
|
|
62221
|
-
|
|
62432
|
+
get drawPoints() {
|
|
62433
|
+
if (this.localPoints.length >= 6) {
|
|
62434
|
+
return this.localPoints;
|
|
62435
|
+
}
|
|
62436
|
+
return this.points;
|
|
62437
|
+
}
|
|
62438
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
62439
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62222
62440
|
_defineProperty11(this, "item", null);
|
|
62223
|
-
|
|
62441
|
+
_defineProperty11(this, "clearLocalPointsWhenYPointsChange", true);
|
|
62442
|
+
_defineProperty11(this, "shouldUseLocalPoints", true);
|
|
62443
|
+
_defineProperty11(this, "localPointsPick", 6);
|
|
62444
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62224
62445
|
this.root.set("type", "triangle");
|
|
62225
62446
|
}
|
|
62226
|
-
if (!this.root.has("points")) {
|
|
62447
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
62227
62448
|
this.root.set("points", new Y7.Array());
|
|
62228
62449
|
}
|
|
62229
62450
|
}
|
|
@@ -62255,9 +62476,9 @@ var TriangleModel = class extends ElementModel {
|
|
|
62255
62476
|
return;
|
|
62256
62477
|
}
|
|
62257
62478
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62258
|
-
const p1 = new this.scope.Point(this.
|
|
62259
|
-
const p2 = new this.scope.Point(this.
|
|
62260
|
-
const p3 = new this.scope.Point(this.
|
|
62479
|
+
const p1 = new this.scope.Point(this.drawPoints[0], this.drawPoints[1]).transform(matrix);
|
|
62480
|
+
const p2 = new this.scope.Point(this.drawPoints[2], this.drawPoints[3]).transform(matrix);
|
|
62481
|
+
const p3 = new this.scope.Point(this.drawPoints[4], this.drawPoints[5]).transform(matrix);
|
|
62261
62482
|
this.item.removeSegments();
|
|
62262
62483
|
this.item.moveTo(p1);
|
|
62263
62484
|
this.item.lineTo(p2);
|
|
@@ -62269,7 +62490,7 @@ var TriangleModel = class extends ElementModel {
|
|
|
62269
62490
|
config.controlPoints.push({
|
|
62270
62491
|
name: "triangle",
|
|
62271
62492
|
getPosition: () => {
|
|
62272
|
-
const point = new this.scope.Point(this.
|
|
62493
|
+
const point = new this.scope.Point(this.drawPoints[0], this.drawPoints[1]);
|
|
62273
62494
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62274
62495
|
return this.scope.project.view.projectToView(point.transform(pointsMatrix));
|
|
62275
62496
|
},
|
|
@@ -62279,7 +62500,7 @@ var TriangleModel = class extends ElementModel {
|
|
|
62279
62500
|
}
|
|
62280
62501
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62281
62502
|
const trPoint = point.transform(pointsMatrix.inverted());
|
|
62282
|
-
const oldPoints = this.
|
|
62503
|
+
const oldPoints = this.drawPoints;
|
|
62283
62504
|
this.setPoints([trPoint.x, trPoint.y, oldPoints[2], oldPoints[3], oldPoints[4], oldPoints[5]]);
|
|
62284
62505
|
}
|
|
62285
62506
|
});
|
|
@@ -62315,25 +62536,34 @@ function _toPrimitive12(t, r) {
|
|
|
62315
62536
|
return ("string" === r ? String : Number)(t);
|
|
62316
62537
|
}
|
|
62317
62538
|
var RectangleModel = class extends ElementModel {
|
|
62318
|
-
|
|
62319
|
-
|
|
62539
|
+
get drawPoints() {
|
|
62540
|
+
if (this.localPoints.length >= 4) {
|
|
62541
|
+
return this.localPoints;
|
|
62542
|
+
}
|
|
62543
|
+
return this.points;
|
|
62544
|
+
}
|
|
62545
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
62546
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62320
62547
|
_defineProperty12(this, "item", null);
|
|
62321
|
-
|
|
62548
|
+
_defineProperty12(this, "clearLocalPointsWhenYPointsChange", true);
|
|
62549
|
+
_defineProperty12(this, "shouldUseLocalPoints", true);
|
|
62550
|
+
_defineProperty12(this, "localPointsPick", 4);
|
|
62551
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62322
62552
|
this.root.set("type", "rectangle");
|
|
62323
62553
|
}
|
|
62324
|
-
if (!this.root.has("points")) {
|
|
62554
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
62325
62555
|
const initPoints = new Y8.Array();
|
|
62326
62556
|
initPoints.push([0, 0, 0, 0]);
|
|
62327
62557
|
this.root.set("points", initPoints);
|
|
62328
62558
|
}
|
|
62329
|
-
if (!this.root.has("radius")) {
|
|
62559
|
+
if (this.root.doc && !this.root.has("radius")) {
|
|
62330
62560
|
this.root.set("radius", 0);
|
|
62331
62561
|
}
|
|
62332
62562
|
}
|
|
62333
62563
|
subDispose() {
|
|
62334
62564
|
}
|
|
62335
62565
|
liveCursorPoint() {
|
|
62336
|
-
const points = this.
|
|
62566
|
+
const points = this.drawPoints;
|
|
62337
62567
|
if (points.length < 4) {
|
|
62338
62568
|
return null;
|
|
62339
62569
|
}
|
|
@@ -62341,7 +62571,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
62341
62571
|
return new this.scope.Point(points[2], points[3]).transform(matrix);
|
|
62342
62572
|
}
|
|
62343
62573
|
createSegments() {
|
|
62344
|
-
const [a2, b2, c, d] = this.
|
|
62574
|
+
const [a2, b2, c, d] = this.drawPoints;
|
|
62345
62575
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62346
62576
|
const maxRadius = this.maxRadiusLength();
|
|
62347
62577
|
const radius = this.root.get("radius") * maxRadius;
|
|
@@ -62406,7 +62636,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
62406
62636
|
}
|
|
62407
62637
|
maxRadiusLength() {
|
|
62408
62638
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62409
|
-
const points = this.
|
|
62639
|
+
const points = this.drawPoints;
|
|
62410
62640
|
const topLeft = new this.scope.Point(points[0], points[1]).transform(pointsMatrix);
|
|
62411
62641
|
const topRight = new this.scope.Point(points[2], points[1]).transform(pointsMatrix);
|
|
62412
62642
|
const bottomLeft = new this.scope.Point(points[0], points[3]).transform(pointsMatrix);
|
|
@@ -62431,7 +62661,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
62431
62661
|
name: "rect-radius",
|
|
62432
62662
|
getPosition: () => {
|
|
62433
62663
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62434
|
-
const points = this.
|
|
62664
|
+
const points = this.drawPoints;
|
|
62435
62665
|
const radius = this.root.get("radius") * this.maxRadiusLength();
|
|
62436
62666
|
let c1 = new this.scope.Point(points[0], points[1]).transform(matrix);
|
|
62437
62667
|
const c3 = new this.scope.Point(points[2], points[3]).transform(matrix);
|
|
@@ -62450,7 +62680,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
62450
62680
|
if (!this.item) {
|
|
62451
62681
|
return;
|
|
62452
62682
|
}
|
|
62453
|
-
const points = this.
|
|
62683
|
+
const points = this.drawPoints;
|
|
62454
62684
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62455
62685
|
const maxRadius = Math.min(points[2] - points[0], points[3] - points[1]) / 2;
|
|
62456
62686
|
const trPoint = point.transform(pointsMatrix.inverted());
|
|
@@ -62475,7 +62705,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
62475
62705
|
}
|
|
62476
62706
|
};
|
|
62477
62707
|
var elementsUndoOrigin = "elementsUndoOrigin";
|
|
62478
|
-
var
|
|
62708
|
+
var import_lodash4 = __toESM2(require_lodash(), 1);
|
|
62479
62709
|
function _defineProperty13(e, r, t) {
|
|
62480
62710
|
return (r = _toPropertyKey13(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62481
62711
|
}
|
|
@@ -62494,14 +62724,23 @@ function _toPrimitive13(t, r) {
|
|
|
62494
62724
|
return ("string" === r ? String : Number)(t);
|
|
62495
62725
|
}
|
|
62496
62726
|
var EraserModel = class extends ElementModel {
|
|
62497
|
-
|
|
62498
|
-
|
|
62727
|
+
get drawPoints() {
|
|
62728
|
+
if (this.localPoints.length > 0) {
|
|
62729
|
+
return this.localPoints;
|
|
62730
|
+
}
|
|
62731
|
+
return this.points;
|
|
62732
|
+
}
|
|
62733
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
62734
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62499
62735
|
_defineProperty13(this, "item", null);
|
|
62500
62736
|
_defineProperty13(this, "sliceBegin", 0);
|
|
62501
|
-
|
|
62737
|
+
_defineProperty13(this, "clearLocalPointsWhenYPointsChange", false);
|
|
62738
|
+
_defineProperty13(this, "shouldUseLocalPoints", true);
|
|
62739
|
+
_defineProperty13(this, "localPointsPick", 4);
|
|
62740
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62502
62741
|
this.root.set("type", "eraser");
|
|
62503
62742
|
}
|
|
62504
|
-
if (!this.root.has("points")) {
|
|
62743
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
62505
62744
|
this.root.set("points", new Y9.Array());
|
|
62506
62745
|
}
|
|
62507
62746
|
}
|
|
@@ -62534,7 +62773,7 @@ var EraserModel = class extends ElementModel {
|
|
|
62534
62773
|
return path;
|
|
62535
62774
|
}
|
|
62536
62775
|
parsePoints(points) {
|
|
62537
|
-
const groupPoints = (0,
|
|
62776
|
+
const groupPoints = (0, import_lodash4.chunk)(points, 2);
|
|
62538
62777
|
return ae(groupPoints, {
|
|
62539
62778
|
size: this.strokeWidth,
|
|
62540
62779
|
smoothing: 0.5,
|
|
@@ -62552,7 +62791,7 @@ var EraserModel = class extends ElementModel {
|
|
|
62552
62791
|
});
|
|
62553
62792
|
}
|
|
62554
62793
|
matrixedPoints() {
|
|
62555
|
-
const currentPoints = (0,
|
|
62794
|
+
const currentPoints = (0, import_lodash4.chunk)(this.drawPoints, 2).slice(this.sliceBegin);
|
|
62556
62795
|
return currentPoints.map((_ref) => {
|
|
62557
62796
|
let [x, y] = _ref;
|
|
62558
62797
|
return new this.scope.Point(x, y);
|
|
@@ -62580,11 +62819,11 @@ var EraserModel = class extends ElementModel {
|
|
|
62580
62819
|
this.item.fillColor = new this.scope.Color(this.strokeColor);
|
|
62581
62820
|
this.onVectorUpdate();
|
|
62582
62821
|
this.item.onFrame = () => {
|
|
62583
|
-
if (!this.
|
|
62822
|
+
if (!this.drawPoints) {
|
|
62584
62823
|
return;
|
|
62585
62824
|
}
|
|
62586
|
-
if (this.
|
|
62587
|
-
this.sliceBegin = this.
|
|
62825
|
+
if (this.drawPoints.length / 2 > 50) {
|
|
62826
|
+
this.sliceBegin = this.drawPoints.length / 2 - 50;
|
|
62588
62827
|
}
|
|
62589
62828
|
};
|
|
62590
62829
|
}
|
|
@@ -62615,7 +62854,7 @@ var EraserModel = class extends ElementModel {
|
|
|
62615
62854
|
return point.transform(new this.scope.Matrix(this.pointsMatrix));
|
|
62616
62855
|
}
|
|
62617
62856
|
};
|
|
62618
|
-
var
|
|
62857
|
+
var import_lodash5 = __toESM2(require_lodash(), 1);
|
|
62619
62858
|
function _defineProperty14(e, r, t) {
|
|
62620
62859
|
return (r = _toPropertyKey14(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62621
62860
|
}
|
|
@@ -62634,21 +62873,24 @@ function _toPrimitive14(t, r) {
|
|
|
62634
62873
|
return ("string" === r ? String : Number)(t);
|
|
62635
62874
|
}
|
|
62636
62875
|
var LaserPointerModel = class extends ElementModel {
|
|
62637
|
-
constructor(clientId, root, scope, liveCursor, removeElement) {
|
|
62638
|
-
super(root, scope, liveCursor);
|
|
62876
|
+
constructor(clientId, root, scope, liveCursor, removeElement, isPerformanceMode) {
|
|
62877
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62639
62878
|
_defineProperty14(this, "item", null);
|
|
62640
62879
|
_defineProperty14(this, "clientId", void 0);
|
|
62641
62880
|
_defineProperty14(this, "sliceBegin", 0);
|
|
62642
62881
|
_defineProperty14(this, "displayStrokeWidth", 8);
|
|
62643
62882
|
_defineProperty14(this, "cachedPoints", null);
|
|
62883
|
+
_defineProperty14(this, "clearLocalPointsWhenYPointsChange", false);
|
|
62884
|
+
_defineProperty14(this, "shouldUseLocalPoints", false);
|
|
62885
|
+
_defineProperty14(this, "localPointsPick", 4);
|
|
62644
62886
|
this.clientId = clientId;
|
|
62645
|
-
if (!this.root.has("type")) {
|
|
62887
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62646
62888
|
this.root.set("type", "laser");
|
|
62647
62889
|
}
|
|
62648
|
-
if (!this.root.has("points")) {
|
|
62890
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
62649
62891
|
this.root.set("points", new Y10.Array());
|
|
62650
62892
|
}
|
|
62651
|
-
if (!this.root.has("removed")) {
|
|
62893
|
+
if (this.root.doc && !this.root.has("removed")) {
|
|
62652
62894
|
this.root.set("removed", false);
|
|
62653
62895
|
}
|
|
62654
62896
|
this.root.observe((event) => {
|
|
@@ -62728,7 +62970,8 @@ var LaserPointerModel = class extends ElementModel {
|
|
|
62728
62970
|
matrixedPoints() {
|
|
62729
62971
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62730
62972
|
const points = this.cachedPoints || this.points;
|
|
62731
|
-
|
|
62973
|
+
console.log("[][][] ,", this.points.length, this.cachedPoints?.length, this.localPoints.length);
|
|
62974
|
+
const groupPoints = (0, import_lodash5.chunk)(points, 2).slice(this.sliceBegin);
|
|
62732
62975
|
return groupPoints.map((_ref) => {
|
|
62733
62976
|
let [x, y] = _ref;
|
|
62734
62977
|
return matrix.transform([x, y]);
|
|
@@ -62794,7 +63037,7 @@ var WhiteboardPermissionFlag = function(WhiteboardPermissionFlag2) {
|
|
|
62794
63037
|
WhiteboardPermissionFlag2[WhiteboardPermissionFlag2["all"] = WhiteboardPermissionFlag2.draw | WhiteboardPermissionFlag2.editSelf | WhiteboardPermissionFlag2.editOthers | WhiteboardPermissionFlag2.deleteSelf | WhiteboardPermissionFlag2.deleteOthers | WhiteboardPermissionFlag2.mainView | WhiteboardPermissionFlag2.setOthersView] = "all";
|
|
62795
63038
|
return WhiteboardPermissionFlag2;
|
|
62796
63039
|
}({});
|
|
62797
|
-
var WhiteboardPermissions = class extends
|
|
63040
|
+
var WhiteboardPermissions = class extends import_forge_room6.AbstractApplicationPermissions {
|
|
62798
63041
|
/**
|
|
62799
63042
|
* 解析权限列表组合
|
|
62800
63043
|
* @param {number} value - 权限数字值
|
|
@@ -62804,7 +63047,7 @@ var WhiteboardPermissions = class extends import_forge_room5.AbstractApplication
|
|
|
62804
63047
|
return [WhiteboardPermissionFlag.draw, WhiteboardPermissionFlag.editSelf, WhiteboardPermissionFlag.editOthers, WhiteboardPermissionFlag.deleteSelf, WhiteboardPermissionFlag.deleteOthers, WhiteboardPermissionFlag.mainView, WhiteboardPermissionFlag.setOthersView].filter((v) => (v & value) !== 0);
|
|
62805
63048
|
}
|
|
62806
63049
|
};
|
|
62807
|
-
var
|
|
63050
|
+
var import_lodash6 = __toESM2(require_lodash(), 1);
|
|
62808
63051
|
function _defineProperty15(e, r, t) {
|
|
62809
63052
|
return (r = _toPropertyKey15(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e;
|
|
62810
63053
|
}
|
|
@@ -62823,13 +63066,22 @@ function _toPrimitive15(t, r) {
|
|
|
62823
63066
|
return ("string" === r ? String : Number)(t);
|
|
62824
63067
|
}
|
|
62825
63068
|
var StraightLineModel = class extends ElementModel {
|
|
62826
|
-
|
|
62827
|
-
|
|
63069
|
+
get drawPoints() {
|
|
63070
|
+
if (this.localPoints.length >= 4) {
|
|
63071
|
+
return this.localPoints;
|
|
63072
|
+
}
|
|
63073
|
+
return this.points;
|
|
63074
|
+
}
|
|
63075
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
63076
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62828
63077
|
_defineProperty15(this, "item", null);
|
|
62829
|
-
|
|
63078
|
+
_defineProperty15(this, "clearLocalPointsWhenYPointsChange", true);
|
|
63079
|
+
_defineProperty15(this, "shouldUseLocalPoints", true);
|
|
63080
|
+
_defineProperty15(this, "localPointsPick", 4);
|
|
63081
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62830
63082
|
this.root.set("type", "line");
|
|
62831
63083
|
}
|
|
62832
|
-
if (!this.root.has("points")) {
|
|
63084
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
62833
63085
|
this.root.set("points", new Y11.Array());
|
|
62834
63086
|
}
|
|
62835
63087
|
}
|
|
@@ -62854,7 +63106,7 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62854
63106
|
}
|
|
62855
63107
|
renderLine() {
|
|
62856
63108
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62857
|
-
const papperPoints = (0,
|
|
63109
|
+
const papperPoints = (0, import_lodash6.chunk)(this.drawPoints, 2).map((item) => {
|
|
62858
63110
|
return new this.scope.Point(item[0], item[1]).transform(matrix);
|
|
62859
63111
|
});
|
|
62860
63112
|
const path = new this.scope.Path();
|
|
@@ -62876,7 +63128,7 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62876
63128
|
name: "line-start",
|
|
62877
63129
|
getPosition: () => {
|
|
62878
63130
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62879
|
-
const points = this.
|
|
63131
|
+
const points = this.drawPoints;
|
|
62880
63132
|
const start = new this.scope.Point(points[0], points[1]);
|
|
62881
63133
|
return this.scope.project.view.projectToView(start.transform(matrix));
|
|
62882
63134
|
},
|
|
@@ -62886,14 +63138,15 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62886
63138
|
}
|
|
62887
63139
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62888
63140
|
const trPoint = point.transform(pointsMatrix.inverted());
|
|
62889
|
-
|
|
63141
|
+
const oldPoints = this.drawPoints;
|
|
63142
|
+
this.setPoints([trPoint.x, trPoint.y, oldPoints[2], oldPoints[3]]);
|
|
62890
63143
|
}
|
|
62891
63144
|
});
|
|
62892
63145
|
cfg.controlPoints.push({
|
|
62893
63146
|
name: "line-end",
|
|
62894
63147
|
getPosition: () => {
|
|
62895
63148
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62896
|
-
const points = this.
|
|
63149
|
+
const points = this.drawPoints;
|
|
62897
63150
|
const end = new this.scope.Point(points[2], points[3]);
|
|
62898
63151
|
return this.scope.project.view.projectToView(end.transform(matrix));
|
|
62899
63152
|
},
|
|
@@ -62903,7 +63156,8 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62903
63156
|
}
|
|
62904
63157
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62905
63158
|
const trPoint = point.transform(pointsMatrix.inverted());
|
|
62906
|
-
|
|
63159
|
+
const oldPoints = this.drawPoints;
|
|
63160
|
+
this.setPoints([oldPoints[0], oldPoints[1], trPoint.x, trPoint.y]);
|
|
62907
63161
|
}
|
|
62908
63162
|
});
|
|
62909
63163
|
return cfg;
|
|
@@ -62947,10 +63201,13 @@ var ImageModel = class extends ElementModel {
|
|
|
62947
63201
|
get src() {
|
|
62948
63202
|
return this.root.get("src");
|
|
62949
63203
|
}
|
|
62950
|
-
constructor(root, scope, imageSets, liveCursor) {
|
|
62951
|
-
super(root, scope, liveCursor);
|
|
63204
|
+
constructor(root, scope, imageSets, liveCursor, isPerformanceMode) {
|
|
63205
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62952
63206
|
_defineProperty16(this, "item", null);
|
|
62953
63207
|
_defineProperty16(this, "imageSets", void 0);
|
|
63208
|
+
_defineProperty16(this, "clearLocalPointsWhenYPointsChange", true);
|
|
63209
|
+
_defineProperty16(this, "shouldUseLocalPoints", true);
|
|
63210
|
+
_defineProperty16(this, "localPointsPick", 4);
|
|
62954
63211
|
this.imageSets = imageSets;
|
|
62955
63212
|
if (!this.root.has("type")) {
|
|
62956
63213
|
this.root.set("type", "image");
|
|
@@ -63031,7 +63288,7 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63031
63288
|
get uuid() {
|
|
63032
63289
|
return (0, import_uuid.v4)().replace(/-/g, "");
|
|
63033
63290
|
}
|
|
63034
|
-
constructor(
|
|
63291
|
+
constructor(options) {
|
|
63035
63292
|
super();
|
|
63036
63293
|
_defineProperty17(this, "scope", void 0);
|
|
63037
63294
|
_defineProperty17(this, "toolbarModel", void 0);
|
|
@@ -63044,6 +63301,7 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63044
63301
|
_defineProperty17(this, "shadowEmitter", void 0);
|
|
63045
63302
|
_defineProperty17(this, "imageSets", void 0);
|
|
63046
63303
|
_defineProperty17(this, "liveCursor", void 0);
|
|
63304
|
+
_defineProperty17(this, "isPerformanceMode", void 0);
|
|
63047
63305
|
_defineProperty17(this, "onElementsChange", (event) => {
|
|
63048
63306
|
for (const [key, value] of event.changes.keys.entries()) {
|
|
63049
63307
|
if (value.action === "add") {
|
|
@@ -63062,15 +63320,16 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63062
63320
|
}
|
|
63063
63321
|
}
|
|
63064
63322
|
});
|
|
63065
|
-
this.
|
|
63066
|
-
this.
|
|
63067
|
-
this.
|
|
63068
|
-
this.
|
|
63069
|
-
this.
|
|
63070
|
-
this.
|
|
63071
|
-
this.
|
|
63072
|
-
this.
|
|
63073
|
-
this.
|
|
63323
|
+
this.isPerformanceMode = options.isPerformanceMode;
|
|
63324
|
+
this.liveCursor = options.liveCursor;
|
|
63325
|
+
this.imageSets = options.imageSets;
|
|
63326
|
+
this.hasPermission = options.hasPermission;
|
|
63327
|
+
this.shadowEmitter = options.shadowEmitter;
|
|
63328
|
+
this.layerId = options.layerId;
|
|
63329
|
+
this.userManager = options.userManager;
|
|
63330
|
+
this.elements = options.elements;
|
|
63331
|
+
this.scope = options.scope;
|
|
63332
|
+
this.toolbarModel = options.toolbarModel;
|
|
63074
63333
|
this.elementModels = /* @__PURE__ */ new Map();
|
|
63075
63334
|
for (const key of this.elements.keys()) {
|
|
63076
63335
|
const type = this.elements.get(key)?.get("type");
|
|
@@ -63101,30 +63360,38 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63101
63360
|
convertToModel(yMap) {
|
|
63102
63361
|
const type = yMap.get("type");
|
|
63103
63362
|
let model = null;
|
|
63363
|
+
const uuid = yMap.get(ElementModel.KEYS.uuid);
|
|
63364
|
+
if (uuid) {
|
|
63365
|
+
const existingModel = this.elementModels.get(uuid);
|
|
63366
|
+
if (existingModel) {
|
|
63367
|
+
existingModel.shadowEmitter = this.shadowEmitter;
|
|
63368
|
+
return existingModel;
|
|
63369
|
+
}
|
|
63370
|
+
}
|
|
63104
63371
|
if (type === "curve") {
|
|
63105
|
-
model = new CurveModel(yMap, this.scope, this.liveCursor);
|
|
63372
|
+
model = new CurveModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63106
63373
|
} else if (["ellipse"].indexOf(type) >= 0) {
|
|
63107
|
-
model = new SegmentsModel(yMap, this.scope, type, this.liveCursor);
|
|
63374
|
+
model = new SegmentsModel(yMap, this.scope, type, this.liveCursor, this.isPerformanceMode);
|
|
63108
63375
|
} else if (type === "selector") {
|
|
63109
|
-
model = new SelectorModel(yMap, this.scope, this.liveCursor);
|
|
63376
|
+
model = new SelectorModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63110
63377
|
} else if (type === "arrow") {
|
|
63111
|
-
model = new LineModel(yMap, this.scope, this.liveCursor);
|
|
63378
|
+
model = new LineModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63112
63379
|
} else if (type === "line") {
|
|
63113
|
-
model = new StraightLineModel(yMap, this.scope, this.liveCursor);
|
|
63380
|
+
model = new StraightLineModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63114
63381
|
} else if (type === "point-text") {
|
|
63115
|
-
model = new PointTextModel(yMap, this.scope, this.liveCursor);
|
|
63382
|
+
model = new PointTextModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63116
63383
|
} else if (type === "triangle") {
|
|
63117
|
-
model = new TriangleModel(yMap, this.scope, this.liveCursor);
|
|
63384
|
+
model = new TriangleModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63118
63385
|
} else if (type === "rectangle") {
|
|
63119
|
-
model = new RectangleModel(yMap, this.scope, this.liveCursor);
|
|
63386
|
+
model = new RectangleModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63120
63387
|
} else if (type === "eraser") {
|
|
63121
|
-
model = new EraserModel(yMap, this.scope, this.liveCursor);
|
|
63388
|
+
model = new EraserModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63122
63389
|
} else if (type === "laser") {
|
|
63123
|
-
model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, this.liveCursor, (
|
|
63124
|
-
this.removeElementItem(
|
|
63125
|
-
});
|
|
63390
|
+
model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, this.liveCursor, (uuid2) => {
|
|
63391
|
+
this.removeElementItem(uuid2);
|
|
63392
|
+
}, this.isPerformanceMode);
|
|
63126
63393
|
} else if (type === "image") {
|
|
63127
|
-
model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor);
|
|
63394
|
+
model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor, this.isPerformanceMode);
|
|
63128
63395
|
}
|
|
63129
63396
|
if (model) {
|
|
63130
63397
|
model.shadowEmitter = this.shadowEmitter;
|
|
@@ -63158,7 +63425,7 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63158
63425
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63159
63426
|
this.elements.set(uuid, yMap);
|
|
63160
63427
|
}, elementsUndoOrigin);
|
|
63161
|
-
const model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor);
|
|
63428
|
+
const model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor, this.isPerformanceMode);
|
|
63162
63429
|
model.root.set("src", src);
|
|
63163
63430
|
const initMatrix = new this.scope.Matrix();
|
|
63164
63431
|
const center = this.scope.project.view.center;
|
|
@@ -63175,8 +63442,10 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63175
63442
|
return null;
|
|
63176
63443
|
}
|
|
63177
63444
|
const yMap = new Y12.Map();
|
|
63445
|
+
const uuid = this.uuid;
|
|
63446
|
+
const curveModel = new CurveModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63447
|
+
this.elementModels.set(uuid, curveModel);
|
|
63178
63448
|
this.elements.doc?.transact(() => {
|
|
63179
|
-
const uuid = this.uuid;
|
|
63180
63449
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63181
63450
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63182
63451
|
yMap.set("type", "curve");
|
|
@@ -63189,7 +63458,6 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63189
63458
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63190
63459
|
this.elements.set(uuid, yMap);
|
|
63191
63460
|
}, elementsUndoOrigin);
|
|
63192
|
-
const curveModel = new CurveModel(yMap, this.scope, this.liveCursor);
|
|
63193
63461
|
this.initElement(curveModel);
|
|
63194
63462
|
return curveModel;
|
|
63195
63463
|
}
|
|
@@ -63198,11 +63466,17 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63198
63466
|
return null;
|
|
63199
63467
|
}
|
|
63200
63468
|
const yMap = new Y12.Map();
|
|
63469
|
+
const uuid = this.uuid;
|
|
63470
|
+
const model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, this.liveCursor, (uuid2) => {
|
|
63471
|
+
this.removeElementItem(uuid2);
|
|
63472
|
+
}, this.isPerformanceMode);
|
|
63473
|
+
this.elementModels.set(uuid, model);
|
|
63201
63474
|
this.elements.doc?.transact(() => {
|
|
63202
|
-
const uuid = this.uuid;
|
|
63203
63475
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63204
63476
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63205
63477
|
yMap.set("type", "laser");
|
|
63478
|
+
yMap.set(ElementModel.KEYS.points, new Y12.Array());
|
|
63479
|
+
yMap.set("removed", false);
|
|
63206
63480
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63207
63481
|
yMap.set(ElementModel.KEYS.strokeWidth, 8);
|
|
63208
63482
|
yMap.set(ElementModel.KEYS.strokeColor, "#F44336");
|
|
@@ -63210,9 +63484,7 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63210
63484
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63211
63485
|
this.elements.set(uuid, yMap);
|
|
63212
63486
|
}, elementsUndoOrigin);
|
|
63213
|
-
|
|
63214
|
-
this.removeElementItem(uuid);
|
|
63215
|
-
});
|
|
63487
|
+
this.initElement(model);
|
|
63216
63488
|
return model;
|
|
63217
63489
|
}
|
|
63218
63490
|
createEraser() {
|
|
@@ -63220,11 +63492,14 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63220
63492
|
return null;
|
|
63221
63493
|
}
|
|
63222
63494
|
const yMap = new Y12.Map();
|
|
63495
|
+
const uuid = this.uuid;
|
|
63496
|
+
const model = new EraserModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63497
|
+
this.elementModels.set(uuid, model);
|
|
63223
63498
|
this.elements.doc?.transact(() => {
|
|
63224
|
-
const uuid = this.uuid;
|
|
63225
63499
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63226
63500
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63227
63501
|
yMap.set("type", "eraser");
|
|
63502
|
+
yMap.set(ElementModel.KEYS.points, new Y12.Array());
|
|
63228
63503
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63229
63504
|
yMap.set(ElementModel.KEYS.strokeWidth, 4);
|
|
63230
63505
|
yMap.set(ElementModel.KEYS.strokeColor, "#9E9E9E");
|
|
@@ -63232,7 +63507,6 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63232
63507
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63233
63508
|
this.elements.set(uuid, yMap);
|
|
63234
63509
|
}, elementsUndoOrigin);
|
|
63235
|
-
const model = new EraserModel(yMap, this.scope, this.liveCursor);
|
|
63236
63510
|
return model;
|
|
63237
63511
|
}
|
|
63238
63512
|
createTriangle(shadow) {
|
|
@@ -63240,45 +63514,52 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63240
63514
|
return null;
|
|
63241
63515
|
}
|
|
63242
63516
|
const yMap = new Y12.Map();
|
|
63517
|
+
const uuid = this.uuid;
|
|
63518
|
+
const triangleModel = new TriangleModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63519
|
+
this.elementModels.set(uuid, triangleModel);
|
|
63243
63520
|
this.elements.doc?.transact(() => {
|
|
63244
|
-
const uuid = this.uuid;
|
|
63245
63521
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63246
63522
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63247
63523
|
yMap.set("type", "triangle");
|
|
63248
63524
|
if (shadow) {
|
|
63249
63525
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63250
63526
|
}
|
|
63527
|
+
yMap.set("points", new Y12.Array());
|
|
63251
63528
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63252
63529
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63253
63530
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63254
63531
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63255
63532
|
this.elements.set(uuid, yMap);
|
|
63256
63533
|
}, elementsUndoOrigin);
|
|
63257
|
-
|
|
63258
|
-
this.
|
|
63259
|
-
|
|
63260
|
-
return triangle;
|
|
63534
|
+
this.initElement(triangleModel);
|
|
63535
|
+
triangleModel.dashArray = this.toolbarModel.dashArray;
|
|
63536
|
+
return triangleModel;
|
|
63261
63537
|
}
|
|
63262
63538
|
createRectangle(shadow) {
|
|
63263
63539
|
if (!this.confirmPermission()) {
|
|
63264
63540
|
return null;
|
|
63265
63541
|
}
|
|
63266
63542
|
const yMap = new Y12.Map();
|
|
63543
|
+
const uuid = this.uuid;
|
|
63544
|
+
const rect = new RectangleModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63545
|
+
this.elementModels.set(uuid, rect);
|
|
63267
63546
|
this.elements.doc?.transact(() => {
|
|
63268
|
-
const uuid = this.uuid;
|
|
63269
63547
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63270
63548
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63271
63549
|
yMap.set("type", "rectangle");
|
|
63272
63550
|
if (shadow) {
|
|
63273
63551
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63274
63552
|
}
|
|
63553
|
+
const initPoints = new Y12.Array();
|
|
63554
|
+
initPoints.push([0, 0, 0, 0]);
|
|
63555
|
+
yMap.set("points", initPoints);
|
|
63556
|
+
yMap.set("radius", 0);
|
|
63275
63557
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63276
63558
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63277
63559
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63278
63560
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63279
63561
|
this.elements.set(uuid, yMap);
|
|
63280
63562
|
}, elementsUndoOrigin);
|
|
63281
|
-
const rect = new RectangleModel(yMap, this.scope, this.liveCursor);
|
|
63282
63563
|
this.initElement(rect);
|
|
63283
63564
|
rect.dashArray = this.toolbarModel.dashArray;
|
|
63284
63565
|
return rect;
|
|
@@ -63288,21 +63569,23 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63288
63569
|
return null;
|
|
63289
63570
|
}
|
|
63290
63571
|
const yMap = new Y12.Map();
|
|
63572
|
+
const uuid = this.uuid;
|
|
63573
|
+
const segmentsModel = new SegmentsModel(yMap, this.scope, type, this.liveCursor, this.isPerformanceMode);
|
|
63574
|
+
this.elementModels.set(uuid, segmentsModel);
|
|
63291
63575
|
this.elements.doc?.transact(() => {
|
|
63292
|
-
const uuid = this.uuid;
|
|
63293
63576
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63294
63577
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63295
63578
|
yMap.set("type", type);
|
|
63296
63579
|
if (shadow) {
|
|
63297
63580
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63298
63581
|
}
|
|
63582
|
+
yMap.set(ElementModel.KEYS.points, new Y12.Array());
|
|
63299
63583
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63300
63584
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63301
63585
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63302
63586
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63303
63587
|
this.elements.set(uuid, yMap);
|
|
63304
63588
|
}, elementsUndoOrigin);
|
|
63305
|
-
const segmentsModel = new SegmentsModel(yMap, this.scope, type, this.liveCursor);
|
|
63306
63589
|
this.initElement(segmentsModel);
|
|
63307
63590
|
segmentsModel.dashArray = this.toolbarModel.dashArray;
|
|
63308
63591
|
return segmentsModel;
|
|
@@ -63313,16 +63596,20 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63313
63596
|
return null;
|
|
63314
63597
|
}
|
|
63315
63598
|
const yMap = new Y12.Map();
|
|
63599
|
+
const uuid = this.uuid;
|
|
63600
|
+
const selectorModel = new SelectorModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63601
|
+
this.elementModels.set(uuid, selectorModel);
|
|
63316
63602
|
this.elements.doc?.transact(() => {
|
|
63317
|
-
const uuid = this.uuid;
|
|
63318
63603
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63319
63604
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63320
63605
|
yMap.set("type", "selector");
|
|
63606
|
+
const initPoints = new Y12.Array();
|
|
63607
|
+
initPoints.push([0, 0, 0, 0]);
|
|
63608
|
+
yMap.set(ElementModel.KEYS.points, initPoints);
|
|
63321
63609
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63322
63610
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63323
63611
|
this.elements.set(uuid, yMap);
|
|
63324
63612
|
}, elementsUndoOrigin);
|
|
63325
|
-
const selectorModel = new SelectorModel(yMap, this.scope, this.liveCursor);
|
|
63326
63613
|
selectorModel.shadow = "layer";
|
|
63327
63614
|
return selectorModel;
|
|
63328
63615
|
}
|
|
@@ -63331,21 +63618,23 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63331
63618
|
return null;
|
|
63332
63619
|
}
|
|
63333
63620
|
const yMap = new Y12.Map();
|
|
63621
|
+
const uuid = this.uuid;
|
|
63622
|
+
const straightLineModel = new StraightLineModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63623
|
+
this.elementModels.set(uuid, straightLineModel);
|
|
63334
63624
|
this.elements.doc?.transact(() => {
|
|
63335
|
-
const uuid = this.uuid;
|
|
63336
63625
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63337
63626
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63338
63627
|
yMap.set("type", "line");
|
|
63339
63628
|
if (shadow) {
|
|
63340
63629
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63341
63630
|
}
|
|
63631
|
+
yMap.set("points", new Y12.Array());
|
|
63342
63632
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63343
63633
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63344
63634
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63345
63635
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63346
63636
|
this.elements.set(uuid, yMap);
|
|
63347
63637
|
}, elementsUndoOrigin);
|
|
63348
|
-
const straightLineModel = new StraightLineModel(yMap, this.scope, this.liveCursor);
|
|
63349
63638
|
this.initElement(straightLineModel);
|
|
63350
63639
|
straightLineModel.dashArray = this.toolbarModel.dashArray;
|
|
63351
63640
|
return straightLineModel;
|
|
@@ -63355,21 +63644,25 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63355
63644
|
return null;
|
|
63356
63645
|
}
|
|
63357
63646
|
const yMap = new Y12.Map();
|
|
63647
|
+
const uuid = this.uuid;
|
|
63648
|
+
const lineModel = new LineModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63649
|
+
this.elementModels.set(uuid, lineModel);
|
|
63358
63650
|
this.elements.doc?.transact(() => {
|
|
63359
|
-
const uuid = this.uuid;
|
|
63360
63651
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63361
63652
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63362
63653
|
yMap.set("type", "arrow");
|
|
63363
63654
|
if (shadow) {
|
|
63364
63655
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63365
63656
|
}
|
|
63657
|
+
yMap.set("headArrow", "none");
|
|
63658
|
+
yMap.set("tailArrow", "normal");
|
|
63659
|
+
yMap.set(ElementModel.KEYS.points, new Y12.Array());
|
|
63366
63660
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63367
63661
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63368
63662
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63369
63663
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63370
63664
|
this.elements.set(uuid, yMap);
|
|
63371
63665
|
}, elementsUndoOrigin);
|
|
63372
|
-
const lineModel = new LineModel(yMap, this.scope, this.liveCursor);
|
|
63373
63666
|
this.initElement(lineModel);
|
|
63374
63667
|
lineModel.dashArray = this.toolbarModel.dashArray;
|
|
63375
63668
|
return lineModel;
|
|
@@ -63379,21 +63672,23 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63379
63672
|
return null;
|
|
63380
63673
|
}
|
|
63381
63674
|
const yMap = new Y12.Map();
|
|
63675
|
+
const uuid = this.uuid;
|
|
63676
|
+
const pointTextModel = new PointTextModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63677
|
+
this.elementModels.set(uuid, pointTextModel);
|
|
63382
63678
|
this.elements.doc?.transact(() => {
|
|
63383
|
-
const uuid = this.uuid;
|
|
63384
63679
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63385
63680
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63386
63681
|
yMap.set("type", "point-text");
|
|
63387
63682
|
if (shadow) {
|
|
63388
63683
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63389
63684
|
}
|
|
63685
|
+
yMap.set(ElementModel.KEYS.points, new Y12.Array());
|
|
63390
63686
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63391
63687
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63392
63688
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63393
63689
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63394
63690
|
this.elements.set(uuid, yMap);
|
|
63395
63691
|
}, elementsUndoOrigin);
|
|
63396
|
-
const pointTextModel = new PointTextModel(yMap, this.scope, this.liveCursor);
|
|
63397
63692
|
pointTextModel.setPoints([x, y]);
|
|
63398
63693
|
pointTextModel.fontSize = this.toolbarModel.fontSize;
|
|
63399
63694
|
pointTextModel.fontFamily = this.toolbarModel.fontFamily;
|
|
@@ -63425,7 +63720,7 @@ var RenderableModel = class extends import_eventemitter3.default {
|
|
|
63425
63720
|
});
|
|
63426
63721
|
}
|
|
63427
63722
|
};
|
|
63428
|
-
var
|
|
63723
|
+
var import_lodash7 = __toESM2(require_lodash(), 1);
|
|
63429
63724
|
function Point(x, y) {
|
|
63430
63725
|
this.X = x;
|
|
63431
63726
|
this.Y = y;
|
|
@@ -63668,7 +63963,7 @@ var Recognizer = class {
|
|
|
63668
63963
|
let maxX = -Number.MAX_VALUE;
|
|
63669
63964
|
let minY = Number.MAX_VALUE;
|
|
63670
63965
|
let maxY = -Number.MAX_VALUE;
|
|
63671
|
-
const result = this.dollar.Recognize((0,
|
|
63966
|
+
const result = this.dollar.Recognize((0, import_lodash7.chunk)(points, 3).map((v) => {
|
|
63672
63967
|
minX = Math.min(minX, v[0]);
|
|
63673
63968
|
maxX = Math.max(maxX, v[0]);
|
|
63674
63969
|
minY = Math.min(minY, v[1]);
|
|
@@ -63710,11 +64005,24 @@ var CurveTool = class extends WhiteboardTool {
|
|
|
63710
64005
|
_defineProperty19(this, "elementModel", null);
|
|
63711
64006
|
_defineProperty19(this, "recognizer", new Recognizer());
|
|
63712
64007
|
_defineProperty19(this, "pointCount", 0);
|
|
64008
|
+
_defineProperty19(this, "pendingPoints", []);
|
|
64009
|
+
_defineProperty19(this, "flushRafId", 0);
|
|
63713
64010
|
_defineProperty19(this, "showLiveCursor", true);
|
|
63714
|
-
this
|
|
64011
|
+
_defineProperty19(this, "flushPendingPoints", () => {
|
|
64012
|
+
this.flushRafId = 0;
|
|
64013
|
+
if (this.elementModel && this.pendingPoints.length > 0) {
|
|
64014
|
+
this.elementModel.appendPoints(this.pendingPoints);
|
|
64015
|
+
this.pendingPoints = [];
|
|
64016
|
+
}
|
|
64017
|
+
});
|
|
63715
64018
|
}
|
|
63716
64019
|
onMouseDown(_event) {
|
|
63717
64020
|
this.pointCount = 0;
|
|
64021
|
+
this.pendingPoints = [];
|
|
64022
|
+
if (this.flushRafId) {
|
|
64023
|
+
cancelAnimationFrame(this.flushRafId);
|
|
64024
|
+
this.flushRafId = 0;
|
|
64025
|
+
}
|
|
63718
64026
|
if (this.elementModel) {
|
|
63719
64027
|
this.elementModel.dispose();
|
|
63720
64028
|
}
|
|
@@ -63729,27 +64037,38 @@ var CurveTool = class extends WhiteboardTool {
|
|
|
63729
64037
|
if (this.pointCount > 1024) {
|
|
63730
64038
|
return;
|
|
63731
64039
|
}
|
|
63732
|
-
const MIN_DISTANCE =
|
|
64040
|
+
const MIN_DISTANCE = 2;
|
|
63733
64041
|
if (this.elementModel) {
|
|
63734
|
-
|
|
63735
|
-
let
|
|
63736
|
-
|
|
63737
|
-
|
|
63738
|
-
|
|
63739
|
-
|
|
63740
|
-
|
|
63741
|
-
|
|
63742
|
-
|
|
63743
|
-
|
|
64042
|
+
let lastX = 0;
|
|
64043
|
+
let lastY = 0;
|
|
64044
|
+
if (this.pendingPoints.length >= 3) {
|
|
64045
|
+
lastX = this.pendingPoints[this.pendingPoints.length - 3];
|
|
64046
|
+
lastY = this.pendingPoints[this.pendingPoints.length - 2];
|
|
64047
|
+
} else {
|
|
64048
|
+
const len = this.elementModel.points.length;
|
|
64049
|
+
if (len >= 3) {
|
|
64050
|
+
lastX = this.elementModel.points[len - 3];
|
|
64051
|
+
lastY = this.elementModel.points[len - 2];
|
|
64052
|
+
}
|
|
63744
64053
|
}
|
|
63745
|
-
const dist = Math.max(Math.abs(
|
|
64054
|
+
const dist = Math.max(Math.abs(lastX - event.point.x), Math.abs(lastY - event.point.y));
|
|
63746
64055
|
if (dist >= MIN_DISTANCE) {
|
|
63747
64056
|
this.pointCount += 1;
|
|
63748
|
-
|
|
64057
|
+
const nativeEvent = event.event;
|
|
64058
|
+
const pressure = nativeEvent.pointerType === "pen" && nativeEvent.pressure > 0 ? nativeEvent.pressure : 0;
|
|
64059
|
+
this.pendingPoints.push(event.point.x, event.point.y, pressure);
|
|
64060
|
+
if (!this.flushRafId) {
|
|
64061
|
+
this.flushRafId = requestAnimationFrame(this.flushPendingPoints);
|
|
64062
|
+
}
|
|
63749
64063
|
}
|
|
63750
64064
|
}
|
|
63751
64065
|
}
|
|
63752
64066
|
onMouseUp(event) {
|
|
64067
|
+
if (this.flushRafId) {
|
|
64068
|
+
cancelAnimationFrame(this.flushRafId);
|
|
64069
|
+
this.flushRafId = 0;
|
|
64070
|
+
}
|
|
64071
|
+
this.flushPendingPoints();
|
|
63753
64072
|
this.modelGetter().then((model) => {
|
|
63754
64073
|
if (!model) {
|
|
63755
64074
|
return;
|
|
@@ -63941,7 +64260,7 @@ var ToolbarModel = class extends import_eventemitter32.default {
|
|
|
63941
64260
|
});
|
|
63942
64261
|
}
|
|
63943
64262
|
dispose() {
|
|
63944
|
-
(0,
|
|
64263
|
+
(0, import_forge_room7.removeObserver)(this.root, this.handleRootUpdate);
|
|
63945
64264
|
this.removeAllListeners();
|
|
63946
64265
|
}
|
|
63947
64266
|
};
|
|
@@ -64079,7 +64398,7 @@ var SelectElementsModel = class extends import_eventemitter33.default {
|
|
|
64079
64398
|
}
|
|
64080
64399
|
const cb = this.observers.get(user.id);
|
|
64081
64400
|
if (cb) {
|
|
64082
|
-
(0,
|
|
64401
|
+
(0, import_forge_room8.removeDeepObserver)(this.requestUserMap(user.id), cb);
|
|
64083
64402
|
this.observers.delete(user.id);
|
|
64084
64403
|
}
|
|
64085
64404
|
});
|
|
@@ -64088,7 +64407,7 @@ var SelectElementsModel = class extends import_eventemitter33.default {
|
|
|
64088
64407
|
this.handleUserSelectElementsChange(user.id, evts);
|
|
64089
64408
|
};
|
|
64090
64409
|
if (this.observers.has(user.id)) {
|
|
64091
|
-
(0,
|
|
64410
|
+
(0, import_forge_room8.removeDeepObserver)(this.requestUserMap(user.id), this.observers.get(user.id));
|
|
64092
64411
|
this.observers.delete(user.id);
|
|
64093
64412
|
}
|
|
64094
64413
|
this.requestUserMap(user.id).observeDeep(observer);
|
|
@@ -64111,7 +64430,7 @@ var SelectElementsModel = class extends import_eventemitter33.default {
|
|
|
64111
64430
|
this.handleUserSelectElementsChange(userId, evts);
|
|
64112
64431
|
};
|
|
64113
64432
|
if (this.observers.has(userId)) {
|
|
64114
|
-
(0,
|
|
64433
|
+
(0, import_forge_room8.removeDeepObserver)(this.requestUserMap(userId), this.observers.get(userId));
|
|
64115
64434
|
}
|
|
64116
64435
|
this.requestUserMap(userId).observeDeep(observer);
|
|
64117
64436
|
this.observers.set(userId, observer);
|
|
@@ -64175,7 +64494,7 @@ var SelectElementsModel = class extends import_eventemitter33.default {
|
|
|
64175
64494
|
}
|
|
64176
64495
|
dispose() {
|
|
64177
64496
|
for (const [key, value] of this.observers.entries()) {
|
|
64178
|
-
(0,
|
|
64497
|
+
(0, import_forge_room8.removeDeepObserver)(this.requestUserMap(key), value);
|
|
64179
64498
|
}
|
|
64180
64499
|
this.observers.clear();
|
|
64181
64500
|
this.userManager.off("leave", this.handleUserLeave);
|
|
@@ -65148,14 +65467,14 @@ var Camera = class extends import_eventemitter36.default {
|
|
|
65148
65467
|
}
|
|
65149
65468
|
const cb = this.observers.get(user.id);
|
|
65150
65469
|
if (cb) {
|
|
65151
|
-
(0,
|
|
65470
|
+
(0, import_forge_room9.removeObserver)(this.requestUserMap(user.id), cb);
|
|
65152
65471
|
}
|
|
65153
65472
|
});
|
|
65154
65473
|
_defineProperty28(this, "handleUserJoin", (user) => {
|
|
65155
65474
|
if (this.observers.has(user.id)) {
|
|
65156
65475
|
const cb = this.observers.get(user.id);
|
|
65157
65476
|
if (cb) {
|
|
65158
|
-
(0,
|
|
65477
|
+
(0, import_forge_room9.removeObserver)(this.requestUserMap(user.id), cb);
|
|
65159
65478
|
this.observers.delete(user.id);
|
|
65160
65479
|
}
|
|
65161
65480
|
}
|
|
@@ -65267,7 +65586,7 @@ var Camera = class extends import_eventemitter36.default {
|
|
|
65267
65586
|
this.handleViewMatrixUpdate(userId, evt);
|
|
65268
65587
|
};
|
|
65269
65588
|
if (this.observers.has(userId)) {
|
|
65270
|
-
(0,
|
|
65589
|
+
(0, import_forge_room9.removeObserver)(this.requestUserMap(userId), observer);
|
|
65271
65590
|
}
|
|
65272
65591
|
this.requestUserMap(userId).observe(observer);
|
|
65273
65592
|
this.observers.set(userId, observer);
|
|
@@ -65464,10 +65783,10 @@ var Camera = class extends import_eventemitter36.default {
|
|
|
65464
65783
|
Array.from(this.observers.keys()).forEach((userId) => {
|
|
65465
65784
|
const cb = this.observers.get(userId);
|
|
65466
65785
|
if (cb) {
|
|
65467
|
-
(0,
|
|
65786
|
+
(0, import_forge_room9.removeObserver)(this.requestUserMap(userId), cb);
|
|
65468
65787
|
}
|
|
65469
65788
|
});
|
|
65470
|
-
(0,
|
|
65789
|
+
(0, import_forge_room9.removeObserver)(this.whiteboardAttrsMap, this.handleMainCameraChange);
|
|
65471
65790
|
this.userManager.off("join", this.handleUserJoin);
|
|
65472
65791
|
this.userManager.off("leave", this.handleUserLeave);
|
|
65473
65792
|
this.gesture.removeAllListeners();
|
|
@@ -65631,6 +65950,8 @@ var Whiteboard = class extends import_eventemitter38.default {
|
|
|
65631
65950
|
_defineProperty31(this, "enableCameraBoundaryHighlight", void 0);
|
|
65632
65951
|
_defineProperty31(this, "getElementAttribute", void 0);
|
|
65633
65952
|
_defineProperty31(this, "setElementAttribute", void 0);
|
|
65953
|
+
_defineProperty31(this, "setPerformanceMode", void 0);
|
|
65954
|
+
_defineProperty31(this, "isPerformanceMode", void 0);
|
|
65634
65955
|
_defineProperty31(this, "removeElement", void 0);
|
|
65635
65956
|
_defineProperty31(this, "getCurrentTool", void 0);
|
|
65636
65957
|
_defineProperty31(this, "setCurrentTool", void 0);
|
|
@@ -65781,14 +66102,14 @@ var TrashedElementsModel = class extends import_eventemitter39.default {
|
|
|
65781
66102
|
}
|
|
65782
66103
|
const cb = this.observers.get(user.id);
|
|
65783
66104
|
if (cb) {
|
|
65784
|
-
(0,
|
|
66105
|
+
(0, import_forge_room10.removeDeepObserver)(this.requestUserMap(user.id), cb);
|
|
65785
66106
|
}
|
|
65786
66107
|
});
|
|
65787
66108
|
_defineProperty33(this, "handleUserJoin", (user) => {
|
|
65788
66109
|
if (this.observers.has(user.id)) {
|
|
65789
66110
|
const cb = this.observers.get(user.id);
|
|
65790
66111
|
if (cb) {
|
|
65791
|
-
(0,
|
|
66112
|
+
(0, import_forge_room10.removeDeepObserver)(this.requestUserMap(user.id), cb);
|
|
65792
66113
|
this.observers.delete(user.id);
|
|
65793
66114
|
}
|
|
65794
66115
|
}
|
|
@@ -65796,7 +66117,7 @@ var TrashedElementsModel = class extends import_eventemitter39.default {
|
|
|
65796
66117
|
this.handleUserTrashElementsChange(user.id, evts);
|
|
65797
66118
|
};
|
|
65798
66119
|
if (this.observers.has(user.id)) {
|
|
65799
|
-
(0,
|
|
66120
|
+
(0, import_forge_room10.removeDeepObserver)(this.requestUserMap(user.id), this.observers.get(user.id));
|
|
65800
66121
|
}
|
|
65801
66122
|
this.requestUserMap(user.id).observeDeep(observer);
|
|
65802
66123
|
this.observers.set(user.id, observer);
|
|
@@ -65810,7 +66131,7 @@ var TrashedElementsModel = class extends import_eventemitter39.default {
|
|
|
65810
66131
|
this.handleUserTrashElementsChange(userId, evts);
|
|
65811
66132
|
};
|
|
65812
66133
|
if (this.observers.has(userId)) {
|
|
65813
|
-
(0,
|
|
66134
|
+
(0, import_forge_room10.removeDeepObserver)(this.requestUserMap(userId), userId);
|
|
65814
66135
|
}
|
|
65815
66136
|
this.requestUserMap(userId).observeDeep(observer);
|
|
65816
66137
|
this.observers.set(userId, observer);
|
|
@@ -65872,7 +66193,7 @@ var TrashedElementsModel = class extends import_eventemitter39.default {
|
|
|
65872
66193
|
}
|
|
65873
66194
|
dispose() {
|
|
65874
66195
|
for (const [key, value] of this.observers.entries()) {
|
|
65875
|
-
(0,
|
|
66196
|
+
(0, import_forge_room10.removeDeepObserver)(this.requestUserMap(key), value);
|
|
65876
66197
|
}
|
|
65877
66198
|
this.observers.clear();
|
|
65878
66199
|
this.userManager.off("leave", this.handleUserLeave);
|
|
@@ -65920,9 +66241,24 @@ var LaserPointerTool = class extends WhiteboardTool {
|
|
|
65920
66241
|
if (this.pointCount > 1024) {
|
|
65921
66242
|
return;
|
|
65922
66243
|
}
|
|
66244
|
+
const MIN_DISTANCE = 4;
|
|
65923
66245
|
if (this.elementModel) {
|
|
65924
|
-
this.
|
|
65925
|
-
|
|
66246
|
+
const len = this.elementModel.points.length;
|
|
66247
|
+
let last = {
|
|
66248
|
+
x: 0,
|
|
66249
|
+
y: 0
|
|
66250
|
+
};
|
|
66251
|
+
if (len >= 2) {
|
|
66252
|
+
last = {
|
|
66253
|
+
x: this.elementModel.points[len - 2],
|
|
66254
|
+
y: this.elementModel.points[len - 1]
|
|
66255
|
+
};
|
|
66256
|
+
}
|
|
66257
|
+
const dist = Math.max(Math.abs(last.x - event.point.x), Math.abs(last.y - event.point.y));
|
|
66258
|
+
if (dist >= MIN_DISTANCE) {
|
|
66259
|
+
this.pointCount += 1;
|
|
66260
|
+
this.elementModel.appendPoints([Math.round(event.point.x), Math.round(event.point.y)]);
|
|
66261
|
+
}
|
|
65926
66262
|
}
|
|
65927
66263
|
}
|
|
65928
66264
|
onMouseUp(_event) {
|
|
@@ -65963,7 +66299,7 @@ var PageModel = class extends import_eventemitter310.default {
|
|
|
65963
66299
|
}
|
|
65964
66300
|
const cb = this.observers.get(user.id);
|
|
65965
66301
|
if (cb) {
|
|
65966
|
-
(0,
|
|
66302
|
+
(0, import_forge_room11.removeObserver)(this.requestUserMap(user.id), cb);
|
|
65967
66303
|
}
|
|
65968
66304
|
});
|
|
65969
66305
|
_defineProperty35(this, "handleUserJoin", (user) => {
|
|
@@ -65977,7 +66313,7 @@ var PageModel = class extends import_eventemitter310.default {
|
|
|
65977
66313
|
if (cameraMode === "main") {
|
|
65978
66314
|
const targetPage = this.whiteboardAttrsMap.get(WhiteboardKeys.currentPage);
|
|
65979
66315
|
if (!this.pageMap.has(targetPage) && targetPage !== "_i_") {
|
|
65980
|
-
(0,
|
|
66316
|
+
(0, import_forge_room11.log)(`main page {${targetPage}} not found.`, {}, "error");
|
|
65981
66317
|
return;
|
|
65982
66318
|
}
|
|
65983
66319
|
this.requestUserMap(this.userManager.selfId).set(WhiteboardKeys.currentPage, targetPage);
|
|
@@ -66024,7 +66360,7 @@ var PageModel = class extends import_eventemitter310.default {
|
|
|
66024
66360
|
if (this.observers.has(userId)) {
|
|
66025
66361
|
const cb = this.observers.get(userId);
|
|
66026
66362
|
if (cb) {
|
|
66027
|
-
(0,
|
|
66363
|
+
(0, import_forge_room11.removeObserver)(this.requestUserMap(userId), cb);
|
|
66028
66364
|
this.observers.delete(userId);
|
|
66029
66365
|
}
|
|
66030
66366
|
}
|
|
@@ -66113,12 +66449,12 @@ var PageModel = class extends import_eventemitter310.default {
|
|
|
66113
66449
|
dispose() {
|
|
66114
66450
|
for (const entry of this.observers.entries()) {
|
|
66115
66451
|
const [userId, observer] = entry;
|
|
66116
|
-
(0,
|
|
66452
|
+
(0, import_forge_room11.removeObserver)(this.requestUserMap(userId), observer);
|
|
66117
66453
|
}
|
|
66118
66454
|
this.userManager.off("join", this.handleUserJoin);
|
|
66119
66455
|
this.userManager.off("leave", this.handleUserLeave);
|
|
66120
|
-
(0,
|
|
66121
|
-
(0,
|
|
66456
|
+
(0, import_forge_room11.removeObserver)(this.whiteboardAttrsMap, this.handleMainPageChange);
|
|
66457
|
+
(0, import_forge_room11.removeObserver)(this.pageMap, this.handlePageMapChange);
|
|
66122
66458
|
}
|
|
66123
66459
|
};
|
|
66124
66460
|
var delay = (value) => new Promise((resolve) => setTimeout(resolve, value));
|
|
@@ -66154,7 +66490,7 @@ var IndexedNavigation = class extends import_eventemitter311.default {
|
|
|
66154
66490
|
return this.list[key] && this.list[key].prev === "";
|
|
66155
66491
|
});
|
|
66156
66492
|
if (!headId) {
|
|
66157
|
-
(0,
|
|
66493
|
+
(0, import_forge_room12.log)("indexed navigation confusion", {
|
|
66158
66494
|
list: JSON.stringify(this.list)
|
|
66159
66495
|
}, "error");
|
|
66160
66496
|
throw new Error("indexed navigation confusion");
|
|
@@ -66470,7 +66806,7 @@ var IndexedNavigation = class extends import_eventemitter311.default {
|
|
|
66470
66806
|
}
|
|
66471
66807
|
}
|
|
66472
66808
|
dispose() {
|
|
66473
|
-
(0,
|
|
66809
|
+
(0, import_forge_room13.removeObserver)(this.indexedPageMap, this.handleIndexedPageMapUpdate);
|
|
66474
66810
|
this.pageModel.off("switchPage");
|
|
66475
66811
|
this.pageModel.off("pagesChange");
|
|
66476
66812
|
}
|
|
@@ -66881,6 +67217,7 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
66881
67217
|
_defineProperty43(this, "permissions", void 0);
|
|
66882
67218
|
_defineProperty43(this, "inputType", "any");
|
|
66883
67219
|
_defineProperty43(this, "isPenEvent", false);
|
|
67220
|
+
_defineProperty43(this, "activePenPointerId", null);
|
|
66884
67221
|
_defineProperty43(this, "hasPenInput", null);
|
|
66885
67222
|
_defineProperty43(this, "disableViewModelUpdate", false);
|
|
66886
67223
|
_defineProperty43(this, "internalResizeObserver", true);
|
|
@@ -66997,6 +67334,9 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
66997
67334
|
_defineProperty43(this, "hasPermission", (flag) => {
|
|
66998
67335
|
return this.permissions.hasPermission(flag, this.userId);
|
|
66999
67336
|
});
|
|
67337
|
+
_defineProperty43(this, "isPerformanceMode", () => {
|
|
67338
|
+
return this.option.performance ?? false;
|
|
67339
|
+
});
|
|
67000
67340
|
_defineProperty43(this, "handleStackItemAdded", () => {
|
|
67001
67341
|
this.selectElementsModel.clearSelectElementForSelf();
|
|
67002
67342
|
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
@@ -67011,7 +67351,18 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67011
67351
|
const id = ids[i];
|
|
67012
67352
|
if (!this.layers.has(id)) {
|
|
67013
67353
|
const elementsMap = this.getMap(`layer/${id}/elements`);
|
|
67014
|
-
const renderableModel = new RenderableModel(
|
|
67354
|
+
const renderableModel = new RenderableModel({
|
|
67355
|
+
layerId: id,
|
|
67356
|
+
shadowEmitter: this.shadowEmitter,
|
|
67357
|
+
elements: elementsMap,
|
|
67358
|
+
scope: this.paperScope,
|
|
67359
|
+
toolbarModel: this.toolbarModel,
|
|
67360
|
+
userManager: this.userManager,
|
|
67361
|
+
imageSets: this.imageSets,
|
|
67362
|
+
liveCursor: this.liveCursor,
|
|
67363
|
+
hasPermission: this.hasPermission,
|
|
67364
|
+
isPerformanceMode: this.isPerformanceMode
|
|
67365
|
+
});
|
|
67015
67366
|
this.layers.set(id, renderableModel);
|
|
67016
67367
|
}
|
|
67017
67368
|
if (!this.undoManagers.has(id)) {
|
|
@@ -67195,11 +67546,34 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67195
67546
|
this.imageSets.setAttribute("data-image-sets", "");
|
|
67196
67547
|
this.rootElement.appendChild(this.imageSets);
|
|
67197
67548
|
document.body.addEventListener("pointerdown", (evt) => {
|
|
67198
|
-
|
|
67199
|
-
|
|
67200
|
-
this.
|
|
67201
|
-
this.
|
|
67202
|
-
|
|
67549
|
+
if (evt.pointerType === "pen") {
|
|
67550
|
+
this.isPenEvent = true;
|
|
67551
|
+
this.activePenPointerId = evt.pointerId;
|
|
67552
|
+
if (this.hasPenInput === null) {
|
|
67553
|
+
this.hasPenInput = true;
|
|
67554
|
+
this.inputType = "pen";
|
|
67555
|
+
this.emitter.emit("inputTypeChange", this.inputType);
|
|
67556
|
+
}
|
|
67557
|
+
} else {
|
|
67558
|
+
if (this.activePenPointerId === null) {
|
|
67559
|
+
this.isPenEvent = false;
|
|
67560
|
+
}
|
|
67561
|
+
}
|
|
67562
|
+
}, {
|
|
67563
|
+
capture: true
|
|
67564
|
+
});
|
|
67565
|
+
document.body.addEventListener("pointerup", (evt) => {
|
|
67566
|
+
if (evt.pointerId === this.activePenPointerId) {
|
|
67567
|
+
this.activePenPointerId = null;
|
|
67568
|
+
this.isPenEvent = false;
|
|
67569
|
+
}
|
|
67570
|
+
}, {
|
|
67571
|
+
capture: true
|
|
67572
|
+
});
|
|
67573
|
+
document.body.addEventListener("pointercancel", (evt) => {
|
|
67574
|
+
if (evt.pointerId === this.activePenPointerId) {
|
|
67575
|
+
this.activePenPointerId = null;
|
|
67576
|
+
this.isPenEvent = false;
|
|
67203
67577
|
}
|
|
67204
67578
|
}, {
|
|
67205
67579
|
capture: true
|
|
@@ -67278,6 +67652,12 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67278
67652
|
this.camera.resetViewMatrixToFlow(flowId);
|
|
67279
67653
|
}
|
|
67280
67654
|
};
|
|
67655
|
+
this.emitter.setPerformanceMode = (enabled) => {
|
|
67656
|
+
this.option.performance = enabled;
|
|
67657
|
+
};
|
|
67658
|
+
this.emitter.isPerformanceMode = () => {
|
|
67659
|
+
return this.isPerformanceMode();
|
|
67660
|
+
};
|
|
67281
67661
|
this.emitter.setViewModeToMain = (userId) => {
|
|
67282
67662
|
if (that.disableViewModelUpdate) {
|
|
67283
67663
|
console.warn("Operation failed. Perspective mode switching is disabled in the current environment.");
|
|
@@ -67332,7 +67712,18 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67332
67712
|
const source = this.getMap(`layer/${sourceId}/elements`);
|
|
67333
67713
|
const target = this.getMap(`layer/${targetId}/elements`);
|
|
67334
67714
|
if (!this.layers.has(targetId)) {
|
|
67335
|
-
this.layers.set(targetId, new RenderableModel(
|
|
67715
|
+
this.layers.set(targetId, new RenderableModel({
|
|
67716
|
+
layerId: targetId,
|
|
67717
|
+
shadowEmitter: this.shadowEmitter,
|
|
67718
|
+
elements: target,
|
|
67719
|
+
scope: this.paperScope,
|
|
67720
|
+
toolbarModel: this.toolbarModel,
|
|
67721
|
+
userManager: this.userManager,
|
|
67722
|
+
imageSets: this.imageSets,
|
|
67723
|
+
liveCursor: this.liveCursor,
|
|
67724
|
+
hasPermission: this.hasPermission,
|
|
67725
|
+
isPerformanceMode: this.isPerformanceMode
|
|
67726
|
+
}));
|
|
67336
67727
|
}
|
|
67337
67728
|
if (!this.undoManagers.has(targetId)) {
|
|
67338
67729
|
const undoManager = new Y15.UndoManager(target, {
|
|
@@ -67567,6 +67958,11 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67567
67958
|
this.editors.forEach((editor) => {
|
|
67568
67959
|
editor.updateBounds();
|
|
67569
67960
|
});
|
|
67961
|
+
const area = this.paperScope.project.view.size.width * this.paperScope.project.view.size.height;
|
|
67962
|
+
const minDistance = Math.ceil(area / 4e5);
|
|
67963
|
+
Object.keys(this.tools).forEach((key) => {
|
|
67964
|
+
this.tools[key].tool.minDistance = minDistance;
|
|
67965
|
+
});
|
|
67570
67966
|
});
|
|
67571
67967
|
this.camera.on("userPageChange", (userId, pageId) => {
|
|
67572
67968
|
this.emitter.emit("activePageChange", userId, pageId);
|
|
@@ -67915,7 +68311,7 @@ var WhiteboardApplication = class _WhiteboardApplication extends import_forge_ro
|
|
|
67915
68311
|
this.toolbarModel.dispose();
|
|
67916
68312
|
this.emitter.indexedNavigation.dispose();
|
|
67917
68313
|
this.permissions.dispose();
|
|
67918
|
-
(0,
|
|
68314
|
+
(0, import_forge_room14.removeObserver)(this.userMap(this.userId), this.handleSyncedWhiteboardStatusChange);
|
|
67919
68315
|
(0, import_forge_room.log)(`whiteboard ${this.appId} disposed. instance count: ${_WhiteboardApplication.instanceCount.get(this.appId) ?? 0}`, {}, "info");
|
|
67920
68316
|
}
|
|
67921
68317
|
};
|
|
@@ -67924,7 +68320,7 @@ _defineProperty43(WhiteboardApplication, "applicationName", WHITEBOARD_APP_NAME)
|
|
|
67924
68320
|
|
|
67925
68321
|
// src/SlideApplication.ts
|
|
67926
68322
|
var import_slide = __toESM(require_Slide());
|
|
67927
|
-
var
|
|
68323
|
+
var import_forge_room17 = require("@netless/forge-room");
|
|
67928
68324
|
|
|
67929
68325
|
// src/Slide.ts
|
|
67930
68326
|
var import_eventemitter313 = __toESM(require("eventemitter3"));
|
|
@@ -67995,7 +68391,7 @@ var SlideForge = class extends import_eventemitter313.default {
|
|
|
67995
68391
|
};
|
|
67996
68392
|
|
|
67997
68393
|
// src/ForgeSlidePermession.ts
|
|
67998
|
-
var
|
|
68394
|
+
var import_forge_room15 = require("@netless/forge-room");
|
|
67999
68395
|
var ForgeSlidePermissionFlag = /* @__PURE__ */ ((ForgeSlidePermissionFlag2) => {
|
|
68000
68396
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["none"] = 0] = "none";
|
|
68001
68397
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["changeStep"] = 1] = "changeStep";
|
|
@@ -68004,7 +68400,7 @@ var ForgeSlidePermissionFlag = /* @__PURE__ */ ((ForgeSlidePermissionFlag2) => {
|
|
|
68004
68400
|
ForgeSlidePermissionFlag2[ForgeSlidePermissionFlag2["all"] = 7] = "all";
|
|
68005
68401
|
return ForgeSlidePermissionFlag2;
|
|
68006
68402
|
})(ForgeSlidePermissionFlag || {});
|
|
68007
|
-
var ForgeSlidePermissions = class extends
|
|
68403
|
+
var ForgeSlidePermissions = class extends import_forge_room15.AbstractApplicationPermissions {
|
|
68008
68404
|
/**
|
|
68009
68405
|
* 解析权限列表组合
|
|
68010
68406
|
* @param {number} value - 权限数字值
|
|
@@ -68181,7 +68577,7 @@ var FooterView = class extends import_eventemitter314.default {
|
|
|
68181
68577
|
|
|
68182
68578
|
// src/SiderBarView.ts
|
|
68183
68579
|
var import_eventemitter315 = __toESM(require("eventemitter3"));
|
|
68184
|
-
var
|
|
68580
|
+
var import_forge_room16 = require("@netless/forge-room");
|
|
68185
68581
|
var SideBarView = class extends import_eventemitter315.default {
|
|
68186
68582
|
root = document.createElement("div");
|
|
68187
68583
|
isShow = false;
|
|
@@ -68266,13 +68662,13 @@ var SideBarView = class extends import_eventemitter315.default {
|
|
|
68266
68662
|
pageIndexContainer.style.color = "#5f5f5f";
|
|
68267
68663
|
const previewUrl = `${this.prefix}/${this.taskId}/preview/${pageIndex}.png`;
|
|
68268
68664
|
const preview = document.createElement("img");
|
|
68269
|
-
const cachePreview = await
|
|
68665
|
+
const cachePreview = await import_forge_room16.kvStore.getItem(previewUrl);
|
|
68270
68666
|
if (cachePreview) {
|
|
68271
68667
|
const { src } = JSON.parse(cachePreview);
|
|
68272
68668
|
preview.src = src;
|
|
68273
68669
|
} else {
|
|
68274
68670
|
const previewInfo = await this.getPreviewImage(previewUrl);
|
|
68275
|
-
await
|
|
68671
|
+
await import_forge_room16.kvStore.setItem(previewUrl, JSON.stringify(previewInfo));
|
|
68276
68672
|
const { src } = previewInfo;
|
|
68277
68673
|
preview.src = src;
|
|
68278
68674
|
}
|
|
@@ -68477,7 +68873,7 @@ var slidePool = new SlidePool();
|
|
|
68477
68873
|
|
|
68478
68874
|
// src/SlideApplication.ts
|
|
68479
68875
|
var Slide_APP_NAME = "forge_slide";
|
|
68480
|
-
var SlideApplication = class _SlideApplication extends
|
|
68876
|
+
var SlideApplication = class _SlideApplication extends import_forge_room17.AbstractApplication {
|
|
68481
68877
|
static applicationName = Slide_APP_NAME;
|
|
68482
68878
|
static slidePool = new SlidePool();
|
|
68483
68879
|
name = Slide_APP_NAME;
|
|
@@ -68696,7 +69092,7 @@ var SlideApplication = class _SlideApplication extends import_forge_room16.Abstr
|
|
|
68696
69092
|
const imageUrl = this.getPreviewImageUrl(pageIndex);
|
|
68697
69093
|
let preview = null;
|
|
68698
69094
|
try {
|
|
68699
|
-
const result = await
|
|
69095
|
+
const result = await import_forge_room17.kvStore.getItem(imageUrl);
|
|
68700
69096
|
preview = result ? JSON.parse(result) : null;
|
|
68701
69097
|
} catch (e) {
|
|
68702
69098
|
console.warn("kvStore getItem error", e);
|
|
@@ -68705,14 +69101,14 @@ var SlideApplication = class _SlideApplication extends import_forge_room16.Abstr
|
|
|
68705
69101
|
return { width: preview.width, height: preview.height };
|
|
68706
69102
|
}
|
|
68707
69103
|
preview = await this.sideBar.getPreviewImage(imageUrl);
|
|
68708
|
-
await
|
|
69104
|
+
await import_forge_room17.kvStore.setItem(imageUrl, JSON.stringify(preview));
|
|
68709
69105
|
return { width: preview.width, height: preview.height };
|
|
68710
69106
|
}
|
|
68711
69107
|
async getImageContent(pageIndex) {
|
|
68712
69108
|
const imageUrl = this.getPreviewImageUrl(pageIndex);
|
|
68713
69109
|
let preview = null;
|
|
68714
69110
|
try {
|
|
68715
|
-
const result = await
|
|
69111
|
+
const result = await import_forge_room17.kvStore.getItem(imageUrl);
|
|
68716
69112
|
preview = result ? JSON.parse(result) : null;
|
|
68717
69113
|
} catch (e) {
|
|
68718
69114
|
console.warn("kvStore getItem error", e);
|
|
@@ -68721,7 +69117,7 @@ var SlideApplication = class _SlideApplication extends import_forge_room16.Abstr
|
|
|
68721
69117
|
return preview.src;
|
|
68722
69118
|
}
|
|
68723
69119
|
preview = await this.sideBar.getPreviewImage(imageUrl);
|
|
68724
|
-
await
|
|
69120
|
+
await import_forge_room17.kvStore.setItem(imageUrl, JSON.stringify(preview));
|
|
68725
69121
|
return preview.src;
|
|
68726
69122
|
}
|
|
68727
69123
|
applySlideState = async () => {
|