@netless/forge-slide 1.1.0 → 1.1.1
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 +458 -167
- package/dist/slide.esm.js.map +3 -3
- package/dist/slide.js +458 -167
- package/dist/slide.js.map +3 -3
- package/package.json +3 -3
package/dist/slide.esm.js
CHANGED
|
@@ -56165,8 +56165,8 @@ var require_lodash = __commonJS2({
|
|
|
56165
56165
|
}
|
|
56166
56166
|
var runInContext = function runInContext2(context) {
|
|
56167
56167
|
context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
|
|
56168
|
-
var
|
|
56169
|
-
var arrayProto =
|
|
56168
|
+
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;
|
|
56169
|
+
var arrayProto = Array14.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
|
|
56170
56170
|
var coreJsData = context["__core-js_shared__"];
|
|
56171
56171
|
var funcToString = funcProto.toString;
|
|
56172
56172
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
@@ -56589,7 +56589,7 @@ var require_lodash = __commonJS2({
|
|
|
56589
56589
|
}
|
|
56590
56590
|
}
|
|
56591
56591
|
function baseAt(object, paths) {
|
|
56592
|
-
var index = -1, length = paths.length, result2 =
|
|
56592
|
+
var index = -1, length = paths.length, result2 = Array14(length), skip = object == null;
|
|
56593
56593
|
while (++index < length) {
|
|
56594
56594
|
result2[index] = skip ? undefined2 : get(object, paths[index]);
|
|
56595
56595
|
}
|
|
@@ -56835,7 +56835,7 @@ var require_lodash = __commonJS2({
|
|
|
56835
56835
|
return number >= nativeMin(start, end) && number < nativeMax(start, end);
|
|
56836
56836
|
}
|
|
56837
56837
|
function baseIntersection(arrays, iteratee2, comparator) {
|
|
56838
|
-
var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches =
|
|
56838
|
+
var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array14(othLength), maxLength = Infinity, result2 = [];
|
|
56839
56839
|
while (othIndex--) {
|
|
56840
56840
|
var array = arrays[othIndex];
|
|
56841
56841
|
if (othIndex && iteratee2) {
|
|
@@ -57016,7 +57016,7 @@ var require_lodash = __commonJS2({
|
|
|
57016
57016
|
return value < other;
|
|
57017
57017
|
}
|
|
57018
57018
|
function baseMap(collection, iteratee2) {
|
|
57019
|
-
var index = -1, result2 = isArrayLike(collection) ?
|
|
57019
|
+
var index = -1, result2 = isArrayLike(collection) ? Array14(collection.length) : [];
|
|
57020
57020
|
baseEach(collection, function(value, key, collection2) {
|
|
57021
57021
|
result2[++index] = iteratee2(value, key, collection2);
|
|
57022
57022
|
});
|
|
@@ -57191,7 +57191,7 @@ var require_lodash = __commonJS2({
|
|
|
57191
57191
|
return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
|
|
57192
57192
|
}
|
|
57193
57193
|
function baseRange(start, end, step, fromRight) {
|
|
57194
|
-
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 =
|
|
57194
|
+
var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result2 = Array14(length);
|
|
57195
57195
|
while (length--) {
|
|
57196
57196
|
result2[fromRight ? length : ++index] = start;
|
|
57197
57197
|
start += step;
|
|
@@ -57273,7 +57273,7 @@ var require_lodash = __commonJS2({
|
|
|
57273
57273
|
}
|
|
57274
57274
|
length = start > end ? 0 : end - start >>> 0;
|
|
57275
57275
|
start >>>= 0;
|
|
57276
|
-
var result2 =
|
|
57276
|
+
var result2 = Array14(length);
|
|
57277
57277
|
while (++index < length) {
|
|
57278
57278
|
result2[index] = array[index + start];
|
|
57279
57279
|
}
|
|
@@ -57433,7 +57433,7 @@ var require_lodash = __commonJS2({
|
|
|
57433
57433
|
if (length < 2) {
|
|
57434
57434
|
return length ? baseUniq(arrays[0]) : [];
|
|
57435
57435
|
}
|
|
57436
|
-
var index = -1, result2 =
|
|
57436
|
+
var index = -1, result2 = Array14(length);
|
|
57437
57437
|
while (++index < length) {
|
|
57438
57438
|
var array = arrays[index], othIndex = -1;
|
|
57439
57439
|
while (++othIndex < length) {
|
|
@@ -57530,7 +57530,7 @@ var require_lodash = __commonJS2({
|
|
|
57530
57530
|
return object.index - other.index;
|
|
57531
57531
|
}
|
|
57532
57532
|
function composeArgs(args, partials, holders, isCurried) {
|
|
57533
|
-
var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 =
|
|
57533
|
+
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;
|
|
57534
57534
|
while (++leftIndex < leftLength) {
|
|
57535
57535
|
result2[leftIndex] = partials[leftIndex];
|
|
57536
57536
|
}
|
|
@@ -57545,7 +57545,7 @@ var require_lodash = __commonJS2({
|
|
|
57545
57545
|
return result2;
|
|
57546
57546
|
}
|
|
57547
57547
|
function composeArgsRight(args, partials, holders, isCurried) {
|
|
57548
|
-
var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result2 =
|
|
57548
|
+
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;
|
|
57549
57549
|
while (++argsIndex < rangeLength) {
|
|
57550
57550
|
result2[argsIndex] = args[argsIndex];
|
|
57551
57551
|
}
|
|
@@ -57562,7 +57562,7 @@ var require_lodash = __commonJS2({
|
|
|
57562
57562
|
}
|
|
57563
57563
|
function copyArray(source, array) {
|
|
57564
57564
|
var index = -1, length = source.length;
|
|
57565
|
-
array || (array =
|
|
57565
|
+
array || (array = Array14(length));
|
|
57566
57566
|
while (++index < length) {
|
|
57567
57567
|
array[index] = source[index];
|
|
57568
57568
|
}
|
|
@@ -57695,7 +57695,7 @@ var require_lodash = __commonJS2({
|
|
|
57695
57695
|
function createCurry(func, bitmask, arity) {
|
|
57696
57696
|
var Ctor = createCtor(func);
|
|
57697
57697
|
function wrapper() {
|
|
57698
|
-
var length = arguments.length, args =
|
|
57698
|
+
var length = arguments.length, args = Array14(length), index = length, placeholder = getHolder(wrapper);
|
|
57699
57699
|
while (index--) {
|
|
57700
57700
|
args[index] = arguments[index];
|
|
57701
57701
|
}
|
|
@@ -57775,7 +57775,7 @@ var require_lodash = __commonJS2({
|
|
|
57775
57775
|
function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
|
|
57776
57776
|
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);
|
|
57777
57777
|
function wrapper() {
|
|
57778
|
-
var length = arguments.length, args =
|
|
57778
|
+
var length = arguments.length, args = Array14(length), index = length;
|
|
57779
57779
|
while (index--) {
|
|
57780
57780
|
args[index] = arguments[index];
|
|
57781
57781
|
}
|
|
@@ -57874,7 +57874,7 @@ var require_lodash = __commonJS2({
|
|
|
57874
57874
|
function createPartial(func, bitmask, thisArg, partials) {
|
|
57875
57875
|
var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
|
|
57876
57876
|
function wrapper() {
|
|
57877
|
-
var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args =
|
|
57877
|
+
var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array14(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
|
|
57878
57878
|
while (++leftIndex < leftLength) {
|
|
57879
57879
|
args[leftIndex] = partials[leftIndex];
|
|
57880
57880
|
}
|
|
@@ -58487,12 +58487,12 @@ var require_lodash = __commonJS2({
|
|
|
58487
58487
|
function overRest(func, start, transform2) {
|
|
58488
58488
|
start = nativeMax(start === undefined2 ? func.length - 1 : start, 0);
|
|
58489
58489
|
return function() {
|
|
58490
|
-
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array =
|
|
58490
|
+
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array14(length);
|
|
58491
58491
|
while (++index < length) {
|
|
58492
58492
|
array[index] = args[start + index];
|
|
58493
58493
|
}
|
|
58494
58494
|
index = -1;
|
|
58495
|
-
var otherArgs =
|
|
58495
|
+
var otherArgs = Array14(start + 1);
|
|
58496
58496
|
while (++index < start) {
|
|
58497
58497
|
otherArgs[index] = args[index];
|
|
58498
58498
|
}
|
|
@@ -58614,7 +58614,7 @@ var require_lodash = __commonJS2({
|
|
|
58614
58614
|
if (!length || size2 < 1) {
|
|
58615
58615
|
return [];
|
|
58616
58616
|
}
|
|
58617
|
-
var index = 0, resIndex = 0, result2 =
|
|
58617
|
+
var index = 0, resIndex = 0, result2 = Array14(nativeCeil(length / size2));
|
|
58618
58618
|
while (index < length) {
|
|
58619
58619
|
result2[resIndex++] = baseSlice(array, index, index += size2);
|
|
58620
58620
|
}
|
|
@@ -58635,7 +58635,7 @@ var require_lodash = __commonJS2({
|
|
|
58635
58635
|
if (!length) {
|
|
58636
58636
|
return [];
|
|
58637
58637
|
}
|
|
58638
|
-
var args =
|
|
58638
|
+
var args = Array14(length - 1), array = arguments[0], index = length;
|
|
58639
58639
|
while (index--) {
|
|
58640
58640
|
args[index - 1] = arguments[index];
|
|
58641
58641
|
}
|
|
@@ -59137,7 +59137,7 @@ var require_lodash = __commonJS2({
|
|
|
59137
59137
|
return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
|
|
59138
59138
|
}
|
|
59139
59139
|
var invokeMap = baseRest(function(collection, path, args) {
|
|
59140
|
-
var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ?
|
|
59140
|
+
var index = -1, isFunc = typeof path == "function", result2 = isArrayLike(collection) ? Array14(collection.length) : [];
|
|
59141
59141
|
baseEach(collection, function(value) {
|
|
59142
59142
|
result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
|
|
59143
59143
|
});
|
|
@@ -59520,7 +59520,7 @@ var require_lodash = __commonJS2({
|
|
|
59520
59520
|
}()) ? baseIsArguments : function(value) {
|
|
59521
59521
|
return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
|
|
59522
59522
|
};
|
|
59523
|
-
var isArray =
|
|
59523
|
+
var isArray = Array14.isArray;
|
|
59524
59524
|
var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
|
|
59525
59525
|
function isArrayLike(value) {
|
|
59526
59526
|
return value != null && isLength(value.length) && !isFunction(value);
|
|
@@ -61185,12 +61185,23 @@ var ElementModel = class _ElementModel {
|
|
|
61185
61185
|
set shadow(value) {
|
|
61186
61186
|
this.root.set(_ElementModel.KEYS.shadow, value);
|
|
61187
61187
|
}
|
|
61188
|
-
|
|
61188
|
+
get isPerformanceEnvironment() {
|
|
61189
|
+
return this.isPerformanceMode() && this.shouldUseLocalPoints;
|
|
61190
|
+
}
|
|
61191
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
61189
61192
|
_defineProperty(this, "shadowEmitter", null);
|
|
61190
61193
|
_defineProperty(this, "root", void 0);
|
|
61191
61194
|
_defineProperty(this, "scope", void 0);
|
|
61192
61195
|
_defineProperty(this, "item", void 0);
|
|
61196
|
+
_defineProperty(this, "clearLocalPointsWhenYPointsChange", void 0);
|
|
61197
|
+
_defineProperty(this, "shouldUseLocalPoints", void 0);
|
|
61198
|
+
_defineProperty(this, "localPointsPick", void 0);
|
|
61193
61199
|
_defineProperty(this, "liveCursor", void 0);
|
|
61200
|
+
_defineProperty(this, "appendPointsTimer", null);
|
|
61201
|
+
_defineProperty(this, "setPointsTimer", null);
|
|
61202
|
+
_defineProperty(this, "pointsUpdateTimer", null);
|
|
61203
|
+
_defineProperty(this, "isPerformanceMode", void 0);
|
|
61204
|
+
_defineProperty(this, "localPoints", []);
|
|
61194
61205
|
_defineProperty(this, "handlePropChange", (events) => {
|
|
61195
61206
|
if (!this.item) {
|
|
61196
61207
|
return;
|
|
@@ -61229,24 +61240,68 @@ var ElementModel = class _ElementModel {
|
|
|
61229
61240
|
}
|
|
61230
61241
|
}
|
|
61231
61242
|
} else if (event.target === this.root.get(_ElementModel.KEYS.points)) {
|
|
61232
|
-
this.
|
|
61233
|
-
|
|
61234
|
-
|
|
61235
|
-
|
|
61236
|
-
this.liveCursor.updateCursorPosition(liveCursorPoint, this.root.get(_ElementModel.KEYS.ownerId));
|
|
61243
|
+
if (this.isPerformanceEnvironment) {
|
|
61244
|
+
this.handlePointsChangePerformance();
|
|
61245
|
+
} else {
|
|
61246
|
+
this.handlePointsChangeDirect();
|
|
61237
61247
|
}
|
|
61238
61248
|
} else {
|
|
61239
61249
|
}
|
|
61240
61250
|
}
|
|
61241
61251
|
});
|
|
61252
|
+
_defineProperty(this, "onPointsArrayChange", (points) => {
|
|
61253
|
+
if (this.localPoints.length >= points.length) {
|
|
61254
|
+
return;
|
|
61255
|
+
}
|
|
61256
|
+
const pointsChunk = points.slice(this.localPoints.length, this.localPoints.length + this.localPointsPick);
|
|
61257
|
+
this.localPoints = this.localPoints.concat(pointsChunk);
|
|
61258
|
+
this.onVectorUpdate();
|
|
61259
|
+
this.pointsUpdateTimer = window.requestAnimationFrame(() => {
|
|
61260
|
+
this.onPointsArrayChange(points);
|
|
61261
|
+
});
|
|
61262
|
+
});
|
|
61263
|
+
this.isPerformanceMode = isPerformanceMode;
|
|
61242
61264
|
this.scope = scope;
|
|
61243
61265
|
this.liveCursor = liveCursor;
|
|
61244
61266
|
this.root = root;
|
|
61245
|
-
if (
|
|
61267
|
+
if (this.root.doc) {
|
|
61268
|
+
if (!this.root.has(_ElementModel.KEYS.pointsMatrix)) {
|
|
61269
|
+
this.root.set(_ElementModel.KEYS.pointsMatrix, [1, 0, 0, 1, 0, 0]);
|
|
61270
|
+
}
|
|
61271
|
+
} else {
|
|
61246
61272
|
this.root.set(_ElementModel.KEYS.pointsMatrix, [1, 0, 0, 1, 0, 0]);
|
|
61247
61273
|
}
|
|
61248
61274
|
this.root.observeDeep(this.handlePropChange);
|
|
61249
61275
|
}
|
|
61276
|
+
handlePointsChangeDirect() {
|
|
61277
|
+
this.onVectorUpdate();
|
|
61278
|
+
const liveCursorPoint = this.liveCursorPoint();
|
|
61279
|
+
const ownerId = this.root.get(_ElementModel.KEYS.ownerId);
|
|
61280
|
+
if (liveCursorPoint && ownerId) {
|
|
61281
|
+
this.liveCursor.updateCursorPosition(liveCursorPoint, this.root.get(_ElementModel.KEYS.ownerId));
|
|
61282
|
+
}
|
|
61283
|
+
}
|
|
61284
|
+
handlePointsChangePerformance() {
|
|
61285
|
+
const liveCursorPoint = this.liveCursorPoint();
|
|
61286
|
+
const ownerId = this.root.get(_ElementModel.KEYS.ownerId);
|
|
61287
|
+
if (liveCursorPoint && ownerId) {
|
|
61288
|
+
this.liveCursor.updateCursorPosition(liveCursorPoint, this.root.get(_ElementModel.KEYS.ownerId));
|
|
61289
|
+
}
|
|
61290
|
+
if (this.liveCursor.userManager.selfId !== ownerId || this.localPoints.length === 0) {
|
|
61291
|
+
if (this.pointsUpdateTimer) {
|
|
61292
|
+
window.cancelAnimationFrame(this.pointsUpdateTimer);
|
|
61293
|
+
}
|
|
61294
|
+
if (this.shadow == "") {
|
|
61295
|
+
this.localPoints = this.points;
|
|
61296
|
+
this.onVectorUpdate();
|
|
61297
|
+
} else {
|
|
61298
|
+
if (this.clearLocalPointsWhenYPointsChange) {
|
|
61299
|
+
this.localPoints = [];
|
|
61300
|
+
}
|
|
61301
|
+
this.onPointsArrayChange(this.points);
|
|
61302
|
+
}
|
|
61303
|
+
}
|
|
61304
|
+
}
|
|
61250
61305
|
createPaperElement() {
|
|
61251
61306
|
this.createPaperItem();
|
|
61252
61307
|
if (this.item) {
|
|
@@ -61258,14 +61313,48 @@ var ElementModel = class _ElementModel {
|
|
|
61258
61313
|
}
|
|
61259
61314
|
}
|
|
61260
61315
|
appendPoints(points) {
|
|
61316
|
+
if (this.isPerformanceEnvironment) {
|
|
61317
|
+
this.appendPointsPerformance(points);
|
|
61318
|
+
} else {
|
|
61319
|
+
this.appendPointsDirect(points);
|
|
61320
|
+
}
|
|
61321
|
+
}
|
|
61322
|
+
appendPointsDirect(points) {
|
|
61261
61323
|
this.root.get(_ElementModel.KEYS.points).push(points);
|
|
61262
61324
|
}
|
|
61325
|
+
appendPointsPerformance(points) {
|
|
61326
|
+
this.localPoints = this.localPoints.concat(points);
|
|
61327
|
+
this.onVectorUpdate();
|
|
61328
|
+
if (this.appendPointsTimer) {
|
|
61329
|
+
window.clearTimeout(this.appendPointsTimer);
|
|
61330
|
+
}
|
|
61331
|
+
if (this.localPoints.length % 80 === 0) {
|
|
61332
|
+
const yArray = this.root.get(_ElementModel.KEYS.points);
|
|
61333
|
+
yArray?.push(this.localPoints.slice(yArray.length));
|
|
61334
|
+
}
|
|
61335
|
+
this.appendPointsTimer = window.setTimeout(() => {
|
|
61336
|
+
this.appendPointsTimer = null;
|
|
61337
|
+
if (this.localPoints.length > 0) {
|
|
61338
|
+
const yArray = this.root.get(_ElementModel.KEYS.points);
|
|
61339
|
+
yArray?.push(this.localPoints.slice(yArray.length));
|
|
61340
|
+
}
|
|
61341
|
+
}, 100);
|
|
61342
|
+
}
|
|
61263
61343
|
setPoints(points) {
|
|
61344
|
+
if (this.isPerformanceEnvironment) {
|
|
61345
|
+
this.setPointsPerformance(points);
|
|
61346
|
+
} else {
|
|
61347
|
+
this.setPointsDirect(points);
|
|
61348
|
+
}
|
|
61349
|
+
}
|
|
61350
|
+
setPointsDirect(points) {
|
|
61264
61351
|
if (this.root.doc) {
|
|
61265
61352
|
this.root.doc.transact(() => {
|
|
61266
61353
|
const yArray = this.root.get(_ElementModel.KEYS.points);
|
|
61267
|
-
|
|
61268
|
-
|
|
61354
|
+
if (yArray) {
|
|
61355
|
+
yArray.delete(0, yArray.length);
|
|
61356
|
+
yArray.push(points);
|
|
61357
|
+
}
|
|
61269
61358
|
});
|
|
61270
61359
|
} else {
|
|
61271
61360
|
const yArray = this.root.get(_ElementModel.KEYS.points) || new Y.Array();
|
|
@@ -61274,6 +61363,29 @@ var ElementModel = class _ElementModel {
|
|
|
61274
61363
|
this.root.set(_ElementModel.KEYS.points, yArray);
|
|
61275
61364
|
}
|
|
61276
61365
|
}
|
|
61366
|
+
setPointsPerformance(points) {
|
|
61367
|
+
this.localPoints = points;
|
|
61368
|
+
this.onVectorUpdate();
|
|
61369
|
+
if (this.setPointsTimer) {
|
|
61370
|
+
window.clearTimeout(this.setPointsTimer);
|
|
61371
|
+
}
|
|
61372
|
+
this.setPointsTimer = window.setTimeout(() => {
|
|
61373
|
+
if (this.root.doc) {
|
|
61374
|
+
this.root.doc.transact(() => {
|
|
61375
|
+
const yArray = this.root.get(_ElementModel.KEYS.points);
|
|
61376
|
+
if (yArray) {
|
|
61377
|
+
yArray.delete(0, yArray.length);
|
|
61378
|
+
yArray.push(points);
|
|
61379
|
+
}
|
|
61380
|
+
});
|
|
61381
|
+
} else {
|
|
61382
|
+
const yArray = this.root.get(_ElementModel.KEYS.points) || new Y.Array();
|
|
61383
|
+
yArray.delete(0, yArray.length);
|
|
61384
|
+
yArray.push(points);
|
|
61385
|
+
this.root.set(_ElementModel.KEYS.points, yArray);
|
|
61386
|
+
}
|
|
61387
|
+
}, 100);
|
|
61388
|
+
}
|
|
61277
61389
|
appendPointsMatrix(matrix) {
|
|
61278
61390
|
const current = new this.scope.Matrix(this.pointsMatrix);
|
|
61279
61391
|
const next = matrix.appended(current);
|
|
@@ -61368,15 +61480,18 @@ function _toPrimitive3(t, r) {
|
|
|
61368
61480
|
return ("string" === r ? String : Number)(t);
|
|
61369
61481
|
}
|
|
61370
61482
|
var CurveModel = class extends ElementModel {
|
|
61371
|
-
constructor(root, scope, liveCursor) {
|
|
61372
|
-
super(root, scope, liveCursor);
|
|
61483
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
61484
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
61373
61485
|
_defineProperty3(this, "item", null);
|
|
61374
61486
|
_defineProperty3(this, "debugPath", void 0);
|
|
61375
61487
|
_defineProperty3(this, "debug", false);
|
|
61376
|
-
|
|
61488
|
+
_defineProperty3(this, "clearLocalPointsWhenYPointsChange", false);
|
|
61489
|
+
_defineProperty3(this, "shouldUseLocalPoints", true);
|
|
61490
|
+
_defineProperty3(this, "localPointsPick", 4);
|
|
61491
|
+
if (!this.root.doc || !this.root.has("type")) {
|
|
61377
61492
|
this.root.set("type", "curve");
|
|
61378
61493
|
}
|
|
61379
|
-
if (!this.root.has("points")) {
|
|
61494
|
+
if (!this.root.doc || !this.root.has("points")) {
|
|
61380
61495
|
this.root.set("points", new Y2.Array());
|
|
61381
61496
|
}
|
|
61382
61497
|
this.debugPath = new scope.Path();
|
|
@@ -61402,7 +61517,7 @@ var CurveModel = class extends ElementModel {
|
|
|
61402
61517
|
});
|
|
61403
61518
|
}
|
|
61404
61519
|
matrixedPoints() {
|
|
61405
|
-
const points = this.points;
|
|
61520
|
+
const points = this.localPoints.length === 0 ? this.points : this.localPoints;
|
|
61406
61521
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61407
61522
|
const output = [];
|
|
61408
61523
|
for (let i = 0, len = points.length; i < len; i += 2) {
|
|
@@ -61526,15 +61641,24 @@ function _toPrimitive4(t, r) {
|
|
|
61526
61641
|
return ("string" === r ? String : Number)(t);
|
|
61527
61642
|
}
|
|
61528
61643
|
var SelectorModel = class extends ElementModel {
|
|
61529
|
-
|
|
61530
|
-
|
|
61644
|
+
get drawPoints() {
|
|
61645
|
+
if (this.localPoints.length >= 4) {
|
|
61646
|
+
return this.localPoints;
|
|
61647
|
+
}
|
|
61648
|
+
return this.points;
|
|
61649
|
+
}
|
|
61650
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
61651
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
61531
61652
|
_defineProperty4(this, "item", null);
|
|
61532
|
-
|
|
61653
|
+
_defineProperty4(this, "clearLocalPointsWhenYPointsChange", true);
|
|
61654
|
+
_defineProperty4(this, "shouldUseLocalPoints", true);
|
|
61655
|
+
_defineProperty4(this, "localPointsPick", 4);
|
|
61656
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
61533
61657
|
this.root.set("type", "selector");
|
|
61534
61658
|
}
|
|
61535
|
-
if (!this.root.has("points")) {
|
|
61659
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
61536
61660
|
const initPoints = new Y3.Array();
|
|
61537
|
-
initPoints.push([0, 0, 0, 0
|
|
61661
|
+
initPoints.push([0, 0, 0, 0]);
|
|
61538
61662
|
this.root.set("points", initPoints);
|
|
61539
61663
|
}
|
|
61540
61664
|
}
|
|
@@ -61545,8 +61669,8 @@ var SelectorModel = class extends ElementModel {
|
|
|
61545
61669
|
}
|
|
61546
61670
|
createPaperRect() {
|
|
61547
61671
|
const scope = this.scope;
|
|
61548
|
-
const bounds = new scope.Rectangle(new scope.Point(this.
|
|
61549
|
-
return new scope.Path.Rectangle(bounds
|
|
61672
|
+
const bounds = new scope.Rectangle(new scope.Point(this.drawPoints[0], this.drawPoints[1]), new scope.Size(this.drawPoints[2], this.drawPoints[3]));
|
|
61673
|
+
return new scope.Path.Rectangle(bounds);
|
|
61550
61674
|
}
|
|
61551
61675
|
onVectorUpdate() {
|
|
61552
61676
|
if (!this.item) {
|
|
@@ -61660,13 +61784,22 @@ function _toPrimitive6(t, r) {
|
|
|
61660
61784
|
return ("string" === r ? String : Number)(t);
|
|
61661
61785
|
}
|
|
61662
61786
|
var SegmentsModel = class extends ElementModel {
|
|
61663
|
-
|
|
61664
|
-
|
|
61787
|
+
get drawPoints() {
|
|
61788
|
+
if (this.localPoints.length >= 4) {
|
|
61789
|
+
return this.localPoints;
|
|
61790
|
+
}
|
|
61791
|
+
return this.points;
|
|
61792
|
+
}
|
|
61793
|
+
constructor(root, scope, type, liveCursor, isPerformanceMode) {
|
|
61794
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
61665
61795
|
_defineProperty6(this, "item", null);
|
|
61666
|
-
|
|
61796
|
+
_defineProperty6(this, "clearLocalPointsWhenYPointsChange", true);
|
|
61797
|
+
_defineProperty6(this, "shouldUseLocalPoints", true);
|
|
61798
|
+
_defineProperty6(this, "localPointsPick", 24);
|
|
61799
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
61667
61800
|
this.root.set("type", type);
|
|
61668
61801
|
}
|
|
61669
|
-
if (!this.root.has("points")) {
|
|
61802
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
61670
61803
|
this.root.set("points", new Y4.Array());
|
|
61671
61804
|
}
|
|
61672
61805
|
}
|
|
@@ -61686,13 +61819,13 @@ var SegmentsModel = class extends ElementModel {
|
|
|
61686
61819
|
}
|
|
61687
61820
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61688
61821
|
this.item.removeSegments();
|
|
61689
|
-
const next = deserializePath(this.
|
|
61822
|
+
const next = deserializePath(this.drawPoints, this.scope, matrix);
|
|
61690
61823
|
this.item.addSegments(next.segments);
|
|
61691
61824
|
this.item.closePath();
|
|
61692
61825
|
}
|
|
61693
61826
|
createPaperItem() {
|
|
61694
61827
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61695
|
-
this.item = deserializePath(this.
|
|
61828
|
+
this.item = deserializePath(this.drawPoints, this.scope, matrix);
|
|
61696
61829
|
this.item.strokeColor = new this.scope.Color(this.strokeColor);
|
|
61697
61830
|
this.item.dashArray = this.dashArray;
|
|
61698
61831
|
this.item.strokeWidth = this.strokeWidth;
|
|
@@ -61851,6 +61984,12 @@ function _toPrimitive9(t, r) {
|
|
|
61851
61984
|
return ("string" === r ? String : Number)(t);
|
|
61852
61985
|
}
|
|
61853
61986
|
var LineModel = class extends ElementModel {
|
|
61987
|
+
get drawPoints() {
|
|
61988
|
+
if (this.localPoints.length > 0) {
|
|
61989
|
+
return this.localPoints;
|
|
61990
|
+
}
|
|
61991
|
+
return this.points;
|
|
61992
|
+
}
|
|
61854
61993
|
get arrowSize() {
|
|
61855
61994
|
return this.strokeWidth * 5 + 15;
|
|
61856
61995
|
}
|
|
@@ -61866,20 +62005,23 @@ var LineModel = class extends ElementModel {
|
|
|
61866
62005
|
set tailArrow(value) {
|
|
61867
62006
|
this.root.set("tailArrow", value);
|
|
61868
62007
|
}
|
|
61869
|
-
constructor(root, scope, liveCursor) {
|
|
61870
|
-
super(root, scope, liveCursor);
|
|
62008
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
62009
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
61871
62010
|
_defineProperty9(this, "controlledPoints", []);
|
|
62011
|
+
_defineProperty9(this, "clearLocalPointsWhenYPointsChange", true);
|
|
62012
|
+
_defineProperty9(this, "shouldUseLocalPoints", true);
|
|
62013
|
+
_defineProperty9(this, "localPointsPick", 99);
|
|
61872
62014
|
_defineProperty9(this, "item", null);
|
|
61873
|
-
if (!this.root.has("type")) {
|
|
62015
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
61874
62016
|
this.root.set("type", "arrow");
|
|
61875
62017
|
}
|
|
61876
|
-
if (!this.root.has("points")) {
|
|
62018
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
61877
62019
|
this.root.set("points", new Y5.Array());
|
|
61878
62020
|
}
|
|
61879
|
-
if (!this.root.has("headArrow")) {
|
|
62021
|
+
if (this.root.doc && !this.root.has("headArrow")) {
|
|
61880
62022
|
this.root.set("headArrow", "none");
|
|
61881
62023
|
}
|
|
61882
|
-
if (!this.root.has("tailArrow")) {
|
|
62024
|
+
if (this.root.doc && !this.root.has("tailArrow")) {
|
|
61883
62025
|
this.root.set("tailArrow", "normal");
|
|
61884
62026
|
}
|
|
61885
62027
|
}
|
|
@@ -61895,7 +62037,7 @@ var LineModel = class extends ElementModel {
|
|
|
61895
62037
|
}
|
|
61896
62038
|
renderLine() {
|
|
61897
62039
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
61898
|
-
const papperPoints = (0, import_lodash4.chunk)(this.
|
|
62040
|
+
const papperPoints = (0, import_lodash4.chunk)(this.drawPoints, 2).map((item) => {
|
|
61899
62041
|
return new this.scope.Point(item[0], item[1]).transform(matrix);
|
|
61900
62042
|
});
|
|
61901
62043
|
const path = new this.scope.Path();
|
|
@@ -62009,13 +62151,14 @@ var LineControlPoint = class {
|
|
|
62009
62151
|
if (this.position) {
|
|
62010
62152
|
return this.model.scope.project.view.projectToView(this.position.transform(matrix));
|
|
62011
62153
|
}
|
|
62154
|
+
const points = this.model["drawPoints"];
|
|
62012
62155
|
const from = {
|
|
62013
|
-
x:
|
|
62014
|
-
y:
|
|
62156
|
+
x: points[0],
|
|
62157
|
+
y: points[1]
|
|
62015
62158
|
};
|
|
62016
62159
|
const to = {
|
|
62017
|
-
x:
|
|
62018
|
-
y:
|
|
62160
|
+
x: points[points.length - 2],
|
|
62161
|
+
y: points[points.length - 1]
|
|
62019
62162
|
};
|
|
62020
62163
|
const clonedPath = new this.scope.Path.Line(from, to);
|
|
62021
62164
|
this.position = clonedPath.getPointAt(clonedPath.length * distance);
|
|
@@ -62028,7 +62171,7 @@ var LineControlPoint = class {
|
|
|
62028
62171
|
}
|
|
62029
62172
|
const pointsMatrix = new this.model.scope.Matrix(this.model.pointsMatrix);
|
|
62030
62173
|
const invertedPoint = point.transform(pointsMatrix.inverted());
|
|
62031
|
-
const points = this.model
|
|
62174
|
+
const points = this.model["drawPoints"];
|
|
62032
62175
|
this.position = invertedPoint;
|
|
62033
62176
|
const clonedPoints = (0, import_lodash4.cloneDeep)(points);
|
|
62034
62177
|
clonedPoints[this.options.index * 2] = invertedPoint.x;
|
|
@@ -62072,9 +62215,18 @@ var PointTextModel = class extends ElementModel {
|
|
|
62072
62215
|
set fontFamily(value) {
|
|
62073
62216
|
this.root.set("font-family", value);
|
|
62074
62217
|
}
|
|
62075
|
-
|
|
62076
|
-
|
|
62218
|
+
get drawPoints() {
|
|
62219
|
+
if (this.localPoints.length > 1) {
|
|
62220
|
+
return this.localPoints;
|
|
62221
|
+
}
|
|
62222
|
+
return this.points;
|
|
62223
|
+
}
|
|
62224
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
62225
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62077
62226
|
_defineProperty10(this, "item", null);
|
|
62227
|
+
_defineProperty10(this, "clearLocalPointsWhenYPointsChange", true);
|
|
62228
|
+
_defineProperty10(this, "shouldUseLocalPoints", false);
|
|
62229
|
+
_defineProperty10(this, "localPointsPick", 2);
|
|
62078
62230
|
_defineProperty10(this, "handleTextPropChange", (event) => {
|
|
62079
62231
|
if (!this.item) {
|
|
62080
62232
|
return;
|
|
@@ -62091,18 +62243,20 @@ var PointTextModel = class extends ElementModel {
|
|
|
62091
62243
|
}
|
|
62092
62244
|
}
|
|
62093
62245
|
});
|
|
62094
|
-
if (!this.root.has("type")) {
|
|
62246
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62095
62247
|
this.root.set("type", "point-text");
|
|
62096
62248
|
}
|
|
62097
|
-
if (!this.root.has(ElementModel.KEYS.points)) {
|
|
62249
|
+
if (this.root.doc && !this.root.has(ElementModel.KEYS.points)) {
|
|
62098
62250
|
this.root.set(ElementModel.KEYS.points, new Y6.Array());
|
|
62099
62251
|
}
|
|
62100
62252
|
this.root.observe(this.handleTextPropChange);
|
|
62101
|
-
|
|
62102
|
-
|
|
62103
|
-
|
|
62104
|
-
|
|
62105
|
-
|
|
62253
|
+
setTimeout(() => {
|
|
62254
|
+
if (this.root && this.root.has("font-size")) {
|
|
62255
|
+
setTimeout(() => {
|
|
62256
|
+
this.updateTextPosition();
|
|
62257
|
+
}, 60);
|
|
62258
|
+
}
|
|
62259
|
+
}, 60);
|
|
62106
62260
|
}
|
|
62107
62261
|
subDispose() {
|
|
62108
62262
|
removeObserver(this.root, this.handleTextPropChange);
|
|
@@ -62120,10 +62274,11 @@ var PointTextModel = class extends ElementModel {
|
|
|
62120
62274
|
if (!this.item) {
|
|
62121
62275
|
return null;
|
|
62122
62276
|
}
|
|
62277
|
+
console.log("[][][] drawPoints", this.drawPoints);
|
|
62123
62278
|
const bounds = this.item.internalBounds;
|
|
62124
62279
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62125
|
-
const topLeft = new this.scope.Point(this.
|
|
62126
|
-
const topRight = new this.scope.Point(this.
|
|
62280
|
+
const topLeft = new this.scope.Point(this.drawPoints[0], this.drawPoints[1]).transform(matrix);
|
|
62281
|
+
const topRight = new this.scope.Point(this.drawPoints[0] + bounds.width, this.drawPoints[1]).transform(matrix);
|
|
62127
62282
|
let scaleX = topRight.getDistance(topLeft) / bounds.width;
|
|
62128
62283
|
scaleX = Number.isNaN(scaleX) ? 1 : scaleX;
|
|
62129
62284
|
const angle = topRight.subtract(topLeft).angle;
|
|
@@ -62208,13 +62363,22 @@ function _toPrimitive11(t, r) {
|
|
|
62208
62363
|
return ("string" === r ? String : Number)(t);
|
|
62209
62364
|
}
|
|
62210
62365
|
var TriangleModel = class extends ElementModel {
|
|
62211
|
-
|
|
62212
|
-
|
|
62366
|
+
get drawPoints() {
|
|
62367
|
+
if (this.localPoints.length >= 6) {
|
|
62368
|
+
return this.localPoints;
|
|
62369
|
+
}
|
|
62370
|
+
return this.points;
|
|
62371
|
+
}
|
|
62372
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
62373
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62213
62374
|
_defineProperty11(this, "item", null);
|
|
62214
|
-
|
|
62375
|
+
_defineProperty11(this, "clearLocalPointsWhenYPointsChange", true);
|
|
62376
|
+
_defineProperty11(this, "shouldUseLocalPoints", true);
|
|
62377
|
+
_defineProperty11(this, "localPointsPick", 6);
|
|
62378
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62215
62379
|
this.root.set("type", "triangle");
|
|
62216
62380
|
}
|
|
62217
|
-
if (!this.root.has("points")) {
|
|
62381
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
62218
62382
|
this.root.set("points", new Y7.Array());
|
|
62219
62383
|
}
|
|
62220
62384
|
}
|
|
@@ -62246,9 +62410,9 @@ var TriangleModel = class extends ElementModel {
|
|
|
62246
62410
|
return;
|
|
62247
62411
|
}
|
|
62248
62412
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62249
|
-
const p1 = new this.scope.Point(this.
|
|
62250
|
-
const p2 = new this.scope.Point(this.
|
|
62251
|
-
const p3 = new this.scope.Point(this.
|
|
62413
|
+
const p1 = new this.scope.Point(this.drawPoints[0], this.drawPoints[1]).transform(matrix);
|
|
62414
|
+
const p2 = new this.scope.Point(this.drawPoints[2], this.drawPoints[3]).transform(matrix);
|
|
62415
|
+
const p3 = new this.scope.Point(this.drawPoints[4], this.drawPoints[5]).transform(matrix);
|
|
62252
62416
|
this.item.removeSegments();
|
|
62253
62417
|
this.item.moveTo(p1);
|
|
62254
62418
|
this.item.lineTo(p2);
|
|
@@ -62260,7 +62424,7 @@ var TriangleModel = class extends ElementModel {
|
|
|
62260
62424
|
config.controlPoints.push({
|
|
62261
62425
|
name: "triangle",
|
|
62262
62426
|
getPosition: () => {
|
|
62263
|
-
const point = new this.scope.Point(this.
|
|
62427
|
+
const point = new this.scope.Point(this.drawPoints[0], this.drawPoints[1]);
|
|
62264
62428
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62265
62429
|
return this.scope.project.view.projectToView(point.transform(pointsMatrix));
|
|
62266
62430
|
},
|
|
@@ -62270,7 +62434,7 @@ var TriangleModel = class extends ElementModel {
|
|
|
62270
62434
|
}
|
|
62271
62435
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62272
62436
|
const trPoint = point.transform(pointsMatrix.inverted());
|
|
62273
|
-
const oldPoints = this.
|
|
62437
|
+
const oldPoints = this.drawPoints;
|
|
62274
62438
|
this.setPoints([trPoint.x, trPoint.y, oldPoints[2], oldPoints[3], oldPoints[4], oldPoints[5]]);
|
|
62275
62439
|
}
|
|
62276
62440
|
});
|
|
@@ -62306,25 +62470,34 @@ function _toPrimitive12(t, r) {
|
|
|
62306
62470
|
return ("string" === r ? String : Number)(t);
|
|
62307
62471
|
}
|
|
62308
62472
|
var RectangleModel = class extends ElementModel {
|
|
62309
|
-
|
|
62310
|
-
|
|
62473
|
+
get drawPoints() {
|
|
62474
|
+
if (this.localPoints.length >= 4) {
|
|
62475
|
+
return this.localPoints;
|
|
62476
|
+
}
|
|
62477
|
+
return this.points;
|
|
62478
|
+
}
|
|
62479
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
62480
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62311
62481
|
_defineProperty12(this, "item", null);
|
|
62312
|
-
|
|
62482
|
+
_defineProperty12(this, "clearLocalPointsWhenYPointsChange", true);
|
|
62483
|
+
_defineProperty12(this, "shouldUseLocalPoints", true);
|
|
62484
|
+
_defineProperty12(this, "localPointsPick", 4);
|
|
62485
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62313
62486
|
this.root.set("type", "rectangle");
|
|
62314
62487
|
}
|
|
62315
|
-
if (!this.root.has("points")) {
|
|
62488
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
62316
62489
|
const initPoints = new Y8.Array();
|
|
62317
62490
|
initPoints.push([0, 0, 0, 0]);
|
|
62318
62491
|
this.root.set("points", initPoints);
|
|
62319
62492
|
}
|
|
62320
|
-
if (!this.root.has("radius")) {
|
|
62493
|
+
if (this.root.doc && !this.root.has("radius")) {
|
|
62321
62494
|
this.root.set("radius", 0);
|
|
62322
62495
|
}
|
|
62323
62496
|
}
|
|
62324
62497
|
subDispose() {
|
|
62325
62498
|
}
|
|
62326
62499
|
liveCursorPoint() {
|
|
62327
|
-
const points = this.
|
|
62500
|
+
const points = this.drawPoints;
|
|
62328
62501
|
if (points.length < 4) {
|
|
62329
62502
|
return null;
|
|
62330
62503
|
}
|
|
@@ -62332,7 +62505,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
62332
62505
|
return new this.scope.Point(points[2], points[3]).transform(matrix);
|
|
62333
62506
|
}
|
|
62334
62507
|
createSegments() {
|
|
62335
|
-
const [a2, b2, c, d] = this.
|
|
62508
|
+
const [a2, b2, c, d] = this.drawPoints;
|
|
62336
62509
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62337
62510
|
const maxRadius = this.maxRadiusLength();
|
|
62338
62511
|
const radius = this.root.get("radius") * maxRadius;
|
|
@@ -62397,7 +62570,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
62397
62570
|
}
|
|
62398
62571
|
maxRadiusLength() {
|
|
62399
62572
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62400
|
-
const points = this.
|
|
62573
|
+
const points = this.drawPoints;
|
|
62401
62574
|
const topLeft = new this.scope.Point(points[0], points[1]).transform(pointsMatrix);
|
|
62402
62575
|
const topRight = new this.scope.Point(points[2], points[1]).transform(pointsMatrix);
|
|
62403
62576
|
const bottomLeft = new this.scope.Point(points[0], points[3]).transform(pointsMatrix);
|
|
@@ -62422,7 +62595,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
62422
62595
|
name: "rect-radius",
|
|
62423
62596
|
getPosition: () => {
|
|
62424
62597
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62425
|
-
const points = this.
|
|
62598
|
+
const points = this.drawPoints;
|
|
62426
62599
|
const radius = this.root.get("radius") * this.maxRadiusLength();
|
|
62427
62600
|
let c1 = new this.scope.Point(points[0], points[1]).transform(matrix);
|
|
62428
62601
|
const c3 = new this.scope.Point(points[2], points[3]).transform(matrix);
|
|
@@ -62441,7 +62614,7 @@ var RectangleModel = class extends ElementModel {
|
|
|
62441
62614
|
if (!this.item) {
|
|
62442
62615
|
return;
|
|
62443
62616
|
}
|
|
62444
|
-
const points = this.
|
|
62617
|
+
const points = this.drawPoints;
|
|
62445
62618
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62446
62619
|
const maxRadius = Math.min(points[2] - points[0], points[3] - points[1]) / 2;
|
|
62447
62620
|
const trPoint = point.transform(pointsMatrix.inverted());
|
|
@@ -62485,14 +62658,23 @@ function _toPrimitive13(t, r) {
|
|
|
62485
62658
|
return ("string" === r ? String : Number)(t);
|
|
62486
62659
|
}
|
|
62487
62660
|
var EraserModel = class extends ElementModel {
|
|
62488
|
-
|
|
62489
|
-
|
|
62661
|
+
get drawPoints() {
|
|
62662
|
+
if (this.localPoints.length > 0) {
|
|
62663
|
+
return this.localPoints;
|
|
62664
|
+
}
|
|
62665
|
+
return this.points;
|
|
62666
|
+
}
|
|
62667
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
62668
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62490
62669
|
_defineProperty13(this, "item", null);
|
|
62491
62670
|
_defineProperty13(this, "sliceBegin", 0);
|
|
62492
|
-
|
|
62671
|
+
_defineProperty13(this, "clearLocalPointsWhenYPointsChange", false);
|
|
62672
|
+
_defineProperty13(this, "shouldUseLocalPoints", true);
|
|
62673
|
+
_defineProperty13(this, "localPointsPick", 4);
|
|
62674
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62493
62675
|
this.root.set("type", "eraser");
|
|
62494
62676
|
}
|
|
62495
|
-
if (!this.root.has("points")) {
|
|
62677
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
62496
62678
|
this.root.set("points", new Y9.Array());
|
|
62497
62679
|
}
|
|
62498
62680
|
}
|
|
@@ -62543,7 +62725,7 @@ var EraserModel = class extends ElementModel {
|
|
|
62543
62725
|
});
|
|
62544
62726
|
}
|
|
62545
62727
|
matrixedPoints() {
|
|
62546
|
-
const currentPoints = (0, import_lodash5.chunk)(this.
|
|
62728
|
+
const currentPoints = (0, import_lodash5.chunk)(this.drawPoints, 2).slice(this.sliceBegin);
|
|
62547
62729
|
return currentPoints.map((_ref) => {
|
|
62548
62730
|
let [x, y] = _ref;
|
|
62549
62731
|
return new this.scope.Point(x, y);
|
|
@@ -62571,11 +62753,11 @@ var EraserModel = class extends ElementModel {
|
|
|
62571
62753
|
this.item.fillColor = new this.scope.Color(this.strokeColor);
|
|
62572
62754
|
this.onVectorUpdate();
|
|
62573
62755
|
this.item.onFrame = () => {
|
|
62574
|
-
if (!this.
|
|
62756
|
+
if (!this.drawPoints) {
|
|
62575
62757
|
return;
|
|
62576
62758
|
}
|
|
62577
|
-
if (this.
|
|
62578
|
-
this.sliceBegin = this.
|
|
62759
|
+
if (this.drawPoints.length / 2 > 50) {
|
|
62760
|
+
this.sliceBegin = this.drawPoints.length / 2 - 50;
|
|
62579
62761
|
}
|
|
62580
62762
|
};
|
|
62581
62763
|
}
|
|
@@ -62625,21 +62807,24 @@ function _toPrimitive14(t, r) {
|
|
|
62625
62807
|
return ("string" === r ? String : Number)(t);
|
|
62626
62808
|
}
|
|
62627
62809
|
var LaserPointerModel = class extends ElementModel {
|
|
62628
|
-
constructor(clientId, root, scope, liveCursor, removeElement) {
|
|
62629
|
-
super(root, scope, liveCursor);
|
|
62810
|
+
constructor(clientId, root, scope, liveCursor, removeElement, isPerformanceMode) {
|
|
62811
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62630
62812
|
_defineProperty14(this, "item", null);
|
|
62631
62813
|
_defineProperty14(this, "clientId", void 0);
|
|
62632
62814
|
_defineProperty14(this, "sliceBegin", 0);
|
|
62633
62815
|
_defineProperty14(this, "displayStrokeWidth", 8);
|
|
62634
62816
|
_defineProperty14(this, "cachedPoints", null);
|
|
62817
|
+
_defineProperty14(this, "clearLocalPointsWhenYPointsChange", false);
|
|
62818
|
+
_defineProperty14(this, "shouldUseLocalPoints", false);
|
|
62819
|
+
_defineProperty14(this, "localPointsPick", 4);
|
|
62635
62820
|
this.clientId = clientId;
|
|
62636
|
-
if (!this.root.has("type")) {
|
|
62821
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62637
62822
|
this.root.set("type", "laser");
|
|
62638
62823
|
}
|
|
62639
|
-
if (!this.root.has("points")) {
|
|
62824
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
62640
62825
|
this.root.set("points", new Y10.Array());
|
|
62641
62826
|
}
|
|
62642
|
-
if (!this.root.has("removed")) {
|
|
62827
|
+
if (this.root.doc && !this.root.has("removed")) {
|
|
62643
62828
|
this.root.set("removed", false);
|
|
62644
62829
|
}
|
|
62645
62830
|
this.root.observe((event) => {
|
|
@@ -62719,6 +62904,7 @@ var LaserPointerModel = class extends ElementModel {
|
|
|
62719
62904
|
matrixedPoints() {
|
|
62720
62905
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62721
62906
|
const points = this.cachedPoints || this.points;
|
|
62907
|
+
console.log("[][][] ,", this.points.length, this.cachedPoints?.length, this.localPoints.length);
|
|
62722
62908
|
const groupPoints = (0, import_lodash6.chunk)(points, 2).slice(this.sliceBegin);
|
|
62723
62909
|
return groupPoints.map((_ref) => {
|
|
62724
62910
|
let [x, y] = _ref;
|
|
@@ -62814,13 +63000,22 @@ function _toPrimitive15(t, r) {
|
|
|
62814
63000
|
return ("string" === r ? String : Number)(t);
|
|
62815
63001
|
}
|
|
62816
63002
|
var StraightLineModel = class extends ElementModel {
|
|
62817
|
-
|
|
62818
|
-
|
|
63003
|
+
get drawPoints() {
|
|
63004
|
+
if (this.localPoints.length >= 4) {
|
|
63005
|
+
return this.localPoints;
|
|
63006
|
+
}
|
|
63007
|
+
return this.points;
|
|
63008
|
+
}
|
|
63009
|
+
constructor(root, scope, liveCursor, isPerformanceMode) {
|
|
63010
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62819
63011
|
_defineProperty15(this, "item", null);
|
|
62820
|
-
|
|
63012
|
+
_defineProperty15(this, "clearLocalPointsWhenYPointsChange", true);
|
|
63013
|
+
_defineProperty15(this, "shouldUseLocalPoints", true);
|
|
63014
|
+
_defineProperty15(this, "localPointsPick", 4);
|
|
63015
|
+
if (this.root.doc && !this.root.has("type")) {
|
|
62821
63016
|
this.root.set("type", "line");
|
|
62822
63017
|
}
|
|
62823
|
-
if (!this.root.has("points")) {
|
|
63018
|
+
if (this.root.doc && !this.root.has("points")) {
|
|
62824
63019
|
this.root.set("points", new Y11.Array());
|
|
62825
63020
|
}
|
|
62826
63021
|
}
|
|
@@ -62845,7 +63040,7 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62845
63040
|
}
|
|
62846
63041
|
renderLine() {
|
|
62847
63042
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62848
|
-
const papperPoints = (0, import_lodash7.chunk)(this.
|
|
63043
|
+
const papperPoints = (0, import_lodash7.chunk)(this.drawPoints, 2).map((item) => {
|
|
62849
63044
|
return new this.scope.Point(item[0], item[1]).transform(matrix);
|
|
62850
63045
|
});
|
|
62851
63046
|
const path = new this.scope.Path();
|
|
@@ -62867,7 +63062,7 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62867
63062
|
name: "line-start",
|
|
62868
63063
|
getPosition: () => {
|
|
62869
63064
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62870
|
-
const points = this.
|
|
63065
|
+
const points = this.drawPoints;
|
|
62871
63066
|
const start = new this.scope.Point(points[0], points[1]);
|
|
62872
63067
|
return this.scope.project.view.projectToView(start.transform(matrix));
|
|
62873
63068
|
},
|
|
@@ -62877,14 +63072,15 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62877
63072
|
}
|
|
62878
63073
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62879
63074
|
const trPoint = point.transform(pointsMatrix.inverted());
|
|
62880
|
-
|
|
63075
|
+
const oldPoints = this.drawPoints;
|
|
63076
|
+
this.setPoints([trPoint.x, trPoint.y, oldPoints[2], oldPoints[3]]);
|
|
62881
63077
|
}
|
|
62882
63078
|
});
|
|
62883
63079
|
cfg.controlPoints.push({
|
|
62884
63080
|
name: "line-end",
|
|
62885
63081
|
getPosition: () => {
|
|
62886
63082
|
const matrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62887
|
-
const points = this.
|
|
63083
|
+
const points = this.drawPoints;
|
|
62888
63084
|
const end = new this.scope.Point(points[2], points[3]);
|
|
62889
63085
|
return this.scope.project.view.projectToView(end.transform(matrix));
|
|
62890
63086
|
},
|
|
@@ -62894,7 +63090,8 @@ var StraightLineModel = class extends ElementModel {
|
|
|
62894
63090
|
}
|
|
62895
63091
|
const pointsMatrix = new this.scope.Matrix(this.pointsMatrix);
|
|
62896
63092
|
const trPoint = point.transform(pointsMatrix.inverted());
|
|
62897
|
-
|
|
63093
|
+
const oldPoints = this.drawPoints;
|
|
63094
|
+
this.setPoints([oldPoints[0], oldPoints[1], trPoint.x, trPoint.y]);
|
|
62898
63095
|
}
|
|
62899
63096
|
});
|
|
62900
63097
|
return cfg;
|
|
@@ -62938,10 +63135,13 @@ var ImageModel = class extends ElementModel {
|
|
|
62938
63135
|
get src() {
|
|
62939
63136
|
return this.root.get("src");
|
|
62940
63137
|
}
|
|
62941
|
-
constructor(root, scope, imageSets, liveCursor) {
|
|
62942
|
-
super(root, scope, liveCursor);
|
|
63138
|
+
constructor(root, scope, imageSets, liveCursor, isPerformanceMode) {
|
|
63139
|
+
super(root, scope, liveCursor, isPerformanceMode);
|
|
62943
63140
|
_defineProperty16(this, "item", null);
|
|
62944
63141
|
_defineProperty16(this, "imageSets", void 0);
|
|
63142
|
+
_defineProperty16(this, "clearLocalPointsWhenYPointsChange", true);
|
|
63143
|
+
_defineProperty16(this, "shouldUseLocalPoints", true);
|
|
63144
|
+
_defineProperty16(this, "localPointsPick", 4);
|
|
62945
63145
|
this.imageSets = imageSets;
|
|
62946
63146
|
if (!this.root.has("type")) {
|
|
62947
63147
|
this.root.set("type", "image");
|
|
@@ -63022,7 +63222,7 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63022
63222
|
get uuid() {
|
|
63023
63223
|
return uuidv4().replace(/-/g, "");
|
|
63024
63224
|
}
|
|
63025
|
-
constructor(
|
|
63225
|
+
constructor(options) {
|
|
63026
63226
|
super();
|
|
63027
63227
|
_defineProperty17(this, "scope", void 0);
|
|
63028
63228
|
_defineProperty17(this, "toolbarModel", void 0);
|
|
@@ -63035,6 +63235,7 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63035
63235
|
_defineProperty17(this, "shadowEmitter", void 0);
|
|
63036
63236
|
_defineProperty17(this, "imageSets", void 0);
|
|
63037
63237
|
_defineProperty17(this, "liveCursor", void 0);
|
|
63238
|
+
_defineProperty17(this, "isPerformanceMode", void 0);
|
|
63038
63239
|
_defineProperty17(this, "onElementsChange", (event) => {
|
|
63039
63240
|
for (const [key, value] of event.changes.keys.entries()) {
|
|
63040
63241
|
if (value.action === "add") {
|
|
@@ -63053,15 +63254,16 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63053
63254
|
}
|
|
63054
63255
|
}
|
|
63055
63256
|
});
|
|
63056
|
-
this.
|
|
63057
|
-
this.
|
|
63058
|
-
this.
|
|
63059
|
-
this.
|
|
63060
|
-
this.
|
|
63061
|
-
this.
|
|
63062
|
-
this.
|
|
63063
|
-
this.
|
|
63064
|
-
this.
|
|
63257
|
+
this.isPerformanceMode = options.isPerformanceMode;
|
|
63258
|
+
this.liveCursor = options.liveCursor;
|
|
63259
|
+
this.imageSets = options.imageSets;
|
|
63260
|
+
this.hasPermission = options.hasPermission;
|
|
63261
|
+
this.shadowEmitter = options.shadowEmitter;
|
|
63262
|
+
this.layerId = options.layerId;
|
|
63263
|
+
this.userManager = options.userManager;
|
|
63264
|
+
this.elements = options.elements;
|
|
63265
|
+
this.scope = options.scope;
|
|
63266
|
+
this.toolbarModel = options.toolbarModel;
|
|
63065
63267
|
this.elementModels = /* @__PURE__ */ new Map();
|
|
63066
63268
|
for (const key of this.elements.keys()) {
|
|
63067
63269
|
const type = this.elements.get(key)?.get("type");
|
|
@@ -63092,30 +63294,38 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63092
63294
|
convertToModel(yMap) {
|
|
63093
63295
|
const type = yMap.get("type");
|
|
63094
63296
|
let model = null;
|
|
63297
|
+
const uuid = yMap.get(ElementModel.KEYS.uuid);
|
|
63298
|
+
if (uuid) {
|
|
63299
|
+
const existingModel = this.elementModels.get(uuid);
|
|
63300
|
+
if (existingModel) {
|
|
63301
|
+
existingModel.shadowEmitter = this.shadowEmitter;
|
|
63302
|
+
return existingModel;
|
|
63303
|
+
}
|
|
63304
|
+
}
|
|
63095
63305
|
if (type === "curve") {
|
|
63096
|
-
model = new CurveModel(yMap, this.scope, this.liveCursor);
|
|
63306
|
+
model = new CurveModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63097
63307
|
} else if (["ellipse"].indexOf(type) >= 0) {
|
|
63098
|
-
model = new SegmentsModel(yMap, this.scope, type, this.liveCursor);
|
|
63308
|
+
model = new SegmentsModel(yMap, this.scope, type, this.liveCursor, this.isPerformanceMode);
|
|
63099
63309
|
} else if (type === "selector") {
|
|
63100
|
-
model = new SelectorModel(yMap, this.scope, this.liveCursor);
|
|
63310
|
+
model = new SelectorModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63101
63311
|
} else if (type === "arrow") {
|
|
63102
|
-
model = new LineModel(yMap, this.scope, this.liveCursor);
|
|
63312
|
+
model = new LineModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63103
63313
|
} else if (type === "line") {
|
|
63104
|
-
model = new StraightLineModel(yMap, this.scope, this.liveCursor);
|
|
63314
|
+
model = new StraightLineModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63105
63315
|
} else if (type === "point-text") {
|
|
63106
|
-
model = new PointTextModel(yMap, this.scope, this.liveCursor);
|
|
63316
|
+
model = new PointTextModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63107
63317
|
} else if (type === "triangle") {
|
|
63108
|
-
model = new TriangleModel(yMap, this.scope, this.liveCursor);
|
|
63318
|
+
model = new TriangleModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63109
63319
|
} else if (type === "rectangle") {
|
|
63110
|
-
model = new RectangleModel(yMap, this.scope, this.liveCursor);
|
|
63320
|
+
model = new RectangleModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63111
63321
|
} else if (type === "eraser") {
|
|
63112
|
-
model = new EraserModel(yMap, this.scope, this.liveCursor);
|
|
63322
|
+
model = new EraserModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63113
63323
|
} else if (type === "laser") {
|
|
63114
|
-
model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, this.liveCursor, (
|
|
63115
|
-
this.removeElementItem(
|
|
63116
|
-
});
|
|
63324
|
+
model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, this.liveCursor, (uuid2) => {
|
|
63325
|
+
this.removeElementItem(uuid2);
|
|
63326
|
+
}, this.isPerformanceMode);
|
|
63117
63327
|
} else if (type === "image") {
|
|
63118
|
-
model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor);
|
|
63328
|
+
model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor, this.isPerformanceMode);
|
|
63119
63329
|
}
|
|
63120
63330
|
if (model) {
|
|
63121
63331
|
model.shadowEmitter = this.shadowEmitter;
|
|
@@ -63149,7 +63359,7 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63149
63359
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63150
63360
|
this.elements.set(uuid, yMap);
|
|
63151
63361
|
}, elementsUndoOrigin);
|
|
63152
|
-
const model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor);
|
|
63362
|
+
const model = new ImageModel(yMap, this.scope, this.imageSets, this.liveCursor, this.isPerformanceMode);
|
|
63153
63363
|
model.root.set("src", src);
|
|
63154
63364
|
const initMatrix = new this.scope.Matrix();
|
|
63155
63365
|
const center = this.scope.project.view.center;
|
|
@@ -63166,8 +63376,10 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63166
63376
|
return null;
|
|
63167
63377
|
}
|
|
63168
63378
|
const yMap = new Y12.Map();
|
|
63379
|
+
const uuid = this.uuid;
|
|
63380
|
+
const curveModel = new CurveModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63381
|
+
this.elementModels.set(uuid, curveModel);
|
|
63169
63382
|
this.elements.doc?.transact(() => {
|
|
63170
|
-
const uuid = this.uuid;
|
|
63171
63383
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63172
63384
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63173
63385
|
yMap.set("type", "curve");
|
|
@@ -63180,7 +63392,6 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63180
63392
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63181
63393
|
this.elements.set(uuid, yMap);
|
|
63182
63394
|
}, elementsUndoOrigin);
|
|
63183
|
-
const curveModel = new CurveModel(yMap, this.scope, this.liveCursor);
|
|
63184
63395
|
this.initElement(curveModel);
|
|
63185
63396
|
return curveModel;
|
|
63186
63397
|
}
|
|
@@ -63189,11 +63400,17 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63189
63400
|
return null;
|
|
63190
63401
|
}
|
|
63191
63402
|
const yMap = new Y12.Map();
|
|
63403
|
+
const uuid = this.uuid;
|
|
63404
|
+
const model = new LaserPointerModel(this.userManager.selfId, yMap, this.scope, this.liveCursor, (uuid2) => {
|
|
63405
|
+
this.removeElementItem(uuid2);
|
|
63406
|
+
}, this.isPerformanceMode);
|
|
63407
|
+
this.elementModels.set(uuid, model);
|
|
63192
63408
|
this.elements.doc?.transact(() => {
|
|
63193
|
-
const uuid = this.uuid;
|
|
63194
63409
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63195
63410
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63196
63411
|
yMap.set("type", "laser");
|
|
63412
|
+
yMap.set(ElementModel.KEYS.points, new Y12.Array());
|
|
63413
|
+
yMap.set("removed", false);
|
|
63197
63414
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63198
63415
|
yMap.set(ElementModel.KEYS.strokeWidth, 8);
|
|
63199
63416
|
yMap.set(ElementModel.KEYS.strokeColor, "#F44336");
|
|
@@ -63201,9 +63418,7 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63201
63418
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63202
63419
|
this.elements.set(uuid, yMap);
|
|
63203
63420
|
}, elementsUndoOrigin);
|
|
63204
|
-
|
|
63205
|
-
this.removeElementItem(uuid);
|
|
63206
|
-
});
|
|
63421
|
+
this.initElement(model);
|
|
63207
63422
|
return model;
|
|
63208
63423
|
}
|
|
63209
63424
|
createEraser() {
|
|
@@ -63211,11 +63426,14 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63211
63426
|
return null;
|
|
63212
63427
|
}
|
|
63213
63428
|
const yMap = new Y12.Map();
|
|
63429
|
+
const uuid = this.uuid;
|
|
63430
|
+
const model = new EraserModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63431
|
+
this.elementModels.set(uuid, model);
|
|
63214
63432
|
this.elements.doc?.transact(() => {
|
|
63215
|
-
const uuid = this.uuid;
|
|
63216
63433
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63217
63434
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63218
63435
|
yMap.set("type", "eraser");
|
|
63436
|
+
yMap.set(ElementModel.KEYS.points, new Y12.Array());
|
|
63219
63437
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63220
63438
|
yMap.set(ElementModel.KEYS.strokeWidth, 4);
|
|
63221
63439
|
yMap.set(ElementModel.KEYS.strokeColor, "#9E9E9E");
|
|
@@ -63223,7 +63441,6 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63223
63441
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63224
63442
|
this.elements.set(uuid, yMap);
|
|
63225
63443
|
}, elementsUndoOrigin);
|
|
63226
|
-
const model = new EraserModel(yMap, this.scope, this.liveCursor);
|
|
63227
63444
|
return model;
|
|
63228
63445
|
}
|
|
63229
63446
|
createTriangle(shadow) {
|
|
@@ -63231,45 +63448,52 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63231
63448
|
return null;
|
|
63232
63449
|
}
|
|
63233
63450
|
const yMap = new Y12.Map();
|
|
63451
|
+
const uuid = this.uuid;
|
|
63452
|
+
const triangleModel = new TriangleModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63453
|
+
this.elementModels.set(uuid, triangleModel);
|
|
63234
63454
|
this.elements.doc?.transact(() => {
|
|
63235
|
-
const uuid = this.uuid;
|
|
63236
63455
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63237
63456
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63238
63457
|
yMap.set("type", "triangle");
|
|
63239
63458
|
if (shadow) {
|
|
63240
63459
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63241
63460
|
}
|
|
63461
|
+
yMap.set("points", new Y12.Array());
|
|
63242
63462
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63243
63463
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63244
63464
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63245
63465
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63246
63466
|
this.elements.set(uuid, yMap);
|
|
63247
63467
|
}, elementsUndoOrigin);
|
|
63248
|
-
|
|
63249
|
-
this.
|
|
63250
|
-
|
|
63251
|
-
return triangle;
|
|
63468
|
+
this.initElement(triangleModel);
|
|
63469
|
+
triangleModel.dashArray = this.toolbarModel.dashArray;
|
|
63470
|
+
return triangleModel;
|
|
63252
63471
|
}
|
|
63253
63472
|
createRectangle(shadow) {
|
|
63254
63473
|
if (!this.confirmPermission()) {
|
|
63255
63474
|
return null;
|
|
63256
63475
|
}
|
|
63257
63476
|
const yMap = new Y12.Map();
|
|
63477
|
+
const uuid = this.uuid;
|
|
63478
|
+
const rect = new RectangleModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63479
|
+
this.elementModels.set(uuid, rect);
|
|
63258
63480
|
this.elements.doc?.transact(() => {
|
|
63259
|
-
const uuid = this.uuid;
|
|
63260
63481
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63261
63482
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63262
63483
|
yMap.set("type", "rectangle");
|
|
63263
63484
|
if (shadow) {
|
|
63264
63485
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63265
63486
|
}
|
|
63487
|
+
const initPoints = new Y12.Array();
|
|
63488
|
+
initPoints.push([0, 0, 0, 0]);
|
|
63489
|
+
yMap.set("points", initPoints);
|
|
63490
|
+
yMap.set("radius", 0);
|
|
63266
63491
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63267
63492
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63268
63493
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63269
63494
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63270
63495
|
this.elements.set(uuid, yMap);
|
|
63271
63496
|
}, elementsUndoOrigin);
|
|
63272
|
-
const rect = new RectangleModel(yMap, this.scope, this.liveCursor);
|
|
63273
63497
|
this.initElement(rect);
|
|
63274
63498
|
rect.dashArray = this.toolbarModel.dashArray;
|
|
63275
63499
|
return rect;
|
|
@@ -63279,21 +63503,23 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63279
63503
|
return null;
|
|
63280
63504
|
}
|
|
63281
63505
|
const yMap = new Y12.Map();
|
|
63506
|
+
const uuid = this.uuid;
|
|
63507
|
+
const segmentsModel = new SegmentsModel(yMap, this.scope, type, this.liveCursor, this.isPerformanceMode);
|
|
63508
|
+
this.elementModels.set(uuid, segmentsModel);
|
|
63282
63509
|
this.elements.doc?.transact(() => {
|
|
63283
|
-
const uuid = this.uuid;
|
|
63284
63510
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63285
63511
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63286
63512
|
yMap.set("type", type);
|
|
63287
63513
|
if (shadow) {
|
|
63288
63514
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63289
63515
|
}
|
|
63516
|
+
yMap.set(ElementModel.KEYS.points, new Y12.Array());
|
|
63290
63517
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63291
63518
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63292
63519
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63293
63520
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63294
63521
|
this.elements.set(uuid, yMap);
|
|
63295
63522
|
}, elementsUndoOrigin);
|
|
63296
|
-
const segmentsModel = new SegmentsModel(yMap, this.scope, type, this.liveCursor);
|
|
63297
63523
|
this.initElement(segmentsModel);
|
|
63298
63524
|
segmentsModel.dashArray = this.toolbarModel.dashArray;
|
|
63299
63525
|
return segmentsModel;
|
|
@@ -63304,16 +63530,20 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63304
63530
|
return null;
|
|
63305
63531
|
}
|
|
63306
63532
|
const yMap = new Y12.Map();
|
|
63533
|
+
const uuid = this.uuid;
|
|
63534
|
+
const selectorModel = new SelectorModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63535
|
+
this.elementModels.set(uuid, selectorModel);
|
|
63307
63536
|
this.elements.doc?.transact(() => {
|
|
63308
|
-
const uuid = this.uuid;
|
|
63309
63537
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63310
63538
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63311
63539
|
yMap.set("type", "selector");
|
|
63540
|
+
const initPoints = new Y12.Array();
|
|
63541
|
+
initPoints.push([0, 0, 0, 0]);
|
|
63542
|
+
yMap.set(ElementModel.KEYS.points, initPoints);
|
|
63312
63543
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63313
63544
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63314
63545
|
this.elements.set(uuid, yMap);
|
|
63315
63546
|
}, elementsUndoOrigin);
|
|
63316
|
-
const selectorModel = new SelectorModel(yMap, this.scope, this.liveCursor);
|
|
63317
63547
|
selectorModel.shadow = "layer";
|
|
63318
63548
|
return selectorModel;
|
|
63319
63549
|
}
|
|
@@ -63322,21 +63552,23 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63322
63552
|
return null;
|
|
63323
63553
|
}
|
|
63324
63554
|
const yMap = new Y12.Map();
|
|
63555
|
+
const uuid = this.uuid;
|
|
63556
|
+
const straightLineModel = new StraightLineModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63557
|
+
this.elementModels.set(uuid, straightLineModel);
|
|
63325
63558
|
this.elements.doc?.transact(() => {
|
|
63326
|
-
const uuid = this.uuid;
|
|
63327
63559
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63328
63560
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63329
63561
|
yMap.set("type", "line");
|
|
63330
63562
|
if (shadow) {
|
|
63331
63563
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63332
63564
|
}
|
|
63565
|
+
yMap.set("points", new Y12.Array());
|
|
63333
63566
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63334
63567
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63335
63568
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63336
63569
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63337
63570
|
this.elements.set(uuid, yMap);
|
|
63338
63571
|
}, elementsUndoOrigin);
|
|
63339
|
-
const straightLineModel = new StraightLineModel(yMap, this.scope, this.liveCursor);
|
|
63340
63572
|
this.initElement(straightLineModel);
|
|
63341
63573
|
straightLineModel.dashArray = this.toolbarModel.dashArray;
|
|
63342
63574
|
return straightLineModel;
|
|
@@ -63346,21 +63578,25 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63346
63578
|
return null;
|
|
63347
63579
|
}
|
|
63348
63580
|
const yMap = new Y12.Map();
|
|
63581
|
+
const uuid = this.uuid;
|
|
63582
|
+
const lineModel = new LineModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63583
|
+
this.elementModels.set(uuid, lineModel);
|
|
63349
63584
|
this.elements.doc?.transact(() => {
|
|
63350
|
-
const uuid = this.uuid;
|
|
63351
63585
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63352
63586
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63353
63587
|
yMap.set("type", "arrow");
|
|
63354
63588
|
if (shadow) {
|
|
63355
63589
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63356
63590
|
}
|
|
63591
|
+
yMap.set("headArrow", "none");
|
|
63592
|
+
yMap.set("tailArrow", "normal");
|
|
63593
|
+
yMap.set(ElementModel.KEYS.points, new Y12.Array());
|
|
63357
63594
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63358
63595
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63359
63596
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63360
63597
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63361
63598
|
this.elements.set(uuid, yMap);
|
|
63362
63599
|
}, elementsUndoOrigin);
|
|
63363
|
-
const lineModel = new LineModel(yMap, this.scope, this.liveCursor);
|
|
63364
63600
|
this.initElement(lineModel);
|
|
63365
63601
|
lineModel.dashArray = this.toolbarModel.dashArray;
|
|
63366
63602
|
return lineModel;
|
|
@@ -63370,21 +63606,23 @@ var RenderableModel = class extends EventEmitter {
|
|
|
63370
63606
|
return null;
|
|
63371
63607
|
}
|
|
63372
63608
|
const yMap = new Y12.Map();
|
|
63609
|
+
const uuid = this.uuid;
|
|
63610
|
+
const pointTextModel = new PointTextModel(yMap, this.scope, this.liveCursor, this.isPerformanceMode);
|
|
63611
|
+
this.elementModels.set(uuid, pointTextModel);
|
|
63373
63612
|
this.elements.doc?.transact(() => {
|
|
63374
|
-
const uuid = this.uuid;
|
|
63375
63613
|
yMap.set(ElementModel.KEYS.index, ++this.maxIndex);
|
|
63376
63614
|
yMap.set(ElementModel.KEYS.uuid, uuid);
|
|
63377
63615
|
yMap.set("type", "point-text");
|
|
63378
63616
|
if (shadow) {
|
|
63379
63617
|
yMap.set(ElementModel.KEYS.shadow, "layer");
|
|
63380
63618
|
}
|
|
63619
|
+
yMap.set(ElementModel.KEYS.points, new Y12.Array());
|
|
63381
63620
|
yMap.set(ElementModel.KEYS.strokeWidth, this.toolbarModel.strokeWidth);
|
|
63382
63621
|
yMap.set(ElementModel.KEYS.strokeColor, this.toolbarModel.strokeColor);
|
|
63383
63622
|
yMap.set(ElementModel.KEYS.fillColor, this.toolbarModel.fillColor);
|
|
63384
63623
|
yMap.set(ElementModel.KEYS.ownerId, this.userManager.selfId);
|
|
63385
63624
|
this.elements.set(uuid, yMap);
|
|
63386
63625
|
}, elementsUndoOrigin);
|
|
63387
|
-
const pointTextModel = new PointTextModel(yMap, this.scope, this.liveCursor);
|
|
63388
63626
|
pointTextModel.setPoints([x, y]);
|
|
63389
63627
|
pointTextModel.fontSize = this.toolbarModel.fontSize;
|
|
63390
63628
|
pointTextModel.fontFamily = this.toolbarModel.fontFamily;
|
|
@@ -63702,7 +63940,7 @@ var CurveTool = class extends WhiteboardTool {
|
|
|
63702
63940
|
_defineProperty19(this, "recognizer", new Recognizer());
|
|
63703
63941
|
_defineProperty19(this, "pointCount", 0);
|
|
63704
63942
|
_defineProperty19(this, "showLiveCursor", true);
|
|
63705
|
-
this.tool.minDistance =
|
|
63943
|
+
this.tool.minDistance = 20;
|
|
63706
63944
|
}
|
|
63707
63945
|
onMouseDown(_event) {
|
|
63708
63946
|
this.pointCount = 0;
|
|
@@ -65622,6 +65860,8 @@ var Whiteboard = class extends EventEmitter8 {
|
|
|
65622
65860
|
_defineProperty31(this, "enableCameraBoundaryHighlight", void 0);
|
|
65623
65861
|
_defineProperty31(this, "getElementAttribute", void 0);
|
|
65624
65862
|
_defineProperty31(this, "setElementAttribute", void 0);
|
|
65863
|
+
_defineProperty31(this, "setPerformanceMode", void 0);
|
|
65864
|
+
_defineProperty31(this, "isPerformanceMode", void 0);
|
|
65625
65865
|
_defineProperty31(this, "removeElement", void 0);
|
|
65626
65866
|
_defineProperty31(this, "getCurrentTool", void 0);
|
|
65627
65867
|
_defineProperty31(this, "setCurrentTool", void 0);
|
|
@@ -65911,9 +66151,24 @@ var LaserPointerTool = class extends WhiteboardTool {
|
|
|
65911
66151
|
if (this.pointCount > 1024) {
|
|
65912
66152
|
return;
|
|
65913
66153
|
}
|
|
66154
|
+
const MIN_DISTANCE = 4;
|
|
65914
66155
|
if (this.elementModel) {
|
|
65915
|
-
this.
|
|
65916
|
-
|
|
66156
|
+
const len = this.elementModel.points.length;
|
|
66157
|
+
let last = {
|
|
66158
|
+
x: 0,
|
|
66159
|
+
y: 0
|
|
66160
|
+
};
|
|
66161
|
+
if (len >= 2) {
|
|
66162
|
+
last = {
|
|
66163
|
+
x: this.elementModel.points[len - 2],
|
|
66164
|
+
y: this.elementModel.points[len - 1]
|
|
66165
|
+
};
|
|
66166
|
+
}
|
|
66167
|
+
const dist = Math.max(Math.abs(last.x - event.point.x), Math.abs(last.y - event.point.y));
|
|
66168
|
+
if (dist >= MIN_DISTANCE) {
|
|
66169
|
+
this.pointCount += 1;
|
|
66170
|
+
this.elementModel.appendPoints([Math.round(event.point.x), Math.round(event.point.y)]);
|
|
66171
|
+
}
|
|
65917
66172
|
}
|
|
65918
66173
|
}
|
|
65919
66174
|
onMouseUp(_event) {
|
|
@@ -66988,6 +67243,9 @@ var WhiteboardApplication = class _WhiteboardApplication extends AbstractApplica
|
|
|
66988
67243
|
_defineProperty43(this, "hasPermission", (flag) => {
|
|
66989
67244
|
return this.permissions.hasPermission(flag, this.userId);
|
|
66990
67245
|
});
|
|
67246
|
+
_defineProperty43(this, "isPerformanceMode", () => {
|
|
67247
|
+
return this.option.performance ?? false;
|
|
67248
|
+
});
|
|
66991
67249
|
_defineProperty43(this, "handleStackItemAdded", () => {
|
|
66992
67250
|
this.selectElementsModel.clearSelectElementForSelf();
|
|
66993
67251
|
this.emitter.emit("redoStackLength", this.undoManager?.redoStack.length ?? 0);
|
|
@@ -67002,7 +67260,18 @@ var WhiteboardApplication = class _WhiteboardApplication extends AbstractApplica
|
|
|
67002
67260
|
const id = ids[i];
|
|
67003
67261
|
if (!this.layers.has(id)) {
|
|
67004
67262
|
const elementsMap = this.getMap(`layer/${id}/elements`);
|
|
67005
|
-
const renderableModel = new RenderableModel(
|
|
67263
|
+
const renderableModel = new RenderableModel({
|
|
67264
|
+
layerId: id,
|
|
67265
|
+
shadowEmitter: this.shadowEmitter,
|
|
67266
|
+
elements: elementsMap,
|
|
67267
|
+
scope: this.paperScope,
|
|
67268
|
+
toolbarModel: this.toolbarModel,
|
|
67269
|
+
userManager: this.userManager,
|
|
67270
|
+
imageSets: this.imageSets,
|
|
67271
|
+
liveCursor: this.liveCursor,
|
|
67272
|
+
hasPermission: this.hasPermission,
|
|
67273
|
+
isPerformanceMode: this.isPerformanceMode
|
|
67274
|
+
});
|
|
67006
67275
|
this.layers.set(id, renderableModel);
|
|
67007
67276
|
}
|
|
67008
67277
|
if (!this.undoManagers.has(id)) {
|
|
@@ -67269,6 +67538,12 @@ var WhiteboardApplication = class _WhiteboardApplication extends AbstractApplica
|
|
|
67269
67538
|
this.camera.resetViewMatrixToFlow(flowId);
|
|
67270
67539
|
}
|
|
67271
67540
|
};
|
|
67541
|
+
this.emitter.setPerformanceMode = (enabled) => {
|
|
67542
|
+
this.option.performance = enabled;
|
|
67543
|
+
};
|
|
67544
|
+
this.emitter.isPerformanceMode = () => {
|
|
67545
|
+
return this.isPerformanceMode();
|
|
67546
|
+
};
|
|
67272
67547
|
this.emitter.setViewModeToMain = (userId) => {
|
|
67273
67548
|
if (that.disableViewModelUpdate) {
|
|
67274
67549
|
console.warn("Operation failed. Perspective mode switching is disabled in the current environment.");
|
|
@@ -67323,7 +67598,18 @@ var WhiteboardApplication = class _WhiteboardApplication extends AbstractApplica
|
|
|
67323
67598
|
const source = this.getMap(`layer/${sourceId}/elements`);
|
|
67324
67599
|
const target = this.getMap(`layer/${targetId}/elements`);
|
|
67325
67600
|
if (!this.layers.has(targetId)) {
|
|
67326
|
-
this.layers.set(targetId, new RenderableModel(
|
|
67601
|
+
this.layers.set(targetId, new RenderableModel({
|
|
67602
|
+
layerId: targetId,
|
|
67603
|
+
shadowEmitter: this.shadowEmitter,
|
|
67604
|
+
elements: target,
|
|
67605
|
+
scope: this.paperScope,
|
|
67606
|
+
toolbarModel: this.toolbarModel,
|
|
67607
|
+
userManager: this.userManager,
|
|
67608
|
+
imageSets: this.imageSets,
|
|
67609
|
+
liveCursor: this.liveCursor,
|
|
67610
|
+
hasPermission: this.hasPermission,
|
|
67611
|
+
isPerformanceMode: this.isPerformanceMode
|
|
67612
|
+
}));
|
|
67327
67613
|
}
|
|
67328
67614
|
if (!this.undoManagers.has(targetId)) {
|
|
67329
67615
|
const undoManager = new Y15.UndoManager(target, {
|
|
@@ -67558,6 +67844,11 @@ var WhiteboardApplication = class _WhiteboardApplication extends AbstractApplica
|
|
|
67558
67844
|
this.editors.forEach((editor) => {
|
|
67559
67845
|
editor.updateBounds();
|
|
67560
67846
|
});
|
|
67847
|
+
const area = this.paperScope.project.view.size.width * this.paperScope.project.view.size.height;
|
|
67848
|
+
const minDistance = Math.ceil(area / 4e5);
|
|
67849
|
+
Object.keys(this.tools).forEach((key) => {
|
|
67850
|
+
this.tools[key].tool.minDistance = minDistance;
|
|
67851
|
+
});
|
|
67561
67852
|
});
|
|
67562
67853
|
this.camera.on("userPageChange", (userId, pageId) => {
|
|
67563
67854
|
this.emitter.emit("activePageChange", userId, pageId);
|