@idraw/core 0.4.0-beta.39 → 0.4.0-beta.40
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/esm/board/index.d.ts +46 -0
- package/dist/esm/board/index.js +371 -0
- package/dist/esm/board/sharer.d.ts +21 -0
- package/dist/esm/board/sharer.js +101 -0
- package/dist/esm/board/viewer.d.ts +32 -0
- package/dist/esm/board/viewer.js +165 -0
- package/dist/esm/board/watcher.d.ts +15 -0
- package/dist/esm/board/watcher.js +218 -0
- package/dist/esm/config.d.ts +2 -0
- package/dist/esm/config.js +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +4 -3
- package/dist/esm/middleware/layout-selector/index.js +4 -1
- package/dist/esm/middleware/scroller/util.js +2 -1
- package/dist/esm/middleware/selector/index.js +23 -8
- package/dist/esm/middleware/selector/util.d.ts +4 -2
- package/dist/esm/middleware/selector/util.js +5 -3
- package/dist/index.global.js +1137 -1045
- package/dist/index.global.min.js +1 -1
- package/package.json +5 -6
package/dist/index.global.js
CHANGED
|
@@ -8,22 +8,22 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
8
8
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
9
9
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
10
10
|
|
|
11
|
-
var _eventHub, _container, _cursorType, _resizeCursorBaseImage, _cursorImageMap, _Cursor_instances,
|
|
11
|
+
var _opts, _store, _hasDestroyed, _BoardWatcher_instances, init_fn, _onWheel, _onContextMenu, _onClick, _onPointLeave, _onPointEnd, _onPointMove, _onPointStart, _onHover, isInTarget_fn, getPoint_fn, isVaildPoint_fn, _activeStore, _sharedStore, _opts2, _drawFrameSnapshotQueue, _drawFrameStatus, _Viewer_instances, init_fn2, drawAnimationFrame_fn, _opts3, _middlewareMap, _middlewares, _activeMiddlewareObjs, _watcher, _renderer, _sharer, _viewer, _calculator, _eventHub, _hasDestroyed2, _Board_instances, init_fn3, handlePointStart_fn, handlePointEnd_fn, handlePointMove_fn, handlePointLeave_fn, handleHover_fn, handleDoubleClick_fn, handleContextMenu_fn, handleWheel_fn, handleWheelScale_fn, handleScrollX_fn, handleScrollY_fn, handleResize_fn, handleClear_fn, handleBeforeDrawFrame_fn, handleAfterDrawFrame_fn, resetActiveMiddlewareObjs_fn, _eventHub2, _container, _cursorType, _resizeCursorBaseImage, _cursorImageMap, _Cursor_instances, init_fn4, loadResizeCursorBaseImage_fn, resetCursor_fn, setCursorResize_fn, appendRotateResizeImage_fn, _board, _canvas, _container2, _Core_instances, initContainer_fn;
|
|
12
12
|
function isColorStr(color2) {
|
|
13
|
-
return typeof color2 === "string" && (
|
|
13
|
+
return typeof color2 === "string" && (/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color2) || /^[a-z]{1,}$/i.test(color2));
|
|
14
14
|
}
|
|
15
15
|
function mergeHexColorAlpha(hex, alpha) {
|
|
16
16
|
if (alpha === 1) {
|
|
17
17
|
return hex;
|
|
18
18
|
}
|
|
19
19
|
let hexAlpha = 1;
|
|
20
|
-
const regHex1 =
|
|
21
|
-
const regHex2 =
|
|
20
|
+
const regHex1 = /^#[0-9a-f]{6,6}$/i;
|
|
21
|
+
const regHex2 = /^#[0-9a-f]{8,8}$/i;
|
|
22
22
|
let result = hex;
|
|
23
23
|
if (regHex1.test(hex)) {
|
|
24
|
-
hexAlpha = parseInt(hex.substring(5, 7).replace(
|
|
24
|
+
hexAlpha = parseInt(hex.substring(5, 7).replace(/^#/, "0x"));
|
|
25
25
|
} else if (regHex2.test(hex)) {
|
|
26
|
-
hexAlpha = parseInt(hex.substring(7, 9).replace(
|
|
26
|
+
hexAlpha = parseInt(hex.substring(7, 9).replace(/^#/, "0x"));
|
|
27
27
|
result = hex.substring(0, 7);
|
|
28
28
|
}
|
|
29
29
|
hexAlpha = hexAlpha * alpha;
|
|
@@ -64,6 +64,17 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
64
64
|
function isAssetId(id) {
|
|
65
65
|
return /^@assets\/[0-9a-z]{8,8}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{4,4}\-[0-9a-z]{12,12}$/.test(`${id}`);
|
|
66
66
|
}
|
|
67
|
+
(function(s, e) {
|
|
68
|
+
var t = {};
|
|
69
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
70
|
+
t[p] = s[p];
|
|
71
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
72
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
73
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
74
|
+
t[p[i]] = s[p[i]];
|
|
75
|
+
}
|
|
76
|
+
return t;
|
|
77
|
+
});
|
|
67
78
|
function deepClone(target) {
|
|
68
79
|
function _clone(t) {
|
|
69
80
|
const type = is$1(t);
|
|
@@ -236,6 +247,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
236
247
|
return image;
|
|
237
248
|
});
|
|
238
249
|
}
|
|
250
|
+
function positiveNum(value) {
|
|
251
|
+
return typeof value === "number" && value >= 0;
|
|
252
|
+
}
|
|
239
253
|
function number(value) {
|
|
240
254
|
return typeof value === "number" && (value > 0 || value <= 0);
|
|
241
255
|
}
|
|
@@ -246,19 +260,19 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
246
260
|
return number(value);
|
|
247
261
|
}
|
|
248
262
|
function w(value) {
|
|
249
|
-
return
|
|
263
|
+
return positiveNum(value);
|
|
250
264
|
}
|
|
251
265
|
function h(value) {
|
|
252
|
-
return
|
|
266
|
+
return positiveNum(value);
|
|
253
267
|
}
|
|
254
268
|
function angle(value) {
|
|
255
269
|
return typeof value === "number" && value >= -360 && value <= 360;
|
|
256
270
|
}
|
|
257
271
|
function borderWidth(value) {
|
|
258
|
-
return
|
|
272
|
+
return positiveNum(value) || Array.isArray(value) && positiveNum(value[0]) && positiveNum(value[1]) && positiveNum(value[2]) && positiveNum(value[3]);
|
|
259
273
|
}
|
|
260
274
|
function borderRadius(value) {
|
|
261
|
-
return
|
|
275
|
+
return positiveNum(value) || Array.isArray(value) && positiveNum(value[0]) && positiveNum(value[1]) && positiveNum(value[2]) && positiveNum(value[3]);
|
|
262
276
|
}
|
|
263
277
|
function color(value) {
|
|
264
278
|
return isColorStr(value);
|
|
@@ -312,6 +326,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
312
326
|
return /^(-?\d+(?:\.\d+)?)$/.test(`${value}`);
|
|
313
327
|
}
|
|
314
328
|
const is = {
|
|
329
|
+
positiveNum,
|
|
315
330
|
x,
|
|
316
331
|
y,
|
|
317
332
|
w,
|
|
@@ -335,13 +350,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
335
350
|
fontWeight: fontWeight$1,
|
|
336
351
|
strokeWidth
|
|
337
352
|
};
|
|
338
|
-
var __classPrivateFieldSet$
|
|
353
|
+
var __classPrivateFieldSet$5 = function(receiver, state, value, kind, f) {
|
|
339
354
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
340
355
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
341
356
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
342
357
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
343
358
|
};
|
|
344
|
-
var __classPrivateFieldGet$
|
|
359
|
+
var __classPrivateFieldGet$5 = function(receiver, state, kind, f) {
|
|
345
360
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
346
361
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
347
362
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -354,21 +369,21 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
354
369
|
constructor(ctx, opts) {
|
|
355
370
|
_Context2D_ctx.set(this, void 0);
|
|
356
371
|
_Context2D_opts.set(this, void 0);
|
|
357
|
-
__classPrivateFieldSet$
|
|
358
|
-
__classPrivateFieldSet$
|
|
372
|
+
__classPrivateFieldSet$5(this, _Context2D_ctx, ctx, "f");
|
|
373
|
+
__classPrivateFieldSet$5(this, _Context2D_opts, Object.assign({ devicePixelRatio: 1, offscreenCanvas: null }, opts), "f");
|
|
359
374
|
this.$resetFont();
|
|
360
375
|
}
|
|
361
376
|
$undoPixelRatio(num) {
|
|
362
|
-
return num / __classPrivateFieldGet$
|
|
377
|
+
return num / __classPrivateFieldGet$5(this, _Context2D_opts, "f").devicePixelRatio;
|
|
363
378
|
}
|
|
364
379
|
$doPixelRatio(num) {
|
|
365
|
-
return __classPrivateFieldGet$
|
|
380
|
+
return __classPrivateFieldGet$5(this, _Context2D_opts, "f").devicePixelRatio * num;
|
|
366
381
|
}
|
|
367
382
|
$getContext() {
|
|
368
|
-
return __classPrivateFieldGet$
|
|
383
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f");
|
|
369
384
|
}
|
|
370
385
|
$setContext(ctx) {
|
|
371
|
-
__classPrivateFieldSet$
|
|
386
|
+
__classPrivateFieldSet$5(this, _Context2D_ctx, ctx, "f");
|
|
372
387
|
}
|
|
373
388
|
$setFont(opts) {
|
|
374
389
|
const strList = [];
|
|
@@ -377,7 +392,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
377
392
|
}
|
|
378
393
|
strList.push(`${this.$doPixelRatio(opts.fontSize || 12)}px`);
|
|
379
394
|
strList.push(`${opts.fontFamily || "sans-serif"}`);
|
|
380
|
-
__classPrivateFieldGet$
|
|
395
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").font = `${strList.join(" ")}`;
|
|
381
396
|
}
|
|
382
397
|
$resetFont() {
|
|
383
398
|
this.$setFont({
|
|
@@ -387,14 +402,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
387
402
|
});
|
|
388
403
|
}
|
|
389
404
|
$getOffscreenCanvas() {
|
|
390
|
-
return __classPrivateFieldGet$
|
|
405
|
+
return __classPrivateFieldGet$5(this, _Context2D_opts, "f").offscreenCanvas;
|
|
391
406
|
}
|
|
392
407
|
$resize(opts) {
|
|
393
408
|
const { width, height, devicePixelRatio, resetStyle } = opts;
|
|
394
|
-
const { canvas } = __classPrivateFieldGet$
|
|
409
|
+
const { canvas } = __classPrivateFieldGet$5(this, _Context2D_ctx, "f");
|
|
395
410
|
canvas.width = width * devicePixelRatio;
|
|
396
411
|
canvas.height = height * devicePixelRatio;
|
|
397
|
-
__classPrivateFieldSet$
|
|
412
|
+
__classPrivateFieldSet$5(this, _Context2D_opts, Object.assign(Object.assign({}, __classPrivateFieldGet$5(this, _Context2D_opts, "f")), {
|
|
398
413
|
devicePixelRatio
|
|
399
414
|
}), "f");
|
|
400
415
|
if (resetStyle === true) {
|
|
@@ -403,8 +418,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
403
418
|
}
|
|
404
419
|
}
|
|
405
420
|
$getSize() {
|
|
406
|
-
const { devicePixelRatio } = __classPrivateFieldGet$
|
|
407
|
-
const { width, height } = __classPrivateFieldGet$
|
|
421
|
+
const { devicePixelRatio } = __classPrivateFieldGet$5(this, _Context2D_opts, "f");
|
|
422
|
+
const { width, height } = __classPrivateFieldGet$5(this, _Context2D_ctx, "f").canvas;
|
|
408
423
|
return {
|
|
409
424
|
width: width / devicePixelRatio,
|
|
410
425
|
height: height / devicePixelRatio,
|
|
@@ -412,125 +427,131 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
412
427
|
};
|
|
413
428
|
}
|
|
414
429
|
get canvas() {
|
|
415
|
-
return __classPrivateFieldGet$
|
|
430
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").canvas;
|
|
416
431
|
}
|
|
417
432
|
get fillStyle() {
|
|
418
|
-
return __classPrivateFieldGet$
|
|
433
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").fillStyle;
|
|
419
434
|
}
|
|
420
435
|
set fillStyle(value) {
|
|
421
|
-
__classPrivateFieldGet$
|
|
436
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").fillStyle = value;
|
|
422
437
|
}
|
|
423
438
|
get strokeStyle() {
|
|
424
|
-
return __classPrivateFieldGet$
|
|
439
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").strokeStyle;
|
|
425
440
|
}
|
|
426
441
|
set strokeStyle(color2) {
|
|
427
|
-
__classPrivateFieldGet$
|
|
442
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").strokeStyle = color2;
|
|
428
443
|
}
|
|
429
444
|
get lineWidth() {
|
|
430
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
445
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$5(this, _Context2D_ctx, "f").lineWidth);
|
|
431
446
|
}
|
|
432
447
|
set lineWidth(w2) {
|
|
433
|
-
__classPrivateFieldGet$
|
|
448
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").lineWidth = this.$doPixelRatio(w2);
|
|
434
449
|
}
|
|
435
450
|
get textAlign() {
|
|
436
|
-
return __classPrivateFieldGet$
|
|
451
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").textAlign;
|
|
437
452
|
}
|
|
438
453
|
set textAlign(align) {
|
|
439
|
-
__classPrivateFieldGet$
|
|
454
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").textAlign = align;
|
|
440
455
|
}
|
|
441
456
|
get textBaseline() {
|
|
442
|
-
return __classPrivateFieldGet$
|
|
457
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").textBaseline;
|
|
443
458
|
}
|
|
444
459
|
set textBaseline(baseline) {
|
|
445
|
-
__classPrivateFieldGet$
|
|
460
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").textBaseline = baseline;
|
|
446
461
|
}
|
|
447
462
|
get globalAlpha() {
|
|
448
|
-
return __classPrivateFieldGet$
|
|
463
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").globalAlpha;
|
|
449
464
|
}
|
|
450
465
|
set globalAlpha(alpha) {
|
|
451
|
-
__classPrivateFieldGet$
|
|
466
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").globalAlpha = alpha;
|
|
452
467
|
}
|
|
453
468
|
get shadowColor() {
|
|
454
|
-
return __classPrivateFieldGet$
|
|
469
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").shadowColor;
|
|
455
470
|
}
|
|
456
471
|
set shadowColor(color2) {
|
|
457
|
-
__classPrivateFieldGet$
|
|
472
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").shadowColor = color2;
|
|
458
473
|
}
|
|
459
474
|
get shadowOffsetX() {
|
|
460
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
475
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$5(this, _Context2D_ctx, "f").shadowOffsetX);
|
|
461
476
|
}
|
|
462
477
|
set shadowOffsetX(offsetX) {
|
|
463
|
-
__classPrivateFieldGet$
|
|
478
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").shadowOffsetX = this.$doPixelRatio(offsetX);
|
|
464
479
|
}
|
|
465
480
|
get shadowOffsetY() {
|
|
466
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
481
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$5(this, _Context2D_ctx, "f").shadowOffsetY);
|
|
467
482
|
}
|
|
468
483
|
set shadowOffsetY(offsetY) {
|
|
469
|
-
__classPrivateFieldGet$
|
|
484
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").shadowOffsetY = this.$doPixelRatio(offsetY);
|
|
470
485
|
}
|
|
471
486
|
get shadowBlur() {
|
|
472
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
487
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$5(this, _Context2D_ctx, "f").shadowBlur);
|
|
473
488
|
}
|
|
474
489
|
set shadowBlur(blur) {
|
|
475
|
-
__classPrivateFieldGet$
|
|
490
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").shadowBlur = this.$doPixelRatio(blur);
|
|
476
491
|
}
|
|
477
492
|
get lineCap() {
|
|
478
|
-
return __classPrivateFieldGet$
|
|
493
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").lineCap;
|
|
479
494
|
}
|
|
480
495
|
set lineCap(lineCap) {
|
|
481
|
-
__classPrivateFieldGet$
|
|
496
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").lineCap = lineCap;
|
|
482
497
|
}
|
|
483
498
|
get globalCompositeOperation() {
|
|
484
|
-
return __classPrivateFieldGet$
|
|
499
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").globalCompositeOperation;
|
|
485
500
|
}
|
|
486
501
|
set globalCompositeOperation(operations) {
|
|
487
|
-
__classPrivateFieldGet$
|
|
502
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").globalCompositeOperation = operations;
|
|
488
503
|
}
|
|
489
504
|
fill(...args) {
|
|
490
|
-
return __classPrivateFieldGet$
|
|
505
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").fill(...args);
|
|
491
506
|
}
|
|
492
507
|
arc(x2, y2, radius, startAngle, endAngle, anticlockwise) {
|
|
493
|
-
return __classPrivateFieldGet$
|
|
508
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").arc(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(radius), startAngle, endAngle, anticlockwise);
|
|
494
509
|
}
|
|
495
510
|
rect(x2, y2, w2, h2) {
|
|
496
|
-
return __classPrivateFieldGet$
|
|
511
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").rect(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(w2), this.$doPixelRatio(h2));
|
|
497
512
|
}
|
|
498
513
|
fillRect(x2, y2, w2, h2) {
|
|
499
|
-
return __classPrivateFieldGet$
|
|
514
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").fillRect(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(w2), this.$doPixelRatio(h2));
|
|
500
515
|
}
|
|
501
516
|
clearRect(x2, y2, w2, h2) {
|
|
502
|
-
return __classPrivateFieldGet$
|
|
517
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").clearRect(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(w2), this.$doPixelRatio(h2));
|
|
503
518
|
}
|
|
504
519
|
beginPath() {
|
|
505
|
-
return __classPrivateFieldGet$
|
|
520
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").beginPath();
|
|
506
521
|
}
|
|
507
522
|
closePath() {
|
|
508
|
-
return __classPrivateFieldGet$
|
|
523
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").closePath();
|
|
509
524
|
}
|
|
510
525
|
lineTo(x2, y2) {
|
|
511
|
-
return __classPrivateFieldGet$
|
|
526
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").lineTo(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
512
527
|
}
|
|
513
528
|
moveTo(x2, y2) {
|
|
514
|
-
return __classPrivateFieldGet$
|
|
529
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").moveTo(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
515
530
|
}
|
|
516
531
|
arcTo(x1, y1, x2, y2, radius) {
|
|
517
|
-
return __classPrivateFieldGet$
|
|
532
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").arcTo(this.$doPixelRatio(x1), this.$doPixelRatio(y1), this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(radius));
|
|
533
|
+
}
|
|
534
|
+
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x2, y2) {
|
|
535
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").bezierCurveTo(this.$doPixelRatio(cp1x), this.$doPixelRatio(cp1y), this.$doPixelRatio(cp2x), this.$doPixelRatio(cp2y), this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
536
|
+
}
|
|
537
|
+
quadraticCurveTo(cpx, cpy, x2, y2) {
|
|
538
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").quadraticCurveTo(this.$doPixelRatio(cpx), this.$doPixelRatio(cpy), this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
518
539
|
}
|
|
519
540
|
getLineDash() {
|
|
520
|
-
return __classPrivateFieldGet$
|
|
541
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").getLineDash();
|
|
521
542
|
}
|
|
522
543
|
setLineDash(nums) {
|
|
523
544
|
const dash = nums.map((n) => this.$doPixelRatio(n));
|
|
524
|
-
return __classPrivateFieldGet$
|
|
545
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").setLineDash(dash);
|
|
525
546
|
}
|
|
526
547
|
stroke(path) {
|
|
527
|
-
return path ? __classPrivateFieldGet$
|
|
548
|
+
return path ? __classPrivateFieldGet$5(this, _Context2D_ctx, "f").stroke(path) : __classPrivateFieldGet$5(this, _Context2D_ctx, "f").stroke();
|
|
528
549
|
}
|
|
529
550
|
translate(x2, y2) {
|
|
530
|
-
return __classPrivateFieldGet$
|
|
551
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").translate(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
531
552
|
}
|
|
532
553
|
rotate(angle2) {
|
|
533
|
-
return __classPrivateFieldGet$
|
|
554
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").rotate(angle2);
|
|
534
555
|
}
|
|
535
556
|
drawImage(...args) {
|
|
536
557
|
const image = args[0];
|
|
@@ -543,64 +564,64 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
543
564
|
const dw = args[args.length - 2];
|
|
544
565
|
const dh = args[args.length - 1];
|
|
545
566
|
if (args.length === 9) {
|
|
546
|
-
return __classPrivateFieldGet$
|
|
567
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").drawImage(image, this.$doPixelRatio(sx), this.$doPixelRatio(sy), this.$doPixelRatio(sw), this.$doPixelRatio(sh), this.$doPixelRatio(dx), this.$doPixelRatio(dy), this.$doPixelRatio(dw), this.$doPixelRatio(dh));
|
|
547
568
|
} else {
|
|
548
|
-
return __classPrivateFieldGet$
|
|
569
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").drawImage(image, this.$doPixelRatio(dx), this.$doPixelRatio(dy), this.$doPixelRatio(dw), this.$doPixelRatio(dh));
|
|
549
570
|
}
|
|
550
571
|
}
|
|
551
572
|
createPattern(image, repetition) {
|
|
552
|
-
return __classPrivateFieldGet$
|
|
573
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").createPattern(image, repetition);
|
|
553
574
|
}
|
|
554
575
|
measureText(text2) {
|
|
555
|
-
const textMetrics = __classPrivateFieldGet$
|
|
576
|
+
const textMetrics = __classPrivateFieldGet$5(this, _Context2D_ctx, "f").measureText(text2);
|
|
556
577
|
return textMetrics;
|
|
557
578
|
}
|
|
558
579
|
fillText(text2, x2, y2, maxWidth) {
|
|
559
580
|
if (maxWidth !== void 0) {
|
|
560
|
-
return __classPrivateFieldGet$
|
|
581
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").fillText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(maxWidth));
|
|
561
582
|
} else {
|
|
562
|
-
return __classPrivateFieldGet$
|
|
583
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").fillText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
563
584
|
}
|
|
564
585
|
}
|
|
565
586
|
strokeText(text2, x2, y2, maxWidth) {
|
|
566
587
|
if (maxWidth !== void 0) {
|
|
567
|
-
return __classPrivateFieldGet$
|
|
588
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").strokeText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(maxWidth));
|
|
568
589
|
} else {
|
|
569
|
-
return __classPrivateFieldGet$
|
|
590
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").strokeText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
570
591
|
}
|
|
571
592
|
}
|
|
572
593
|
save() {
|
|
573
|
-
__classPrivateFieldGet$
|
|
594
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").save();
|
|
574
595
|
}
|
|
575
596
|
restore() {
|
|
576
|
-
__classPrivateFieldGet$
|
|
597
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").restore();
|
|
577
598
|
}
|
|
578
599
|
scale(ratioX, ratioY) {
|
|
579
|
-
__classPrivateFieldGet$
|
|
600
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").scale(ratioX, ratioY);
|
|
580
601
|
}
|
|
581
602
|
circle(x2, y2, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise) {
|
|
582
|
-
__classPrivateFieldGet$
|
|
603
|
+
__classPrivateFieldGet$5(this, _Context2D_ctx, "f").ellipse(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(radiusX), this.$doPixelRatio(radiusY), rotation, startAngle, endAngle, counterclockwise);
|
|
583
604
|
}
|
|
584
605
|
isPointInPath(x2, y2) {
|
|
585
|
-
return __classPrivateFieldGet$
|
|
606
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").isPointInPath(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
586
607
|
}
|
|
587
608
|
clip(...args) {
|
|
588
|
-
return __classPrivateFieldGet$
|
|
609
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").clip(...args);
|
|
589
610
|
}
|
|
590
611
|
setTransform(a, b, c, d, e, f) {
|
|
591
|
-
return __classPrivateFieldGet$
|
|
612
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").setTransform(a, b, c, d, e, f);
|
|
592
613
|
}
|
|
593
614
|
getTransform() {
|
|
594
|
-
return __classPrivateFieldGet$
|
|
615
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").getTransform();
|
|
595
616
|
}
|
|
596
617
|
createLinearGradient(x0, y0, x1, y1) {
|
|
597
|
-
return __classPrivateFieldGet$
|
|
618
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").createLinearGradient(this.$doPixelRatio(x0), this.$doPixelRatio(y0), this.$doPixelRatio(x1), this.$doPixelRatio(y1));
|
|
598
619
|
}
|
|
599
620
|
createRadialGradient(x0, y0, r0, x1, y1, r1) {
|
|
600
|
-
return __classPrivateFieldGet$
|
|
621
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").createRadialGradient(this.$doPixelRatio(x0), this.$doPixelRatio(y0), this.$doPixelRatio(r0), this.$doPixelRatio(x1), this.$doPixelRatio(y1), this.$doPixelRatio(r1));
|
|
601
622
|
}
|
|
602
623
|
createConicGradient(startAngle, x2, y2) {
|
|
603
|
-
return __classPrivateFieldGet$
|
|
624
|
+
return __classPrivateFieldGet$5(this, _Context2D_ctx, "f").createConicGradient(startAngle, this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
604
625
|
}
|
|
605
626
|
}
|
|
606
627
|
_Context2D_ctx = /* @__PURE__ */ new WeakMap(), _Context2D_opts = /* @__PURE__ */ new WeakMap();
|
|
@@ -628,91 +649,45 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
628
649
|
return context2d;
|
|
629
650
|
}
|
|
630
651
|
function createBoardContent(canvas, opts) {
|
|
631
|
-
const { width, height, devicePixelRatio
|
|
652
|
+
const { width, height, devicePixelRatio } = opts;
|
|
632
653
|
const ctxOpts = {
|
|
633
654
|
width,
|
|
634
655
|
height,
|
|
635
656
|
devicePixelRatio
|
|
636
657
|
};
|
|
637
658
|
const ctx = canvas.getContext("2d");
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
if (offscreen === true) {
|
|
663
|
-
const viewContext = createOffscreenContext2D(ctxOpts);
|
|
664
|
-
const overlayContext = createOffscreenContext2D(ctxOpts);
|
|
665
|
-
const underlayContext = createOffscreenContext2D(ctxOpts);
|
|
666
|
-
const boardContext = createContext2D(Object.assign({ ctx }, ctxOpts));
|
|
667
|
-
const drawView = () => {
|
|
668
|
-
const { width: w2, height: h2 } = viewContext.$getSize();
|
|
669
|
-
boardContext.clearRect(0, 0, w2, h2);
|
|
670
|
-
boardContext.drawImage(underlayContext.canvas, 0, 0, w2, h2);
|
|
671
|
-
boardContext.drawImage(viewContext.canvas, 0, 0, w2, h2);
|
|
672
|
-
boardContext.drawImage(overlayContext.canvas, 0, 0, w2, h2);
|
|
673
|
-
underlayContext.clearRect(0, 0, w2, h2);
|
|
674
|
-
viewContext.clearRect(0, 0, w2, h2);
|
|
675
|
-
overlayContext.clearRect(0, 0, w2, h2);
|
|
676
|
-
};
|
|
677
|
-
const content = {
|
|
678
|
-
underlayContext,
|
|
679
|
-
viewContext,
|
|
680
|
-
overlayContext,
|
|
681
|
-
boardContext,
|
|
682
|
-
drawView
|
|
683
|
-
};
|
|
684
|
-
return content;
|
|
685
|
-
} else {
|
|
686
|
-
const viewContext = createContext2D(ctxOpts);
|
|
687
|
-
const overlayContext = createContext2D(ctxOpts);
|
|
688
|
-
const underlayContext = createContext2D(ctxOpts);
|
|
689
|
-
const boardContext = createContext2D(Object.assign({ ctx }, ctxOpts));
|
|
690
|
-
const drawView = () => {
|
|
691
|
-
boardContext.clearRect(0, 0, width, height);
|
|
692
|
-
boardContext.drawImage(underlayContext.canvas, 0, 0, width, height);
|
|
693
|
-
boardContext.drawImage(viewContext.canvas, 0, 0, width, height);
|
|
694
|
-
boardContext.drawImage(overlayContext.canvas, 0, 0, width, height);
|
|
695
|
-
underlayContext.clearRect(0, 0, width, height);
|
|
696
|
-
viewContext.clearRect(0, 0, width, height);
|
|
697
|
-
overlayContext.clearRect(0, 0, width, height);
|
|
698
|
-
};
|
|
699
|
-
const content = {
|
|
700
|
-
underlayContext,
|
|
701
|
-
viewContext,
|
|
702
|
-
overlayContext,
|
|
703
|
-
boardContext,
|
|
704
|
-
drawView
|
|
705
|
-
};
|
|
706
|
-
return content;
|
|
707
|
-
}
|
|
659
|
+
const viewContext = createOffscreenContext2D(ctxOpts);
|
|
660
|
+
const overlayContext = createOffscreenContext2D(ctxOpts);
|
|
661
|
+
const underlayContext = createOffscreenContext2D(ctxOpts);
|
|
662
|
+
const boardContext = createContext2D(Object.assign({ ctx }, ctxOpts));
|
|
663
|
+
const tempContext = createOffscreenContext2D(ctxOpts);
|
|
664
|
+
const drawView = () => {
|
|
665
|
+
const { width: w2, height: h2 } = viewContext.$getSize();
|
|
666
|
+
boardContext.clearRect(0, 0, w2, h2);
|
|
667
|
+
boardContext.drawImage(underlayContext.canvas, 0, 0, w2, h2);
|
|
668
|
+
boardContext.drawImage(viewContext.canvas, 0, 0, w2, h2);
|
|
669
|
+
boardContext.drawImage(overlayContext.canvas, 0, 0, w2, h2);
|
|
670
|
+
underlayContext.clearRect(0, 0, w2, h2);
|
|
671
|
+
viewContext.clearRect(0, 0, w2, h2);
|
|
672
|
+
overlayContext.clearRect(0, 0, w2, h2);
|
|
673
|
+
};
|
|
674
|
+
const content = {
|
|
675
|
+
underlayContext,
|
|
676
|
+
viewContext,
|
|
677
|
+
overlayContext,
|
|
678
|
+
boardContext,
|
|
679
|
+
tempContext,
|
|
680
|
+
drawView
|
|
681
|
+
};
|
|
682
|
+
return content;
|
|
708
683
|
}
|
|
709
|
-
var __classPrivateFieldSet$
|
|
684
|
+
var __classPrivateFieldSet$4 = function(receiver, state, value, kind, f) {
|
|
710
685
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
711
686
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
712
687
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
713
688
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
714
689
|
};
|
|
715
|
-
var __classPrivateFieldGet$
|
|
690
|
+
var __classPrivateFieldGet$4 = function(receiver, state, kind, f) {
|
|
716
691
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
717
692
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
718
693
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -721,20 +696,20 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
721
696
|
class EventEmitter {
|
|
722
697
|
constructor() {
|
|
723
698
|
_EventEmitter_listeners.set(this, void 0);
|
|
724
|
-
__classPrivateFieldSet$
|
|
699
|
+
__classPrivateFieldSet$4(this, _EventEmitter_listeners, /* @__PURE__ */ new Map(), "f");
|
|
725
700
|
}
|
|
726
701
|
on(eventKey, callback) {
|
|
727
|
-
if (__classPrivateFieldGet$
|
|
728
|
-
const callbacks = __classPrivateFieldGet$
|
|
702
|
+
if (__classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").has(eventKey)) {
|
|
703
|
+
const callbacks = __classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").get(eventKey) || [];
|
|
729
704
|
callbacks === null || callbacks === void 0 ? void 0 : callbacks.push(callback);
|
|
730
|
-
__classPrivateFieldGet$
|
|
705
|
+
__classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").set(eventKey, callbacks);
|
|
731
706
|
} else {
|
|
732
|
-
__classPrivateFieldGet$
|
|
707
|
+
__classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").set(eventKey, [callback]);
|
|
733
708
|
}
|
|
734
709
|
}
|
|
735
710
|
off(eventKey, callback) {
|
|
736
|
-
if (__classPrivateFieldGet$
|
|
737
|
-
const callbacks = __classPrivateFieldGet$
|
|
711
|
+
if (__classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").has(eventKey)) {
|
|
712
|
+
const callbacks = __classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").get(eventKey);
|
|
738
713
|
if (Array.isArray(callbacks)) {
|
|
739
714
|
for (let i = 0; i < (callbacks === null || callbacks === void 0 ? void 0 : callbacks.length); i++) {
|
|
740
715
|
if (callbacks[i] === callback) {
|
|
@@ -743,11 +718,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
743
718
|
}
|
|
744
719
|
}
|
|
745
720
|
}
|
|
746
|
-
__classPrivateFieldGet$
|
|
721
|
+
__classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").set(eventKey, callbacks || []);
|
|
747
722
|
}
|
|
748
723
|
}
|
|
749
724
|
trigger(eventKey, e) {
|
|
750
|
-
const callbacks = __classPrivateFieldGet$
|
|
725
|
+
const callbacks = __classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").get(eventKey);
|
|
751
726
|
if (Array.isArray(callbacks)) {
|
|
752
727
|
callbacks.forEach((cb) => {
|
|
753
728
|
cb(e);
|
|
@@ -758,8 +733,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
758
733
|
}
|
|
759
734
|
}
|
|
760
735
|
has(name) {
|
|
761
|
-
if (__classPrivateFieldGet$
|
|
762
|
-
const list = __classPrivateFieldGet$
|
|
736
|
+
if (__classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").has(name)) {
|
|
737
|
+
const list = __classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").get(name);
|
|
763
738
|
if (Array.isArray(list) && list.length > 0) {
|
|
764
739
|
return true;
|
|
765
740
|
}
|
|
@@ -770,7 +745,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
770
745
|
this.clear();
|
|
771
746
|
}
|
|
772
747
|
clear() {
|
|
773
|
-
__classPrivateFieldGet$
|
|
748
|
+
__classPrivateFieldGet$4(this, _EventEmitter_listeners, "f").clear();
|
|
774
749
|
}
|
|
775
750
|
}
|
|
776
751
|
_EventEmitter_listeners = /* @__PURE__ */ new WeakMap();
|
|
@@ -784,13 +759,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
784
759
|
y: p1.y + (p2.y - p1.y) / 2
|
|
785
760
|
};
|
|
786
761
|
}
|
|
787
|
-
var __classPrivateFieldSet$
|
|
762
|
+
var __classPrivateFieldSet$3 = function(receiver, state, value, kind, f) {
|
|
788
763
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
789
764
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
790
765
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
791
766
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
792
767
|
};
|
|
793
|
-
var __classPrivateFieldGet$
|
|
768
|
+
var __classPrivateFieldGet$3 = function(receiver, state, kind, f) {
|
|
794
769
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
795
770
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
796
771
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -802,38 +777,38 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
802
777
|
_Store_temp.set(this, void 0);
|
|
803
778
|
_Store_backUpDefaultStorage.set(this, void 0);
|
|
804
779
|
_Store_static.set(this, void 0);
|
|
805
|
-
__classPrivateFieldSet$
|
|
806
|
-
__classPrivateFieldSet$
|
|
807
|
-
__classPrivateFieldSet$
|
|
780
|
+
__classPrivateFieldSet$3(this, _Store_backUpDefaultStorage, deepClone(opts.defaultStorage), "f");
|
|
781
|
+
__classPrivateFieldSet$3(this, _Store_temp, __classPrivateFieldGet$3(this, _Store_instances, "m", _Store_createTempStorage).call(this), "f");
|
|
782
|
+
__classPrivateFieldSet$3(this, _Store_static, opts.defaultStatic || {}, "f");
|
|
808
783
|
}
|
|
809
784
|
set(name, value) {
|
|
810
|
-
__classPrivateFieldGet$
|
|
785
|
+
__classPrivateFieldGet$3(this, _Store_temp, "f")[name] = value;
|
|
811
786
|
}
|
|
812
787
|
get(name) {
|
|
813
|
-
return __classPrivateFieldGet$
|
|
788
|
+
return __classPrivateFieldGet$3(this, _Store_temp, "f")[name];
|
|
814
789
|
}
|
|
815
790
|
setStatic(name, value) {
|
|
816
|
-
__classPrivateFieldGet$
|
|
791
|
+
__classPrivateFieldGet$3(this, _Store_static, "f")[name] = value;
|
|
817
792
|
}
|
|
818
793
|
getStatic(name) {
|
|
819
|
-
return __classPrivateFieldGet$
|
|
794
|
+
return __classPrivateFieldGet$3(this, _Store_static, "f")[name];
|
|
820
795
|
}
|
|
821
796
|
getSnapshot(opts) {
|
|
822
797
|
if ((opts === null || opts === void 0 ? void 0 : opts.deepClone) === true) {
|
|
823
|
-
return deepClone(__classPrivateFieldGet$
|
|
798
|
+
return deepClone(__classPrivateFieldGet$3(this, _Store_temp, "f"));
|
|
824
799
|
}
|
|
825
|
-
return Object.assign({}, __classPrivateFieldGet$
|
|
800
|
+
return Object.assign({}, __classPrivateFieldGet$3(this, _Store_temp, "f"));
|
|
826
801
|
}
|
|
827
802
|
clear() {
|
|
828
|
-
__classPrivateFieldSet$
|
|
803
|
+
__classPrivateFieldSet$3(this, _Store_temp, __classPrivateFieldGet$3(this, _Store_instances, "m", _Store_createTempStorage).call(this), "f");
|
|
829
804
|
}
|
|
830
805
|
destroy() {
|
|
831
|
-
__classPrivateFieldSet$
|
|
832
|
-
__classPrivateFieldSet$
|
|
806
|
+
__classPrivateFieldSet$3(this, _Store_temp, null, "f");
|
|
807
|
+
__classPrivateFieldSet$3(this, _Store_static, null, "f");
|
|
833
808
|
}
|
|
834
809
|
}
|
|
835
810
|
_Store_temp = /* @__PURE__ */ new WeakMap(), _Store_backUpDefaultStorage = /* @__PURE__ */ new WeakMap(), _Store_static = /* @__PURE__ */ new WeakMap(), _Store_instances = /* @__PURE__ */ new WeakSet(), _Store_createTempStorage = function _Store_createTempStorage2() {
|
|
836
|
-
return deepClone(__classPrivateFieldGet$
|
|
811
|
+
return deepClone(__classPrivateFieldGet$3(this, _Store_backUpDefaultStorage, "f"));
|
|
837
812
|
};
|
|
838
813
|
function getViewScaleInfoFromSnapshot(snapshot) {
|
|
839
814
|
const { activeStore } = snapshot;
|
|
@@ -992,7 +967,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
992
967
|
let resultY = point.y;
|
|
993
968
|
groupQueue.forEach((group) => {
|
|
994
969
|
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = group;
|
|
995
|
-
const center = calcElementCenter({ x: x2, y: y2, w: w2, h: h2
|
|
970
|
+
const center = calcElementCenter({ x: x2, y: y2, w: w2, h: h2 });
|
|
996
971
|
const temp = rotatePoint(center, { x: resultX, y: resultY }, parseAngleToRadian(angle2));
|
|
997
972
|
resultX = temp.x;
|
|
998
973
|
resultY = temp.y;
|
|
@@ -1289,7 +1264,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1289
1264
|
if (angle2 === 0) {
|
|
1290
1265
|
return getElementVertexes(elemSize);
|
|
1291
1266
|
}
|
|
1292
|
-
return getElementRotateVertexes(elemSize, calcElementCenter({ x: x2, y: y2, w: w2, h: h2
|
|
1267
|
+
return getElementRotateVertexes(elemSize, calcElementCenter({ x: x2, y: y2, w: w2, h: h2 }), angle2);
|
|
1293
1268
|
}
|
|
1294
1269
|
function calcElementQueueVertexesQueueInGroup(groupQueue) {
|
|
1295
1270
|
const vesList = [];
|
|
@@ -1303,7 +1278,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1303
1278
|
totalY += y2;
|
|
1304
1279
|
let ves;
|
|
1305
1280
|
if (i === 0) {
|
|
1306
|
-
const elemSize = { x: totalX, y: totalY, w: w2, h: h2
|
|
1281
|
+
const elemSize = { x: totalX, y: totalY, w: w2, h: h2 };
|
|
1307
1282
|
ves = calcElementVertexes({ x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
1308
1283
|
rotateActionList.push({
|
|
1309
1284
|
center: calcElementCenter(elemSize),
|
|
@@ -1311,7 +1286,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1311
1286
|
radian: parseAngleToRadian(angle2)
|
|
1312
1287
|
});
|
|
1313
1288
|
} else {
|
|
1314
|
-
const elemSize = { x: totalX, y: totalY, w: w2, h: h2
|
|
1289
|
+
const elemSize = { x: totalX, y: totalY, w: w2, h: h2 };
|
|
1315
1290
|
ves = getElementVertexes(elemSize);
|
|
1316
1291
|
for (let aIdx = 0; aIdx < rotateActionList.length; aIdx++) {
|
|
1317
1292
|
const { center, radian } = rotateActionList[aIdx];
|
|
@@ -1498,7 +1473,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1498
1473
|
h: child.h,
|
|
1499
1474
|
angle: totalAngle + (child.angle || 0)
|
|
1500
1475
|
};
|
|
1501
|
-
if (isViewPointInElement(p, { context2d: ctx, element: elemSize, viewScaleInfo
|
|
1476
|
+
if (isViewPointInElement(p, { context2d: ctx, element: elemSize, viewScaleInfo })) {
|
|
1502
1477
|
result.element = child;
|
|
1503
1478
|
if (gIdx < groupQueue.length - 1 || child.type !== "group") {
|
|
1504
1479
|
result.groupQueueIndex = gIdx;
|
|
@@ -1523,7 +1498,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1523
1498
|
if (((_c = elem === null || elem === void 0 ? void 0 : elem.operations) === null || _c === void 0 ? void 0 : _c.invisible) === true) {
|
|
1524
1499
|
continue;
|
|
1525
1500
|
}
|
|
1526
|
-
if (isViewPointInElement(p, { context2d: ctx, element: elem, viewScaleInfo
|
|
1501
|
+
if (isViewPointInElement(p, { context2d: ctx, element: elem, viewScaleInfo })) {
|
|
1527
1502
|
result.index = i;
|
|
1528
1503
|
result.element = elem;
|
|
1529
1504
|
break;
|
|
@@ -1590,94 +1565,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1590
1565
|
};
|
|
1591
1566
|
return rangeRectInfo;
|
|
1592
1567
|
}
|
|
1593
|
-
function sortElementsViewVisiableInfoMap(elements, opts) {
|
|
1594
|
-
const visibleInfoMap = {};
|
|
1595
|
-
const currentPosition = [];
|
|
1596
|
-
const _walk = (elem) => {
|
|
1597
|
-
const baseInfo = {
|
|
1598
|
-
isVisibleInView: true,
|
|
1599
|
-
isGroup: elem.type === "group",
|
|
1600
|
-
position: [...currentPosition]
|
|
1601
|
-
};
|
|
1602
|
-
let originRectInfo = null;
|
|
1603
|
-
const groupQueue = getGroupQueueByElementPosition(elements, currentPosition);
|
|
1604
|
-
originRectInfo = calcElementOriginRectInfo(elem, {
|
|
1605
|
-
groupQueue: groupQueue || []
|
|
1606
|
-
});
|
|
1607
|
-
visibleInfoMap[elem.uuid] = Object.assign(Object.assign({}, baseInfo), {
|
|
1608
|
-
originRectInfo,
|
|
1609
|
-
rangeRectInfo: is.angle(elem.angle) ? originRectInfoToRangeRectInfo(originRectInfo) : originRectInfo
|
|
1610
|
-
});
|
|
1611
|
-
if (elem.type === "group") {
|
|
1612
|
-
elem.detail.children.forEach((ele, i) => {
|
|
1613
|
-
currentPosition.push(i);
|
|
1614
|
-
_walk(ele);
|
|
1615
|
-
currentPosition.pop();
|
|
1616
|
-
});
|
|
1617
|
-
}
|
|
1618
|
-
};
|
|
1619
|
-
elements.forEach((elem, index) => {
|
|
1620
|
-
currentPosition.push(index);
|
|
1621
|
-
_walk(elem);
|
|
1622
|
-
currentPosition.pop();
|
|
1623
|
-
});
|
|
1624
|
-
return updateViewVisibleInfoMapStatus(visibleInfoMap, opts);
|
|
1625
|
-
}
|
|
1626
|
-
function isRangeRectInfoCollide(info1, info2) {
|
|
1627
|
-
const rect1MinX = Math.min(info1.topLeft.x, info1.topRight.x, info1.bottomLeft.x, info1.bottomRight.x);
|
|
1628
|
-
const rect1MaxX = Math.max(info1.topLeft.x, info1.topRight.x, info1.bottomLeft.x, info1.bottomRight.x);
|
|
1629
|
-
const rect1MinY = Math.min(info1.topLeft.y, info1.topRight.y, info1.bottomLeft.y, info1.bottomRight.y);
|
|
1630
|
-
const rect1MaxY = Math.max(info1.topLeft.y, info1.topRight.y, info1.bottomLeft.y, info1.bottomRight.y);
|
|
1631
|
-
const rect2MinX = Math.min(info2.topLeft.x, info2.topRight.x, info2.bottomLeft.x, info2.bottomRight.x);
|
|
1632
|
-
const rect2MaxX = Math.max(info2.topLeft.x, info2.topRight.x, info2.bottomLeft.x, info2.bottomRight.x);
|
|
1633
|
-
const rect2MinY = Math.min(info2.topLeft.y, info2.topRight.y, info2.bottomLeft.y, info2.bottomRight.y);
|
|
1634
|
-
const rect2MaxY = Math.max(info2.topLeft.y, info2.topRight.y, info2.bottomLeft.y, info2.bottomRight.y);
|
|
1635
|
-
if (rect1MinX <= rect2MaxX && rect1MaxX >= rect2MinX && rect1MinY <= rect2MaxY && rect1MaxY >= rect2MinY || rect2MaxX <= rect1MaxY && rect2MaxX >= rect1MaxY && rect2MaxX <= rect1MaxY && rect2MaxX >= rect1MaxY) {
|
|
1636
|
-
return true;
|
|
1637
|
-
}
|
|
1638
|
-
return false;
|
|
1639
|
-
}
|
|
1640
|
-
function updateViewVisibleInfoMapStatus(viewVisibleInfoMap, opts) {
|
|
1641
|
-
const canvasRectInfo = calcVisibleOriginCanvasRectInfo(opts);
|
|
1642
|
-
let visibleCount = 0;
|
|
1643
|
-
let invisibleCount = 0;
|
|
1644
|
-
Object.keys(viewVisibleInfoMap).forEach((uuid) => {
|
|
1645
|
-
const info = viewVisibleInfoMap[uuid];
|
|
1646
|
-
info.isVisibleInView = isRangeRectInfoCollide(info.rangeRectInfo, canvasRectInfo);
|
|
1647
|
-
info.isVisibleInView ? visibleCount++ : invisibleCount++;
|
|
1648
|
-
});
|
|
1649
|
-
return { viewVisibleInfoMap, visibleCount, invisibleCount };
|
|
1650
|
-
}
|
|
1651
|
-
function calcVisibleOriginCanvasRectInfo(opts) {
|
|
1652
|
-
const { viewScaleInfo, viewSizeInfo } = opts;
|
|
1653
|
-
const { scale, offsetTop, offsetLeft } = viewScaleInfo;
|
|
1654
|
-
const { width, height } = viewSizeInfo;
|
|
1655
|
-
const x2 = 0 - offsetLeft / scale;
|
|
1656
|
-
const y2 = 0 - offsetTop / scale;
|
|
1657
|
-
const w2 = width / scale;
|
|
1658
|
-
const h2 = height / scale;
|
|
1659
|
-
const center = calcElementCenter({ x: x2, y: y2, w: w2, h: h2 });
|
|
1660
|
-
const topLeft = { x: x2, y: y2 };
|
|
1661
|
-
const topRight = { x: x2 + w2, y: y2 };
|
|
1662
|
-
const bottomLeft = { x: x2, y: y2 + h2 };
|
|
1663
|
-
const bottomRight = { x: x2 + w2, y: y2 + h2 };
|
|
1664
|
-
const left = { x: x2, y: center.y };
|
|
1665
|
-
const top = { x: center.x, y: y2 };
|
|
1666
|
-
const right = { x: x2 + w2, y: center.y };
|
|
1667
|
-
const bottom = { x: center.x, y: y2 + h2 };
|
|
1668
|
-
const rectInfo = {
|
|
1669
|
-
center,
|
|
1670
|
-
topLeft,
|
|
1671
|
-
topRight,
|
|
1672
|
-
bottomLeft,
|
|
1673
|
-
bottomRight,
|
|
1674
|
-
left,
|
|
1675
|
-
top,
|
|
1676
|
-
right,
|
|
1677
|
-
bottom
|
|
1678
|
-
};
|
|
1679
|
-
return rectInfo;
|
|
1680
|
-
}
|
|
1681
1568
|
function createControllerElementSizeFromCenter(center, opts) {
|
|
1682
1569
|
const { x: x2, y: y2 } = center;
|
|
1683
1570
|
const { size, angle: angle2 } = opts;
|
|
@@ -1993,7 +1880,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
1993
1880
|
function calcViewBoxSize(viewElem, opts) {
|
|
1994
1881
|
const { viewScaleInfo } = opts;
|
|
1995
1882
|
const { scale } = viewScaleInfo;
|
|
1996
|
-
let { borderRadius: borderRadius2
|
|
1883
|
+
let { borderRadius: borderRadius2 } = viewElem.detail;
|
|
1884
|
+
const { borderDash } = viewElem.detail;
|
|
1997
1885
|
const hasBorderDash = Array.isArray(borderDash) && borderDash.length > 0;
|
|
1998
1886
|
const { boxSizing = defaultElemConfig$1.boxSizing, borderWidth: borderWidth2 } = viewElem.detail;
|
|
1999
1887
|
if (Array.isArray(borderWidth2)) {
|
|
@@ -2233,14 +2121,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2233
2121
|
ctx.globalAlpha = opacity;
|
|
2234
2122
|
drawBoxBackground(ctx, viewElem, { pattern, viewScaleInfo, viewSizeInfo });
|
|
2235
2123
|
renderContent === null || renderContent === void 0 ? void 0 : renderContent();
|
|
2236
|
-
drawBoxBorder(ctx, viewElem, { viewScaleInfo
|
|
2124
|
+
drawBoxBorder(ctx, viewElem, { viewScaleInfo });
|
|
2237
2125
|
ctx.globalAlpha = parentOpacity;
|
|
2238
2126
|
};
|
|
2239
2127
|
if (clipPath) {
|
|
2240
2128
|
drawClipPath(ctx, viewElem, {
|
|
2241
2129
|
originElem,
|
|
2242
2130
|
calcElemSize,
|
|
2243
|
-
viewScaleInfo,
|
|
2244
2131
|
viewSizeInfo,
|
|
2245
2132
|
renderContent: () => {
|
|
2246
2133
|
mainRender();
|
|
@@ -2250,7 +2137,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2250
2137
|
drawClipPathStroke(ctx, viewElem, {
|
|
2251
2138
|
originElem,
|
|
2252
2139
|
calcElemSize,
|
|
2253
|
-
viewScaleInfo,
|
|
2254
2140
|
viewSizeInfo,
|
|
2255
2141
|
parentOpacity
|
|
2256
2142
|
});
|
|
@@ -2326,8 +2212,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2326
2212
|
const transform = [];
|
|
2327
2213
|
if (viewElem.detail.background || pattern) {
|
|
2328
2214
|
const { x: x2, y: y2, w: w2, h: h2, radiusList } = calcViewBoxSize(viewElem, {
|
|
2329
|
-
viewScaleInfo
|
|
2330
|
-
viewSizeInfo
|
|
2215
|
+
viewScaleInfo
|
|
2331
2216
|
});
|
|
2332
2217
|
ctx.beginPath();
|
|
2333
2218
|
ctx.moveTo(x2 + radiusList[0], y2);
|
|
@@ -2388,12 +2273,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2388
2273
|
if (isColorStr(viewElem.detail.borderColor) === true) {
|
|
2389
2274
|
borderColor2 = viewElem.detail.borderColor;
|
|
2390
2275
|
}
|
|
2391
|
-
const { borderWidth: borderWidth2, borderRadius: borderRadius2,
|
|
2392
|
-
let
|
|
2393
|
-
if (
|
|
2394
|
-
|
|
2276
|
+
const { borderDash, borderWidth: borderWidth2, borderRadius: borderRadius2, boxSizing = defaultElemConfig.boxSizing } = viewElem.detail;
|
|
2277
|
+
let viewBorderDash = [];
|
|
2278
|
+
if (Array.isArray(borderDash) && borderDash.length > 0) {
|
|
2279
|
+
viewBorderDash = borderDash.map((num) => Math.ceil(num * scale));
|
|
2280
|
+
}
|
|
2281
|
+
if (viewBorderDash.length > 0) {
|
|
2282
|
+
ctx.lineCap = "butt";
|
|
2283
|
+
} else {
|
|
2284
|
+
ctx.lineCap = "square";
|
|
2395
2285
|
}
|
|
2396
|
-
bw = bw * scale;
|
|
2397
2286
|
let radiusList = [0, 0, 0, 0];
|
|
2398
2287
|
if (typeof borderRadius2 === "number") {
|
|
2399
2288
|
const br = borderRadius2 * scale;
|
|
@@ -2401,11 +2290,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2401
2290
|
} else if (Array.isArray(borderRadius2) && (borderRadius2 === null || borderRadius2 === void 0 ? void 0 : borderRadius2.length) === 4) {
|
|
2402
2291
|
radiusList = [borderRadius2[0] * scale, borderRadius2[1] * scale, borderRadius2[2] * scale, borderRadius2[3] * scale];
|
|
2403
2292
|
}
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
viewBorderDash = borderDash.map((num) => Math.ceil(num * scale));
|
|
2293
|
+
let bw = 0;
|
|
2294
|
+
if (typeof borderWidth2 === "number") {
|
|
2295
|
+
bw = borderWidth2 || 1;
|
|
2408
2296
|
}
|
|
2297
|
+
bw = bw * scale;
|
|
2298
|
+
ctx.strokeStyle = borderColor2;
|
|
2409
2299
|
let borderTop = 0;
|
|
2410
2300
|
let borderRight = 0;
|
|
2411
2301
|
let borderBottom = 0;
|
|
@@ -2485,11 +2375,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2485
2375
|
w2 = viewElem.w;
|
|
2486
2376
|
h2 = viewElem.h;
|
|
2487
2377
|
}
|
|
2488
|
-
if (viewBorderDash.length > 0) {
|
|
2489
|
-
ctx.lineCap = "butt";
|
|
2490
|
-
} else {
|
|
2491
|
-
ctx.lineCap = "square";
|
|
2492
|
-
}
|
|
2493
2378
|
w2 = Math.max(w2, 1);
|
|
2494
2379
|
h2 = Math.max(h2, 1);
|
|
2495
2380
|
radiusList = radiusList.map((r) => {
|
|
@@ -2546,7 +2431,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2546
2431
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2547
2432
|
drawBoxShadow(ctx, viewElem, {
|
|
2548
2433
|
viewScaleInfo,
|
|
2549
|
-
viewSizeInfo,
|
|
2550
2434
|
renderContent: () => {
|
|
2551
2435
|
let a = w2 / 2;
|
|
2552
2436
|
let b = h2 / 2;
|
|
@@ -2555,10 +2439,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2555
2439
|
const radiusA = a;
|
|
2556
2440
|
const radiusB = b;
|
|
2557
2441
|
if (bw > 0) {
|
|
2558
|
-
if (boxSizing === "content-box")
|
|
2559
|
-
|
|
2560
|
-
b = b;
|
|
2561
|
-
} else if (boxSizing === "center-line") {
|
|
2442
|
+
if (boxSizing === "content-box") ;
|
|
2443
|
+
else if (boxSizing === "center-line") {
|
|
2562
2444
|
a = a - bw / 2;
|
|
2563
2445
|
b = b - bw / 2;
|
|
2564
2446
|
} else {
|
|
@@ -2607,7 +2489,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2607
2489
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2608
2490
|
drawBoxShadow(ctx, viewElem, {
|
|
2609
2491
|
viewScaleInfo,
|
|
2610
|
-
viewSizeInfo,
|
|
2611
2492
|
renderContent: () => {
|
|
2612
2493
|
drawBox(ctx, viewElem, {
|
|
2613
2494
|
originElem: elem,
|
|
@@ -2630,7 +2511,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2630
2511
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2631
2512
|
drawBoxShadow(ctx, viewElem, {
|
|
2632
2513
|
viewScaleInfo,
|
|
2633
|
-
viewSizeInfo,
|
|
2634
2514
|
renderContent: () => {
|
|
2635
2515
|
drawBox(ctx, viewElem, {
|
|
2636
2516
|
originElem: elem,
|
|
@@ -2645,8 +2525,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2645
2525
|
if (elem.type === "image" && content) {
|
|
2646
2526
|
ctx.globalAlpha = getOpacity(elem) * parentOpacity;
|
|
2647
2527
|
const { x: x3, y: y3, w: w3, h: h3, radiusList } = calcViewBoxSize(viewElem, {
|
|
2648
|
-
viewScaleInfo
|
|
2649
|
-
viewSizeInfo
|
|
2528
|
+
viewScaleInfo
|
|
2650
2529
|
});
|
|
2651
2530
|
const { detail } = elem;
|
|
2652
2531
|
const { scaleMode, originW = 0, originH = 0 } = detail;
|
|
@@ -2710,7 +2589,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2710
2589
|
function drawSVG(ctx, elem, opts) {
|
|
2711
2590
|
const content = opts.loader.getContent(elem);
|
|
2712
2591
|
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2713
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo
|
|
2592
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo }) || elem;
|
|
2714
2593
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2715
2594
|
if (!content && !opts.loader.isDestroyed()) {
|
|
2716
2595
|
opts.loader.load(elem, opts.elementAssets || {});
|
|
@@ -2725,7 +2604,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2725
2604
|
function drawHTML(ctx, elem, opts) {
|
|
2726
2605
|
const content = opts.loader.getContent(elem);
|
|
2727
2606
|
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2728
|
-
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo
|
|
2607
|
+
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo }) || elem;
|
|
2729
2608
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2730
2609
|
if (!content && !opts.loader.isDestroyed()) {
|
|
2731
2610
|
opts.loader.load(elem, opts.elementAssets || {});
|
|
@@ -2737,23 +2616,15 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2737
2616
|
}
|
|
2738
2617
|
});
|
|
2739
2618
|
}
|
|
2740
|
-
const detailConfig = getDefaultElementDetailConfig();
|
|
2741
|
-
function isTextWidthWithinErrorRange(w0, w1, scale) {
|
|
2742
|
-
if (scale < 0.5) {
|
|
2743
|
-
if (w0 < w1 && (w0 - w1) / w0 > -0.15) {
|
|
2744
|
-
return true;
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
|
-
return w0 >= w1;
|
|
2748
|
-
}
|
|
2619
|
+
const detailConfig$1 = getDefaultElementDetailConfig();
|
|
2749
2620
|
function drawText(ctx, elem, opts) {
|
|
2750
|
-
const { viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2621
|
+
const { viewScaleInfo, viewSizeInfo, parentOpacity, calculator } = opts;
|
|
2751
2622
|
const { x: x2, y: y2, w: w2, h: h2, angle: angle2 } = calcViewElementSize(elem, { viewScaleInfo }) || elem;
|
|
2752
2623
|
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
2753
2624
|
rotateElement$1(ctx, { x: x2, y: y2, w: w2, h: h2, angle: angle2 }, () => {
|
|
2625
|
+
var _a, _b;
|
|
2754
2626
|
drawBoxShadow(ctx, viewElem, {
|
|
2755
2627
|
viewScaleInfo,
|
|
2756
|
-
viewSizeInfo,
|
|
2757
2628
|
renderContent: () => {
|
|
2758
2629
|
drawBox(ctx, viewElem, {
|
|
2759
2630
|
originElem: elem,
|
|
@@ -2765,130 +2636,38 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2765
2636
|
}
|
|
2766
2637
|
});
|
|
2767
2638
|
{
|
|
2768
|
-
const detail = Object.assign(Object.assign({}, detailConfig), elem.detail);
|
|
2769
|
-
const originFontSize = detail.fontSize || detailConfig.fontSize;
|
|
2639
|
+
const detail = Object.assign(Object.assign({}, detailConfig$1), elem.detail);
|
|
2640
|
+
const originFontSize = detail.fontSize || detailConfig$1.fontSize;
|
|
2770
2641
|
const fontSize2 = originFontSize * viewScaleInfo.scale;
|
|
2771
2642
|
if (fontSize2 < 2) {
|
|
2772
2643
|
return;
|
|
2773
2644
|
}
|
|
2774
|
-
|
|
2775
|
-
const lineHeight2 = originLineHeight * viewScaleInfo.scale;
|
|
2776
|
-
ctx.fillStyle = elem.detail.color || detailConfig.color;
|
|
2645
|
+
ctx.fillStyle = elem.detail.color || detailConfig$1.color;
|
|
2777
2646
|
ctx.textBaseline = "top";
|
|
2778
2647
|
ctx.$setFont({
|
|
2779
2648
|
fontWeight: detail.fontWeight,
|
|
2780
2649
|
fontSize: fontSize2,
|
|
2781
2650
|
fontFamily: enhanceFontFamliy(detail.fontFamily)
|
|
2782
2651
|
});
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
}
|
|
2789
|
-
const fontHeight = lineHeight2;
|
|
2790
|
-
const detailTextList = detailText.split("\n");
|
|
2791
|
-
const lines = [];
|
|
2792
|
-
let lineNum = 0;
|
|
2793
|
-
detailTextList.forEach((itemText, idx) => {
|
|
2794
|
-
if (detail.minInlineSize === "maxContent") {
|
|
2795
|
-
lines.push({
|
|
2796
|
-
text: itemText,
|
|
2797
|
-
width: ctx.$undoPixelRatio(ctx.measureText(itemText).width)
|
|
2798
|
-
});
|
|
2799
|
-
} else {
|
|
2800
|
-
let lineText = "";
|
|
2801
|
-
let splitStr = "";
|
|
2802
|
-
let tempStrList = itemText.split(splitStr);
|
|
2803
|
-
if (detail.wordBreak === "normal") {
|
|
2804
|
-
const splitStr2 = " ";
|
|
2805
|
-
const wordList = itemText.split(splitStr2);
|
|
2806
|
-
tempStrList = [];
|
|
2807
|
-
wordList.forEach((word, idx2) => {
|
|
2808
|
-
tempStrList.push(word);
|
|
2809
|
-
if (idx2 < wordList.length - 1) {
|
|
2810
|
-
tempStrList.push(splitStr2);
|
|
2811
|
-
}
|
|
2812
|
-
});
|
|
2652
|
+
{
|
|
2653
|
+
const virtualTextDetail = calculator.getVirtualFlatItem(elem.uuid);
|
|
2654
|
+
if (Array.isArray(virtualTextDetail === null || virtualTextDetail === void 0 ? void 0 : virtualTextDetail.textLines) && ((_a = virtualTextDetail === null || virtualTextDetail === void 0 ? void 0 : virtualTextDetail.textLines) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
2655
|
+
if (detail.textShadowColor !== void 0 && isColorStr(detail.textShadowColor)) {
|
|
2656
|
+
ctx.shadowColor = detail.textShadowColor;
|
|
2813
2657
|
}
|
|
2814
|
-
if (
|
|
2815
|
-
|
|
2816
|
-
text: tempStrList[0],
|
|
2817
|
-
width: ctx.$undoPixelRatio(ctx.measureText(tempStrList[0]).width)
|
|
2818
|
-
});
|
|
2819
|
-
} else if (tempStrList.length > 0) {
|
|
2820
|
-
for (let i = 0; i < tempStrList.length; i++) {
|
|
2821
|
-
if (isTextWidthWithinErrorRange(ctx.$doPixelRatio(w2), ctx.measureText(lineText + tempStrList[i]).width, viewScaleInfo.scale)) {
|
|
2822
|
-
lineText += tempStrList[i] || "";
|
|
2823
|
-
} else {
|
|
2824
|
-
lines.push({
|
|
2825
|
-
text: lineText,
|
|
2826
|
-
width: ctx.$undoPixelRatio(ctx.measureText(lineText).width)
|
|
2827
|
-
});
|
|
2828
|
-
lineText = tempStrList[i] || "";
|
|
2829
|
-
lineNum++;
|
|
2830
|
-
}
|
|
2831
|
-
if ((lineNum + 1) * fontHeight > h2 && detail.overflow === "hidden") {
|
|
2832
|
-
break;
|
|
2833
|
-
}
|
|
2834
|
-
if (tempStrList.length - 1 === i) {
|
|
2835
|
-
if ((lineNum + 1) * fontHeight <= h2) {
|
|
2836
|
-
lines.push({
|
|
2837
|
-
text: lineText,
|
|
2838
|
-
width: ctx.$undoPixelRatio(ctx.measureText(lineText).width)
|
|
2839
|
-
});
|
|
2840
|
-
if (idx < detailTextList.length - 1) {
|
|
2841
|
-
lineNum++;
|
|
2842
|
-
}
|
|
2843
|
-
break;
|
|
2844
|
-
}
|
|
2845
|
-
}
|
|
2846
|
-
}
|
|
2847
|
-
} else {
|
|
2848
|
-
lines.push({
|
|
2849
|
-
text: "",
|
|
2850
|
-
width: 0
|
|
2851
|
-
});
|
|
2658
|
+
if (detail.textShadowOffsetX !== void 0 && is.number(detail.textShadowOffsetX)) {
|
|
2659
|
+
ctx.shadowOffsetX = detail.textShadowOffsetX;
|
|
2852
2660
|
}
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
let startY = 0;
|
|
2856
|
-
let eachLineStartY = 0;
|
|
2857
|
-
if (fontHeight > fontSize2) {
|
|
2858
|
-
eachLineStartY = (fontHeight - fontSize2) / 2;
|
|
2859
|
-
}
|
|
2860
|
-
if (lines.length * fontHeight < h2) {
|
|
2861
|
-
if (elem.detail.verticalAlign === "top") {
|
|
2862
|
-
startY = 0;
|
|
2863
|
-
} else if (elem.detail.verticalAlign === "bottom") {
|
|
2864
|
-
startY += h2 - lines.length * fontHeight;
|
|
2865
|
-
} else {
|
|
2866
|
-
startY += (h2 - lines.length * fontHeight) / 2;
|
|
2867
|
-
}
|
|
2868
|
-
}
|
|
2869
|
-
{
|
|
2870
|
-
const _y = y2 + startY;
|
|
2871
|
-
if (detail.textShadowColor !== void 0 && isColorStr(detail.textShadowColor)) {
|
|
2872
|
-
ctx.shadowColor = detail.textShadowColor;
|
|
2873
|
-
}
|
|
2874
|
-
if (detail.textShadowOffsetX !== void 0 && is.number(detail.textShadowOffsetX)) {
|
|
2875
|
-
ctx.shadowOffsetX = detail.textShadowOffsetX;
|
|
2876
|
-
}
|
|
2877
|
-
if (detail.textShadowOffsetY !== void 0 && is.number(detail.textShadowOffsetY)) {
|
|
2878
|
-
ctx.shadowOffsetY = detail.textShadowOffsetY;
|
|
2879
|
-
}
|
|
2880
|
-
if (detail.textShadowBlur !== void 0 && is.number(detail.textShadowBlur)) {
|
|
2881
|
-
ctx.shadowBlur = detail.textShadowBlur;
|
|
2882
|
-
}
|
|
2883
|
-
lines.forEach((line, i) => {
|
|
2884
|
-
let _x = x2;
|
|
2885
|
-
if (detail.textAlign === "center") {
|
|
2886
|
-
_x = x2 + (w2 - line.width) / 2;
|
|
2887
|
-
} else if (detail.textAlign === "right") {
|
|
2888
|
-
_x = x2 + (w2 - line.width);
|
|
2661
|
+
if (detail.textShadowOffsetY !== void 0 && is.number(detail.textShadowOffsetY)) {
|
|
2662
|
+
ctx.shadowOffsetY = detail.textShadowOffsetY;
|
|
2889
2663
|
}
|
|
2890
|
-
|
|
2891
|
-
|
|
2664
|
+
if (detail.textShadowBlur !== void 0 && is.number(detail.textShadowBlur)) {
|
|
2665
|
+
ctx.shadowBlur = detail.textShadowBlur;
|
|
2666
|
+
}
|
|
2667
|
+
(_b = virtualTextDetail === null || virtualTextDetail === void 0 ? void 0 : virtualTextDetail.textLines) === null || _b === void 0 ? void 0 : _b.forEach((line) => {
|
|
2668
|
+
ctx.fillText(line.text, x2 + line.x * viewScaleInfo.scale, y2 + line.y * viewScaleInfo.scale);
|
|
2669
|
+
});
|
|
2670
|
+
}
|
|
2892
2671
|
}
|
|
2893
2672
|
}
|
|
2894
2673
|
});
|
|
@@ -2916,7 +2695,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2916
2695
|
const viewOriginY = originY * scaleH;
|
|
2917
2696
|
const internalX = x2 - viewOriginX;
|
|
2918
2697
|
const internalY = y2 - viewOriginY;
|
|
2919
|
-
const _c = elem.detail, restDetail = __rest(_c, ["clipPath", "clipPathStrokeColor", "clipPathStrokeWidth"]);
|
|
2698
|
+
const _c = elem.detail, { clipPath, clipPathStrokeColor, clipPathStrokeWidth } = _c, restDetail = __rest(_c, ["clipPath", "clipPathStrokeColor", "clipPathStrokeWidth"]);
|
|
2920
2699
|
const scaleNum = viewScaleInfo.scale * viewSizeInfo.devicePixelRatio;
|
|
2921
2700
|
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
2922
2701
|
let boxViewElem = Object.assign({}, viewElem);
|
|
@@ -2948,7 +2727,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
2948
2727
|
renderContent: () => {
|
|
2949
2728
|
drawBoxShadow(ctx, viewElem, {
|
|
2950
2729
|
viewScaleInfo,
|
|
2951
|
-
viewSizeInfo,
|
|
2952
2730
|
renderContent: () => {
|
|
2953
2731
|
ctx.save();
|
|
2954
2732
|
ctx.translate(internalX, internalY);
|
|
@@ -3045,7 +2823,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3045
2823
|
ctx.globalAlpha = getOpacity(elem) * parentOpacity;
|
|
3046
2824
|
drawBoxShadow(ctx, viewElem, {
|
|
3047
2825
|
viewScaleInfo,
|
|
3048
|
-
viewSizeInfo,
|
|
3049
2826
|
renderContent: () => {
|
|
3050
2827
|
drawBox(ctx, viewElem, {
|
|
3051
2828
|
originElem: elem,
|
|
@@ -3055,8 +2832,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3055
2832
|
parentOpacity,
|
|
3056
2833
|
renderContent: () => {
|
|
3057
2834
|
const { x: x3, y: y3, w: w3, h: h3, radiusList } = calcViewBoxSize(viewElem, {
|
|
3058
|
-
viewScaleInfo
|
|
3059
|
-
viewSizeInfo
|
|
2835
|
+
viewScaleInfo
|
|
3060
2836
|
});
|
|
3061
2837
|
if (elem.detail.overflow === "hidden") {
|
|
3062
2838
|
ctx.save();
|
|
@@ -3142,7 +2918,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3142
2918
|
ctx.globalAlpha = 1;
|
|
3143
2919
|
drawBoxShadow(ctx, viewElem, {
|
|
3144
2920
|
viewScaleInfo,
|
|
3145
|
-
viewSizeInfo,
|
|
3146
2921
|
renderContent: () => {
|
|
3147
2922
|
drawBoxBackground(ctx, viewElem, { viewScaleInfo, viewSizeInfo });
|
|
3148
2923
|
}
|
|
@@ -3153,8 +2928,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3153
2928
|
const viewElemSize = calcViewElementSize(elem2, { viewScaleInfo: viewScaleInfo2 }) || elem2;
|
|
3154
2929
|
const viewElem2 = Object.assign(Object.assign({}, elem2), viewElemSize);
|
|
3155
2930
|
const { x: x3, y: y3, w: w3, h: h3, radiusList } = calcViewBoxSize(viewElem2, {
|
|
3156
|
-
viewScaleInfo: viewScaleInfo2
|
|
3157
|
-
viewSizeInfo: viewSizeInfo2
|
|
2931
|
+
viewScaleInfo: viewScaleInfo2
|
|
3158
2932
|
});
|
|
3159
2933
|
ctx.save();
|
|
3160
2934
|
ctx.fillStyle = "transparent";
|
|
@@ -3172,7 +2946,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3172
2946
|
if (layout.detail.overflow === "hidden") {
|
|
3173
2947
|
ctx.restore();
|
|
3174
2948
|
}
|
|
3175
|
-
drawBoxBorder(ctx, viewElem, { viewScaleInfo
|
|
2949
|
+
drawBoxBorder(ctx, viewElem, { viewScaleInfo });
|
|
3176
2950
|
ctx.globalAlpha = parentOpacity;
|
|
3177
2951
|
}
|
|
3178
2952
|
function drawGlobalBackground(ctx, global, opts) {
|
|
@@ -3211,12 +2985,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3211
2985
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
3212
2986
|
});
|
|
3213
2987
|
};
|
|
3214
|
-
var __classPrivateFieldGet$
|
|
2988
|
+
var __classPrivateFieldGet$2 = function(receiver, state, kind, f) {
|
|
3215
2989
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3216
2990
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3217
2991
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3218
2992
|
};
|
|
3219
|
-
var __classPrivateFieldSet$
|
|
2993
|
+
var __classPrivateFieldSet$2 = function(receiver, state, value, kind, f) {
|
|
3220
2994
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3221
2995
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3222
2996
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
@@ -3250,7 +3024,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3250
3024
|
_Loader_currentLoadItemMap.set(this, {});
|
|
3251
3025
|
_Loader_storageLoadItemMap.set(this, {});
|
|
3252
3026
|
_Loader_hasDestroyed.set(this, false);
|
|
3253
|
-
__classPrivateFieldGet$
|
|
3027
|
+
__classPrivateFieldGet$2(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "image", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
3254
3028
|
var _a;
|
|
3255
3029
|
const src = ((_a = assets[elem.detail.src]) === null || _a === void 0 ? void 0 : _a.value) || elem.detail.src;
|
|
3256
3030
|
const content = yield loadImage(src);
|
|
@@ -3260,7 +3034,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3260
3034
|
content
|
|
3261
3035
|
};
|
|
3262
3036
|
}));
|
|
3263
|
-
__classPrivateFieldGet$
|
|
3037
|
+
__classPrivateFieldGet$2(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "html", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
3264
3038
|
var _a;
|
|
3265
3039
|
const html2 = ((_a = assets[elem.detail.html]) === null || _a === void 0 ? void 0 : _a.value) || elem.detail.html;
|
|
3266
3040
|
const content = yield loadHTML(html2, {
|
|
@@ -3273,7 +3047,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3273
3047
|
content
|
|
3274
3048
|
};
|
|
3275
3049
|
}));
|
|
3276
|
-
__classPrivateFieldGet$
|
|
3050
|
+
__classPrivateFieldGet$2(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "svg", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
3277
3051
|
var _a;
|
|
3278
3052
|
const svg2 = ((_a = assets[elem.detail.svg]) === null || _a === void 0 ? void 0 : _a.value) || elem.detail.svg;
|
|
3279
3053
|
const content = yield loadSVG(svg2);
|
|
@@ -3285,40 +3059,40 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3285
3059
|
}));
|
|
3286
3060
|
}
|
|
3287
3061
|
isDestroyed() {
|
|
3288
|
-
return __classPrivateFieldGet$
|
|
3062
|
+
return __classPrivateFieldGet$2(this, _Loader_hasDestroyed, "f");
|
|
3289
3063
|
}
|
|
3290
3064
|
destroy() {
|
|
3291
|
-
__classPrivateFieldSet$
|
|
3065
|
+
__classPrivateFieldSet$2(this, _Loader_hasDestroyed, true, "f");
|
|
3292
3066
|
this.clear();
|
|
3293
|
-
__classPrivateFieldSet$
|
|
3294
|
-
__classPrivateFieldSet$
|
|
3295
|
-
__classPrivateFieldSet$
|
|
3067
|
+
__classPrivateFieldSet$2(this, _Loader_loadFuncMap, null, "f");
|
|
3068
|
+
__classPrivateFieldSet$2(this, _Loader_currentLoadItemMap, null, "f");
|
|
3069
|
+
__classPrivateFieldSet$2(this, _Loader_storageLoadItemMap, null, "f");
|
|
3296
3070
|
}
|
|
3297
3071
|
load(element, assets) {
|
|
3298
|
-
if (__classPrivateFieldGet$
|
|
3072
|
+
if (__classPrivateFieldGet$2(this, _Loader_hasDestroyed, "f") === true) {
|
|
3299
3073
|
return;
|
|
3300
3074
|
}
|
|
3301
|
-
if (__classPrivateFieldGet$
|
|
3075
|
+
if (__classPrivateFieldGet$2(this, _Loader_instances, "m", _Loader_isExistingErrorStorage).call(this, element)) {
|
|
3302
3076
|
return;
|
|
3303
3077
|
}
|
|
3304
3078
|
if (supportElementTypes.includes(element.type)) {
|
|
3305
|
-
__classPrivateFieldGet$
|
|
3079
|
+
__classPrivateFieldGet$2(this, _Loader_instances, "m", _Loader_loadResource).call(this, element, assets);
|
|
3306
3080
|
}
|
|
3307
3081
|
}
|
|
3308
3082
|
getContent(element) {
|
|
3309
3083
|
var _a, _b;
|
|
3310
3084
|
const assetId = getAssetIdFromElement(element);
|
|
3311
|
-
return ((_b = (_a = __classPrivateFieldGet$
|
|
3085
|
+
return ((_b = (_a = __classPrivateFieldGet$2(this, _Loader_storageLoadItemMap, "f")) === null || _a === void 0 ? void 0 : _a[assetId]) === null || _b === void 0 ? void 0 : _b.content) || null;
|
|
3312
3086
|
}
|
|
3313
3087
|
getLoadItemMap() {
|
|
3314
|
-
return __classPrivateFieldGet$
|
|
3088
|
+
return __classPrivateFieldGet$2(this, _Loader_storageLoadItemMap, "f");
|
|
3315
3089
|
}
|
|
3316
3090
|
setLoadItemMap(itemMap) {
|
|
3317
|
-
__classPrivateFieldSet$
|
|
3091
|
+
__classPrivateFieldSet$2(this, _Loader_storageLoadItemMap, itemMap, "f");
|
|
3318
3092
|
}
|
|
3319
3093
|
}
|
|
3320
3094
|
_Loader_loadFuncMap = /* @__PURE__ */ new WeakMap(), _Loader_currentLoadItemMap = /* @__PURE__ */ new WeakMap(), _Loader_storageLoadItemMap = /* @__PURE__ */ new WeakMap(), _Loader_hasDestroyed = /* @__PURE__ */ new WeakMap(), _Loader_instances = /* @__PURE__ */ new WeakSet(), _Loader_registerLoadFunc = function _Loader_registerLoadFunc2(type, func) {
|
|
3321
|
-
__classPrivateFieldGet$
|
|
3095
|
+
__classPrivateFieldGet$2(this, _Loader_loadFuncMap, "f")[type] = func;
|
|
3322
3096
|
}, _Loader_getLoadElementSource = function _Loader_getLoadElementSource2(element) {
|
|
3323
3097
|
var _a, _b, _c;
|
|
3324
3098
|
let source = null;
|
|
@@ -3338,185 +3112,316 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3338
3112
|
error: null,
|
|
3339
3113
|
startTime: -1,
|
|
3340
3114
|
endTime: -1,
|
|
3341
|
-
source: __classPrivateFieldGet$
|
|
3115
|
+
source: __classPrivateFieldGet$2(this, _Loader_instances, "m", _Loader_getLoadElementSource).call(this, element)
|
|
3342
3116
|
};
|
|
3343
3117
|
}, _Loader_emitLoad = function _Loader_emitLoad2(item) {
|
|
3344
3118
|
const assetId = getAssetIdFromElement(item.element);
|
|
3345
|
-
const storageItem = __classPrivateFieldGet$
|
|
3346
|
-
if (!__classPrivateFieldGet$
|
|
3119
|
+
const storageItem = __classPrivateFieldGet$2(this, _Loader_storageLoadItemMap, "f")[assetId];
|
|
3120
|
+
if (!__classPrivateFieldGet$2(this, _Loader_hasDestroyed, "f")) {
|
|
3347
3121
|
if (storageItem) {
|
|
3348
3122
|
if (storageItem.startTime < item.startTime) {
|
|
3349
|
-
__classPrivateFieldGet$
|
|
3123
|
+
__classPrivateFieldGet$2(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
3350
3124
|
this.trigger("load", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
3351
3125
|
}
|
|
3352
3126
|
} else {
|
|
3353
|
-
__classPrivateFieldGet$
|
|
3127
|
+
__classPrivateFieldGet$2(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
3354
3128
|
this.trigger("load", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
3355
3129
|
}
|
|
3356
3130
|
}
|
|
3357
3131
|
}, _Loader_emitError = function _Loader_emitError2(item) {
|
|
3358
3132
|
var _a;
|
|
3359
3133
|
const assetId = getAssetIdFromElement(item.element);
|
|
3360
|
-
const storageItem = (_a = __classPrivateFieldGet$
|
|
3361
|
-
if (!__classPrivateFieldGet$
|
|
3134
|
+
const storageItem = (_a = __classPrivateFieldGet$2(this, _Loader_storageLoadItemMap, "f")) === null || _a === void 0 ? void 0 : _a[assetId];
|
|
3135
|
+
if (!__classPrivateFieldGet$2(this, _Loader_hasDestroyed, "f")) {
|
|
3362
3136
|
if (storageItem) {
|
|
3363
3137
|
if (storageItem.startTime < item.startTime) {
|
|
3364
|
-
__classPrivateFieldGet$
|
|
3138
|
+
__classPrivateFieldGet$2(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
3365
3139
|
this.trigger("error", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
3366
3140
|
}
|
|
3367
3141
|
} else {
|
|
3368
|
-
__classPrivateFieldGet$
|
|
3142
|
+
__classPrivateFieldGet$2(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
3369
3143
|
this.trigger("error", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
3370
3144
|
}
|
|
3371
3145
|
}
|
|
3372
3146
|
}, _Loader_loadResource = function _Loader_loadResource2(element, assets) {
|
|
3373
|
-
const item = __classPrivateFieldGet$
|
|
3147
|
+
const item = __classPrivateFieldGet$2(this, _Loader_instances, "m", _Loader_createLoadItem).call(this, element);
|
|
3374
3148
|
const assetId = getAssetIdFromElement(element);
|
|
3375
|
-
if (__classPrivateFieldGet$
|
|
3149
|
+
if (__classPrivateFieldGet$2(this, _Loader_currentLoadItemMap, "f")[assetId]) {
|
|
3376
3150
|
return;
|
|
3377
3151
|
}
|
|
3378
|
-
__classPrivateFieldGet$
|
|
3379
|
-
const loadFunc = __classPrivateFieldGet$
|
|
3380
|
-
if (typeof loadFunc === "function" && !__classPrivateFieldGet$
|
|
3152
|
+
__classPrivateFieldGet$2(this, _Loader_currentLoadItemMap, "f")[assetId] = item;
|
|
3153
|
+
const loadFunc = __classPrivateFieldGet$2(this, _Loader_loadFuncMap, "f")[element.type];
|
|
3154
|
+
if (typeof loadFunc === "function" && !__classPrivateFieldGet$2(this, _Loader_hasDestroyed, "f")) {
|
|
3381
3155
|
item.startTime = Date.now();
|
|
3382
3156
|
loadFunc(element, assets).then((result) => {
|
|
3383
|
-
if (!__classPrivateFieldGet$
|
|
3157
|
+
if (!__classPrivateFieldGet$2(this, _Loader_hasDestroyed, "f")) {
|
|
3384
3158
|
item.content = result.content;
|
|
3385
3159
|
item.endTime = Date.now();
|
|
3386
3160
|
item.status = "load";
|
|
3387
|
-
__classPrivateFieldGet$
|
|
3161
|
+
__classPrivateFieldGet$2(this, _Loader_instances, "m", _Loader_emitLoad).call(this, item);
|
|
3388
3162
|
}
|
|
3389
3163
|
}).catch((err) => {
|
|
3390
3164
|
console.warn(`Load element source "${item.source}" fail`, err, element);
|
|
3391
3165
|
item.endTime = Date.now();
|
|
3392
3166
|
item.status = "error";
|
|
3393
3167
|
item.error = err;
|
|
3394
|
-
__classPrivateFieldGet$
|
|
3168
|
+
__classPrivateFieldGet$2(this, _Loader_instances, "m", _Loader_emitError).call(this, item);
|
|
3395
3169
|
});
|
|
3396
3170
|
}
|
|
3397
3171
|
}, _Loader_isExistingErrorStorage = function _Loader_isExistingErrorStorage2(element) {
|
|
3398
3172
|
var _a;
|
|
3399
3173
|
const assetId = getAssetIdFromElement(element);
|
|
3400
|
-
const existItem = (_a = __classPrivateFieldGet$
|
|
3401
|
-
if (existItem && existItem.status === "error" && existItem.source && existItem.source === __classPrivateFieldGet$
|
|
3174
|
+
const existItem = (_a = __classPrivateFieldGet$2(this, _Loader_currentLoadItemMap, "f")) === null || _a === void 0 ? void 0 : _a[assetId];
|
|
3175
|
+
if (existItem && existItem.status === "error" && existItem.source && existItem.source === __classPrivateFieldGet$2(this, _Loader_instances, "m", _Loader_getLoadElementSource).call(this, element)) {
|
|
3402
3176
|
return true;
|
|
3403
3177
|
}
|
|
3404
3178
|
return false;
|
|
3405
3179
|
};
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
const parentElementSize = {
|
|
3447
|
-
x: 0,
|
|
3448
|
-
y: 0,
|
|
3449
|
-
w: opts.viewSizeInfo.width,
|
|
3450
|
-
h: opts.viewSizeInfo.height
|
|
3451
|
-
};
|
|
3452
|
-
const drawOpts = Object.assign({
|
|
3453
|
-
loader,
|
|
3454
|
-
calculator,
|
|
3455
|
-
parentElementSize,
|
|
3456
|
-
elementAssets: data.assets,
|
|
3457
|
-
parentOpacity: 1,
|
|
3458
|
-
overrideElementMap: sharer === null || sharer === void 0 ? void 0 : sharer.getActiveOverrideElemenentMap()
|
|
3459
|
-
}, opts);
|
|
3460
|
-
drawGlobalBackground(viewContext, data.global, drawOpts);
|
|
3461
|
-
if (data.layout) {
|
|
3462
|
-
drawLayout(viewContext, data.layout, drawOpts, () => {
|
|
3463
|
-
drawElementList(viewContext, data, drawOpts);
|
|
3180
|
+
const detailConfig = getDefaultElementDetailConfig();
|
|
3181
|
+
function isTextWidthWithinErrorRange(w0, w1, scale) {
|
|
3182
|
+
return w0 >= w1;
|
|
3183
|
+
}
|
|
3184
|
+
function calcVirtualTextDetail(elem, opts) {
|
|
3185
|
+
const { w: w2, h: h2 } = elem;
|
|
3186
|
+
const x2 = 0;
|
|
3187
|
+
const y2 = 0;
|
|
3188
|
+
const ctx = opts.tempContext;
|
|
3189
|
+
const lines = [];
|
|
3190
|
+
const detail = Object.assign(Object.assign({}, detailConfig), elem.detail);
|
|
3191
|
+
const originFontSize = detail.fontSize || detailConfig.fontSize;
|
|
3192
|
+
const fontSize2 = originFontSize;
|
|
3193
|
+
if (fontSize2 < 2) {
|
|
3194
|
+
return {};
|
|
3195
|
+
}
|
|
3196
|
+
const originLineHeight = detail.lineHeight || originFontSize;
|
|
3197
|
+
const lineHeight2 = originLineHeight;
|
|
3198
|
+
ctx.textBaseline = "top";
|
|
3199
|
+
ctx.$setFont({
|
|
3200
|
+
fontWeight: detail.fontWeight,
|
|
3201
|
+
fontSize: fontSize2,
|
|
3202
|
+
fontFamily: enhanceFontFamliy(detail.fontFamily)
|
|
3203
|
+
});
|
|
3204
|
+
let detailText = detail.text.replace(/\r\n/gi, "\n");
|
|
3205
|
+
if (detail.textTransform === "lowercase") {
|
|
3206
|
+
detailText = detailText.toLowerCase();
|
|
3207
|
+
} else if (detail.textTransform === "uppercase") {
|
|
3208
|
+
detailText = detailText.toUpperCase();
|
|
3209
|
+
}
|
|
3210
|
+
const fontHeight = lineHeight2;
|
|
3211
|
+
const detailTextList = detailText.split("\n");
|
|
3212
|
+
let lineNum = 0;
|
|
3213
|
+
detailTextList.forEach((itemText, idx) => {
|
|
3214
|
+
if (detail.minInlineSize === "maxContent") {
|
|
3215
|
+
lines.push({
|
|
3216
|
+
x: x2,
|
|
3217
|
+
y: 0,
|
|
3218
|
+
text: itemText,
|
|
3219
|
+
width: ctx.$undoPixelRatio(ctx.measureText(itemText).width)
|
|
3464
3220
|
});
|
|
3465
3221
|
} else {
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
width
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3222
|
+
let lineText = "";
|
|
3223
|
+
let splitStr = "";
|
|
3224
|
+
let tempStrList = itemText.split(splitStr);
|
|
3225
|
+
if (detail.wordBreak === "normal") {
|
|
3226
|
+
splitStr = " ";
|
|
3227
|
+
const wordList = itemText.split(splitStr);
|
|
3228
|
+
tempStrList = [];
|
|
3229
|
+
wordList.forEach((word, idx2) => {
|
|
3230
|
+
tempStrList.push(word);
|
|
3231
|
+
if (idx2 < wordList.length - 1) {
|
|
3232
|
+
tempStrList.push(splitStr);
|
|
3233
|
+
}
|
|
3234
|
+
});
|
|
3235
|
+
}
|
|
3236
|
+
if (tempStrList.length === 1 && detail.overflow === "visible") {
|
|
3237
|
+
lines.push({
|
|
3238
|
+
x: x2,
|
|
3239
|
+
y: 0,
|
|
3240
|
+
text: tempStrList[0],
|
|
3241
|
+
width: ctx.$undoPixelRatio(ctx.measureText(tempStrList[0]).width)
|
|
3242
|
+
});
|
|
3243
|
+
} else if (tempStrList.length > 0) {
|
|
3244
|
+
for (let i = 0; i < tempStrList.length; i++) {
|
|
3245
|
+
if (isTextWidthWithinErrorRange(ctx.$doPixelRatio(w2), ctx.measureText(lineText + tempStrList[i]).width)) {
|
|
3246
|
+
lineText += tempStrList[i] || "";
|
|
3247
|
+
} else {
|
|
3248
|
+
lines.push({
|
|
3249
|
+
x: x2,
|
|
3250
|
+
y: 0,
|
|
3251
|
+
text: lineText,
|
|
3252
|
+
width: ctx.$undoPixelRatio(ctx.measureText(lineText).width)
|
|
3253
|
+
});
|
|
3254
|
+
lineText = tempStrList[i] || "";
|
|
3255
|
+
lineNum++;
|
|
3256
|
+
}
|
|
3257
|
+
if ((lineNum + 1) * fontHeight > h2 && detail.overflow === "hidden") {
|
|
3258
|
+
break;
|
|
3259
|
+
}
|
|
3260
|
+
if (tempStrList.length - 1 === i) {
|
|
3261
|
+
if ((lineNum + 1) * fontHeight <= h2) {
|
|
3262
|
+
lines.push({
|
|
3263
|
+
x: x2,
|
|
3264
|
+
y: 0,
|
|
3265
|
+
text: lineText,
|
|
3266
|
+
width: ctx.$undoPixelRatio(ctx.measureText(lineText).width)
|
|
3267
|
+
});
|
|
3268
|
+
if (idx < detailTextList.length - 1) {
|
|
3269
|
+
lineNum++;
|
|
3270
|
+
}
|
|
3271
|
+
break;
|
|
3272
|
+
}
|
|
3273
|
+
}
|
|
3490
3274
|
}
|
|
3491
|
-
}
|
|
3275
|
+
} else {
|
|
3276
|
+
lines.push({
|
|
3277
|
+
x: x2,
|
|
3278
|
+
y: 0,
|
|
3279
|
+
text: "",
|
|
3280
|
+
width: 0
|
|
3281
|
+
});
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
});
|
|
3285
|
+
let startY = 0;
|
|
3286
|
+
let eachLineStartY = 0;
|
|
3287
|
+
if (fontHeight > fontSize2) {
|
|
3288
|
+
eachLineStartY = (fontHeight - fontSize2) / 2;
|
|
3289
|
+
}
|
|
3290
|
+
if (lines.length * fontHeight < h2) {
|
|
3291
|
+
if (elem.detail.verticalAlign === "top") {
|
|
3292
|
+
startY = 0;
|
|
3293
|
+
} else if (elem.detail.verticalAlign === "bottom") {
|
|
3294
|
+
startY += h2 - lines.length * fontHeight;
|
|
3295
|
+
} else {
|
|
3296
|
+
startY += (h2 - lines.length * fontHeight) / 2;
|
|
3492
3297
|
}
|
|
3493
3298
|
}
|
|
3494
|
-
|
|
3495
|
-
|
|
3299
|
+
{
|
|
3300
|
+
const _y = y2 + startY;
|
|
3301
|
+
lines.forEach((line, i) => {
|
|
3302
|
+
let _x = x2;
|
|
3303
|
+
if (detail.textAlign === "center") {
|
|
3304
|
+
_x = x2 + (w2 - line.width) / 2;
|
|
3305
|
+
} else if (detail.textAlign === "right") {
|
|
3306
|
+
_x = x2 + (w2 - line.width);
|
|
3307
|
+
}
|
|
3308
|
+
lines[i].x = _x;
|
|
3309
|
+
lines[i].y = _y + fontHeight * i + eachLineStartY;
|
|
3310
|
+
});
|
|
3496
3311
|
}
|
|
3497
|
-
|
|
3498
|
-
|
|
3312
|
+
const virtualTextDetail = {
|
|
3313
|
+
textLines: lines
|
|
3314
|
+
};
|
|
3315
|
+
return virtualTextDetail;
|
|
3316
|
+
}
|
|
3317
|
+
function calcVirtualFlatDetail(elem, opts) {
|
|
3318
|
+
let virtualDetail = {};
|
|
3319
|
+
if (elem.type === "text") {
|
|
3320
|
+
virtualDetail = calcVirtualTextDetail(elem, opts);
|
|
3499
3321
|
}
|
|
3500
|
-
|
|
3501
|
-
|
|
3322
|
+
return virtualDetail;
|
|
3323
|
+
}
|
|
3324
|
+
function elementsToVirtualFlatMap(elements, opts) {
|
|
3325
|
+
const virtualFlatMap = {};
|
|
3326
|
+
const currentPosition = [];
|
|
3327
|
+
const _walk = (elem) => {
|
|
3328
|
+
const baseInfo = {
|
|
3329
|
+
type: elem.type,
|
|
3330
|
+
isVisibleInView: true,
|
|
3331
|
+
position: [...currentPosition]
|
|
3332
|
+
};
|
|
3333
|
+
let originRectInfo = null;
|
|
3334
|
+
const groupQueue = getGroupQueueByElementPosition(elements, currentPosition);
|
|
3335
|
+
originRectInfo = calcElementOriginRectInfo(elem, {
|
|
3336
|
+
groupQueue: groupQueue || []
|
|
3337
|
+
});
|
|
3338
|
+
const virtualItem = Object.assign(Object.assign(Object.assign({}, baseInfo), {
|
|
3339
|
+
originRectInfo,
|
|
3340
|
+
rangeRectInfo: is.angle(elem.angle) ? originRectInfoToRangeRectInfo(originRectInfo) : originRectInfo
|
|
3341
|
+
}), calcVirtualFlatDetail(elem, opts));
|
|
3342
|
+
virtualFlatMap[elem.uuid] = virtualItem;
|
|
3343
|
+
if (elem.type === "group") {
|
|
3344
|
+
elem.detail.children.forEach((ele, i) => {
|
|
3345
|
+
currentPosition.push(i);
|
|
3346
|
+
_walk(ele);
|
|
3347
|
+
currentPosition.pop();
|
|
3348
|
+
});
|
|
3349
|
+
}
|
|
3350
|
+
};
|
|
3351
|
+
elements.forEach((elem, index) => {
|
|
3352
|
+
currentPosition.push(index);
|
|
3353
|
+
_walk(elem);
|
|
3354
|
+
currentPosition.pop();
|
|
3355
|
+
});
|
|
3356
|
+
return virtualFlatMap;
|
|
3357
|
+
}
|
|
3358
|
+
function sortElementsViewVisiableInfoMap(elements, opts) {
|
|
3359
|
+
const { viewScaleInfo, viewSizeInfo, tempContext } = opts;
|
|
3360
|
+
const visibleInfoMap = elementsToVirtualFlatMap(elements, { tempContext });
|
|
3361
|
+
return updateVirtualFlatItemMapStatus(visibleInfoMap, { viewScaleInfo, viewSizeInfo });
|
|
3362
|
+
}
|
|
3363
|
+
function isRangeRectInfoCollide(info1, info2) {
|
|
3364
|
+
const rect1MinX = Math.min(info1.topLeft.x, info1.topRight.x, info1.bottomLeft.x, info1.bottomRight.x);
|
|
3365
|
+
const rect1MaxX = Math.max(info1.topLeft.x, info1.topRight.x, info1.bottomLeft.x, info1.bottomRight.x);
|
|
3366
|
+
const rect1MinY = Math.min(info1.topLeft.y, info1.topRight.y, info1.bottomLeft.y, info1.bottomRight.y);
|
|
3367
|
+
const rect1MaxY = Math.max(info1.topLeft.y, info1.topRight.y, info1.bottomLeft.y, info1.bottomRight.y);
|
|
3368
|
+
const rect2MinX = Math.min(info2.topLeft.x, info2.topRight.x, info2.bottomLeft.x, info2.bottomRight.x);
|
|
3369
|
+
const rect2MaxX = Math.max(info2.topLeft.x, info2.topRight.x, info2.bottomLeft.x, info2.bottomRight.x);
|
|
3370
|
+
const rect2MinY = Math.min(info2.topLeft.y, info2.topRight.y, info2.bottomLeft.y, info2.bottomRight.y);
|
|
3371
|
+
const rect2MaxY = Math.max(info2.topLeft.y, info2.topRight.y, info2.bottomLeft.y, info2.bottomRight.y);
|
|
3372
|
+
if (rect1MinX <= rect2MaxX && rect1MaxX >= rect2MinX && rect1MinY <= rect2MaxY && rect1MaxY >= rect2MinY || rect2MaxX <= rect1MaxY && rect2MaxX >= rect1MaxY && rect2MaxX <= rect1MaxY && rect2MaxX >= rect1MaxY) {
|
|
3373
|
+
return true;
|
|
3502
3374
|
}
|
|
3375
|
+
return false;
|
|
3503
3376
|
}
|
|
3504
|
-
|
|
3505
|
-
const
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3377
|
+
function updateVirtualFlatItemMapStatus(virtualFlatItemMap, opts) {
|
|
3378
|
+
const canvasRectInfo = calcVisibleOriginCanvasRectInfo(opts);
|
|
3379
|
+
let visibleCount = 0;
|
|
3380
|
+
let invisibleCount = 0;
|
|
3381
|
+
Object.keys(virtualFlatItemMap).forEach((uuid) => {
|
|
3382
|
+
const info = virtualFlatItemMap[uuid];
|
|
3383
|
+
info.isVisibleInView = isRangeRectInfoCollide(info.rangeRectInfo, canvasRectInfo);
|
|
3384
|
+
info.isVisibleInView ? visibleCount++ : invisibleCount++;
|
|
3511
3385
|
});
|
|
3512
|
-
|
|
3513
|
-
|
|
3386
|
+
return { virtualFlatItemMap, visibleCount, invisibleCount };
|
|
3387
|
+
}
|
|
3388
|
+
function calcVisibleOriginCanvasRectInfo(opts) {
|
|
3389
|
+
const { viewScaleInfo, viewSizeInfo } = opts;
|
|
3390
|
+
const { scale, offsetTop, offsetLeft } = viewScaleInfo;
|
|
3391
|
+
const { width, height } = viewSizeInfo;
|
|
3392
|
+
const x2 = 0 - offsetLeft / scale;
|
|
3393
|
+
const y2 = 0 - offsetTop / scale;
|
|
3394
|
+
const w2 = width / scale;
|
|
3395
|
+
const h2 = height / scale;
|
|
3396
|
+
const center = calcElementCenter({ x: x2, y: y2, w: w2, h: h2 });
|
|
3397
|
+
const topLeft = { x: x2, y: y2 };
|
|
3398
|
+
const topRight = { x: x2 + w2, y: y2 };
|
|
3399
|
+
const bottomLeft = { x: x2, y: y2 + h2 };
|
|
3400
|
+
const bottomRight = { x: x2 + w2, y: y2 + h2 };
|
|
3401
|
+
const left = { x: x2, y: center.y };
|
|
3402
|
+
const top = { x: center.x, y: y2 };
|
|
3403
|
+
const right = { x: x2 + w2, y: center.y };
|
|
3404
|
+
const bottom = { x: center.x, y: y2 + h2 };
|
|
3405
|
+
const rectInfo = {
|
|
3406
|
+
center,
|
|
3407
|
+
topLeft,
|
|
3408
|
+
topRight,
|
|
3409
|
+
bottomLeft,
|
|
3410
|
+
bottomRight,
|
|
3411
|
+
left,
|
|
3412
|
+
top,
|
|
3413
|
+
right,
|
|
3414
|
+
bottom
|
|
3415
|
+
};
|
|
3416
|
+
return rectInfo;
|
|
3417
|
+
}
|
|
3418
|
+
var __classPrivateFieldSet$1 = function(receiver, state, value, kind, f) {
|
|
3514
3419
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3515
3420
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3516
3421
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3517
3422
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3518
3423
|
};
|
|
3519
|
-
var __classPrivateFieldGet$
|
|
3424
|
+
var __classPrivateFieldGet$1 = function(receiver, state, kind, f) {
|
|
3520
3425
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3521
3426
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3522
3427
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
@@ -3526,10 +3431,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3526
3431
|
constructor(opts) {
|
|
3527
3432
|
_Calculator_opts.set(this, void 0);
|
|
3528
3433
|
_Calculator_store.set(this, void 0);
|
|
3529
|
-
__classPrivateFieldSet$
|
|
3530
|
-
__classPrivateFieldSet$
|
|
3434
|
+
__classPrivateFieldSet$1(this, _Calculator_opts, opts, "f");
|
|
3435
|
+
__classPrivateFieldSet$1(this, _Calculator_store, new Store({
|
|
3531
3436
|
defaultStorage: {
|
|
3532
|
-
|
|
3437
|
+
virtualFlatItemMap: {},
|
|
3533
3438
|
visibleCount: 0,
|
|
3534
3439
|
invisibleCount: 0
|
|
3535
3440
|
}
|
|
@@ -3542,45 +3447,38 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3542
3447
|
return Math.round(num);
|
|
3543
3448
|
}
|
|
3544
3449
|
destroy() {
|
|
3545
|
-
__classPrivateFieldSet$
|
|
3450
|
+
__classPrivateFieldSet$1(this, _Calculator_opts, null, "f");
|
|
3546
3451
|
}
|
|
3547
3452
|
needRender(elem) {
|
|
3548
|
-
const
|
|
3549
|
-
const info =
|
|
3453
|
+
const virtualFlatItemMap = __classPrivateFieldGet$1(this, _Calculator_store, "f").get("virtualFlatItemMap");
|
|
3454
|
+
const info = virtualFlatItemMap[elem.uuid];
|
|
3550
3455
|
if (!info) {
|
|
3551
3456
|
return true;
|
|
3552
3457
|
}
|
|
3553
3458
|
return info.isVisibleInView;
|
|
3554
3459
|
}
|
|
3555
|
-
isPointInElement(p, elem, viewScaleInfo, viewSizeInfo) {
|
|
3556
|
-
const context2d = __classPrivateFieldGet$4(this, _Calculator_opts, "f").viewContext;
|
|
3557
|
-
return isViewPointInElement(p, {
|
|
3558
|
-
context2d,
|
|
3559
|
-
element: elem,
|
|
3560
|
-
viewScaleInfo,
|
|
3561
|
-
viewSizeInfo
|
|
3562
|
-
});
|
|
3563
|
-
}
|
|
3564
3460
|
getPointElement(p, opts) {
|
|
3565
|
-
const context2d = __classPrivateFieldGet$
|
|
3461
|
+
const context2d = __classPrivateFieldGet$1(this, _Calculator_opts, "f").tempContext;
|
|
3566
3462
|
return getViewPointAtElement(p, Object.assign(Object.assign({}, opts), { context2d }));
|
|
3567
3463
|
}
|
|
3568
|
-
|
|
3464
|
+
resetVirtualFlatItemMap(data, opts) {
|
|
3569
3465
|
if (data) {
|
|
3570
|
-
const {
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
__classPrivateFieldGet$
|
|
3466
|
+
const { virtualFlatItemMap, invisibleCount, visibleCount } = sortElementsViewVisiableInfoMap(data.elements, Object.assign(Object.assign({}, opts), {
|
|
3467
|
+
tempContext: __classPrivateFieldGet$1(this, _Calculator_opts, "f").tempContext
|
|
3468
|
+
}));
|
|
3469
|
+
__classPrivateFieldGet$1(this, _Calculator_store, "f").set("virtualFlatItemMap", virtualFlatItemMap);
|
|
3470
|
+
__classPrivateFieldGet$1(this, _Calculator_store, "f").set("invisibleCount", invisibleCount);
|
|
3471
|
+
__classPrivateFieldGet$1(this, _Calculator_store, "f").set("visibleCount", visibleCount);
|
|
3574
3472
|
}
|
|
3575
3473
|
}
|
|
3576
3474
|
updateVisiableStatus(opts) {
|
|
3577
|
-
const {
|
|
3578
|
-
__classPrivateFieldGet$
|
|
3579
|
-
__classPrivateFieldGet$
|
|
3580
|
-
__classPrivateFieldGet$
|
|
3475
|
+
const { virtualFlatItemMap, invisibleCount, visibleCount } = updateVirtualFlatItemMapStatus(__classPrivateFieldGet$1(this, _Calculator_store, "f").get("virtualFlatItemMap"), opts);
|
|
3476
|
+
__classPrivateFieldGet$1(this, _Calculator_store, "f").set("virtualFlatItemMap", virtualFlatItemMap);
|
|
3477
|
+
__classPrivateFieldGet$1(this, _Calculator_store, "f").set("invisibleCount", invisibleCount);
|
|
3478
|
+
__classPrivateFieldGet$1(this, _Calculator_store, "f").set("visibleCount", visibleCount);
|
|
3581
3479
|
}
|
|
3582
3480
|
calcViewRectInfoFromOrigin(uuid, opts) {
|
|
3583
|
-
const infoData = __classPrivateFieldGet$
|
|
3481
|
+
const infoData = __classPrivateFieldGet$1(this, _Calculator_store, "f").get("virtualFlatItemMap")[uuid];
|
|
3584
3482
|
if (!(infoData === null || infoData === void 0 ? void 0 : infoData.originRectInfo)) {
|
|
3585
3483
|
return null;
|
|
3586
3484
|
}
|
|
@@ -3589,7 +3487,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3589
3487
|
if (checkVisible === true && infoData.isVisibleInView === false) {
|
|
3590
3488
|
return null;
|
|
3591
3489
|
}
|
|
3592
|
-
const calcOpts = { viewScaleInfo
|
|
3490
|
+
const calcOpts = { viewScaleInfo };
|
|
3593
3491
|
const viewRectInfo = {
|
|
3594
3492
|
center: calcViewPointSize(center, calcOpts),
|
|
3595
3493
|
left: calcViewPointSize(left, calcOpts),
|
|
@@ -3604,7 +3502,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3604
3502
|
return viewRectInfo;
|
|
3605
3503
|
}
|
|
3606
3504
|
calcViewRectInfoFromRange(uuid, opts) {
|
|
3607
|
-
const infoData = __classPrivateFieldGet$
|
|
3505
|
+
const infoData = __classPrivateFieldGet$1(this, _Calculator_store, "f").get("virtualFlatItemMap")[uuid];
|
|
3608
3506
|
if (!(infoData === null || infoData === void 0 ? void 0 : infoData.originRectInfo)) {
|
|
3609
3507
|
return null;
|
|
3610
3508
|
}
|
|
@@ -3613,7 +3511,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3613
3511
|
if (checkVisible === true && infoData.isVisibleInView === false) {
|
|
3614
3512
|
return null;
|
|
3615
3513
|
}
|
|
3616
|
-
const calcOpts = { viewScaleInfo
|
|
3514
|
+
const calcOpts = { viewScaleInfo };
|
|
3617
3515
|
const viewRectInfo = {
|
|
3618
3516
|
center: calcViewPointSize(center, calcOpts),
|
|
3619
3517
|
left: calcViewPointSize(left, calcOpts),
|
|
@@ -3627,11 +3525,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3627
3525
|
};
|
|
3628
3526
|
return viewRectInfo;
|
|
3629
3527
|
}
|
|
3630
|
-
|
|
3528
|
+
modifyVirtualFlatItemMap(data, opts) {
|
|
3631
3529
|
const { modifyOptions, viewScaleInfo, viewSizeInfo } = opts;
|
|
3632
3530
|
const { type, content } = modifyOptions;
|
|
3633
3531
|
const list = data.elements;
|
|
3634
|
-
const
|
|
3532
|
+
const virtualFlatItemMap = __classPrivateFieldGet$1(this, _Calculator_store, "f").get("virtualFlatItemMap");
|
|
3635
3533
|
if (type === "deleteElement") {
|
|
3636
3534
|
const { element } = content;
|
|
3637
3535
|
const uuids = [];
|
|
@@ -3645,68 +3543,171 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3645
3543
|
};
|
|
3646
3544
|
_walk(element);
|
|
3647
3545
|
uuids.forEach((uuid) => {
|
|
3648
|
-
delete
|
|
3546
|
+
delete virtualFlatItemMap[uuid];
|
|
3649
3547
|
});
|
|
3650
|
-
__classPrivateFieldGet$
|
|
3548
|
+
__classPrivateFieldGet$1(this, _Calculator_store, "f").set("virtualFlatItemMap", virtualFlatItemMap);
|
|
3651
3549
|
} else if (type === "addElement" || type === "updateElement") {
|
|
3652
3550
|
const { position } = content;
|
|
3653
3551
|
const element = findElementFromListByPosition(position, data.elements);
|
|
3654
3552
|
const groupQueue = getGroupQueueByElementPosition(list, position);
|
|
3655
3553
|
if (element) {
|
|
3656
3554
|
if (type === "updateElement" && element.type === "group") {
|
|
3657
|
-
this.
|
|
3555
|
+
this.resetVirtualFlatItemMap(data, { viewScaleInfo, viewSizeInfo });
|
|
3658
3556
|
} else {
|
|
3659
3557
|
const originRectInfo = calcElementOriginRectInfo(element, {
|
|
3660
3558
|
groupQueue: groupQueue || []
|
|
3661
3559
|
});
|
|
3662
|
-
const
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
position: [...position]
|
|
3668
|
-
};
|
|
3669
|
-
viewVisibleInfoMap[element.uuid] = newViewVisibleInfo;
|
|
3670
|
-
__classPrivateFieldGet$4(this, _Calculator_store, "f").set("viewVisibleInfoMap", viewVisibleInfoMap);
|
|
3560
|
+
const newVirtualFlatItem = Object.assign({ type: element.type, originRectInfo, rangeRectInfo: is.angle(element.angle) ? originRectInfoToRangeRectInfo(originRectInfo) : originRectInfo, isVisibleInView: true, position: [...position] }, calcVirtualFlatDetail(element, {
|
|
3561
|
+
tempContext: __classPrivateFieldGet$1(this, _Calculator_opts, "f").tempContext
|
|
3562
|
+
}));
|
|
3563
|
+
virtualFlatItemMap[element.uuid] = newVirtualFlatItem;
|
|
3564
|
+
__classPrivateFieldGet$1(this, _Calculator_store, "f").set("virtualFlatItemMap", virtualFlatItemMap);
|
|
3671
3565
|
if (type === "updateElement") {
|
|
3672
3566
|
this.updateVisiableStatus({ viewScaleInfo, viewSizeInfo });
|
|
3673
3567
|
}
|
|
3674
3568
|
}
|
|
3675
3569
|
}
|
|
3676
3570
|
} else if (type === "moveElement") {
|
|
3677
|
-
this.
|
|
3571
|
+
this.resetVirtualFlatItemMap(data, { viewScaleInfo, viewSizeInfo });
|
|
3678
3572
|
}
|
|
3679
3573
|
}
|
|
3574
|
+
getVirtualFlatItem(uuid) {
|
|
3575
|
+
const itemMap = __classPrivateFieldGet$1(this, _Calculator_store, "f").get("virtualFlatItemMap");
|
|
3576
|
+
return itemMap[uuid] || null;
|
|
3577
|
+
}
|
|
3680
3578
|
}
|
|
3681
3579
|
_Calculator_opts = /* @__PURE__ */ new WeakMap(), _Calculator_store = /* @__PURE__ */ new WeakMap();
|
|
3682
|
-
var __classPrivateFieldSet
|
|
3580
|
+
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
3683
3581
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3684
3582
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3685
3583
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3686
3584
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3687
3585
|
};
|
|
3688
|
-
var __classPrivateFieldGet
|
|
3586
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
3689
3587
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3690
3588
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3691
3589
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3692
3590
|
};
|
|
3693
|
-
var
|
|
3591
|
+
var _Renderer_instances, _Renderer_opts, _Renderer_loader, _Renderer_calculator, _Renderer_hasDestroyed, _Renderer_init;
|
|
3592
|
+
class Renderer extends EventEmitter {
|
|
3593
|
+
constructor(opts) {
|
|
3594
|
+
super();
|
|
3595
|
+
_Renderer_instances.add(this);
|
|
3596
|
+
_Renderer_opts.set(this, void 0);
|
|
3597
|
+
_Renderer_loader.set(this, new Loader());
|
|
3598
|
+
_Renderer_calculator.set(this, void 0);
|
|
3599
|
+
_Renderer_hasDestroyed.set(this, false);
|
|
3600
|
+
__classPrivateFieldSet(this, _Renderer_opts, opts, "f");
|
|
3601
|
+
__classPrivateFieldSet(this, _Renderer_calculator, new Calculator({
|
|
3602
|
+
tempContext: opts.tempContext
|
|
3603
|
+
}), "f");
|
|
3604
|
+
__classPrivateFieldGet(this, _Renderer_instances, "m", _Renderer_init).call(this);
|
|
3605
|
+
}
|
|
3606
|
+
isDestroyed() {
|
|
3607
|
+
return __classPrivateFieldGet(this, _Renderer_hasDestroyed, "f");
|
|
3608
|
+
}
|
|
3609
|
+
destroy() {
|
|
3610
|
+
this.clear();
|
|
3611
|
+
__classPrivateFieldSet(this, _Renderer_opts, null, "f");
|
|
3612
|
+
__classPrivateFieldGet(this, _Renderer_loader, "f").destroy();
|
|
3613
|
+
__classPrivateFieldSet(this, _Renderer_loader, null, "f");
|
|
3614
|
+
__classPrivateFieldSet(this, _Renderer_hasDestroyed, true, "f");
|
|
3615
|
+
}
|
|
3616
|
+
updateOptions(opts) {
|
|
3617
|
+
__classPrivateFieldSet(this, _Renderer_opts, opts, "f");
|
|
3618
|
+
}
|
|
3619
|
+
drawData(data, opts) {
|
|
3620
|
+
const loader = __classPrivateFieldGet(this, _Renderer_loader, "f");
|
|
3621
|
+
const calculator = __classPrivateFieldGet(this, _Renderer_calculator, "f");
|
|
3622
|
+
const { sharer } = __classPrivateFieldGet(this, _Renderer_opts, "f");
|
|
3623
|
+
const viewContext = __classPrivateFieldGet(this, _Renderer_opts, "f").viewContext;
|
|
3624
|
+
viewContext.clearRect(0, 0, viewContext.canvas.width, viewContext.canvas.height);
|
|
3625
|
+
const parentElementSize = {
|
|
3626
|
+
x: 0,
|
|
3627
|
+
y: 0,
|
|
3628
|
+
w: opts.viewSizeInfo.width,
|
|
3629
|
+
h: opts.viewSizeInfo.height
|
|
3630
|
+
};
|
|
3631
|
+
const drawOpts = Object.assign({
|
|
3632
|
+
loader,
|
|
3633
|
+
calculator,
|
|
3634
|
+
parentElementSize,
|
|
3635
|
+
elementAssets: data.assets,
|
|
3636
|
+
parentOpacity: 1,
|
|
3637
|
+
overrideElementMap: sharer === null || sharer === void 0 ? void 0 : sharer.getActiveOverrideElemenentMap()
|
|
3638
|
+
}, opts);
|
|
3639
|
+
drawGlobalBackground(viewContext, data.global, drawOpts);
|
|
3640
|
+
if (data.layout) {
|
|
3641
|
+
drawLayout(viewContext, data.layout, drawOpts, () => {
|
|
3642
|
+
drawElementList(viewContext, data, drawOpts);
|
|
3643
|
+
});
|
|
3644
|
+
} else {
|
|
3645
|
+
drawElementList(viewContext, data, drawOpts);
|
|
3646
|
+
}
|
|
3647
|
+
}
|
|
3648
|
+
scale(num) {
|
|
3649
|
+
const { sharer } = __classPrivateFieldGet(this, _Renderer_opts, "f");
|
|
3650
|
+
if (!sharer) {
|
|
3651
|
+
return;
|
|
3652
|
+
}
|
|
3653
|
+
const { data, offsetTop, offsetBottom, offsetLeft, offsetRight, width, height, contextHeight, contextWidth, devicePixelRatio } = sharer.getActiveStoreSnapshot();
|
|
3654
|
+
if (data) {
|
|
3655
|
+
this.drawData(data, {
|
|
3656
|
+
viewScaleInfo: {
|
|
3657
|
+
scale: num,
|
|
3658
|
+
offsetTop,
|
|
3659
|
+
offsetBottom,
|
|
3660
|
+
offsetLeft,
|
|
3661
|
+
offsetRight
|
|
3662
|
+
},
|
|
3663
|
+
viewSizeInfo: {
|
|
3664
|
+
width,
|
|
3665
|
+
height,
|
|
3666
|
+
contextHeight,
|
|
3667
|
+
contextWidth,
|
|
3668
|
+
devicePixelRatio
|
|
3669
|
+
}
|
|
3670
|
+
});
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
setLoadItemMap(itemMap) {
|
|
3674
|
+
__classPrivateFieldGet(this, _Renderer_loader, "f").setLoadItemMap(itemMap);
|
|
3675
|
+
}
|
|
3676
|
+
getLoadItemMap() {
|
|
3677
|
+
return __classPrivateFieldGet(this, _Renderer_loader, "f").getLoadItemMap();
|
|
3678
|
+
}
|
|
3679
|
+
getLoader() {
|
|
3680
|
+
return __classPrivateFieldGet(this, _Renderer_loader, "f");
|
|
3681
|
+
}
|
|
3682
|
+
getCalculator() {
|
|
3683
|
+
return __classPrivateFieldGet(this, _Renderer_calculator, "f");
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3686
|
+
_Renderer_opts = /* @__PURE__ */ new WeakMap(), _Renderer_loader = /* @__PURE__ */ new WeakMap(), _Renderer_calculator = /* @__PURE__ */ new WeakMap(), _Renderer_hasDestroyed = /* @__PURE__ */ new WeakMap(), _Renderer_instances = /* @__PURE__ */ new WeakSet(), _Renderer_init = function _Renderer_init2() {
|
|
3687
|
+
const loader = __classPrivateFieldGet(this, _Renderer_loader, "f");
|
|
3688
|
+
loader.on("load", (e) => {
|
|
3689
|
+
this.trigger("load", e);
|
|
3690
|
+
});
|
|
3691
|
+
loader.on("error", (e) => {
|
|
3692
|
+
console.error(e);
|
|
3693
|
+
});
|
|
3694
|
+
};
|
|
3694
3695
|
function isBoardAvailableNum(num) {
|
|
3695
3696
|
return num > 0 || num < 0 || num === 0;
|
|
3696
3697
|
}
|
|
3697
3698
|
class BoardWatcher extends EventEmitter {
|
|
3698
3699
|
constructor(opts) {
|
|
3699
3700
|
super();
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
if (!
|
|
3701
|
+
__privateAdd(this, _BoardWatcher_instances);
|
|
3702
|
+
__privateAdd(this, _opts);
|
|
3703
|
+
__privateAdd(this, _store);
|
|
3704
|
+
__privateAdd(this, _hasDestroyed, false);
|
|
3705
|
+
__privateAdd(this, _onWheel, (e) => {
|
|
3706
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isInTarget_fn).call(this, e)) {
|
|
3706
3707
|
return;
|
|
3707
3708
|
}
|
|
3708
|
-
const point =
|
|
3709
|
-
if (!
|
|
3709
|
+
const point = __privateMethod(this, _BoardWatcher_instances, getPoint_fn).call(this, e);
|
|
3710
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isVaildPoint_fn).call(this, point)) {
|
|
3710
3711
|
return;
|
|
3711
3712
|
}
|
|
3712
3713
|
e.preventDefault();
|
|
@@ -3719,144 +3720,162 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3719
3720
|
this.trigger("wheel", { deltaX, deltaY, point });
|
|
3720
3721
|
}
|
|
3721
3722
|
});
|
|
3722
|
-
|
|
3723
|
+
__privateAdd(this, _onContextMenu, (e) => {
|
|
3723
3724
|
if (e.button !== 2) {
|
|
3724
3725
|
return;
|
|
3725
3726
|
}
|
|
3726
|
-
if (!
|
|
3727
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isInTarget_fn).call(this, e)) {
|
|
3727
3728
|
return;
|
|
3728
3729
|
}
|
|
3729
3730
|
e.preventDefault();
|
|
3730
|
-
const point =
|
|
3731
|
-
if (!
|
|
3731
|
+
const point = __privateMethod(this, _BoardWatcher_instances, getPoint_fn).call(this, e);
|
|
3732
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isVaildPoint_fn).call(this, point)) {
|
|
3732
3733
|
return;
|
|
3733
3734
|
}
|
|
3734
3735
|
this.trigger("contextMenu", { point });
|
|
3735
3736
|
});
|
|
3736
|
-
|
|
3737
|
-
if (!
|
|
3737
|
+
__privateAdd(this, _onClick, (e) => {
|
|
3738
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isInTarget_fn).call(this, e)) {
|
|
3738
3739
|
return;
|
|
3739
3740
|
}
|
|
3740
3741
|
e.preventDefault();
|
|
3741
|
-
const point =
|
|
3742
|
-
if (!
|
|
3742
|
+
const point = __privateMethod(this, _BoardWatcher_instances, getPoint_fn).call(this, e);
|
|
3743
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isVaildPoint_fn).call(this, point)) {
|
|
3743
3744
|
return;
|
|
3744
3745
|
}
|
|
3745
3746
|
const maxLimitTime = 500;
|
|
3746
3747
|
const t = Date.now();
|
|
3747
|
-
const preClickPoint =
|
|
3748
|
+
const preClickPoint = __privateGet(this, _store).get("prevClickPoint");
|
|
3748
3749
|
if (preClickPoint && t - preClickPoint.t <= maxLimitTime && Math.abs(preClickPoint.x - point.x) <= 5 && Math.abs(preClickPoint.y - point.y) <= 5) {
|
|
3749
3750
|
this.trigger("doubleClick", { point });
|
|
3750
3751
|
} else {
|
|
3751
|
-
|
|
3752
|
+
__privateGet(this, _store).set("prevClickPoint", point);
|
|
3752
3753
|
}
|
|
3753
3754
|
});
|
|
3754
|
-
|
|
3755
|
-
|
|
3755
|
+
__privateAdd(this, _onPointLeave, (e) => {
|
|
3756
|
+
__privateGet(this, _store).set("hasPointDown", false);
|
|
3756
3757
|
e.preventDefault();
|
|
3757
|
-
const point =
|
|
3758
|
+
const point = __privateMethod(this, _BoardWatcher_instances, getPoint_fn).call(this, e);
|
|
3758
3759
|
this.trigger("pointLeave", { point });
|
|
3759
3760
|
});
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
if (!
|
|
3761
|
+
__privateAdd(this, _onPointEnd, (e) => {
|
|
3762
|
+
__privateGet(this, _store).set("hasPointDown", false);
|
|
3763
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isInTarget_fn).call(this, e)) {
|
|
3763
3764
|
return;
|
|
3764
3765
|
}
|
|
3765
3766
|
e.preventDefault();
|
|
3766
|
-
const point =
|
|
3767
|
+
const point = __privateMethod(this, _BoardWatcher_instances, getPoint_fn).call(this, e);
|
|
3767
3768
|
this.trigger("pointEnd", { point });
|
|
3768
3769
|
});
|
|
3769
|
-
|
|
3770
|
-
if (!
|
|
3770
|
+
__privateAdd(this, _onPointMove, (e) => {
|
|
3771
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isInTarget_fn).call(this, e)) {
|
|
3771
3772
|
return;
|
|
3772
3773
|
}
|
|
3773
3774
|
e.preventDefault();
|
|
3774
3775
|
e.stopPropagation();
|
|
3775
|
-
const point =
|
|
3776
|
-
if (!
|
|
3777
|
-
if (
|
|
3776
|
+
const point = __privateMethod(this, _BoardWatcher_instances, getPoint_fn).call(this, e);
|
|
3777
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isVaildPoint_fn).call(this, point)) {
|
|
3778
|
+
if (__privateGet(this, _store).get("hasPointDown")) {
|
|
3778
3779
|
this.trigger("pointLeave", { point });
|
|
3779
|
-
|
|
3780
|
+
__privateGet(this, _store).set("hasPointDown", false);
|
|
3780
3781
|
}
|
|
3781
3782
|
return;
|
|
3782
3783
|
}
|
|
3783
|
-
if (
|
|
3784
|
+
if (__privateGet(this, _store).get("hasPointDown") !== true) {
|
|
3784
3785
|
return;
|
|
3785
3786
|
}
|
|
3786
3787
|
this.trigger("pointMove", { point });
|
|
3787
3788
|
});
|
|
3788
|
-
|
|
3789
|
+
__privateAdd(this, _onPointStart, (e) => {
|
|
3789
3790
|
if (e.button !== 0) {
|
|
3790
3791
|
return;
|
|
3791
3792
|
}
|
|
3792
|
-
if (!
|
|
3793
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isInTarget_fn).call(this, e)) {
|
|
3793
3794
|
return;
|
|
3794
3795
|
}
|
|
3795
3796
|
e.preventDefault();
|
|
3796
|
-
const point =
|
|
3797
|
-
if (!
|
|
3797
|
+
const point = __privateMethod(this, _BoardWatcher_instances, getPoint_fn).call(this, e);
|
|
3798
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isVaildPoint_fn).call(this, point)) {
|
|
3798
3799
|
return;
|
|
3799
3800
|
}
|
|
3800
|
-
|
|
3801
|
+
__privateGet(this, _store).set("hasPointDown", true);
|
|
3801
3802
|
this.trigger("pointStart", { point });
|
|
3802
3803
|
});
|
|
3803
|
-
|
|
3804
|
-
if (!
|
|
3805
|
-
if (
|
|
3806
|
-
|
|
3807
|
-
|
|
3804
|
+
__privateAdd(this, _onHover, (e) => {
|
|
3805
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isInTarget_fn).call(this, e)) {
|
|
3806
|
+
if (__privateGet(this, _store).get("inCanvas") === true) {
|
|
3807
|
+
__privateGet(this, _store).set("inCanvas", false);
|
|
3808
|
+
__privateGet(this, _onPointLeave).call(this, e);
|
|
3808
3809
|
}
|
|
3809
3810
|
return;
|
|
3810
3811
|
}
|
|
3811
|
-
|
|
3812
|
+
__privateGet(this, _store).set("inCanvas", true);
|
|
3812
3813
|
e.preventDefault();
|
|
3813
|
-
const point =
|
|
3814
|
-
if (!
|
|
3814
|
+
const point = __privateMethod(this, _BoardWatcher_instances, getPoint_fn).call(this, e);
|
|
3815
|
+
if (!__privateMethod(this, _BoardWatcher_instances, isVaildPoint_fn).call(this, point)) {
|
|
3815
3816
|
return;
|
|
3816
3817
|
}
|
|
3817
3818
|
this.trigger("hover", { point });
|
|
3818
3819
|
});
|
|
3819
|
-
const store = new Store({
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3820
|
+
const store = new Store({
|
|
3821
|
+
defaultStorage: { hasPointDown: false, prevClickPoint: null, inCanvas: true }
|
|
3822
|
+
});
|
|
3823
|
+
__privateSet(this, _store, store);
|
|
3824
|
+
__privateSet(this, _opts, opts);
|
|
3825
|
+
__privateMethod(this, _BoardWatcher_instances, init_fn).call(this);
|
|
3823
3826
|
}
|
|
3824
3827
|
onEvents() {
|
|
3825
|
-
if (
|
|
3828
|
+
if (__privateGet(this, _hasDestroyed)) {
|
|
3826
3829
|
return;
|
|
3827
3830
|
}
|
|
3831
|
+
const canvas = __privateGet(this, _opts).boardContent.boardContext.canvas;
|
|
3828
3832
|
const container = window;
|
|
3829
|
-
container.addEventListener("mousemove",
|
|
3830
|
-
container.addEventListener("mousedown",
|
|
3831
|
-
container.addEventListener("mousemove",
|
|
3832
|
-
container.addEventListener("mouseup",
|
|
3833
|
-
|
|
3834
|
-
container.addEventListener("click",
|
|
3835
|
-
container.addEventListener("contextmenu",
|
|
3833
|
+
container.addEventListener("mousemove", __privateGet(this, _onHover));
|
|
3834
|
+
container.addEventListener("mousedown", __privateGet(this, _onPointStart));
|
|
3835
|
+
container.addEventListener("mousemove", __privateGet(this, _onPointMove));
|
|
3836
|
+
container.addEventListener("mouseup", __privateGet(this, _onPointEnd));
|
|
3837
|
+
canvas.addEventListener("wheel", __privateGet(this, _onWheel), { passive: false });
|
|
3838
|
+
container.addEventListener("click", __privateGet(this, _onClick));
|
|
3839
|
+
container.addEventListener("contextmenu", __privateGet(this, _onContextMenu));
|
|
3836
3840
|
}
|
|
3837
3841
|
offEvents() {
|
|
3838
3842
|
const container = window;
|
|
3839
|
-
|
|
3840
|
-
container.removeEventListener("
|
|
3841
|
-
container.removeEventListener("
|
|
3842
|
-
container.removeEventListener("
|
|
3843
|
-
container.removeEventListener("
|
|
3844
|
-
container.removeEventListener("
|
|
3845
|
-
|
|
3846
|
-
container.removeEventListener("
|
|
3843
|
+
const canvas = __privateGet(this, _opts).boardContent.boardContext.canvas;
|
|
3844
|
+
container.removeEventListener("mousemove", __privateGet(this, _onHover));
|
|
3845
|
+
container.removeEventListener("mousedown", __privateGet(this, _onPointStart));
|
|
3846
|
+
container.removeEventListener("mousemove", __privateGet(this, _onPointMove));
|
|
3847
|
+
container.removeEventListener("mouseup", __privateGet(this, _onPointEnd));
|
|
3848
|
+
container.removeEventListener("mouseleave", __privateGet(this, _onPointLeave));
|
|
3849
|
+
canvas.removeEventListener("wheel", __privateGet(this, _onWheel));
|
|
3850
|
+
container.removeEventListener("click", __privateGet(this, _onClick));
|
|
3851
|
+
container.removeEventListener("contextmenu", __privateGet(this, _onContextMenu));
|
|
3847
3852
|
}
|
|
3848
3853
|
destroy() {
|
|
3849
3854
|
this.offEvents();
|
|
3850
|
-
|
|
3851
|
-
|
|
3855
|
+
__privateGet(this, _store).destroy();
|
|
3856
|
+
__privateSet(this, _hasDestroyed, true);
|
|
3852
3857
|
}
|
|
3853
3858
|
}
|
|
3854
|
-
|
|
3859
|
+
_opts = new WeakMap();
|
|
3860
|
+
_store = new WeakMap();
|
|
3861
|
+
_hasDestroyed = new WeakMap();
|
|
3862
|
+
_BoardWatcher_instances = new WeakSet();
|
|
3863
|
+
init_fn = function() {
|
|
3855
3864
|
this.onEvents();
|
|
3856
|
-
}
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3865
|
+
};
|
|
3866
|
+
_onWheel = new WeakMap();
|
|
3867
|
+
_onContextMenu = new WeakMap();
|
|
3868
|
+
_onClick = new WeakMap();
|
|
3869
|
+
_onPointLeave = new WeakMap();
|
|
3870
|
+
_onPointEnd = new WeakMap();
|
|
3871
|
+
_onPointMove = new WeakMap();
|
|
3872
|
+
_onPointStart = new WeakMap();
|
|
3873
|
+
_onHover = new WeakMap();
|
|
3874
|
+
isInTarget_fn = function(e) {
|
|
3875
|
+
return e.target === __privateGet(this, _opts).boardContent.boardContext.canvas;
|
|
3876
|
+
};
|
|
3877
|
+
getPoint_fn = function(e) {
|
|
3878
|
+
const boardCanvas = __privateGet(this, _opts).boardContent.boardContext.canvas;
|
|
3860
3879
|
const rect = boardCanvas.getBoundingClientRect();
|
|
3861
3880
|
const p = {
|
|
3862
3881
|
x: e.clientX - rect.left,
|
|
@@ -3864,26 +3883,15 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3864
3883
|
t: Date.now()
|
|
3865
3884
|
};
|
|
3866
3885
|
return p;
|
|
3867
|
-
}
|
|
3868
|
-
|
|
3886
|
+
};
|
|
3887
|
+
isVaildPoint_fn = function(p) {
|
|
3888
|
+
const viewSize = __privateGet(this, _opts).sharer.getActiveViewSizeInfo();
|
|
3869
3889
|
const { width, height } = viewSize;
|
|
3870
3890
|
if (isBoardAvailableNum(p.x) && isBoardAvailableNum(p.y) && p.x <= width && p.y <= height) {
|
|
3871
3891
|
return true;
|
|
3872
3892
|
}
|
|
3873
3893
|
return false;
|
|
3874
3894
|
};
|
|
3875
|
-
var __classPrivateFieldSet$2 = function(receiver, state, value, kind, f) {
|
|
3876
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3877
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3878
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3879
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3880
|
-
};
|
|
3881
|
-
var __classPrivateFieldGet$2 = function(receiver, state, kind, f) {
|
|
3882
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3883
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3884
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3885
|
-
};
|
|
3886
|
-
var _Sharer_activeStore, _Sharer_sharedStore;
|
|
3887
3895
|
const defaultActiveStorage = {
|
|
3888
3896
|
width: 0,
|
|
3889
3897
|
height: 0,
|
|
@@ -3900,119 +3908,109 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
3900
3908
|
};
|
|
3901
3909
|
class Sharer {
|
|
3902
3910
|
constructor() {
|
|
3903
|
-
|
|
3904
|
-
|
|
3911
|
+
__privateAdd(this, _activeStore);
|
|
3912
|
+
__privateAdd(this, _sharedStore);
|
|
3905
3913
|
const activeStore = new Store({
|
|
3906
3914
|
defaultStorage: defaultActiveStorage
|
|
3907
3915
|
});
|
|
3908
3916
|
const sharedStore = new Store({
|
|
3909
3917
|
defaultStorage: {}
|
|
3910
3918
|
});
|
|
3911
|
-
|
|
3912
|
-
|
|
3919
|
+
__privateSet(this, _activeStore, activeStore);
|
|
3920
|
+
__privateSet(this, _sharedStore, sharedStore);
|
|
3913
3921
|
}
|
|
3914
3922
|
getActiveStorage(key2) {
|
|
3915
|
-
return
|
|
3923
|
+
return __privateGet(this, _activeStore).get(key2);
|
|
3916
3924
|
}
|
|
3917
3925
|
setActiveStorage(key2, storage) {
|
|
3918
|
-
return
|
|
3926
|
+
return __privateGet(this, _activeStore).set(key2, storage);
|
|
3919
3927
|
}
|
|
3920
3928
|
getActiveStoreSnapshot(opts) {
|
|
3921
|
-
return
|
|
3929
|
+
return __privateGet(this, _activeStore).getSnapshot(opts);
|
|
3922
3930
|
}
|
|
3923
3931
|
getSharedStorage(key2) {
|
|
3924
|
-
return
|
|
3932
|
+
return __privateGet(this, _sharedStore).get(key2);
|
|
3925
3933
|
}
|
|
3926
3934
|
setSharedStorage(key2, storage) {
|
|
3927
|
-
return
|
|
3935
|
+
return __privateGet(this, _sharedStore).set(key2, storage);
|
|
3928
3936
|
}
|
|
3929
3937
|
getSharedStoreSnapshot(opts) {
|
|
3930
|
-
return
|
|
3938
|
+
return __privateGet(this, _sharedStore).getSnapshot(opts);
|
|
3931
3939
|
}
|
|
3940
|
+
// get/set active info
|
|
3932
3941
|
getActiveViewScaleInfo() {
|
|
3933
3942
|
const viewScaleInfo = {
|
|
3934
|
-
scale:
|
|
3935
|
-
offsetTop:
|
|
3936
|
-
offsetBottom:
|
|
3937
|
-
offsetLeft:
|
|
3938
|
-
offsetRight:
|
|
3943
|
+
scale: __privateGet(this, _activeStore).get("scale"),
|
|
3944
|
+
offsetTop: __privateGet(this, _activeStore).get("offsetTop"),
|
|
3945
|
+
offsetBottom: __privateGet(this, _activeStore).get("offsetBottom"),
|
|
3946
|
+
offsetLeft: __privateGet(this, _activeStore).get("offsetLeft"),
|
|
3947
|
+
offsetRight: __privateGet(this, _activeStore).get("offsetRight")
|
|
3939
3948
|
};
|
|
3940
3949
|
return viewScaleInfo;
|
|
3941
3950
|
}
|
|
3942
3951
|
setActiveViewScaleInfo(viewScaleInfo) {
|
|
3943
3952
|
const { scale, offsetTop, offsetBottom, offsetLeft, offsetRight } = viewScaleInfo;
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3953
|
+
__privateGet(this, _activeStore).set("scale", scale);
|
|
3954
|
+
__privateGet(this, _activeStore).set("offsetTop", offsetTop);
|
|
3955
|
+
__privateGet(this, _activeStore).set("offsetBottom", offsetBottom);
|
|
3956
|
+
__privateGet(this, _activeStore).set("offsetLeft", offsetLeft);
|
|
3957
|
+
__privateGet(this, _activeStore).set("offsetRight", offsetRight);
|
|
3949
3958
|
}
|
|
3950
3959
|
setActiveViewSizeInfo(size) {
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3960
|
+
__privateGet(this, _activeStore).set("width", size.width);
|
|
3961
|
+
__privateGet(this, _activeStore).set("height", size.height);
|
|
3962
|
+
__privateGet(this, _activeStore).set("devicePixelRatio", size.devicePixelRatio);
|
|
3963
|
+
__privateGet(this, _activeStore).set("contextWidth", size.contextWidth);
|
|
3964
|
+
__privateGet(this, _activeStore).set("contextHeight", size.contextHeight);
|
|
3956
3965
|
}
|
|
3957
3966
|
getActiveViewSizeInfo() {
|
|
3958
3967
|
const sizeInfo = {
|
|
3959
|
-
width:
|
|
3960
|
-
height:
|
|
3961
|
-
devicePixelRatio:
|
|
3962
|
-
contextWidth:
|
|
3963
|
-
contextHeight:
|
|
3968
|
+
width: __privateGet(this, _activeStore).get("width"),
|
|
3969
|
+
height: __privateGet(this, _activeStore).get("height"),
|
|
3970
|
+
devicePixelRatio: __privateGet(this, _activeStore).get("devicePixelRatio"),
|
|
3971
|
+
contextWidth: __privateGet(this, _activeStore).get("contextWidth"),
|
|
3972
|
+
contextHeight: __privateGet(this, _activeStore).get("contextHeight")
|
|
3964
3973
|
};
|
|
3965
3974
|
return sizeInfo;
|
|
3966
3975
|
}
|
|
3967
3976
|
getActiveOverrideElemenentMap() {
|
|
3968
|
-
return
|
|
3977
|
+
return __privateGet(this, _activeStore).get("overrideElementMap");
|
|
3969
3978
|
}
|
|
3970
3979
|
setActiveOverrideElemenentMap(map) {
|
|
3971
|
-
|
|
3980
|
+
__privateGet(this, _activeStore).set("overrideElementMap", map);
|
|
3972
3981
|
}
|
|
3973
3982
|
}
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3977
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
3978
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3979
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3980
|
-
};
|
|
3981
|
-
var __classPrivateFieldGet$1 = function(receiver, state, kind, f) {
|
|
3982
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3983
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3984
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3985
|
-
};
|
|
3986
|
-
var _Viewer_instances, _Viewer_opts, _Viewer_drawFrameSnapshotQueue, _Viewer_drawFrameStatus, _Viewer_init, _Viewer_drawAnimationFrame;
|
|
3983
|
+
_activeStore = new WeakMap();
|
|
3984
|
+
_sharedStore = new WeakMap();
|
|
3987
3985
|
const { requestAnimationFrame } = window;
|
|
3988
3986
|
class Viewer extends EventEmitter {
|
|
3989
3987
|
constructor(opts) {
|
|
3990
3988
|
super();
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
}
|
|
3998
|
-
|
|
3989
|
+
__privateAdd(this, _Viewer_instances);
|
|
3990
|
+
__privateAdd(this, _opts2);
|
|
3991
|
+
__privateAdd(this, _drawFrameSnapshotQueue, []);
|
|
3992
|
+
__privateAdd(this, _drawFrameStatus, "FREE");
|
|
3993
|
+
__privateSet(this, _opts2, opts);
|
|
3994
|
+
__privateMethod(this, _Viewer_instances, init_fn2).call(this);
|
|
3995
|
+
}
|
|
3996
|
+
resetVirtualFlatItemMap(data, opts) {
|
|
3999
3997
|
if (data) {
|
|
4000
|
-
|
|
3998
|
+
__privateGet(this, _opts2).calculator.resetVirtualFlatItemMap(data, opts);
|
|
4001
3999
|
}
|
|
4002
4000
|
}
|
|
4003
4001
|
drawFrame() {
|
|
4004
|
-
const { sharer } =
|
|
4002
|
+
const { sharer } = __privateGet(this, _opts2);
|
|
4005
4003
|
const activeStore = sharer.getActiveStoreSnapshot();
|
|
4006
4004
|
const sharedStore = sharer.getSharedStoreSnapshot();
|
|
4007
|
-
|
|
4005
|
+
__privateGet(this, _drawFrameSnapshotQueue).push({
|
|
4008
4006
|
activeStore,
|
|
4009
4007
|
sharedStore
|
|
4010
4008
|
});
|
|
4011
|
-
|
|
4009
|
+
__privateMethod(this, _Viewer_instances, drawAnimationFrame_fn).call(this);
|
|
4012
4010
|
}
|
|
4013
4011
|
scale(opts) {
|
|
4014
4012
|
const { scale, point, ignoreUpdateVisibleStatus } = opts;
|
|
4015
|
-
const { sharer } =
|
|
4013
|
+
const { sharer } = __privateGet(this, _opts2);
|
|
4016
4014
|
const { moveX, moveY } = viewScale({
|
|
4017
4015
|
scale,
|
|
4018
4016
|
point,
|
|
@@ -4021,7 +4019,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4021
4019
|
});
|
|
4022
4020
|
sharer.setActiveStorage("scale", scale);
|
|
4023
4021
|
if (!ignoreUpdateVisibleStatus) {
|
|
4024
|
-
|
|
4022
|
+
__privateGet(this, _opts2).calculator.updateVisiableStatus({
|
|
4025
4023
|
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
4026
4024
|
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
4027
4025
|
});
|
|
@@ -4029,7 +4027,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4029
4027
|
return { moveX, moveY };
|
|
4030
4028
|
}
|
|
4031
4029
|
scroll(opts) {
|
|
4032
|
-
const { sharer } =
|
|
4030
|
+
const { sharer } = __privateGet(this, _opts2);
|
|
4033
4031
|
const prevViewScaleInfo = sharer.getActiveViewScaleInfo();
|
|
4034
4032
|
const { moveX, moveY, ignoreUpdateVisibleStatus } = opts;
|
|
4035
4033
|
const viewSizeInfo = sharer.getActiveViewSizeInfo();
|
|
@@ -4041,7 +4039,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4041
4039
|
});
|
|
4042
4040
|
sharer.setActiveViewScaleInfo(viewScaleInfo);
|
|
4043
4041
|
if (!ignoreUpdateVisibleStatus) {
|
|
4044
|
-
|
|
4042
|
+
__privateGet(this, _opts2).calculator.updateVisiableStatus({
|
|
4045
4043
|
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
4046
4044
|
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
4047
4045
|
});
|
|
@@ -4049,23 +4047,23 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4049
4047
|
return viewScaleInfo;
|
|
4050
4048
|
}
|
|
4051
4049
|
updateViewScaleInfo(opts) {
|
|
4052
|
-
const { sharer } =
|
|
4050
|
+
const { sharer } = __privateGet(this, _opts2);
|
|
4053
4051
|
const viewScaleInfo = calcViewScaleInfo(opts, {
|
|
4054
4052
|
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
4055
4053
|
});
|
|
4056
4054
|
sharer.setActiveViewScaleInfo(viewScaleInfo);
|
|
4057
|
-
|
|
4055
|
+
__privateGet(this, _opts2).calculator.updateVisiableStatus({
|
|
4058
4056
|
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
4059
4057
|
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
4060
4058
|
});
|
|
4061
4059
|
return viewScaleInfo;
|
|
4062
4060
|
}
|
|
4063
4061
|
resize(viewSize = {}, opts) {
|
|
4064
|
-
const { sharer } =
|
|
4062
|
+
const { sharer } = __privateGet(this, _opts2);
|
|
4065
4063
|
const originViewSize = sharer.getActiveViewSizeInfo();
|
|
4066
|
-
const newViewSize =
|
|
4064
|
+
const newViewSize = { ...originViewSize, ...viewSize };
|
|
4067
4065
|
const { width, height, devicePixelRatio } = newViewSize;
|
|
4068
|
-
const { underlayContext, boardContext, overlayContext, viewContext } =
|
|
4066
|
+
const { underlayContext, boardContext, overlayContext, viewContext } = __privateGet(this, _opts2).boardContent;
|
|
4069
4067
|
boardContext.canvas.width = width * devicePixelRatio;
|
|
4070
4068
|
boardContext.canvas.height = height * devicePixelRatio;
|
|
4071
4069
|
boardContext.canvas.style.width = `${width}px`;
|
|
@@ -4077,8 +4075,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4077
4075
|
viewContext.canvas.width = width * devicePixelRatio;
|
|
4078
4076
|
viewContext.canvas.height = height * devicePixelRatio;
|
|
4079
4077
|
sharer.setActiveViewSizeInfo(newViewSize);
|
|
4080
|
-
if (!(opts
|
|
4081
|
-
|
|
4078
|
+
if (!(opts == null ? void 0 : opts.ignoreUpdateVisibleStatus)) {
|
|
4079
|
+
__privateGet(this, _opts2).calculator.updateVisiableStatus({
|
|
4082
4080
|
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
4083
4081
|
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
4084
4082
|
});
|
|
@@ -4086,21 +4084,37 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4086
4084
|
return newViewSize;
|
|
4087
4085
|
}
|
|
4088
4086
|
}
|
|
4089
|
-
|
|
4090
|
-
|
|
4087
|
+
_opts2 = new WeakMap();
|
|
4088
|
+
_drawFrameSnapshotQueue = new WeakMap();
|
|
4089
|
+
_drawFrameStatus = new WeakMap();
|
|
4090
|
+
_Viewer_instances = new WeakSet();
|
|
4091
|
+
init_fn2 = function() {
|
|
4092
|
+
const { renderer } = __privateGet(this, _opts2);
|
|
4091
4093
|
renderer.on("load", () => {
|
|
4092
4094
|
this.drawFrame();
|
|
4093
4095
|
});
|
|
4094
|
-
}
|
|
4095
|
-
|
|
4096
|
+
};
|
|
4097
|
+
drawAnimationFrame_fn = function() {
|
|
4098
|
+
if (__privateGet(this, _drawFrameStatus) === "DRAWING" || __privateGet(this, _drawFrameSnapshotQueue).length === 0) {
|
|
4096
4099
|
return;
|
|
4097
4100
|
} else {
|
|
4098
|
-
|
|
4101
|
+
__privateSet(this, _drawFrameStatus, "DRAWING");
|
|
4099
4102
|
}
|
|
4100
|
-
const snapshot =
|
|
4101
|
-
const { renderer, boardContent, beforeDrawFrame, afterDrawFrame } =
|
|
4103
|
+
const snapshot = __privateGet(this, _drawFrameSnapshotQueue).shift();
|
|
4104
|
+
const { renderer, boardContent, beforeDrawFrame, afterDrawFrame } = __privateGet(this, _opts2);
|
|
4102
4105
|
if (snapshot) {
|
|
4103
|
-
const {
|
|
4106
|
+
const {
|
|
4107
|
+
scale,
|
|
4108
|
+
offsetTop,
|
|
4109
|
+
offsetBottom,
|
|
4110
|
+
offsetLeft,
|
|
4111
|
+
offsetRight,
|
|
4112
|
+
width,
|
|
4113
|
+
height,
|
|
4114
|
+
contextHeight,
|
|
4115
|
+
contextWidth,
|
|
4116
|
+
devicePixelRatio
|
|
4117
|
+
} = snapshot.activeStore;
|
|
4104
4118
|
const viewScaleInfo = {
|
|
4105
4119
|
scale,
|
|
4106
4120
|
offsetTop,
|
|
@@ -4115,7 +4129,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4115
4129
|
contextWidth,
|
|
4116
4130
|
devicePixelRatio
|
|
4117
4131
|
};
|
|
4118
|
-
if (snapshot
|
|
4132
|
+
if (snapshot == null ? void 0 : snapshot.activeStore.data) {
|
|
4119
4133
|
renderer.drawData(snapshot.activeStore.data, {
|
|
4120
4134
|
viewScaleInfo,
|
|
4121
4135
|
viewSizeInfo
|
|
@@ -4125,97 +4139,85 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4125
4139
|
boardContent.drawView();
|
|
4126
4140
|
afterDrawFrame({ snapshot });
|
|
4127
4141
|
}
|
|
4128
|
-
if (
|
|
4129
|
-
|
|
4142
|
+
if (__privateGet(this, _drawFrameSnapshotQueue).length === 0) {
|
|
4143
|
+
__privateSet(this, _drawFrameStatus, "COMPLETE");
|
|
4130
4144
|
return;
|
|
4131
4145
|
}
|
|
4132
|
-
if (
|
|
4146
|
+
if (__privateSet(this, _drawFrameStatus, "DRAWING")) {
|
|
4133
4147
|
requestAnimationFrame(() => {
|
|
4134
|
-
|
|
4148
|
+
__privateMethod(this, _Viewer_instances, drawAnimationFrame_fn).call(this);
|
|
4135
4149
|
});
|
|
4136
4150
|
}
|
|
4137
4151
|
};
|
|
4138
|
-
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
4139
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4140
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4141
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
4142
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
4143
|
-
};
|
|
4144
|
-
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
4145
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
4146
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4147
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
4148
|
-
};
|
|
4149
|
-
var _Board_instances, _Board_opts, _Board_middlewareMap, _Board_middlewares, _Board_activeMiddlewareObjs, _Board_watcher, _Board_renderer, _Board_sharer, _Board_viewer, _Board_calculator, _Board_eventHub, _Board_hasDestroyed, _Board_init, _Board_handlePointStart, _Board_handlePointEnd, _Board_handlePointMove, _Board_handlePointLeave, _Board_handleHover, _Board_handleDoubleClick, _Board_handleContextMenu, _Board_handleWheel, _Board_handleWheelScale, _Board_handleScrollX, _Board_handleScrollY, _Board_handleResize, _Board_handleClear, _Board_handleBeforeDrawFrame, _Board_handleAfterDrawFrame, _Board_resetActiveMiddlewareObjs;
|
|
4150
4152
|
class Board {
|
|
4151
4153
|
constructor(opts) {
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4154
|
+
__privateAdd(this, _Board_instances);
|
|
4155
|
+
__privateAdd(this, _opts3);
|
|
4156
|
+
__privateAdd(this, _middlewareMap, /* @__PURE__ */ new WeakMap());
|
|
4157
|
+
__privateAdd(this, _middlewares, []);
|
|
4158
|
+
__privateAdd(this, _activeMiddlewareObjs, []);
|
|
4159
|
+
__privateAdd(this, _watcher);
|
|
4160
|
+
__privateAdd(this, _renderer);
|
|
4161
|
+
__privateAdd(this, _sharer);
|
|
4162
|
+
__privateAdd(this, _viewer);
|
|
4163
|
+
__privateAdd(this, _calculator);
|
|
4164
|
+
__privateAdd(this, _eventHub, new EventEmitter());
|
|
4165
|
+
__privateAdd(this, _hasDestroyed2, false);
|
|
4164
4166
|
const { boardContent } = opts;
|
|
4165
4167
|
const sharer = new Sharer();
|
|
4166
|
-
const calculator = new Calculator({ viewContext: boardContent.viewContext });
|
|
4167
4168
|
const watcher = new BoardWatcher({
|
|
4168
4169
|
boardContent,
|
|
4169
4170
|
sharer
|
|
4170
4171
|
});
|
|
4171
4172
|
const renderer = new Renderer({
|
|
4172
4173
|
viewContext: boardContent.viewContext,
|
|
4173
|
-
|
|
4174
|
-
|
|
4174
|
+
tempContext: boardContent.tempContext,
|
|
4175
|
+
sharer
|
|
4175
4176
|
});
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4177
|
+
const calculator = renderer.getCalculator();
|
|
4178
|
+
__privateSet(this, _opts3, opts);
|
|
4179
|
+
__privateSet(this, _sharer, sharer);
|
|
4180
|
+
__privateSet(this, _watcher, watcher);
|
|
4181
|
+
__privateSet(this, _renderer, renderer);
|
|
4182
|
+
__privateSet(this, _calculator, calculator);
|
|
4183
|
+
__privateSet(this, _viewer, new Viewer({
|
|
4182
4184
|
boardContent: opts.boardContent,
|
|
4183
4185
|
sharer,
|
|
4184
4186
|
renderer,
|
|
4185
|
-
calculator:
|
|
4187
|
+
calculator: __privateGet(this, _calculator),
|
|
4186
4188
|
beforeDrawFrame: (e) => {
|
|
4187
|
-
|
|
4189
|
+
__privateMethod(this, _Board_instances, handleBeforeDrawFrame_fn).call(this, e);
|
|
4188
4190
|
},
|
|
4189
4191
|
afterDrawFrame: (e) => {
|
|
4190
|
-
|
|
4192
|
+
__privateMethod(this, _Board_instances, handleAfterDrawFrame_fn).call(this, e);
|
|
4191
4193
|
}
|
|
4192
|
-
})
|
|
4193
|
-
|
|
4194
|
-
|
|
4194
|
+
}));
|
|
4195
|
+
__privateMethod(this, _Board_instances, init_fn3).call(this);
|
|
4196
|
+
__privateMethod(this, _Board_instances, resetActiveMiddlewareObjs_fn).call(this);
|
|
4195
4197
|
}
|
|
4196
4198
|
isDestroyed() {
|
|
4197
|
-
return
|
|
4199
|
+
return __privateGet(this, _hasDestroyed2);
|
|
4198
4200
|
}
|
|
4199
4201
|
destroy() {
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4202
|
+
__privateGet(this, _watcher).destroy();
|
|
4203
|
+
__privateGet(this, _renderer).destroy();
|
|
4204
|
+
__privateGet(this, _calculator).destroy();
|
|
4205
|
+
__privateGet(this, _eventHub).destroy();
|
|
4206
|
+
__privateSet(this, _hasDestroyed2, true);
|
|
4205
4207
|
}
|
|
4206
4208
|
getSharer() {
|
|
4207
|
-
return
|
|
4209
|
+
return __privateGet(this, _sharer);
|
|
4208
4210
|
}
|
|
4209
4211
|
getViewer() {
|
|
4210
|
-
return
|
|
4212
|
+
return __privateGet(this, _viewer);
|
|
4211
4213
|
}
|
|
4212
4214
|
getRenderer() {
|
|
4213
|
-
return
|
|
4215
|
+
return __privateGet(this, _renderer);
|
|
4214
4216
|
}
|
|
4215
4217
|
setData(data, opts) {
|
|
4216
4218
|
const { modifiedOptions } = opts || {};
|
|
4217
|
-
const sharer =
|
|
4218
|
-
|
|
4219
|
+
const sharer = __privateGet(this, _sharer);
|
|
4220
|
+
__privateGet(this, _sharer).setActiveStorage("data", data);
|
|
4219
4221
|
const viewSizeInfo = sharer.getActiveViewSizeInfo();
|
|
4220
4222
|
const viewScaleInfo = sharer.getActiveViewScaleInfo();
|
|
4221
4223
|
const newViewContextSize = calcElementsContextSize(data.elements, {
|
|
@@ -4224,280 +4226,318 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4224
4226
|
extend: true
|
|
4225
4227
|
});
|
|
4226
4228
|
if (modifiedOptions) {
|
|
4227
|
-
|
|
4229
|
+
__privateGet(this, _viewer).resetVirtualFlatItemMap(data, {
|
|
4228
4230
|
viewSizeInfo,
|
|
4229
4231
|
viewScaleInfo
|
|
4230
4232
|
});
|
|
4231
4233
|
} else {
|
|
4232
|
-
|
|
4234
|
+
__privateGet(this, _viewer).resetVirtualFlatItemMap(data, {
|
|
4233
4235
|
viewSizeInfo,
|
|
4234
4236
|
viewScaleInfo
|
|
4235
4237
|
});
|
|
4236
4238
|
}
|
|
4237
|
-
|
|
4238
|
-
const newViewSizeInfo =
|
|
4239
|
-
|
|
4239
|
+
__privateGet(this, _viewer).drawFrame();
|
|
4240
|
+
const newViewSizeInfo = {
|
|
4241
|
+
...viewSizeInfo,
|
|
4242
|
+
...newViewContextSize
|
|
4243
|
+
};
|
|
4244
|
+
__privateGet(this, _sharer).setActiveViewSizeInfo(newViewSizeInfo);
|
|
4240
4245
|
return { viewSizeInfo: newViewSizeInfo };
|
|
4241
4246
|
}
|
|
4242
4247
|
getData() {
|
|
4243
|
-
const { data } =
|
|
4248
|
+
const { data } = __privateGet(this, _sharer).getActiveStoreSnapshot();
|
|
4244
4249
|
return data;
|
|
4245
4250
|
}
|
|
4246
4251
|
use(middleware, config) {
|
|
4247
4252
|
var _a, _b, _c;
|
|
4248
|
-
if (
|
|
4249
|
-
const item =
|
|
4253
|
+
if (__privateGet(this, _middlewareMap).has(middleware)) {
|
|
4254
|
+
const item = __privateGet(this, _middlewareMap).get(middleware);
|
|
4250
4255
|
if (item) {
|
|
4251
|
-
(_b = (_a = item.middlewareObject).use)
|
|
4256
|
+
(_b = (_a = item.middlewareObject).use) == null ? void 0 : _b.call(_a);
|
|
4252
4257
|
item.status = "enable";
|
|
4253
|
-
|
|
4254
|
-
|
|
4258
|
+
__privateGet(this, _middlewareMap).set(middleware, item);
|
|
4259
|
+
__privateMethod(this, _Board_instances, resetActiveMiddlewareObjs_fn).call(this);
|
|
4255
4260
|
return;
|
|
4256
4261
|
}
|
|
4257
4262
|
}
|
|
4258
|
-
const { boardContent, container } =
|
|
4259
|
-
const sharer =
|
|
4260
|
-
const viewer =
|
|
4261
|
-
const calculator =
|
|
4262
|
-
const eventHub =
|
|
4263
|
-
const obj = middleware(
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4263
|
+
const { boardContent, container } = __privateGet(this, _opts3);
|
|
4264
|
+
const sharer = __privateGet(this, _sharer);
|
|
4265
|
+
const viewer = __privateGet(this, _viewer);
|
|
4266
|
+
const calculator = __privateGet(this, _calculator);
|
|
4267
|
+
const eventHub = __privateGet(this, _eventHub);
|
|
4268
|
+
const obj = middleware(
|
|
4269
|
+
{ boardContent, sharer, viewer, calculator, eventHub, container },
|
|
4270
|
+
config
|
|
4271
|
+
);
|
|
4272
|
+
(_c = obj.use) == null ? void 0 : _c.call(obj);
|
|
4273
|
+
__privateGet(this, _middlewares).push(middleware);
|
|
4274
|
+
__privateGet(this, _activeMiddlewareObjs).push(obj);
|
|
4275
|
+
__privateGet(this, _middlewareMap).set(middleware, {
|
|
4268
4276
|
status: "enable",
|
|
4269
4277
|
middlewareObject: obj,
|
|
4270
4278
|
config
|
|
4271
4279
|
});
|
|
4272
|
-
|
|
4280
|
+
__privateMethod(this, _Board_instances, resetActiveMiddlewareObjs_fn).call(this);
|
|
4273
4281
|
}
|
|
4274
4282
|
disuse(middleware) {
|
|
4275
4283
|
var _a, _b;
|
|
4276
|
-
const item =
|
|
4284
|
+
const item = __privateGet(this, _middlewareMap).get(middleware);
|
|
4277
4285
|
if (item) {
|
|
4278
|
-
(_b = (_a = item.middlewareObject).disuse)
|
|
4286
|
+
(_b = (_a = item.middlewareObject).disuse) == null ? void 0 : _b.call(_a);
|
|
4279
4287
|
item.status = "disable";
|
|
4280
|
-
|
|
4281
|
-
|
|
4288
|
+
__privateGet(this, _middlewareMap).set(middleware, item);
|
|
4289
|
+
__privateMethod(this, _Board_instances, resetActiveMiddlewareObjs_fn).call(this);
|
|
4282
4290
|
}
|
|
4283
4291
|
}
|
|
4284
4292
|
resetMiddlewareConfig(middleware, config) {
|
|
4285
4293
|
var _a, _b;
|
|
4286
|
-
if (
|
|
4287
|
-
const item =
|
|
4294
|
+
if (__privateGet(this, _middlewareMap).has(middleware)) {
|
|
4295
|
+
const item = __privateGet(this, _middlewareMap).get(middleware);
|
|
4288
4296
|
if (item) {
|
|
4289
|
-
(_b = (_a = item.middlewareObject).resetConfig)
|
|
4297
|
+
(_b = (_a = item.middlewareObject).resetConfig) == null ? void 0 : _b.call(_a, config);
|
|
4290
4298
|
}
|
|
4291
4299
|
}
|
|
4292
4300
|
}
|
|
4293
4301
|
scale(opts) {
|
|
4294
|
-
const viewer =
|
|
4302
|
+
const viewer = __privateGet(this, _viewer);
|
|
4295
4303
|
const { ignoreUpdateVisibleStatus } = opts;
|
|
4296
|
-
const { moveX, moveY } = viewer.scale(
|
|
4297
|
-
|
|
4298
|
-
|
|
4304
|
+
const { moveX, moveY } = viewer.scale({
|
|
4305
|
+
...opts,
|
|
4306
|
+
...{
|
|
4307
|
+
ignoreUpdateVisibleStatus: true
|
|
4308
|
+
}
|
|
4309
|
+
});
|
|
4299
4310
|
viewer.scroll({ moveX, moveY, ignoreUpdateVisibleStatus });
|
|
4300
4311
|
}
|
|
4301
4312
|
scroll(opts) {
|
|
4302
|
-
const result =
|
|
4313
|
+
const result = __privateGet(this, _viewer).scroll(opts);
|
|
4303
4314
|
return result;
|
|
4304
4315
|
}
|
|
4305
4316
|
updateViewScaleInfo(opts) {
|
|
4306
|
-
const result =
|
|
4317
|
+
const result = __privateGet(this, _viewer).updateViewScaleInfo(opts);
|
|
4307
4318
|
return result;
|
|
4308
4319
|
}
|
|
4309
4320
|
resize(newViewSize, opts) {
|
|
4310
|
-
const viewSize =
|
|
4321
|
+
const viewSize = __privateGet(this, _viewer).resize(newViewSize, opts);
|
|
4311
4322
|
const { width, height, devicePixelRatio } = newViewSize;
|
|
4312
|
-
const { boardContent } =
|
|
4323
|
+
const { boardContent } = __privateGet(this, _opts3);
|
|
4313
4324
|
boardContent.viewContext.$resize({ width, height, devicePixelRatio });
|
|
4314
4325
|
boardContent.overlayContext.$resize({ width, height, devicePixelRatio });
|
|
4315
4326
|
boardContent.boardContext.$resize({ width, height, devicePixelRatio });
|
|
4316
4327
|
boardContent.underlayContext.$resize({ width, height, devicePixelRatio });
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4328
|
+
__privateGet(this, _viewer).drawFrame();
|
|
4329
|
+
__privateGet(this, _watcher).trigger("resize", viewSize);
|
|
4330
|
+
__privateGet(this, _sharer).setActiveViewSizeInfo(newViewSize);
|
|
4320
4331
|
}
|
|
4321
4332
|
clear() {
|
|
4322
|
-
const { boardContent } =
|
|
4333
|
+
const { boardContent } = __privateGet(this, _opts3);
|
|
4323
4334
|
const { underlayContext, overlayContext, viewContext, boardContext } = boardContent;
|
|
4324
4335
|
underlayContext.clearRect(0, 0, underlayContext.canvas.width, underlayContext.canvas.height);
|
|
4325
4336
|
overlayContext.clearRect(0, 0, overlayContext.canvas.width, overlayContext.canvas.height);
|
|
4326
4337
|
viewContext.clearRect(0, 0, viewContext.canvas.width, viewContext.canvas.height);
|
|
4327
4338
|
boardContext.clearRect(0, 0, boardContext.canvas.width, boardContext.canvas.height);
|
|
4328
|
-
|
|
4339
|
+
__privateMethod(this, _Board_instances, handleClear_fn).call(this);
|
|
4329
4340
|
}
|
|
4330
4341
|
getEventHub() {
|
|
4331
|
-
return
|
|
4342
|
+
return __privateGet(this, _eventHub);
|
|
4332
4343
|
}
|
|
4333
4344
|
onWatcherEvents() {
|
|
4334
|
-
|
|
4345
|
+
__privateGet(this, _watcher).onEvents();
|
|
4335
4346
|
}
|
|
4336
4347
|
offWatcherEvents() {
|
|
4337
|
-
|
|
4338
|
-
}
|
|
4339
|
-
}
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4348
|
+
__privateGet(this, _watcher).offEvents();
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4351
|
+
_opts3 = new WeakMap();
|
|
4352
|
+
_middlewareMap = new WeakMap();
|
|
4353
|
+
_middlewares = new WeakMap();
|
|
4354
|
+
_activeMiddlewareObjs = new WeakMap();
|
|
4355
|
+
_watcher = new WeakMap();
|
|
4356
|
+
_renderer = new WeakMap();
|
|
4357
|
+
_sharer = new WeakMap();
|
|
4358
|
+
_viewer = new WeakMap();
|
|
4359
|
+
_calculator = new WeakMap();
|
|
4360
|
+
_eventHub = new WeakMap();
|
|
4361
|
+
_hasDestroyed2 = new WeakMap();
|
|
4362
|
+
_Board_instances = new WeakSet();
|
|
4363
|
+
init_fn3 = function() {
|
|
4364
|
+
__privateGet(this, _watcher).on("pointStart", __privateMethod(this, _Board_instances, handlePointStart_fn).bind(this));
|
|
4365
|
+
__privateGet(this, _watcher).on("pointEnd", __privateMethod(this, _Board_instances, handlePointEnd_fn).bind(this));
|
|
4366
|
+
__privateGet(this, _watcher).on("pointMove", __privateMethod(this, _Board_instances, handlePointMove_fn).bind(this));
|
|
4367
|
+
__privateGet(this, _watcher).on("pointLeave", __privateMethod(this, _Board_instances, handlePointLeave_fn).bind(this));
|
|
4368
|
+
__privateGet(this, _watcher).on("hover", __privateMethod(this, _Board_instances, handleHover_fn).bind(this));
|
|
4369
|
+
__privateGet(this, _watcher).on("wheel", __privateMethod(this, _Board_instances, handleWheel_fn).bind(this));
|
|
4370
|
+
__privateGet(this, _watcher).on("wheelScale", __privateMethod(this, _Board_instances, handleWheelScale_fn).bind(this));
|
|
4371
|
+
__privateGet(this, _watcher).on("scrollX", __privateMethod(this, _Board_instances, handleScrollX_fn).bind(this));
|
|
4372
|
+
__privateGet(this, _watcher).on("scrollY", __privateMethod(this, _Board_instances, handleScrollY_fn).bind(this));
|
|
4373
|
+
__privateGet(this, _watcher).on("resize", __privateMethod(this, _Board_instances, handleResize_fn).bind(this));
|
|
4374
|
+
__privateGet(this, _watcher).on("doubleClick", __privateMethod(this, _Board_instances, handleDoubleClick_fn).bind(this));
|
|
4375
|
+
__privateGet(this, _watcher).on("contextMenu", __privateMethod(this, _Board_instances, handleContextMenu_fn).bind(this));
|
|
4376
|
+
__privateGet(this, _renderer).on("load", () => {
|
|
4377
|
+
__privateGet(this, _eventHub).trigger("loadResource");
|
|
4355
4378
|
});
|
|
4356
|
-
}
|
|
4379
|
+
};
|
|
4380
|
+
handlePointStart_fn = function(e) {
|
|
4357
4381
|
var _a;
|
|
4358
|
-
for (let i = 0; i <
|
|
4359
|
-
const obj =
|
|
4360
|
-
const result = (_a = obj
|
|
4382
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4383
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4384
|
+
const result = (_a = obj == null ? void 0 : obj.pointStart) == null ? void 0 : _a.call(obj, e);
|
|
4361
4385
|
if (result === false) {
|
|
4362
4386
|
return;
|
|
4363
4387
|
}
|
|
4364
4388
|
}
|
|
4365
|
-
}
|
|
4389
|
+
};
|
|
4390
|
+
handlePointEnd_fn = function(e) {
|
|
4366
4391
|
var _a;
|
|
4367
|
-
for (let i = 0; i <
|
|
4368
|
-
const obj =
|
|
4369
|
-
const result = (_a = obj
|
|
4392
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4393
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4394
|
+
const result = (_a = obj == null ? void 0 : obj.pointEnd) == null ? void 0 : _a.call(obj, e);
|
|
4370
4395
|
if (result === false) {
|
|
4371
4396
|
return;
|
|
4372
4397
|
}
|
|
4373
4398
|
}
|
|
4374
|
-
}
|
|
4399
|
+
};
|
|
4400
|
+
handlePointMove_fn = function(e) {
|
|
4375
4401
|
var _a;
|
|
4376
|
-
for (let i = 0; i <
|
|
4377
|
-
const obj =
|
|
4378
|
-
const result = (_a = obj
|
|
4402
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4403
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4404
|
+
const result = (_a = obj == null ? void 0 : obj.pointMove) == null ? void 0 : _a.call(obj, e);
|
|
4379
4405
|
if (result === false) {
|
|
4380
4406
|
return;
|
|
4381
4407
|
}
|
|
4382
4408
|
}
|
|
4383
|
-
}
|
|
4409
|
+
};
|
|
4410
|
+
handlePointLeave_fn = function(e) {
|
|
4384
4411
|
var _a;
|
|
4385
|
-
for (let i = 0; i <
|
|
4386
|
-
const obj =
|
|
4387
|
-
const result = (_a = obj
|
|
4412
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4413
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4414
|
+
const result = (_a = obj == null ? void 0 : obj.pointLeave) == null ? void 0 : _a.call(obj, e);
|
|
4388
4415
|
if (result === false) {
|
|
4389
4416
|
return;
|
|
4390
4417
|
}
|
|
4391
4418
|
}
|
|
4392
|
-
}
|
|
4419
|
+
};
|
|
4420
|
+
handleHover_fn = function(e) {
|
|
4393
4421
|
var _a;
|
|
4394
|
-
for (let i = 0; i <
|
|
4395
|
-
const obj =
|
|
4396
|
-
const result = (_a = obj
|
|
4422
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4423
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4424
|
+
const result = (_a = obj == null ? void 0 : obj.hover) == null ? void 0 : _a.call(obj, e);
|
|
4397
4425
|
if (result === false) {
|
|
4398
4426
|
return;
|
|
4399
4427
|
}
|
|
4400
4428
|
}
|
|
4401
|
-
}
|
|
4429
|
+
};
|
|
4430
|
+
handleDoubleClick_fn = function(e) {
|
|
4402
4431
|
var _a;
|
|
4403
|
-
for (let i = 0; i <
|
|
4404
|
-
const obj =
|
|
4405
|
-
const result = (_a = obj
|
|
4432
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4433
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4434
|
+
const result = (_a = obj == null ? void 0 : obj.doubleClick) == null ? void 0 : _a.call(obj, e);
|
|
4406
4435
|
if (result === false) {
|
|
4407
4436
|
return;
|
|
4408
4437
|
}
|
|
4409
4438
|
}
|
|
4410
|
-
}
|
|
4439
|
+
};
|
|
4440
|
+
handleContextMenu_fn = function(e) {
|
|
4411
4441
|
var _a;
|
|
4412
|
-
for (let i = 0; i <
|
|
4413
|
-
const obj =
|
|
4414
|
-
const result = (_a = obj
|
|
4442
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4443
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4444
|
+
const result = (_a = obj == null ? void 0 : obj.contextMenu) == null ? void 0 : _a.call(obj, e);
|
|
4415
4445
|
if (result === false) {
|
|
4416
4446
|
return;
|
|
4417
4447
|
}
|
|
4418
4448
|
}
|
|
4419
|
-
}
|
|
4449
|
+
};
|
|
4450
|
+
handleWheel_fn = function(e) {
|
|
4420
4451
|
var _a;
|
|
4421
|
-
for (let i = 0; i <
|
|
4422
|
-
const obj =
|
|
4423
|
-
const result = (_a = obj
|
|
4452
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4453
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4454
|
+
const result = (_a = obj == null ? void 0 : obj.wheel) == null ? void 0 : _a.call(obj, e);
|
|
4424
4455
|
if (result === false) {
|
|
4425
4456
|
return;
|
|
4426
4457
|
}
|
|
4427
4458
|
}
|
|
4428
|
-
}
|
|
4459
|
+
};
|
|
4460
|
+
handleWheelScale_fn = function(e) {
|
|
4429
4461
|
var _a;
|
|
4430
|
-
for (let i = 0; i <
|
|
4431
|
-
const obj =
|
|
4432
|
-
const result = (_a = obj
|
|
4462
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4463
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4464
|
+
const result = (_a = obj == null ? void 0 : obj.wheelScale) == null ? void 0 : _a.call(obj, e);
|
|
4433
4465
|
if (result === false) {
|
|
4434
4466
|
return;
|
|
4435
4467
|
}
|
|
4436
4468
|
}
|
|
4437
|
-
}
|
|
4469
|
+
};
|
|
4470
|
+
handleScrollX_fn = function(e) {
|
|
4438
4471
|
var _a;
|
|
4439
|
-
for (let i = 0; i <
|
|
4440
|
-
const obj =
|
|
4441
|
-
const result = (_a = obj
|
|
4472
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4473
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4474
|
+
const result = (_a = obj == null ? void 0 : obj.scrollX) == null ? void 0 : _a.call(obj, e);
|
|
4442
4475
|
if (result === false) {
|
|
4443
4476
|
return;
|
|
4444
4477
|
}
|
|
4445
4478
|
}
|
|
4446
|
-
}
|
|
4479
|
+
};
|
|
4480
|
+
handleScrollY_fn = function(e) {
|
|
4447
4481
|
var _a;
|
|
4448
|
-
for (let i = 0; i <
|
|
4449
|
-
const obj =
|
|
4450
|
-
const result = (_a = obj
|
|
4482
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4483
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4484
|
+
const result = (_a = obj == null ? void 0 : obj.scrollY) == null ? void 0 : _a.call(obj, e);
|
|
4451
4485
|
if (result === false) {
|
|
4452
4486
|
return;
|
|
4453
4487
|
}
|
|
4454
4488
|
}
|
|
4455
|
-
}
|
|
4489
|
+
};
|
|
4490
|
+
handleResize_fn = function(e) {
|
|
4456
4491
|
var _a;
|
|
4457
|
-
for (let i = 0; i <
|
|
4458
|
-
const obj =
|
|
4459
|
-
const result = (_a = obj
|
|
4492
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4493
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4494
|
+
const result = (_a = obj == null ? void 0 : obj.resize) == null ? void 0 : _a.call(obj, e);
|
|
4460
4495
|
if (result === false) {
|
|
4461
4496
|
return;
|
|
4462
4497
|
}
|
|
4463
4498
|
}
|
|
4464
|
-
}
|
|
4499
|
+
};
|
|
4500
|
+
handleClear_fn = function(e) {
|
|
4465
4501
|
var _a;
|
|
4466
|
-
for (let i = 0; i <
|
|
4467
|
-
const obj =
|
|
4468
|
-
const result = (_a = obj
|
|
4502
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4503
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4504
|
+
const result = (_a = obj == null ? void 0 : obj.clear) == null ? void 0 : _a.call(obj, e);
|
|
4469
4505
|
if (result === false) {
|
|
4470
4506
|
return;
|
|
4471
4507
|
}
|
|
4472
4508
|
}
|
|
4473
|
-
}
|
|
4509
|
+
};
|
|
4510
|
+
// draw event
|
|
4511
|
+
handleBeforeDrawFrame_fn = function(e) {
|
|
4474
4512
|
var _a;
|
|
4475
|
-
for (let i = 0; i <
|
|
4476
|
-
const obj =
|
|
4477
|
-
const result = (_a = obj
|
|
4513
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4514
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4515
|
+
const result = (_a = obj == null ? void 0 : obj.beforeDrawFrame) == null ? void 0 : _a.call(obj, e);
|
|
4478
4516
|
if (result === false) {
|
|
4479
4517
|
return;
|
|
4480
4518
|
}
|
|
4481
4519
|
}
|
|
4482
|
-
}
|
|
4520
|
+
};
|
|
4521
|
+
handleAfterDrawFrame_fn = function(e) {
|
|
4483
4522
|
var _a;
|
|
4484
|
-
for (let i = 0; i <
|
|
4485
|
-
const obj =
|
|
4486
|
-
const result = (_a = obj
|
|
4523
|
+
for (let i = 0; i < __privateGet(this, _activeMiddlewareObjs).length; i++) {
|
|
4524
|
+
const obj = __privateGet(this, _activeMiddlewareObjs)[i];
|
|
4525
|
+
const result = (_a = obj == null ? void 0 : obj.afterDrawFrame) == null ? void 0 : _a.call(obj, e);
|
|
4487
4526
|
if (result === false) {
|
|
4488
4527
|
return;
|
|
4489
4528
|
}
|
|
4490
4529
|
}
|
|
4491
|
-
}
|
|
4530
|
+
};
|
|
4531
|
+
resetActiveMiddlewareObjs_fn = function() {
|
|
4492
4532
|
const activeMiddlewareObjs = [];
|
|
4493
|
-
const middlewareMap =
|
|
4494
|
-
|
|
4533
|
+
const middlewareMap = __privateGet(this, _middlewareMap);
|
|
4534
|
+
__privateGet(this, _middlewares).forEach((middleware) => {
|
|
4495
4535
|
const item = middlewareMap.get(middleware);
|
|
4496
|
-
if ((item
|
|
4536
|
+
if ((item == null ? void 0 : item.status) === "enable" && (item == null ? void 0 : item.middlewareObject)) {
|
|
4497
4537
|
activeMiddlewareObjs.push(item.middlewareObject);
|
|
4498
4538
|
}
|
|
4499
4539
|
});
|
|
4500
|
-
|
|
4540
|
+
__privateSet(this, _activeMiddlewareObjs, activeMiddlewareObjs);
|
|
4501
4541
|
};
|
|
4502
4542
|
const CURSOR = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjMtMDktMTdUMTY6MDc6MjYrMDg6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIzLTA5LTE3VDE2OjEyOjUwKzA4OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIzLTA5LTE3VDE2OjEyOjUwKzA4OjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgcGhvdG9zaG9wOklDQ1Byb2ZpbGU9InNSR0IgSUVDNjE5NjYtMi4xIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjliMGM0MzI2LWU4ZTQtNDlkNy04MmUzLTgxODkwYTE2ZmU1YSIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjMzOGFhZDBmLWZkZjMtODE0MS1iMTZmLWNiZWIzNTQyYTJhMCIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjUwODAxNzc1LWZlNGEtNDQyMy05NDQ3LThkYWRhNzZhYTllOSI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6NTA4MDE3NzUtZmU0YS00NDIzLTk0NDctOGRhZGE3NmFhOWU5IiBzdEV2dDp3aGVuPSIyMDIzLTA5LTE3VDE2OjA3OjI2KzA4OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6OWIwYzQzMjYtZThlNC00OWQ3LTgyZTMtODE4OTBhMTZmZTVhIiBzdEV2dDp3aGVuPSIyMDIzLTA5LTE3VDE2OjEyOjUwKzA4OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7W6XrzAAAGLklEQVRYhb2Xf2iUdRzHX/txtfXLplZ6Wblm6fzRmG6r7Uou1AxKRjQKYUqgaLBACFogppcK1h8aLRkMSYaJIA5hYMomZpskEfPOufCaDpZ6t7rbre263U3vzn3643meu+eu3XNzvz7w4bbdc/e89nl/Pu/v50HUCAQCx1tbW0uAx4CHgSwggxkKERkziUQif2mQ0WjU53a7vwSeBB4BTEDmTICmBBwYGDivVlDjlFAo9KvT6dwIPAHkANkq6MwDXr169bCISENDg9TX14s+BgcHf2hubi5mBmRPCXj06NFPREQ6OjoEkPLycrl06VIMMhKJeFwu1xdMs+wpAYuLi9eIiIyOjkpeXp4AAsj27dvF7/fHQIPB4C9dXV0fME2ypwQEXvX7/bdFRNauXRsDBMRkMsnhw4cTZB8YGGhsamp6hSmW3Qhw1Y0bN86LiNTW1iYAallWViZtbW162ftcLtdO/i/7tAAWtba2ficicvLkyTEBtdy6dasMDg7GQIeHh9s7OzvfBx5nkrIbAS7du3fvxyIiPT09hoBa1tXVJcv+fWNj4zLgUeAhJiC7EeDLwOsiMioisnDhwnFBrlixQi5evKiX/c6tW7c+R5E9lweU3QjwReDV/v7+bhGRqqqqcQFquWnTJvH5fHrZLzocjkoSZU9bTSPA54GV165daxYROXDgwAMBannw4MFk2RsaGhqWME7ZjQDNwIrTp09/JSLS0tIyIUBACgoK5MKFCzHIcDj85+3btz8FZpFGdiPAZ4DCmpqaTSIiPp9vwoBaVlVVidfr1ct+/sqVK+9iILsR4FzgJcASDoeHRUSKioomDQnI/v37E2T3+Xz1hw4dWjSW7EaAeUA+UNbX12cXEdmyZcuUAAJiNpvlzJkzetl73G53rVrN2EmUCjATuA9EgYjL5eoGKCkpGatNHijmz5/Pxo0b2blzJ2azOfZ3k8lUYDabv45Go/Y7d+6sIY0VZQOjGqDT6bxeWlrKqlWrJgRlsVhYv349FRUVWCwWcnJyEt4PBoOuoaEhu9frvdzR0fHTtm3buolvRpLqe3OBp4EllZWV74mIRKNRyc3NTSvf7Nmzpbq6Wk6cOCFut1uSY2RkJOB0Ou3Nzc3Ha2trPwPWAGXAEuBZFFPPAbKMevBhYA6wCKgIBoP9IiKrV682hLPZbP8DEpH7vb29N1paWn602WwHFyxYsAX4EKgE3gIsQBFQgOIeT6j3z0wFqEkc60OPx9Odn58/t6SkhPb29jFLbrVa2bNnDwBer7fv5s2bPQ6Ho7upqcnZ1tbmASJq3gPC6utdYESXYfWeo6mkBaUHRQ/odrv/yM/Pt5SWlqb8kAbncDh+W7lyZYN683u6DOvAwipsOOnniA4wZf9lqhdoVYzY7fbrQMpBsdlsWK1WRkZGAtXV1d8D/wA+wKNLr5o+YEC9ZggIAEHiFbyfDhCUCcoFngIWFxYWrtMaat68eQl9V15eHmu2+vr6OuAd4A2gGFgMLERp/mdQ+noWyuadi9Jr2aQ4k42GBPXDs1Ga97WhoaFbIiIbNmxIANTWq87Ozp9VuApgGfACihPkoRjwI+p3mlSgtA9ZRkYNYwwKJBr2rl27sFqthEKhwZqamqOAX5f/AsPE5btLvM/GJWO6yFb/82eBonPnztWJiJw9e1YAWb58eUzaI0eOfAO8CbwCPIfiZZN+eEoncSaKLPOApbt3794uIuL1ehOktdvtF4C3gRKURXcOSn9lTRRsvIAZKI4+l/gjQFREZMeOHSIiEggE+tetW/cRitkuRhmERxnnxjxZQFDWnzzURwCv1+vUHxHHjh37lri0C1Am9KGpgDMC1G8SQnxxCHs8Hqf2RldX10+bN28+i+JjwyT62KSaP13oAfWTHO7t7f0dIBQK/b1v375GlEnVjPYuyoQaHlNTDahVMALca29vdwBcvnz5+KlTp26OATft1UuODBS7yEOxj0K/329HOSWWopjxlE1tchhtM7FriPfgXSDDbrfXo0gbJr4QzIi0WiRPYBbKZJrUV23b0dYn7XSYcsBkS9EiO/k6lApq1cwiPjzaAM1Y9cYC1G6uAWrPCtrvMwoHqU02Q5caIEzj1KaS+D+vIjxtLug31gAAAABJRU5ErkJggg==";
|
|
4503
4543
|
const CURSOR_RESIZE = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAApCAYAAABHomvIAAAACXBIWXMAAAsTAAALEwEAmpwYAAAF92lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNi4wLWMwMDYgNzkuMTY0NzUzLCAyMDIxLzAyLzE1LTExOjUyOjEzICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIgeG1wOkNyZWF0ZURhdGU9IjIwMjMtMDktMTdUMTY6MzE6MjMrMDg6MDAiIHhtcDpNb2RpZnlEYXRlPSIyMDIzLTA5LTE3VDE2OjQ0OjIyKzA4OjAwIiB4bXA6TWV0YWRhdGFEYXRlPSIyMDIzLTA5LTE3VDE2OjQ0OjIyKzA4OjAwIiBkYzpmb3JtYXQ9ImltYWdlL3BuZyIgcGhvdG9zaG9wOkNvbG9yTW9kZT0iMyIgcGhvdG9zaG9wOklDQ1Byb2ZpbGU9InNSR0IgSUVDNjE5NjYtMi4xIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjY0MTBhYjUzLWM0ZjEtNDVhNS04MjhkLTIxOTczOWFjOTk3MSIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjBkMDNmNjM5LTE5MzctY2Y0MC1hMTg0LTIyMjg0NzczNWNmYSIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjgyYjQwZGRmLWE0ZGEtNDY3MC1iYzc2LTBhYjY3ZmI5M2I0ZSI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ODJiNDBkZGYtYTRkYS00NjcwLWJjNzYtMGFiNjdmYjkzYjRlIiBzdEV2dDp3aGVuPSIyMDIzLTA5LTE3VDE2OjMxOjIzKzA4OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6NjQxMGFiNTMtYzRmMS00NWE1LTgyOGQtMjE5NzM5YWM5OTcxIiBzdEV2dDp3aGVuPSIyMDIzLTA5LTE3VDE2OjQ0OjIyKzA4OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjIuMyAoTWFjaW50b3NoKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz57vRudAAAEk0lEQVRYhe3ZW0jbVxzA8e8/MX+NYnG9uI4xE3bvoLt0FzradRfGBtsYo32YdAhb6WQyBqV7KOylpYjzZShDGfjmyxgbgjjwyRm16SYMhgiNKDhbL3VtNF4xJOnf3x7+59i/Wf4aTbInf3AwJMdzPjnnf/n9/jFEhGzDMIxMb3uAIsDs6ek5urS05Dtz5syE+uwekAQS6u89YD19gC0NIpJ1c8GZQHlXV9fJRCIxGo/HxxoaGj4CngWOAEGgEihXfT07MeQC3MB1dna+lkgkRkXF6urq3xcuXPgUOAE8DzwGPOiGLARwEy4ej4+JiITD4elr167NiIgsLi7eqq2trQPeBI4Bj7sh8w10xZmmeds0zdn+/v5/RERisdjUuXPnvgLeAl50Q+YTaAA+oKy7u/uE3laNAwSQ4uLiu6FQ6G4G5DG13YeAMjWWkU+gBygJhULHNe769etTTpwDGXUiz58//yXwujp5qoAHgBLAk0+gNxKJHEulUiMKN2ma5gwgPp/vjhOXjlxYWJisq6urBV5RW30IKAW8eQPGYrGjlmXdEBEZHBy8aZrmFCCmac729fVtAHt7e6MO5N2+vr47IiJLS0s3L126dBZ4Sh2LZUBRwVdwYGBgVuwOYh/zsoF0bnPBVzDTMRgOh6dFhROokSIi8/Pz0+pEeaPQx+DGWdzV1XVSX2LcgCIic3NzMzU1NV8D7wIvq9WrLNRZvOk62NHRccqJTAdGo9Hb1dXV3wAfYt9VjgAPFfI66EQWAxU9PT0fuwEvXrzYBJwF3gFeAAJAhfrfrO4k/7lxZxnr2JlJqry8POnWyePx6H4JR0vhktVkHGOXQI20SkpKLLcOhmGsA5YCaZiVLS5XoADi9XpdkznDMERhnE0fCgUHZhvOW+CO4/8A5hR7wFxjD5hr7AFzjZyBlmVlrOYdYaS1HUUuQA/gWV9fd51URDyqn1c1j6MVFGjoidfW1oq2ABrYj0V82OmVzwHNajVdB88C5wOKTdM87NaxsrKyQsFKHC2BnTDo+/TWt8Bd5INeVC44NDT0xXYZdXNz8w/AaeyS8yjwCPdzQu92ht2m/OUjIyOfS1pkAoqItLS0fA+8D7wKPA0cxs6qC1O4T0xMfKYnb21tnXEDNjc3z+nXbW1t3wFvYz9dCAL7KUThHovFPtGTNjU1jQFSX18/lg68cuXKLUAaGxs3vkB7e/u3wHHgCQpUdnpTqdQvesJgMDisUVevXh3Xry9fvnxTv66qqprQ/cfHx/vVNj/J/couv0DAv7q6+pMDeYPNSalkwkUikX7s4ukl4FHgAODPN1CXnPsWFxd/dCAjW+GGhoZCwAfYpeczwMPAPjVW3gv3IvXN98disZ8dyBGNCwQC4/r94eHhfuy6+JS6zATUCeJXY+W9cNfIUuDAwsLCr05kIBDYeBQ8Ojr6h8Lpx25BtbWlGpfv62BG5PLy8m+SFpOTk38C76mVe84NVyhgOvLgysrK7xoXjUb/Uqt2XG1rEDiYCbcd0MgwsWtk+J1EI03An0wmw5Zlefx+/2n1eRKIO5r+rWTTpFsZ/gWFrGMmeObuqwAAAABJRU5ErkJggg==";
|
|
@@ -4509,6 +4549,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4509
4549
|
const EVENT_KEY_RULER = "ruler";
|
|
4510
4550
|
const EVENT_KEY_SCALE = "scale";
|
|
4511
4551
|
const EVENT_KEY_SELECT = "select";
|
|
4552
|
+
const EVENT_KEY_SELECT_LAYOUT = "selectLayout";
|
|
4512
4553
|
const EVENT_KEY_CLEAR_SELECT = "clearSelect";
|
|
4513
4554
|
const EVENT_KEY_TEXT_EDIT = "textEdit";
|
|
4514
4555
|
const EVENT_KEY_TEXT_CHANGE = "textChange";
|
|
@@ -4519,6 +4560,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4519
4560
|
CHANGE: EVENT_KEY_CHANGE,
|
|
4520
4561
|
RULER: EVENT_KEY_RULER,
|
|
4521
4562
|
SCALE: EVENT_KEY_SCALE,
|
|
4563
|
+
SELECT_LAYOUT: EVENT_KEY_SELECT_LAYOUT,
|
|
4522
4564
|
SELECT: EVENT_KEY_SELECT,
|
|
4523
4565
|
CLEAR_SELECT: EVENT_KEY_CLEAR_SELECT,
|
|
4524
4566
|
TEXT_EDIT: EVENT_KEY_TEXT_EDIT,
|
|
@@ -4537,7 +4579,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4537
4579
|
class Cursor {
|
|
4538
4580
|
constructor(container, opts) {
|
|
4539
4581
|
__privateAdd(this, _Cursor_instances);
|
|
4540
|
-
__privateAdd(this,
|
|
4582
|
+
__privateAdd(this, _eventHub2);
|
|
4541
4583
|
__privateAdd(this, _container);
|
|
4542
4584
|
__privateAdd(this, _cursorType, null);
|
|
4543
4585
|
__privateAdd(this, _resizeCursorBaseImage, null);
|
|
@@ -4549,19 +4591,19 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4549
4591
|
rotate: CURSOR_RESIZE_ROTATE
|
|
4550
4592
|
});
|
|
4551
4593
|
__privateSet(this, _container, container);
|
|
4552
|
-
__privateSet(this,
|
|
4553
|
-
__privateMethod(this, _Cursor_instances,
|
|
4594
|
+
__privateSet(this, _eventHub2, opts.eventHub);
|
|
4595
|
+
__privateMethod(this, _Cursor_instances, init_fn4).call(this);
|
|
4554
4596
|
__privateMethod(this, _Cursor_instances, loadResizeCursorBaseImage_fn).call(this);
|
|
4555
4597
|
}
|
|
4556
4598
|
}
|
|
4557
|
-
|
|
4599
|
+
_eventHub2 = new WeakMap();
|
|
4558
4600
|
_container = new WeakMap();
|
|
4559
4601
|
_cursorType = new WeakMap();
|
|
4560
4602
|
_resizeCursorBaseImage = new WeakMap();
|
|
4561
4603
|
_cursorImageMap = new WeakMap();
|
|
4562
4604
|
_Cursor_instances = new WeakSet();
|
|
4563
|
-
|
|
4564
|
-
const eventHub = __privateGet(this,
|
|
4605
|
+
init_fn4 = function() {
|
|
4606
|
+
const eventHub = __privateGet(this, _eventHub2);
|
|
4565
4607
|
__privateMethod(this, _Cursor_instances, resetCursor_fn).call(this, "default");
|
|
4566
4608
|
eventHub.on(coreEventKeys.CURSOR, (e) => {
|
|
4567
4609
|
var _a;
|
|
@@ -4729,22 +4771,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4729
4771
|
ctx.stroke();
|
|
4730
4772
|
}
|
|
4731
4773
|
function drawCircleController(ctx, circleCenter, opts) {
|
|
4732
|
-
const { size,
|
|
4774
|
+
const { size, background: background2 } = opts;
|
|
4733
4775
|
const center = circleCenter;
|
|
4734
4776
|
const r = size / 2;
|
|
4735
4777
|
const a = r;
|
|
4736
4778
|
const b = r;
|
|
4737
4779
|
if (a >= 0 && b >= 0) {
|
|
4738
|
-
if (typeof borderWidth2 === "number" && borderWidth2 > 0) {
|
|
4739
|
-
const ba = borderWidth2 / 2 + a;
|
|
4740
|
-
const bb = borderWidth2 / 2 + b;
|
|
4741
|
-
ctx.beginPath();
|
|
4742
|
-
ctx.strokeStyle = borderColor2;
|
|
4743
|
-
ctx.lineWidth = borderWidth2;
|
|
4744
|
-
ctx.circle(center.x, center.y, ba, bb, 0, 0, 2 * Math.PI);
|
|
4745
|
-
ctx.closePath();
|
|
4746
|
-
ctx.stroke();
|
|
4747
|
-
}
|
|
4748
4780
|
ctx.beginPath();
|
|
4749
4781
|
ctx.fillStyle = background2;
|
|
4750
4782
|
ctx.circle(center.x, center.y, a, b, 0, 0, 2 * Math.PI);
|
|
@@ -4819,7 +4851,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4819
4851
|
const { controller } = opts;
|
|
4820
4852
|
if (controller) {
|
|
4821
4853
|
const { topLeft, topRight, bottomLeft, bottomRight, topMiddle, bottomMiddle, leftMiddle, rightMiddle } = controller;
|
|
4822
|
-
const ctrlOpts = { ...wrapperOpts, borderWidth: 1
|
|
4854
|
+
const ctrlOpts = { ...wrapperOpts, borderWidth: 1 };
|
|
4823
4855
|
drawCrossVertexes(ctx, calcViewVertexes(topMiddle.vertexes, opts), ctrlOpts);
|
|
4824
4856
|
drawCrossVertexes(ctx, calcViewVertexes(bottomMiddle.vertexes, opts), ctrlOpts);
|
|
4825
4857
|
drawCrossVertexes(ctx, calcViewVertexes(leftMiddle.vertexes, opts), ctrlOpts);
|
|
@@ -4855,7 +4887,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4855
4887
|
drawVertexes(ctx, calcViewVertexes(bottomLeft.vertexes, opts), ctrlOpts);
|
|
4856
4888
|
drawVertexes(ctx, calcViewVertexes(bottomRight.vertexes, opts), ctrlOpts);
|
|
4857
4889
|
if (((_a = element == null ? void 0 : element.operations) == null ? void 0 : _a.rotatable) !== false) {
|
|
4858
|
-
drawCircleController(ctx, calcViewPointSize(rotate.center, opts), { ...ctrlOpts, size: rotate.size
|
|
4890
|
+
drawCircleController(ctx, calcViewPointSize(rotate.center, opts), { ...ctrlOpts, size: rotate.size });
|
|
4859
4891
|
const rotateCenter = calcViewPointSize(rotate.center, opts);
|
|
4860
4892
|
ctx.drawImage(
|
|
4861
4893
|
rotateControllerPattern.canvas,
|
|
@@ -4980,7 +5012,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4980
5012
|
if (!vertexes) {
|
|
4981
5013
|
return false;
|
|
4982
5014
|
}
|
|
4983
|
-
return isPointInViewActiveVertexes(p, { ctx, vertexes, viewScaleInfo
|
|
5015
|
+
return isPointInViewActiveVertexes(p, { ctx, vertexes, viewScaleInfo });
|
|
4984
5016
|
}
|
|
4985
5017
|
function getPointTarget(p, opts) {
|
|
4986
5018
|
var _a, _b, _c, _d, _e;
|
|
@@ -4991,7 +5023,17 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
4991
5023
|
groupQueue: [],
|
|
4992
5024
|
groupQueueVertexesList: []
|
|
4993
5025
|
};
|
|
4994
|
-
const {
|
|
5026
|
+
const {
|
|
5027
|
+
ctx,
|
|
5028
|
+
data,
|
|
5029
|
+
calculator,
|
|
5030
|
+
selectedElements,
|
|
5031
|
+
viewScaleInfo,
|
|
5032
|
+
viewSizeInfo,
|
|
5033
|
+
areaSize,
|
|
5034
|
+
groupQueue,
|
|
5035
|
+
selectedElementController
|
|
5036
|
+
} = opts;
|
|
4995
5037
|
if (selectedElementController) {
|
|
4996
5038
|
const { left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight, rotate } = selectedElementController;
|
|
4997
5039
|
const ctrls = [left, right, top, bottom, topLeft, topRight, bottomLeft, bottomRight];
|
|
@@ -5000,7 +5042,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5000
5042
|
}
|
|
5001
5043
|
for (let i = 0; i < ctrls.length; i++) {
|
|
5002
5044
|
const ctrl = ctrls[i];
|
|
5003
|
-
if (isPointInViewActiveVertexes(p, { ctx, vertexes: ctrl.vertexes,
|
|
5045
|
+
if (isPointInViewActiveVertexes(p, { ctx, vertexes: ctrl.vertexes, viewScaleInfo })) {
|
|
5004
5046
|
target.type = `resize-${ctrl.type}`;
|
|
5005
5047
|
if (selectedElements && (selectedElements == null ? void 0 : selectedElements.length) > 0) {
|
|
5006
5048
|
target.groupQueue = groupQueue || [];
|
|
@@ -5016,7 +5058,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5016
5058
|
for (let i = lastGroup.detail.children.length - 1; i >= 0; i--) {
|
|
5017
5059
|
const child = lastGroup.detail.children[i];
|
|
5018
5060
|
const vertexes = calcElementVertexesInGroup(child, { groupQueue });
|
|
5019
|
-
if (vertexes && isPointInViewActiveVertexes(p, { ctx, vertexes, viewScaleInfo
|
|
5061
|
+
if (vertexes && isPointInViewActiveVertexes(p, { ctx, vertexes, viewScaleInfo })) {
|
|
5020
5062
|
if (!target.type) {
|
|
5021
5063
|
target.type = "over-element";
|
|
5022
5064
|
}
|
|
@@ -5052,7 +5094,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5052
5094
|
function resizeElement(elem, opts) {
|
|
5053
5095
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
5054
5096
|
let { x: x2, y: y2, w: w2, h: h2, angle: angle2 = 0 } = elem;
|
|
5055
|
-
const elemCenter = calcElementCenter({ x: x2, y: y2, w: w2, h: h2
|
|
5097
|
+
const elemCenter = calcElementCenter({ x: x2, y: y2, w: w2, h: h2 });
|
|
5056
5098
|
angle2 = limitAngle(angle2);
|
|
5057
5099
|
const radian = parseAngleToRadian(angle2);
|
|
5058
5100
|
const limitRatio = !!((_a = elem == null ? void 0 : elem.operations) == null ? void 0 : _a.limitRatio);
|
|
@@ -5343,7 +5385,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5343
5385
|
centerY = centerY - centerMoveHorizontalDist2 * Math.sin(radian);
|
|
5344
5386
|
} else if (angle2 < 180) {
|
|
5345
5387
|
moveVerticalDist = changeMoveDistDirect(moveVerticalDist, moveVerticalX);
|
|
5346
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5388
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5389
|
+
moveHorizontalDist,
|
|
5390
|
+
limitRatio ? moveVerticalDist : moveHorizontalX
|
|
5391
|
+
);
|
|
5347
5392
|
const radian2 = parseRadian(angle2 - 90);
|
|
5348
5393
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5349
5394
|
centerX = centerX + centerMoveVerticalDist2 * Math.cos(radian2);
|
|
@@ -5353,7 +5398,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5353
5398
|
centerY = centerY - centerMoveDist * Math.cos(radian2);
|
|
5354
5399
|
} else if (angle2 < 270) {
|
|
5355
5400
|
moveVerticalDist = changeMoveDistDirect(moveVerticalDist, moveVerticalY);
|
|
5356
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5401
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5402
|
+
moveHorizontalDist,
|
|
5403
|
+
limitRatio ? moveVerticalDist : moveHorizontalY
|
|
5404
|
+
);
|
|
5357
5405
|
const radian2 = parseRadian(angle2 - 180);
|
|
5358
5406
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5359
5407
|
centerX = centerX - centerMoveVerticalDist2 * Math.sin(radian2);
|
|
@@ -5363,7 +5411,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5363
5411
|
centerY = centerY + centerMoveHorizontalDist2 * Math.sin(radian2);
|
|
5364
5412
|
} else if (angle2 < 360) {
|
|
5365
5413
|
moveVerticalDist = 0 - changeMoveDistDirect(moveVerticalDist, moveVerticalX);
|
|
5366
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5414
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5415
|
+
moveHorizontalDist,
|
|
5416
|
+
limitRatio ? moveVerticalDist : moveHorizontalY
|
|
5417
|
+
);
|
|
5367
5418
|
const radian2 = parseRadian(angle2 - 270);
|
|
5368
5419
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5369
5420
|
centerX = centerX - centerMoveVerticalDist2 * Math.cos(radian2);
|
|
@@ -5397,7 +5448,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5397
5448
|
let centerY = elemCenter.y;
|
|
5398
5449
|
if (angle2 < 90) {
|
|
5399
5450
|
moveVerticalDist = 0 - changeMoveDistDirect(moveVerticalDist, moveVerticalY);
|
|
5400
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5451
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5452
|
+
moveHorizontalDist,
|
|
5453
|
+
limitRatio ? moveVerticalDist : moveHorizontalY
|
|
5454
|
+
);
|
|
5401
5455
|
const radian2 = parseRadian(angle2);
|
|
5402
5456
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5403
5457
|
centerX = centerX + centerMoveVerticalDist2 * Math.sin(radian2);
|
|
@@ -5407,7 +5461,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5407
5461
|
centerY = centerY + centerMoveHorizontalDist2 * Math.sin(radian2);
|
|
5408
5462
|
} else if (angle2 < 180) {
|
|
5409
5463
|
moveVerticalDist = changeMoveDistDirect(moveVerticalDist, moveVerticalX);
|
|
5410
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5464
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5465
|
+
moveHorizontalDist,
|
|
5466
|
+
limitRatio ? moveVerticalDist : moveHorizontalY
|
|
5467
|
+
);
|
|
5411
5468
|
const radian2 = parseRadian(angle2 - 90);
|
|
5412
5469
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5413
5470
|
centerX = centerX + centerMoveVerticalDist2 * Math.cos(radian2);
|
|
@@ -5418,7 +5475,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5418
5475
|
} else if (angle2 < 270) {
|
|
5419
5476
|
const radian2 = parseRadian(angle2 - 180);
|
|
5420
5477
|
moveVerticalDist = changeMoveDistDirect(moveVerticalDist, moveVerticalY);
|
|
5421
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5478
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5479
|
+
moveHorizontalDist,
|
|
5480
|
+
limitRatio ? moveVerticalDist : 0 - moveHorizontalX
|
|
5481
|
+
);
|
|
5422
5482
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5423
5483
|
centerX = centerX - centerMoveVerticalDist2 * Math.sin(radian2);
|
|
5424
5484
|
centerY = centerY + centerMoveVerticalDist2 * Math.cos(radian2);
|
|
@@ -5427,7 +5487,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5427
5487
|
centerY = centerY - centerMoveHorizontalDist2 * Math.sin(radian2);
|
|
5428
5488
|
} else if (angle2 < 360) {
|
|
5429
5489
|
moveVerticalDist = 0 - changeMoveDistDirect(moveVerticalDist, moveVerticalX);
|
|
5430
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5490
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5491
|
+
moveHorizontalDist,
|
|
5492
|
+
limitRatio ? moveVerticalDist : moveHorizontalX
|
|
5493
|
+
);
|
|
5431
5494
|
const radian2 = parseRadian(angle2 - 270);
|
|
5432
5495
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5433
5496
|
centerX = centerX - centerMoveVerticalDist2 * Math.cos(radian2);
|
|
@@ -5471,7 +5534,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5471
5534
|
centerY = centerY - centerMoveHorizontalDist2 * Math.sin(radian2);
|
|
5472
5535
|
} else if (angle2 < 180) {
|
|
5473
5536
|
moveVerticalDist = 0 - changeMoveDistDirect(moveVerticalDist, moveVerticalX);
|
|
5474
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5537
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5538
|
+
moveHorizontalDist,
|
|
5539
|
+
limitRatio ? moveVerticalDist : moveHorizontalX
|
|
5540
|
+
);
|
|
5475
5541
|
const radian2 = parseRadian(angle2 - 90);
|
|
5476
5542
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5477
5543
|
centerX = centerX - centerMoveVerticalDist2 * Math.cos(radian2);
|
|
@@ -5481,7 +5547,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5481
5547
|
centerY = centerY - centerMoveDist * Math.cos(radian2);
|
|
5482
5548
|
} else if (angle2 < 270) {
|
|
5483
5549
|
moveVerticalDist = changeMoveDistDirect(moveVerticalDist, moveVerticalX);
|
|
5484
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5550
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5551
|
+
moveHorizontalDist,
|
|
5552
|
+
limitRatio ? moveVerticalDist : moveHorizontalY
|
|
5553
|
+
);
|
|
5485
5554
|
const radian2 = parseRadian(angle2 - 180);
|
|
5486
5555
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5487
5556
|
centerX = centerX + centerMoveVerticalDist2 * Math.sin(radian2);
|
|
@@ -5491,7 +5560,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5491
5560
|
centerY = centerY + centerMoveHorizontalDist2 * Math.sin(radian2);
|
|
5492
5561
|
} else if (angle2 < 360) {
|
|
5493
5562
|
moveVerticalDist = changeMoveDistDirect(moveVerticalDist, moveVerticalX);
|
|
5494
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5563
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5564
|
+
moveHorizontalDist,
|
|
5565
|
+
limitRatio ? moveVerticalDist : moveHorizontalY
|
|
5566
|
+
);
|
|
5495
5567
|
const radian2 = parseRadian(angle2 - 270);
|
|
5496
5568
|
const centerMoveDist = moveVerticalDist / 2;
|
|
5497
5569
|
centerX = centerX + centerMoveDist * Math.cos(radian2);
|
|
@@ -5524,7 +5596,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5524
5596
|
let centerY = elemCenter.y;
|
|
5525
5597
|
if (angle2 < 90) {
|
|
5526
5598
|
moveVerticalDist = changeMoveDistDirect(moveVerticalDist, moveVerticalY);
|
|
5527
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5599
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5600
|
+
moveHorizontalDist,
|
|
5601
|
+
limitRatio ? moveVerticalDist : moveHorizontalY
|
|
5602
|
+
);
|
|
5528
5603
|
const radian2 = parseRadian(angle2);
|
|
5529
5604
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5530
5605
|
centerX = centerX - centerMoveVerticalDist2 * Math.sin(radian2);
|
|
@@ -5544,7 +5619,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5544
5619
|
centerY = centerY + centerMoveHorizontalDist2 * Math.cos(radian2);
|
|
5545
5620
|
} else if (angle2 < 270) {
|
|
5546
5621
|
moveVerticalDist = changeMoveDistDirect(moveVerticalDist, moveVerticalX);
|
|
5547
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5622
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5623
|
+
moveHorizontalDist,
|
|
5624
|
+
limitRatio ? moveVerticalDist : 0 - moveHorizontalY
|
|
5625
|
+
);
|
|
5548
5626
|
const radian2 = parseRadian(angle2 - 180);
|
|
5549
5627
|
const centerMoveVerticalDist2 = moveVerticalDist / 2;
|
|
5550
5628
|
centerX = centerX + centerMoveVerticalDist2 * Math.sin(radian2);
|
|
@@ -5554,7 +5632,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5554
5632
|
centerY = centerY - centerMoveHorizontalDist2 * Math.sin(radian2);
|
|
5555
5633
|
} else if (angle2 < 360) {
|
|
5556
5634
|
moveVerticalDist = changeMoveDistDirect(moveVerticalDist, moveVerticalX);
|
|
5557
|
-
moveHorizontalDist = changeMoveDistDirect(
|
|
5635
|
+
moveHorizontalDist = changeMoveDistDirect(
|
|
5636
|
+
moveHorizontalDist,
|
|
5637
|
+
limitRatio ? moveVerticalDist : moveHorizontalX
|
|
5638
|
+
);
|
|
5558
5639
|
const radian2 = parseRadian(angle2 - 270);
|
|
5559
5640
|
const centerMoveDist = moveVerticalDist / 2;
|
|
5560
5641
|
centerX = centerX + centerMoveDist * Math.cos(radian2);
|
|
@@ -5599,7 +5680,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5599
5680
|
const indexes = [];
|
|
5600
5681
|
const uuids = [];
|
|
5601
5682
|
const elements = [];
|
|
5602
|
-
const { viewScaleInfo,
|
|
5683
|
+
const { viewScaleInfo, start, end } = opts;
|
|
5603
5684
|
if (!(Array.isArray(data.elements) && start && end)) {
|
|
5604
5685
|
return { indexes, uuids, elements };
|
|
5605
5686
|
}
|
|
@@ -5749,8 +5830,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5749
5830
|
if (!targetRectInfo) {
|
|
5750
5831
|
return null;
|
|
5751
5832
|
}
|
|
5752
|
-
const vTargetLineDotMap = {};
|
|
5753
|
-
const hTargetLineDotMap = {};
|
|
5754
5833
|
const vRefLineDotMap = {};
|
|
5755
5834
|
const hRefLineDotMap = {};
|
|
5756
5835
|
const vHelperLineDotMapList = [];
|
|
@@ -5758,12 +5837,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
5758
5837
|
let sortedRefXKeys = [];
|
|
5759
5838
|
let sortedRefYKeys = [];
|
|
5760
5839
|
const targetBox = getViewBoxInfo(targetRectInfo);
|
|
5761
|
-
vTargetLineDotMap[targetBox.minX] = [targetBox.minY, targetBox.midY, targetBox.maxY];
|
|
5762
|
-
vTargetLineDotMap[targetBox.midX] = [targetBox.minY, targetBox.midY, targetBox.maxY];
|
|
5763
|
-
vTargetLineDotMap[targetBox.maxX] = [targetBox.minY, targetBox.midY, targetBox.maxY];
|
|
5764
|
-
hTargetLineDotMap[targetBox.minY] = [targetBox.minX, targetBox.midX, targetBox.maxX];
|
|
5765
|
-
hTargetLineDotMap[targetBox.midY] = [targetBox.minX, targetBox.midX, targetBox.maxX];
|
|
5766
|
-
hTargetLineDotMap[targetBox.maxY] = [targetBox.minX, targetBox.midX, targetBox.maxX];
|
|
5767
5840
|
siblingViewRectInfoList.forEach((info) => {
|
|
5768
5841
|
const box = getViewBoxInfo(info);
|
|
5769
5842
|
if (!vRefLineDotMap[box.minX]) {
|
|
@@ -6207,6 +6280,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6207
6280
|
}
|
|
6208
6281
|
if (sharer.getSharedStorage(keyLayoutIsSelected) === true && !prevIsSelected) {
|
|
6209
6282
|
viewer.drawFrame();
|
|
6283
|
+
eventHub.trigger(coreEventKeys.SELECT_LAYOUT);
|
|
6210
6284
|
}
|
|
6211
6285
|
prevIsSelected = sharer.getSharedStorage(keyLayoutIsSelected);
|
|
6212
6286
|
if (sharer.getSharedStorage(keyLayoutIsHoverController) === true) {
|
|
@@ -6308,10 +6382,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6308
6382
|
const data = sharer.getActiveStorage("data");
|
|
6309
6383
|
if (data && layoutActionType === "resize" && layoutControlType) {
|
|
6310
6384
|
eventHub.trigger(coreEventKeys.CHANGE, {
|
|
6311
|
-
type: "
|
|
6385
|
+
type: "dragLayout",
|
|
6312
6386
|
data
|
|
6313
6387
|
});
|
|
6314
6388
|
}
|
|
6389
|
+
sharer.setSharedStorage(keyLayoutActionType, null);
|
|
6390
|
+
sharer.setSharedStorage(keyLayoutControlType, null);
|
|
6315
6391
|
if (sharer.getSharedStorage(keyLayoutIsHoverController) === true) {
|
|
6316
6392
|
return false;
|
|
6317
6393
|
}
|
|
@@ -6863,7 +6939,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6863
6939
|
sharer.setSharedStorage(keySelectedElementList, list);
|
|
6864
6940
|
if (list.length === 1) {
|
|
6865
6941
|
updateSelectedElemenetController();
|
|
6866
|
-
sharer.setSharedStorage(
|
|
6942
|
+
sharer.setSharedStorage(
|
|
6943
|
+
keySelectedElementPosition,
|
|
6944
|
+
getElementPositionFromList(list[0].uuid, ((_a = sharer.getActiveStorage("data")) == null ? void 0 : _a.elements) || [])
|
|
6945
|
+
);
|
|
6867
6946
|
} else {
|
|
6868
6947
|
sharer.setSharedStorage(keySelectedElementController, null);
|
|
6869
6948
|
sharer.setSharedStorage(keySelectedElementPosition, []);
|
|
@@ -6872,7 +6951,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
6872
6951
|
const uuids = list.map((elem) => elem.uuid);
|
|
6873
6952
|
const data = sharer.getActiveStorage("data");
|
|
6874
6953
|
const positionMap = getElementPositionMapFromList(uuids, (data == null ? void 0 : data.elements) || []);
|
|
6875
|
-
eventHub.trigger(coreEventKeys.SELECT, {
|
|
6954
|
+
eventHub.trigger(coreEventKeys.SELECT, {
|
|
6955
|
+
type: "clickCanvas",
|
|
6956
|
+
uuids,
|
|
6957
|
+
positions: list.map((elem) => [...positionMap[elem.uuid]])
|
|
6958
|
+
});
|
|
6876
6959
|
}
|
|
6877
6960
|
};
|
|
6878
6961
|
const pointTargetBaseOptions = () => {
|
|
@@ -7017,13 +7100,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7017
7100
|
}
|
|
7018
7101
|
const selectedElements = getActiveElements();
|
|
7019
7102
|
const viewScaleInfo = sharer.getActiveViewScaleInfo();
|
|
7020
|
-
|
|
7103
|
+
sharer.getActiveViewSizeInfo();
|
|
7021
7104
|
const target = getPointTarget(e.point, {
|
|
7022
7105
|
...pointTargetBaseOptions(),
|
|
7023
7106
|
areaSize: calcSelectedElementsArea(selectedElements, {
|
|
7024
|
-
viewScaleInfo
|
|
7025
|
-
viewSizeInfo,
|
|
7026
|
-
calculator
|
|
7107
|
+
viewScaleInfo
|
|
7027
7108
|
})
|
|
7028
7109
|
});
|
|
7029
7110
|
triggerCursor(target);
|
|
@@ -7089,8 +7170,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7089
7170
|
}
|
|
7090
7171
|
const listAreaSize = calcSelectedElementsArea(getActiveElements(), {
|
|
7091
7172
|
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
7092
|
-
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
7093
|
-
calculator
|
|
7173
|
+
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
7094
7174
|
});
|
|
7095
7175
|
const target = getPointTarget(e.point, {
|
|
7096
7176
|
...pointTargetBaseOptions(),
|
|
@@ -7170,7 +7250,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7170
7250
|
elems[0].x = calculator.toGridNum(moveOriginalStartElementSize.x + totalMoveX);
|
|
7171
7251
|
elems[0].y = calculator.toGridNum(moveOriginalStartElementSize.y + totalMoveY);
|
|
7172
7252
|
updateSelectedElementList([elems[0]]);
|
|
7173
|
-
calculator.
|
|
7253
|
+
calculator.modifyVirtualFlatItemMap(data, {
|
|
7174
7254
|
modifyOptions: {
|
|
7175
7255
|
type: "updateElement",
|
|
7176
7256
|
content: {
|
|
@@ -7194,7 +7274,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7194
7274
|
if (elem && ((_a2 = elem == null ? void 0 : elem.operations) == null ? void 0 : _a2.locked) !== true) {
|
|
7195
7275
|
elem.x = calculator.toGridNum(elem.x + moveX);
|
|
7196
7276
|
elem.y = calculator.toGridNum(elem.y + moveY);
|
|
7197
|
-
calculator.
|
|
7277
|
+
calculator.modifyVirtualFlatItemMap(data, {
|
|
7198
7278
|
modifyOptions: {
|
|
7199
7279
|
type: "updateElement",
|
|
7200
7280
|
content: {
|
|
@@ -7232,7 +7312,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7232
7312
|
resizeEnd = rotatePointInGroup(end, pointGroupQueue);
|
|
7233
7313
|
}
|
|
7234
7314
|
if (resizeType === "resize-rotate") {
|
|
7235
|
-
const controller = sharer.getSharedStorage(
|
|
7315
|
+
const controller = sharer.getSharedStorage(
|
|
7316
|
+
keySelectedElementController
|
|
7317
|
+
);
|
|
7236
7318
|
const viewVertexes = [
|
|
7237
7319
|
controller.topLeft.center,
|
|
7238
7320
|
controller.topRight.center,
|
|
@@ -7243,15 +7325,15 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7243
7325
|
const resizedElemSize = rotateElement(moveOriginalStartElementSize, {
|
|
7244
7326
|
center: viewCenter,
|
|
7245
7327
|
viewScaleInfo,
|
|
7246
|
-
viewSizeInfo,
|
|
7247
7328
|
start: originalStart,
|
|
7248
|
-
end
|
|
7249
|
-
resizeType,
|
|
7250
|
-
sharer
|
|
7329
|
+
end
|
|
7251
7330
|
});
|
|
7252
7331
|
elems[0].angle = calculator.toGridNum(resizedElemSize.angle || 0);
|
|
7253
7332
|
} else {
|
|
7254
|
-
const resizedElemSize = resizeElement(
|
|
7333
|
+
const resizedElemSize = resizeElement(
|
|
7334
|
+
{ ...moveOriginalStartElementSize, operations: elems[0].operations },
|
|
7335
|
+
{ scale, start: resizeStart, end: resizeEnd, resizeType }
|
|
7336
|
+
);
|
|
7255
7337
|
const calcOpts = { ignore: !!moveOriginalStartElementSize.angle };
|
|
7256
7338
|
elems[0].x = calculator.toGridNum(resizedElemSize.x, calcOpts);
|
|
7257
7339
|
elems[0].y = calculator.toGridNum(resizedElemSize.y, calcOpts);
|
|
@@ -7266,7 +7348,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7266
7348
|
}
|
|
7267
7349
|
}
|
|
7268
7350
|
updateSelectedElementList([elems[0]]);
|
|
7269
|
-
calculator.
|
|
7351
|
+
calculator.modifyVirtualFlatItemMap(data, {
|
|
7270
7352
|
modifyOptions: {
|
|
7271
7353
|
type: "updateElement",
|
|
7272
7354
|
content: {
|
|
@@ -7314,7 +7396,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7314
7396
|
const { elements } = getSelectedListArea(data, {
|
|
7315
7397
|
start,
|
|
7316
7398
|
end,
|
|
7317
|
-
calculator,
|
|
7318
7399
|
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
7319
7400
|
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
7320
7401
|
});
|
|
@@ -7394,7 +7475,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7394
7475
|
eventHub.trigger(coreEventKeys.TEXT_EDIT, {
|
|
7395
7476
|
element: target.elements[0],
|
|
7396
7477
|
groupQueue: sharer.getSharedStorage(keyGroupQueue) || [],
|
|
7397
|
-
position: getElementPositionFromList(
|
|
7478
|
+
position: getElementPositionFromList(
|
|
7479
|
+
(_g = target.elements[0]) == null ? void 0 : _g.uuid,
|
|
7480
|
+
((_h = sharer.getActiveStorage("data")) == null ? void 0 : _h.elements) || []
|
|
7481
|
+
),
|
|
7398
7482
|
viewScaleInfo: sharer.getActiveViewScaleInfo()
|
|
7399
7483
|
});
|
|
7400
7484
|
}
|
|
@@ -7429,8 +7513,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7429
7513
|
}
|
|
7430
7514
|
const listAreaSize = calcSelectedElementsArea(getActiveElements(), {
|
|
7431
7515
|
viewScaleInfo: sharer.getActiveViewScaleInfo(),
|
|
7432
|
-
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
7433
|
-
calculator
|
|
7516
|
+
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
7434
7517
|
});
|
|
7435
7518
|
const target = getPointTarget(e.point, {
|
|
7436
7519
|
...pointTargetBaseOptions(),
|
|
@@ -7451,7 +7534,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7451
7534
|
const { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 } = innerConfig;
|
|
7452
7535
|
const style = { activeColor: activeColor2, activeAreaColor: activeAreaColor2, lockedColor: lockedColor2, referenceColor: referenceColor2 };
|
|
7453
7536
|
const { activeStore, sharedStore } = snapshot;
|
|
7454
|
-
const {
|
|
7537
|
+
const {
|
|
7538
|
+
scale,
|
|
7539
|
+
offsetLeft,
|
|
7540
|
+
offsetTop,
|
|
7541
|
+
offsetRight,
|
|
7542
|
+
offsetBottom,
|
|
7543
|
+
width,
|
|
7544
|
+
height,
|
|
7545
|
+
contextHeight,
|
|
7546
|
+
contextWidth,
|
|
7547
|
+
devicePixelRatio
|
|
7548
|
+
} = activeStore;
|
|
7455
7549
|
if (rotateControllerPattern.fill !== activeColor2) {
|
|
7456
7550
|
rotateControllerPattern = createRotateControllerPattern({
|
|
7457
7551
|
fill: innerConfig.activeColor,
|
|
@@ -7504,7 +7598,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7504
7598
|
drawSelectedElementControllersVertexes(overlayContext, selectedElementController, {
|
|
7505
7599
|
...drawBaseOpts,
|
|
7506
7600
|
element: elem,
|
|
7507
|
-
calculator,
|
|
7508
7601
|
hideControllers: !!isMoving && actionType === "drag",
|
|
7509
7602
|
rotateControllerPattern: rotateControllerPattern.context2d,
|
|
7510
7603
|
style
|
|
@@ -7547,7 +7640,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7547
7640
|
drawSelectedElementControllersVertexes(overlayContext, selectedElementController, {
|
|
7548
7641
|
...drawBaseOpts,
|
|
7549
7642
|
element: elem,
|
|
7550
|
-
calculator,
|
|
7551
7643
|
hideControllers: !!isMoving && actionType === "drag",
|
|
7552
7644
|
rotateControllerPattern: rotateControllerPattern.context2d,
|
|
7553
7645
|
style
|
|
@@ -7578,8 +7670,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7578
7670
|
} else if (["drag-list", "drag-list-end"].includes(actionType)) {
|
|
7579
7671
|
const listAreaSize = calcSelectedElementsArea(getActiveElements(), {
|
|
7580
7672
|
viewScaleInfo: sharer2.getActiveViewScaleInfo(),
|
|
7581
|
-
viewSizeInfo: sharer2.getActiveViewSizeInfo()
|
|
7582
|
-
calculator
|
|
7673
|
+
viewSizeInfo: sharer2.getActiveViewSizeInfo()
|
|
7583
7674
|
});
|
|
7584
7675
|
if (listAreaSize) {
|
|
7585
7676
|
drawListArea(overlayContext, { areaSize: listAreaSize, style });
|
|
@@ -7709,7 +7800,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
7709
7800
|
return scrollWrapper;
|
|
7710
7801
|
}
|
|
7711
7802
|
function drawScrollerThumb(ctx, opts) {
|
|
7712
|
-
let { x: x2, y: y2, h: h2, w: w2
|
|
7803
|
+
let { x: x2, y: y2, h: h2, w: w2 } = opts;
|
|
7804
|
+
const { background: background2, borderColor: borderColor2 } = opts;
|
|
7713
7805
|
ctx.save();
|
|
7714
7806
|
ctx.shadowColor = "#FFFFFF";
|
|
7715
7807
|
ctx.shadowOffsetX = 0;
|
|
@@ -8032,7 +8124,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8032
8124
|
const { scale, offsetLeft } = viewScaleInfo;
|
|
8033
8125
|
const { width } = viewSizeInfo;
|
|
8034
8126
|
return calcRulerScaleList({
|
|
8035
|
-
axis: "X",
|
|
8036
8127
|
scale,
|
|
8037
8128
|
viewLength: width,
|
|
8038
8129
|
viewOffset: offsetLeft
|
|
@@ -8043,7 +8134,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8043
8134
|
const { scale, offsetTop } = viewScaleInfo;
|
|
8044
8135
|
const { height } = viewSizeInfo;
|
|
8045
8136
|
return calcRulerScaleList({
|
|
8046
|
-
axis: "Y",
|
|
8047
8137
|
scale,
|
|
8048
8138
|
viewLength: height,
|
|
8049
8139
|
viewOffset: offsetTop
|
|
@@ -8274,7 +8364,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8274
8364
|
const viewScaleInfo = getViewScaleInfoFromSnapshot(snapshot);
|
|
8275
8365
|
const viewSizeInfo = getViewSizeInfoFromSnapshot(snapshot);
|
|
8276
8366
|
drawScrollerSelectedArea(overlayContext, { snapshot, calculator, style });
|
|
8277
|
-
drawRulerBackground(overlayContext, {
|
|
8367
|
+
drawRulerBackground(overlayContext, { viewSizeInfo, style });
|
|
8278
8368
|
const { list: xList, rulerUnit } = calcXRulerScaleList({ viewScaleInfo, viewSizeInfo });
|
|
8279
8369
|
drawXRuler(overlayContext, { scaleList: xList, style });
|
|
8280
8370
|
const { list: yList } = calcYRulerScaleList({ viewScaleInfo, viewSizeInfo });
|
|
@@ -8284,7 +8374,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8284
8374
|
drawGrid(ctx, {
|
|
8285
8375
|
xList,
|
|
8286
8376
|
yList,
|
|
8287
|
-
viewScaleInfo,
|
|
8288
8377
|
viewSizeInfo,
|
|
8289
8378
|
style
|
|
8290
8379
|
});
|
|
@@ -8606,14 +8695,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8606
8695
|
// #opts: CoreOptions;
|
|
8607
8696
|
__privateAdd(this, _canvas);
|
|
8608
8697
|
__privateAdd(this, _container2);
|
|
8609
|
-
const { devicePixelRatio = 1, width, height
|
|
8698
|
+
const { devicePixelRatio = 1, width, height } = opts;
|
|
8610
8699
|
__privateSet(this, _container2, container);
|
|
8611
8700
|
const canvas = document.createElement("canvas");
|
|
8612
8701
|
canvas.setAttribute("tabindex", "0");
|
|
8613
8702
|
__privateSet(this, _canvas, canvas);
|
|
8614
8703
|
__privateMethod(this, _Core_instances, initContainer_fn).call(this);
|
|
8615
8704
|
container.appendChild(canvas);
|
|
8616
|
-
const boardContent = createBoardContent(canvas, { width, height, devicePixelRatio
|
|
8705
|
+
const boardContent = createBoardContent(canvas, { width, height, devicePixelRatio });
|
|
8617
8706
|
const board = new Board({ boardContent, container });
|
|
8618
8707
|
const sharer = board.getSharer();
|
|
8619
8708
|
sharer.setActiveViewSizeInfo({
|
|
@@ -8716,6 +8805,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8716
8805
|
const container = __privateGet(this, _container2);
|
|
8717
8806
|
container.style.position = "relative";
|
|
8718
8807
|
};
|
|
8808
|
+
exports.Board = Board;
|
|
8809
|
+
exports.Calculator = Calculator;
|
|
8719
8810
|
exports.Core = Core;
|
|
8720
8811
|
exports.MiddlewareDragger = MiddlewareDragger;
|
|
8721
8812
|
exports.MiddlewareInfo = MiddlewareInfo;
|
|
@@ -8726,6 +8817,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
8726
8817
|
exports.MiddlewareScroller = MiddlewareScroller;
|
|
8727
8818
|
exports.MiddlewareSelector = MiddlewareSelector;
|
|
8728
8819
|
exports.MiddlewareTextEditor = MiddlewareTextEditor;
|
|
8820
|
+
exports.Sharer = Sharer;
|
|
8729
8821
|
exports.coreEventKeys = coreEventKeys;
|
|
8730
8822
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8731
8823
|
return exports;
|