@idraw/core 0.4.0-beta.7 → 0.4.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/middleware/selector/index.js +17 -2
- package/dist/index.global.js +383 -314
- package/dist/index.global.min.js +1 -1
- package/package.json +5 -5
package/dist/index.global.js
CHANGED
|
@@ -26,7 +26,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
26
26
|
function throttle(fn, timeout) {
|
|
27
27
|
let timer = -1;
|
|
28
28
|
return function(...args) {
|
|
29
|
-
if (timer
|
|
29
|
+
if (timer >= 0) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
timer = setTimeout(() => {
|
|
@@ -358,7 +358,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
358
358
|
fontWeight: fontWeight$1,
|
|
359
359
|
strokeWidth
|
|
360
360
|
};
|
|
361
|
-
var __classPrivateFieldSet$
|
|
361
|
+
var __classPrivateFieldSet$9 = function(receiver, state, value, kind, f) {
|
|
362
362
|
if (kind === "m")
|
|
363
363
|
throw new TypeError("Private method is not writable");
|
|
364
364
|
if (kind === "a" && !f)
|
|
@@ -367,7 +367,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
367
367
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
368
368
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
369
369
|
};
|
|
370
|
-
var __classPrivateFieldGet$
|
|
370
|
+
var __classPrivateFieldGet$9 = function(receiver, state, kind, f) {
|
|
371
371
|
if (kind === "a" && !f)
|
|
372
372
|
throw new TypeError("Private accessor was defined without a getter");
|
|
373
373
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -379,17 +379,17 @@ var __privateMethod = (obj, member, method) => {
|
|
|
379
379
|
constructor(ctx, opts) {
|
|
380
380
|
_Context2D_ctx.set(this, void 0);
|
|
381
381
|
_Context2D_opts.set(this, void 0);
|
|
382
|
-
__classPrivateFieldSet$
|
|
383
|
-
__classPrivateFieldSet$
|
|
382
|
+
__classPrivateFieldSet$9(this, _Context2D_ctx, ctx, "f");
|
|
383
|
+
__classPrivateFieldSet$9(this, _Context2D_opts, Object.assign({ devicePixelRatio: 1, offscreenCanvas: null }, opts), "f");
|
|
384
384
|
}
|
|
385
385
|
$undoPixelRatio(num) {
|
|
386
|
-
return num / __classPrivateFieldGet$
|
|
386
|
+
return num / __classPrivateFieldGet$9(this, _Context2D_opts, "f").devicePixelRatio;
|
|
387
387
|
}
|
|
388
388
|
$doPixelRatio(num) {
|
|
389
|
-
return __classPrivateFieldGet$
|
|
389
|
+
return __classPrivateFieldGet$9(this, _Context2D_opts, "f").devicePixelRatio * num;
|
|
390
390
|
}
|
|
391
391
|
$getContext() {
|
|
392
|
-
return __classPrivateFieldGet$
|
|
392
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f");
|
|
393
393
|
}
|
|
394
394
|
$setFont(opts) {
|
|
395
395
|
const strList = [];
|
|
@@ -398,17 +398,17 @@ var __privateMethod = (obj, member, method) => {
|
|
|
398
398
|
}
|
|
399
399
|
strList.push(`${this.$doPixelRatio(opts.fontSize || 12)}px`);
|
|
400
400
|
strList.push(`${opts.fontFamily || "sans-serif"}`);
|
|
401
|
-
__classPrivateFieldGet$
|
|
401
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").font = `${strList.join(" ")}`;
|
|
402
402
|
}
|
|
403
403
|
$getOffscreenCanvas() {
|
|
404
|
-
return __classPrivateFieldGet$
|
|
404
|
+
return __classPrivateFieldGet$9(this, _Context2D_opts, "f").offscreenCanvas;
|
|
405
405
|
}
|
|
406
406
|
$resize(opts) {
|
|
407
407
|
const { width, height, devicePixelRatio, resetStyle } = opts;
|
|
408
|
-
const { canvas } = __classPrivateFieldGet$
|
|
408
|
+
const { canvas } = __classPrivateFieldGet$9(this, _Context2D_ctx, "f");
|
|
409
409
|
canvas.width = width * devicePixelRatio;
|
|
410
410
|
canvas.height = height * devicePixelRatio;
|
|
411
|
-
__classPrivateFieldSet$
|
|
411
|
+
__classPrivateFieldSet$9(this, _Context2D_opts, Object.assign(Object.assign({}, __classPrivateFieldGet$9(this, _Context2D_opts, "f")), {
|
|
412
412
|
devicePixelRatio
|
|
413
413
|
}), "f");
|
|
414
414
|
if (resetStyle === true) {
|
|
@@ -417,8 +417,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
$getSize() {
|
|
420
|
-
const { devicePixelRatio } = __classPrivateFieldGet$
|
|
421
|
-
const { width, height } = __classPrivateFieldGet$
|
|
420
|
+
const { devicePixelRatio } = __classPrivateFieldGet$9(this, _Context2D_opts, "f");
|
|
421
|
+
const { width, height } = __classPrivateFieldGet$9(this, _Context2D_ctx, "f").canvas;
|
|
422
422
|
return {
|
|
423
423
|
width: width / devicePixelRatio,
|
|
424
424
|
height: height / devicePixelRatio,
|
|
@@ -426,125 +426,125 @@ var __privateMethod = (obj, member, method) => {
|
|
|
426
426
|
};
|
|
427
427
|
}
|
|
428
428
|
get canvas() {
|
|
429
|
-
return __classPrivateFieldGet$
|
|
429
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").canvas;
|
|
430
430
|
}
|
|
431
431
|
get fillStyle() {
|
|
432
|
-
return __classPrivateFieldGet$
|
|
432
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").fillStyle;
|
|
433
433
|
}
|
|
434
434
|
set fillStyle(value) {
|
|
435
|
-
__classPrivateFieldGet$
|
|
435
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").fillStyle = value;
|
|
436
436
|
}
|
|
437
437
|
get strokeStyle() {
|
|
438
|
-
return __classPrivateFieldGet$
|
|
438
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").strokeStyle;
|
|
439
439
|
}
|
|
440
440
|
set strokeStyle(color2) {
|
|
441
|
-
__classPrivateFieldGet$
|
|
441
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").strokeStyle = color2;
|
|
442
442
|
}
|
|
443
443
|
get lineWidth() {
|
|
444
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
444
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$9(this, _Context2D_ctx, "f").lineWidth);
|
|
445
445
|
}
|
|
446
446
|
set lineWidth(w2) {
|
|
447
|
-
__classPrivateFieldGet$
|
|
447
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").lineWidth = this.$doPixelRatio(w2);
|
|
448
448
|
}
|
|
449
449
|
get textAlign() {
|
|
450
|
-
return __classPrivateFieldGet$
|
|
450
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").textAlign;
|
|
451
451
|
}
|
|
452
452
|
set textAlign(align) {
|
|
453
|
-
__classPrivateFieldGet$
|
|
453
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").textAlign = align;
|
|
454
454
|
}
|
|
455
455
|
get textBaseline() {
|
|
456
|
-
return __classPrivateFieldGet$
|
|
456
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").textBaseline;
|
|
457
457
|
}
|
|
458
458
|
set textBaseline(baseline) {
|
|
459
|
-
__classPrivateFieldGet$
|
|
459
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").textBaseline = baseline;
|
|
460
460
|
}
|
|
461
461
|
get globalAlpha() {
|
|
462
|
-
return __classPrivateFieldGet$
|
|
462
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").globalAlpha;
|
|
463
463
|
}
|
|
464
464
|
set globalAlpha(alpha) {
|
|
465
|
-
__classPrivateFieldGet$
|
|
465
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").globalAlpha = alpha;
|
|
466
466
|
}
|
|
467
467
|
get shadowColor() {
|
|
468
|
-
return __classPrivateFieldGet$
|
|
468
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").shadowColor;
|
|
469
469
|
}
|
|
470
470
|
set shadowColor(color2) {
|
|
471
|
-
__classPrivateFieldGet$
|
|
471
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").shadowColor = color2;
|
|
472
472
|
}
|
|
473
473
|
get shadowOffsetX() {
|
|
474
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
474
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$9(this, _Context2D_ctx, "f").shadowOffsetX);
|
|
475
475
|
}
|
|
476
476
|
set shadowOffsetX(offsetX) {
|
|
477
|
-
__classPrivateFieldGet$
|
|
477
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").shadowOffsetX = this.$doPixelRatio(offsetX);
|
|
478
478
|
}
|
|
479
479
|
get shadowOffsetY() {
|
|
480
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
480
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$9(this, _Context2D_ctx, "f").shadowOffsetY);
|
|
481
481
|
}
|
|
482
482
|
set shadowOffsetY(offsetY) {
|
|
483
|
-
__classPrivateFieldGet$
|
|
483
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").shadowOffsetY = this.$doPixelRatio(offsetY);
|
|
484
484
|
}
|
|
485
485
|
get shadowBlur() {
|
|
486
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
486
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$9(this, _Context2D_ctx, "f").shadowBlur);
|
|
487
487
|
}
|
|
488
488
|
set shadowBlur(blur) {
|
|
489
|
-
__classPrivateFieldGet$
|
|
489
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").shadowBlur = this.$doPixelRatio(blur);
|
|
490
490
|
}
|
|
491
491
|
get lineCap() {
|
|
492
|
-
return __classPrivateFieldGet$
|
|
492
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").lineCap;
|
|
493
493
|
}
|
|
494
494
|
set lineCap(lineCap) {
|
|
495
|
-
__classPrivateFieldGet$
|
|
495
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").lineCap = lineCap;
|
|
496
496
|
}
|
|
497
497
|
get globalCompositeOperation() {
|
|
498
|
-
return __classPrivateFieldGet$
|
|
498
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").globalCompositeOperation;
|
|
499
499
|
}
|
|
500
500
|
set globalCompositeOperation(operations) {
|
|
501
|
-
__classPrivateFieldGet$
|
|
501
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").globalCompositeOperation = operations;
|
|
502
502
|
}
|
|
503
503
|
fill(...args) {
|
|
504
|
-
return __classPrivateFieldGet$
|
|
504
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").fill(...args);
|
|
505
505
|
}
|
|
506
506
|
arc(x2, y2, radius, startAngle, endAngle, anticlockwise) {
|
|
507
|
-
return __classPrivateFieldGet$
|
|
507
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").arc(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(radius), startAngle, endAngle, anticlockwise);
|
|
508
508
|
}
|
|
509
509
|
rect(x2, y2, w2, h2) {
|
|
510
|
-
return __classPrivateFieldGet$
|
|
510
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").rect(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(w2), this.$doPixelRatio(h2));
|
|
511
511
|
}
|
|
512
512
|
fillRect(x2, y2, w2, h2) {
|
|
513
|
-
return __classPrivateFieldGet$
|
|
513
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").fillRect(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(w2), this.$doPixelRatio(h2));
|
|
514
514
|
}
|
|
515
515
|
clearRect(x2, y2, w2, h2) {
|
|
516
|
-
return __classPrivateFieldGet$
|
|
516
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").clearRect(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(w2), this.$doPixelRatio(h2));
|
|
517
517
|
}
|
|
518
518
|
beginPath() {
|
|
519
|
-
return __classPrivateFieldGet$
|
|
519
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").beginPath();
|
|
520
520
|
}
|
|
521
521
|
closePath() {
|
|
522
|
-
return __classPrivateFieldGet$
|
|
522
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").closePath();
|
|
523
523
|
}
|
|
524
524
|
lineTo(x2, y2) {
|
|
525
|
-
return __classPrivateFieldGet$
|
|
525
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").lineTo(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
526
526
|
}
|
|
527
527
|
moveTo(x2, y2) {
|
|
528
|
-
return __classPrivateFieldGet$
|
|
528
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").moveTo(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
529
529
|
}
|
|
530
530
|
arcTo(x1, y1, x2, y2, radius) {
|
|
531
|
-
return __classPrivateFieldGet$
|
|
531
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").arcTo(this.$doPixelRatio(x1), this.$doPixelRatio(y1), this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(radius));
|
|
532
532
|
}
|
|
533
533
|
getLineDash() {
|
|
534
|
-
return __classPrivateFieldGet$
|
|
534
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").getLineDash();
|
|
535
535
|
}
|
|
536
536
|
setLineDash(nums) {
|
|
537
537
|
const dash = nums.map((n) => this.$doPixelRatio(n));
|
|
538
|
-
return __classPrivateFieldGet$
|
|
538
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").setLineDash(dash);
|
|
539
539
|
}
|
|
540
540
|
stroke(path) {
|
|
541
|
-
return path ? __classPrivateFieldGet$
|
|
541
|
+
return path ? __classPrivateFieldGet$9(this, _Context2D_ctx, "f").stroke(path) : __classPrivateFieldGet$9(this, _Context2D_ctx, "f").stroke();
|
|
542
542
|
}
|
|
543
543
|
translate(x2, y2) {
|
|
544
|
-
return __classPrivateFieldGet$
|
|
544
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").translate(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
545
545
|
}
|
|
546
546
|
rotate(angle2) {
|
|
547
|
-
return __classPrivateFieldGet$
|
|
547
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").rotate(angle2);
|
|
548
548
|
}
|
|
549
549
|
drawImage(...args) {
|
|
550
550
|
const image = args[0];
|
|
@@ -557,64 +557,64 @@ var __privateMethod = (obj, member, method) => {
|
|
|
557
557
|
const dw = args[args.length - 2];
|
|
558
558
|
const dh = args[args.length - 1];
|
|
559
559
|
if (args.length === 9) {
|
|
560
|
-
return __classPrivateFieldGet$
|
|
560
|
+
return __classPrivateFieldGet$9(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));
|
|
561
561
|
} else {
|
|
562
|
-
return __classPrivateFieldGet$
|
|
562
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").drawImage(image, this.$doPixelRatio(dx), this.$doPixelRatio(dy), this.$doPixelRatio(dw), this.$doPixelRatio(dh));
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
createPattern(image, repetition) {
|
|
566
|
-
return __classPrivateFieldGet$
|
|
566
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").createPattern(image, repetition);
|
|
567
567
|
}
|
|
568
568
|
measureText(text2) {
|
|
569
|
-
const textMetrics = __classPrivateFieldGet$
|
|
569
|
+
const textMetrics = __classPrivateFieldGet$9(this, _Context2D_ctx, "f").measureText(text2);
|
|
570
570
|
return textMetrics;
|
|
571
571
|
}
|
|
572
572
|
fillText(text2, x2, y2, maxWidth) {
|
|
573
573
|
if (maxWidth !== void 0) {
|
|
574
|
-
return __classPrivateFieldGet$
|
|
574
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").fillText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(maxWidth));
|
|
575
575
|
} else {
|
|
576
|
-
return __classPrivateFieldGet$
|
|
576
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").fillText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
579
|
strokeText(text2, x2, y2, maxWidth) {
|
|
580
580
|
if (maxWidth !== void 0) {
|
|
581
|
-
return __classPrivateFieldGet$
|
|
581
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").strokeText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(maxWidth));
|
|
582
582
|
} else {
|
|
583
|
-
return __classPrivateFieldGet$
|
|
583
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").strokeText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
save() {
|
|
587
|
-
__classPrivateFieldGet$
|
|
587
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").save();
|
|
588
588
|
}
|
|
589
589
|
restore() {
|
|
590
|
-
__classPrivateFieldGet$
|
|
590
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").restore();
|
|
591
591
|
}
|
|
592
592
|
scale(ratioX, ratioY) {
|
|
593
|
-
__classPrivateFieldGet$
|
|
593
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").scale(ratioX, ratioY);
|
|
594
594
|
}
|
|
595
595
|
circle(x2, y2, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise) {
|
|
596
|
-
__classPrivateFieldGet$
|
|
596
|
+
__classPrivateFieldGet$9(this, _Context2D_ctx, "f").ellipse(this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(radiusX), this.$doPixelRatio(radiusY), rotation, startAngle, endAngle, counterclockwise);
|
|
597
597
|
}
|
|
598
598
|
isPointInPath(x2, y2) {
|
|
599
|
-
return __classPrivateFieldGet$
|
|
599
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").isPointInPath(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
600
600
|
}
|
|
601
601
|
clip(...args) {
|
|
602
|
-
return __classPrivateFieldGet$
|
|
602
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").clip(...args);
|
|
603
603
|
}
|
|
604
604
|
setTransform(a, b, c, d, e, f) {
|
|
605
|
-
return __classPrivateFieldGet$
|
|
605
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").setTransform(a, b, c, d, e, f);
|
|
606
606
|
}
|
|
607
607
|
getTransform() {
|
|
608
|
-
return __classPrivateFieldGet$
|
|
608
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").getTransform();
|
|
609
609
|
}
|
|
610
610
|
createLinearGradient(x0, y0, x1, y1) {
|
|
611
|
-
return __classPrivateFieldGet$
|
|
611
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").createLinearGradient(this.$doPixelRatio(x0), this.$doPixelRatio(y0), this.$doPixelRatio(x1), this.$doPixelRatio(y1));
|
|
612
612
|
}
|
|
613
613
|
createRadialGradient(x0, y0, r0, x1, y1, r1) {
|
|
614
|
-
return __classPrivateFieldGet$
|
|
614
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").createRadialGradient(this.$doPixelRatio(x0), this.$doPixelRatio(y0), this.$doPixelRatio(r0), this.$doPixelRatio(x1), this.$doPixelRatio(y1), this.$doPixelRatio(r1));
|
|
615
615
|
}
|
|
616
616
|
createConicGradient(startAngle, x2, y2) {
|
|
617
|
-
return __classPrivateFieldGet$
|
|
617
|
+
return __classPrivateFieldGet$9(this, _Context2D_ctx, "f").createConicGradient(startAngle, this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
618
618
|
}
|
|
619
619
|
}
|
|
620
620
|
_Context2D_ctx = /* @__PURE__ */ new WeakMap(), _Context2D_opts = /* @__PURE__ */ new WeakMap();
|
|
@@ -697,7 +697,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
697
697
|
return content;
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
-
var __classPrivateFieldSet$
|
|
700
|
+
var __classPrivateFieldSet$8 = function(receiver, state, value, kind, f) {
|
|
701
701
|
if (kind === "m")
|
|
702
702
|
throw new TypeError("Private method is not writable");
|
|
703
703
|
if (kind === "a" && !f)
|
|
@@ -706,7 +706,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
706
706
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
707
707
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
708
708
|
};
|
|
709
|
-
var __classPrivateFieldGet$
|
|
709
|
+
var __classPrivateFieldGet$8 = function(receiver, state, kind, f) {
|
|
710
710
|
if (kind === "a" && !f)
|
|
711
711
|
throw new TypeError("Private accessor was defined without a getter");
|
|
712
712
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -717,20 +717,20 @@ var __privateMethod = (obj, member, method) => {
|
|
|
717
717
|
class EventEmitter {
|
|
718
718
|
constructor() {
|
|
719
719
|
_EventEmitter_listeners.set(this, void 0);
|
|
720
|
-
__classPrivateFieldSet$
|
|
720
|
+
__classPrivateFieldSet$8(this, _EventEmitter_listeners, /* @__PURE__ */ new Map(), "f");
|
|
721
721
|
}
|
|
722
722
|
on(eventKey, callback) {
|
|
723
|
-
if (__classPrivateFieldGet$
|
|
724
|
-
const callbacks = __classPrivateFieldGet$
|
|
723
|
+
if (__classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").has(eventKey)) {
|
|
724
|
+
const callbacks = __classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").get(eventKey) || [];
|
|
725
725
|
callbacks === null || callbacks === void 0 ? void 0 : callbacks.push(callback);
|
|
726
|
-
__classPrivateFieldGet$
|
|
726
|
+
__classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").set(eventKey, callbacks);
|
|
727
727
|
} else {
|
|
728
|
-
__classPrivateFieldGet$
|
|
728
|
+
__classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").set(eventKey, [callback]);
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
731
|
off(eventKey, callback) {
|
|
732
|
-
if (__classPrivateFieldGet$
|
|
733
|
-
const callbacks = __classPrivateFieldGet$
|
|
732
|
+
if (__classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").has(eventKey)) {
|
|
733
|
+
const callbacks = __classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").get(eventKey);
|
|
734
734
|
if (Array.isArray(callbacks)) {
|
|
735
735
|
for (let i = 0; i < (callbacks === null || callbacks === void 0 ? void 0 : callbacks.length); i++) {
|
|
736
736
|
if (callbacks[i] === callback) {
|
|
@@ -739,11 +739,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
741
|
}
|
|
742
|
-
__classPrivateFieldGet$
|
|
742
|
+
__classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").set(eventKey, callbacks || []);
|
|
743
743
|
}
|
|
744
744
|
}
|
|
745
745
|
trigger(eventKey, e) {
|
|
746
|
-
const callbacks = __classPrivateFieldGet$
|
|
746
|
+
const callbacks = __classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").get(eventKey);
|
|
747
747
|
if (Array.isArray(callbacks)) {
|
|
748
748
|
callbacks.forEach((cb) => {
|
|
749
749
|
cb(e);
|
|
@@ -754,8 +754,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
754
754
|
}
|
|
755
755
|
}
|
|
756
756
|
has(name) {
|
|
757
|
-
if (__classPrivateFieldGet$
|
|
758
|
-
const list = __classPrivateFieldGet$
|
|
757
|
+
if (__classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").has(name)) {
|
|
758
|
+
const list = __classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").get(name);
|
|
759
759
|
if (Array.isArray(list) && list.length > 0) {
|
|
760
760
|
return true;
|
|
761
761
|
}
|
|
@@ -763,7 +763,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
763
763
|
return false;
|
|
764
764
|
}
|
|
765
765
|
destroy() {
|
|
766
|
-
__classPrivateFieldGet$
|
|
766
|
+
__classPrivateFieldGet$8(this, _EventEmitter_listeners, "f").clear();
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
_EventEmitter_listeners = /* @__PURE__ */ new WeakMap();
|
|
@@ -777,7 +777,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
777
777
|
y: p1.y + (p2.y - p1.y) / 2
|
|
778
778
|
};
|
|
779
779
|
}
|
|
780
|
-
var __classPrivateFieldSet$
|
|
780
|
+
var __classPrivateFieldSet$7 = function(receiver, state, value, kind, f) {
|
|
781
781
|
if (kind === "m")
|
|
782
782
|
throw new TypeError("Private method is not writable");
|
|
783
783
|
if (kind === "a" && !f)
|
|
@@ -786,7 +786,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
786
786
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
787
787
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
788
788
|
};
|
|
789
|
-
var __classPrivateFieldGet$
|
|
789
|
+
var __classPrivateFieldGet$7 = function(receiver, state, kind, f) {
|
|
790
790
|
if (kind === "a" && !f)
|
|
791
791
|
throw new TypeError("Private accessor was defined without a getter");
|
|
792
792
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -799,27 +799,27 @@ var __privateMethod = (obj, member, method) => {
|
|
|
799
799
|
_Store_instances.add(this);
|
|
800
800
|
_Store_temp.set(this, void 0);
|
|
801
801
|
_Store_backUpDefaultStorage.set(this, void 0);
|
|
802
|
-
__classPrivateFieldSet$
|
|
803
|
-
__classPrivateFieldSet$
|
|
802
|
+
__classPrivateFieldSet$7(this, _Store_backUpDefaultStorage, deepClone(opts.defaultStorage), "f");
|
|
803
|
+
__classPrivateFieldSet$7(this, _Store_temp, __classPrivateFieldGet$7(this, _Store_instances, "m", _Store_createTempStorage).call(this), "f");
|
|
804
804
|
}
|
|
805
805
|
set(name, value) {
|
|
806
|
-
__classPrivateFieldGet$
|
|
806
|
+
__classPrivateFieldGet$7(this, _Store_temp, "f")[name] = value;
|
|
807
807
|
}
|
|
808
808
|
get(name) {
|
|
809
|
-
return __classPrivateFieldGet$
|
|
809
|
+
return __classPrivateFieldGet$7(this, _Store_temp, "f")[name];
|
|
810
810
|
}
|
|
811
811
|
getSnapshot() {
|
|
812
|
-
return deepClone(__classPrivateFieldGet$
|
|
812
|
+
return deepClone(__classPrivateFieldGet$7(this, _Store_temp, "f"));
|
|
813
813
|
}
|
|
814
814
|
clear() {
|
|
815
|
-
__classPrivateFieldSet$
|
|
815
|
+
__classPrivateFieldSet$7(this, _Store_temp, __classPrivateFieldGet$7(this, _Store_instances, "m", _Store_createTempStorage).call(this), "f");
|
|
816
816
|
}
|
|
817
817
|
destroy() {
|
|
818
|
-
__classPrivateFieldSet$
|
|
818
|
+
__classPrivateFieldSet$7(this, _Store_temp, null, "f");
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
821
|
_Store_temp = /* @__PURE__ */ new WeakMap(), _Store_backUpDefaultStorage = /* @__PURE__ */ new WeakMap(), _Store_instances = /* @__PURE__ */ new WeakSet(), _Store_createTempStorage = function _Store_createTempStorage2() {
|
|
822
|
-
return deepClone(__classPrivateFieldGet$
|
|
822
|
+
return deepClone(__classPrivateFieldGet$7(this, _Store_backUpDefaultStorage, "f"));
|
|
823
823
|
};
|
|
824
824
|
function getViewScaleInfoFromSnapshot(snapshot) {
|
|
825
825
|
const { activeStore } = snapshot;
|
|
@@ -1785,8 +1785,8 @@ var __privateMethod = (obj, member, method) => {
|
|
|
1785
1785
|
});
|
|
1786
1786
|
}
|
|
1787
1787
|
function drawClipPath(ctx, viewElem, opts) {
|
|
1788
|
-
const { renderContent, originElem, calcElemSize,
|
|
1789
|
-
const totalScale =
|
|
1788
|
+
const { renderContent, originElem, calcElemSize, viewSizeInfo } = opts;
|
|
1789
|
+
const totalScale = viewSizeInfo.devicePixelRatio;
|
|
1790
1790
|
const { clipPath } = (originElem === null || originElem === void 0 ? void 0 : originElem.detail) || {};
|
|
1791
1791
|
if (clipPath && calcElemSize && clipPath.commands) {
|
|
1792
1792
|
const { x: x2, y: y2, w: w2, h: h2 } = calcElemSize;
|
|
@@ -2050,29 +2050,31 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2050
2050
|
b = b - bw;
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2053
|
+
if (a >= 0 && b >= 0) {
|
|
2054
|
+
const opacity = getOpacity(viewElem) * parentOpacity;
|
|
2055
|
+
ctx.globalAlpha = opacity;
|
|
2056
|
+
if (typeof borderWidth2 === "number" && borderWidth2 > 0) {
|
|
2057
|
+
const ba = borderWidth2 / 2 + a;
|
|
2058
|
+
const bb = borderWidth2 / 2 + b;
|
|
2059
|
+
ctx.beginPath();
|
|
2060
|
+
ctx.strokeStyle = borderColor2;
|
|
2061
|
+
ctx.lineWidth = borderWidth2;
|
|
2062
|
+
ctx.circle(centerX, centerY, ba, bb, 0, 0, 2 * Math.PI);
|
|
2063
|
+
ctx.closePath();
|
|
2064
|
+
ctx.stroke();
|
|
2065
|
+
}
|
|
2058
2066
|
ctx.beginPath();
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2067
|
+
const fillStyle = createColorStyle(ctx, background2, {
|
|
2068
|
+
viewElementSize: { x: x2, y: y2, w: w2, h: h2 },
|
|
2069
|
+
viewScaleInfo,
|
|
2070
|
+
opacity: ctx.globalAlpha
|
|
2071
|
+
});
|
|
2072
|
+
ctx.fillStyle = fillStyle;
|
|
2073
|
+
ctx.circle(centerX, centerY, a, b, 0, 0, 2 * Math.PI);
|
|
2062
2074
|
ctx.closePath();
|
|
2063
|
-
ctx.
|
|
2075
|
+
ctx.fill();
|
|
2076
|
+
ctx.globalAlpha = parentOpacity;
|
|
2064
2077
|
}
|
|
2065
|
-
ctx.beginPath();
|
|
2066
|
-
const fillStyle = createColorStyle(ctx, background2, {
|
|
2067
|
-
viewElementSize: { x: x2, y: y2, w: w2, h: h2 },
|
|
2068
|
-
viewScaleInfo,
|
|
2069
|
-
opacity: ctx.globalAlpha
|
|
2070
|
-
});
|
|
2071
|
-
ctx.fillStyle = fillStyle;
|
|
2072
|
-
ctx.circle(centerX, centerY, a, b, 0, 0, 2 * Math.PI);
|
|
2073
|
-
ctx.closePath();
|
|
2074
|
-
ctx.fill();
|
|
2075
|
-
ctx.globalAlpha = parentOpacity;
|
|
2076
2078
|
}
|
|
2077
2079
|
});
|
|
2078
2080
|
});
|
|
@@ -2332,6 +2334,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2332
2334
|
if (((_a = elem === null || elem === void 0 ? void 0 : elem.operations) === null || _a === void 0 ? void 0 : _a.invisible) === true) {
|
|
2333
2335
|
return;
|
|
2334
2336
|
}
|
|
2337
|
+
const { w: w2, h: h2 } = elem;
|
|
2338
|
+
const { scale } = opts.viewScaleInfo;
|
|
2339
|
+
if (scale < 1 && (w2 * scale < 1 || h2 * scale < 1) || opts.parentOpacity === 0) {
|
|
2340
|
+
return;
|
|
2341
|
+
}
|
|
2335
2342
|
try {
|
|
2336
2343
|
switch (elem.type) {
|
|
2337
2344
|
case "rect": {
|
|
@@ -2471,6 +2478,28 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2471
2478
|
}
|
|
2472
2479
|
}
|
|
2473
2480
|
}
|
|
2481
|
+
function drawUnderlay(ctx, underlay, opts) {
|
|
2482
|
+
const { calculator, viewScaleInfo, viewSizeInfo, parentOpacity } = opts;
|
|
2483
|
+
const elem = Object.assign({ uuid: "underlay" }, underlay);
|
|
2484
|
+
const { x: x2, y: y2, w: w2, h: h2 } = (calculator === null || calculator === void 0 ? void 0 : calculator.elementSize(elem, viewScaleInfo, viewSizeInfo)) || elem;
|
|
2485
|
+
const angle2 = 0;
|
|
2486
|
+
const viewElem = Object.assign(Object.assign({}, elem), { x: x2, y: y2, w: w2, h: h2, angle: angle2 });
|
|
2487
|
+
drawBoxShadow(ctx, viewElem, {
|
|
2488
|
+
viewScaleInfo,
|
|
2489
|
+
viewSizeInfo,
|
|
2490
|
+
renderContent: () => {
|
|
2491
|
+
drawBox(ctx, viewElem, {
|
|
2492
|
+
originElem: elem,
|
|
2493
|
+
calcElemSize: { x: x2, y: y2, w: w2, h: h2, angle: angle2 },
|
|
2494
|
+
viewScaleInfo,
|
|
2495
|
+
viewSizeInfo,
|
|
2496
|
+
parentOpacity,
|
|
2497
|
+
renderContent: () => {
|
|
2498
|
+
}
|
|
2499
|
+
});
|
|
2500
|
+
}
|
|
2501
|
+
});
|
|
2502
|
+
}
|
|
2474
2503
|
var __awaiter = function(thisArg, _arguments, P, generator) {
|
|
2475
2504
|
function adopt(value) {
|
|
2476
2505
|
return value instanceof P ? value : new P(function(resolve) {
|
|
@@ -2498,14 +2527,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2498
2527
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2499
2528
|
});
|
|
2500
2529
|
};
|
|
2501
|
-
var __classPrivateFieldGet$
|
|
2530
|
+
var __classPrivateFieldGet$6 = function(receiver, state, kind, f) {
|
|
2502
2531
|
if (kind === "a" && !f)
|
|
2503
2532
|
throw new TypeError("Private accessor was defined without a getter");
|
|
2504
2533
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
2505
2534
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
2506
2535
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2507
2536
|
};
|
|
2508
|
-
var __classPrivateFieldSet$
|
|
2537
|
+
var __classPrivateFieldSet$6 = function(receiver, state, value, kind, f) {
|
|
2509
2538
|
if (kind === "m")
|
|
2510
2539
|
throw new TypeError("Private method is not writable");
|
|
2511
2540
|
if (kind === "a" && !f)
|
|
@@ -2541,7 +2570,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2541
2570
|
_Loader_loadFuncMap.set(this, {});
|
|
2542
2571
|
_Loader_currentLoadItemMap.set(this, {});
|
|
2543
2572
|
_Loader_storageLoadItemMap.set(this, {});
|
|
2544
|
-
__classPrivateFieldGet$
|
|
2573
|
+
__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "image", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
2545
2574
|
var _a;
|
|
2546
2575
|
const src = ((_a = assets[elem.detail.src]) === null || _a === void 0 ? void 0 : _a.value) || elem.detail.src;
|
|
2547
2576
|
const content = yield loadImage(src);
|
|
@@ -2551,7 +2580,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2551
2580
|
content
|
|
2552
2581
|
};
|
|
2553
2582
|
}));
|
|
2554
|
-
__classPrivateFieldGet$
|
|
2583
|
+
__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "html", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
2555
2584
|
var _b;
|
|
2556
2585
|
const html2 = ((_b = assets[elem.detail.html]) === null || _b === void 0 ? void 0 : _b.value) || elem.detail.html;
|
|
2557
2586
|
const content = yield loadHTML(html2, {
|
|
@@ -2564,7 +2593,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2564
2593
|
content
|
|
2565
2594
|
};
|
|
2566
2595
|
}));
|
|
2567
|
-
__classPrivateFieldGet$
|
|
2596
|
+
__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "svg", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
2568
2597
|
var _c;
|
|
2569
2598
|
const svg2 = ((_c = assets[elem.detail.svg]) === null || _c === void 0 ? void 0 : _c.value) || elem.detail.svg;
|
|
2570
2599
|
const content = yield loadSVG(svg2);
|
|
@@ -2576,32 +2605,32 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2576
2605
|
}));
|
|
2577
2606
|
}
|
|
2578
2607
|
destroy() {
|
|
2579
|
-
__classPrivateFieldSet$
|
|
2580
|
-
__classPrivateFieldSet$
|
|
2581
|
-
__classPrivateFieldSet$
|
|
2608
|
+
__classPrivateFieldSet$6(this, _Loader_loadFuncMap, null, "f");
|
|
2609
|
+
__classPrivateFieldSet$6(this, _Loader_currentLoadItemMap, null, "f");
|
|
2610
|
+
__classPrivateFieldSet$6(this, _Loader_storageLoadItemMap, null, "f");
|
|
2582
2611
|
}
|
|
2583
2612
|
load(element, assets) {
|
|
2584
|
-
if (__classPrivateFieldGet$
|
|
2613
|
+
if (__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_isExistingErrorStorage).call(this, element)) {
|
|
2585
2614
|
return;
|
|
2586
2615
|
}
|
|
2587
2616
|
if (supportElementTypes.includes(element.type)) {
|
|
2588
|
-
__classPrivateFieldGet$
|
|
2617
|
+
__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_loadResource).call(this, element, assets);
|
|
2589
2618
|
}
|
|
2590
2619
|
}
|
|
2591
2620
|
getContent(element) {
|
|
2592
2621
|
var _a, _b;
|
|
2593
2622
|
const assetId = getAssetIdFromElement(element);
|
|
2594
|
-
return ((_b = (_a = __classPrivateFieldGet$
|
|
2623
|
+
return ((_b = (_a = __classPrivateFieldGet$6(this, _Loader_storageLoadItemMap, "f")) === null || _a === void 0 ? void 0 : _a[assetId]) === null || _b === void 0 ? void 0 : _b.content) || null;
|
|
2595
2624
|
}
|
|
2596
2625
|
getLoadItemMap() {
|
|
2597
|
-
return __classPrivateFieldGet$
|
|
2626
|
+
return __classPrivateFieldGet$6(this, _Loader_storageLoadItemMap, "f");
|
|
2598
2627
|
}
|
|
2599
2628
|
setLoadItemMap(itemMap) {
|
|
2600
|
-
__classPrivateFieldSet$
|
|
2629
|
+
__classPrivateFieldSet$6(this, _Loader_storageLoadItemMap, itemMap, "f");
|
|
2601
2630
|
}
|
|
2602
2631
|
}
|
|
2603
2632
|
_Loader_loadFuncMap = /* @__PURE__ */ new WeakMap(), _Loader_currentLoadItemMap = /* @__PURE__ */ new WeakMap(), _Loader_storageLoadItemMap = /* @__PURE__ */ new WeakMap(), _Loader_instances = /* @__PURE__ */ new WeakSet(), _Loader_registerLoadFunc = function _Loader_registerLoadFunc2(type, func) {
|
|
2604
|
-
__classPrivateFieldGet$
|
|
2633
|
+
__classPrivateFieldGet$6(this, _Loader_loadFuncMap, "f")[type] = func;
|
|
2605
2634
|
}, _Loader_getLoadElementSource = function _Loader_getLoadElementSource2(element) {
|
|
2606
2635
|
var _a, _b, _c;
|
|
2607
2636
|
let source = null;
|
|
@@ -2621,62 +2650,62 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2621
2650
|
error: null,
|
|
2622
2651
|
startTime: -1,
|
|
2623
2652
|
endTime: -1,
|
|
2624
|
-
source: __classPrivateFieldGet$
|
|
2653
|
+
source: __classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_getLoadElementSource).call(this, element)
|
|
2625
2654
|
};
|
|
2626
2655
|
}, _Loader_emitLoad = function _Loader_emitLoad2(item) {
|
|
2627
2656
|
const assetId = getAssetIdFromElement(item.element);
|
|
2628
|
-
const storageItem = __classPrivateFieldGet$
|
|
2657
|
+
const storageItem = __classPrivateFieldGet$6(this, _Loader_storageLoadItemMap, "f")[assetId];
|
|
2629
2658
|
if (storageItem) {
|
|
2630
2659
|
if (storageItem.startTime < item.startTime) {
|
|
2631
|
-
__classPrivateFieldGet$
|
|
2660
|
+
__classPrivateFieldGet$6(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
2632
2661
|
this.trigger("load", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
2633
2662
|
}
|
|
2634
2663
|
} else {
|
|
2635
|
-
__classPrivateFieldGet$
|
|
2664
|
+
__classPrivateFieldGet$6(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
2636
2665
|
this.trigger("load", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
2637
2666
|
}
|
|
2638
2667
|
}, _Loader_emitError = function _Loader_emitError2(item) {
|
|
2639
2668
|
const assetId = getAssetIdFromElement(item.element);
|
|
2640
|
-
const storageItem = __classPrivateFieldGet$
|
|
2669
|
+
const storageItem = __classPrivateFieldGet$6(this, _Loader_storageLoadItemMap, "f")[assetId];
|
|
2641
2670
|
if (storageItem) {
|
|
2642
2671
|
if (storageItem.startTime < item.startTime) {
|
|
2643
|
-
__classPrivateFieldGet$
|
|
2672
|
+
__classPrivateFieldGet$6(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
2644
2673
|
this.trigger("error", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
2645
2674
|
}
|
|
2646
2675
|
} else {
|
|
2647
|
-
__classPrivateFieldGet$
|
|
2676
|
+
__classPrivateFieldGet$6(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
2648
2677
|
this.trigger("error", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
2649
2678
|
}
|
|
2650
2679
|
}, _Loader_loadResource = function _Loader_loadResource2(element, assets) {
|
|
2651
|
-
const item = __classPrivateFieldGet$
|
|
2680
|
+
const item = __classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_createLoadItem).call(this, element);
|
|
2652
2681
|
const assetId = getAssetIdFromElement(element);
|
|
2653
|
-
__classPrivateFieldGet$
|
|
2654
|
-
const loadFunc = __classPrivateFieldGet$
|
|
2682
|
+
__classPrivateFieldGet$6(this, _Loader_currentLoadItemMap, "f")[assetId] = item;
|
|
2683
|
+
const loadFunc = __classPrivateFieldGet$6(this, _Loader_loadFuncMap, "f")[element.type];
|
|
2655
2684
|
if (typeof loadFunc === "function") {
|
|
2656
2685
|
item.startTime = Date.now();
|
|
2657
2686
|
loadFunc(element, assets).then((result) => {
|
|
2658
2687
|
item.content = result.content;
|
|
2659
2688
|
item.endTime = Date.now();
|
|
2660
2689
|
item.status = "load";
|
|
2661
|
-
__classPrivateFieldGet$
|
|
2690
|
+
__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_emitLoad).call(this, item);
|
|
2662
2691
|
}).catch((err) => {
|
|
2663
2692
|
console.warn(`Load element source "${item.source}" fail`, err, element);
|
|
2664
2693
|
item.endTime = Date.now();
|
|
2665
2694
|
item.status = "error";
|
|
2666
2695
|
item.error = err;
|
|
2667
|
-
__classPrivateFieldGet$
|
|
2696
|
+
__classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_emitError).call(this, item);
|
|
2668
2697
|
});
|
|
2669
2698
|
}
|
|
2670
2699
|
}, _Loader_isExistingErrorStorage = function _Loader_isExistingErrorStorage2(element) {
|
|
2671
2700
|
var _a;
|
|
2672
2701
|
const assetId = getAssetIdFromElement(element);
|
|
2673
|
-
const existItem = (_a = __classPrivateFieldGet$
|
|
2674
|
-
if (existItem && existItem.status === "error" && existItem.source && existItem.source === __classPrivateFieldGet$
|
|
2702
|
+
const existItem = (_a = __classPrivateFieldGet$6(this, _Loader_currentLoadItemMap, "f")) === null || _a === void 0 ? void 0 : _a[assetId];
|
|
2703
|
+
if (existItem && existItem.status === "error" && existItem.source && existItem.source === __classPrivateFieldGet$6(this, _Loader_instances, "m", _Loader_getLoadElementSource).call(this, element)) {
|
|
2675
2704
|
return true;
|
|
2676
2705
|
}
|
|
2677
2706
|
return false;
|
|
2678
2707
|
};
|
|
2679
|
-
var __classPrivateFieldSet$
|
|
2708
|
+
var __classPrivateFieldSet$5 = function(receiver, state, value, kind, f) {
|
|
2680
2709
|
if (kind === "m")
|
|
2681
2710
|
throw new TypeError("Private method is not writable");
|
|
2682
2711
|
if (kind === "a" && !f)
|
|
@@ -2685,7 +2714,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2685
2714
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2686
2715
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
2687
2716
|
};
|
|
2688
|
-
var __classPrivateFieldGet$
|
|
2717
|
+
var __classPrivateFieldGet$5 = function(receiver, state, kind, f) {
|
|
2689
2718
|
if (kind === "a" && !f)
|
|
2690
2719
|
throw new TypeError("Private accessor was defined without a getter");
|
|
2691
2720
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -2699,21 +2728,21 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2699
2728
|
_Renderer_instances.add(this);
|
|
2700
2729
|
_Renderer_opts.set(this, void 0);
|
|
2701
2730
|
_Renderer_loader.set(this, new Loader());
|
|
2702
|
-
__classPrivateFieldSet$
|
|
2703
|
-
__classPrivateFieldGet$
|
|
2731
|
+
__classPrivateFieldSet$5(this, _Renderer_opts, opts, "f");
|
|
2732
|
+
__classPrivateFieldGet$5(this, _Renderer_instances, "m", _Renderer_init).call(this);
|
|
2704
2733
|
}
|
|
2705
2734
|
destroy() {
|
|
2706
|
-
__classPrivateFieldSet$
|
|
2707
|
-
__classPrivateFieldGet$
|
|
2708
|
-
__classPrivateFieldSet$
|
|
2735
|
+
__classPrivateFieldSet$5(this, _Renderer_opts, null, "f");
|
|
2736
|
+
__classPrivateFieldGet$5(this, _Renderer_loader, "f").destroy();
|
|
2737
|
+
__classPrivateFieldSet$5(this, _Renderer_loader, null, "f");
|
|
2709
2738
|
}
|
|
2710
2739
|
updateOptions(opts) {
|
|
2711
|
-
__classPrivateFieldSet$
|
|
2740
|
+
__classPrivateFieldSet$5(this, _Renderer_opts, opts, "f");
|
|
2712
2741
|
}
|
|
2713
2742
|
drawData(data, opts) {
|
|
2714
|
-
const loader = __classPrivateFieldGet$
|
|
2715
|
-
const { calculator } = __classPrivateFieldGet$
|
|
2716
|
-
const viewContext = __classPrivateFieldGet$
|
|
2743
|
+
const loader = __classPrivateFieldGet$5(this, _Renderer_loader, "f");
|
|
2744
|
+
const { calculator } = __classPrivateFieldGet$5(this, _Renderer_opts, "f");
|
|
2745
|
+
const viewContext = __classPrivateFieldGet$5(this, _Renderer_opts, "f").viewContext;
|
|
2717
2746
|
viewContext.clearRect(0, 0, viewContext.canvas.width, viewContext.canvas.height);
|
|
2718
2747
|
const parentElementSize = {
|
|
2719
2748
|
x: 0,
|
|
@@ -2721,6 +2750,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2721
2750
|
w: opts.viewSizeInfo.width,
|
|
2722
2751
|
h: opts.viewSizeInfo.height
|
|
2723
2752
|
};
|
|
2753
|
+
if (data.underlay) {
|
|
2754
|
+
drawUnderlay(viewContext, data.underlay, Object.assign({
|
|
2755
|
+
loader,
|
|
2756
|
+
calculator,
|
|
2757
|
+
parentElementSize,
|
|
2758
|
+
parentOpacity: 1
|
|
2759
|
+
}, opts));
|
|
2760
|
+
}
|
|
2724
2761
|
drawElementList(viewContext, data, Object.assign({
|
|
2725
2762
|
loader,
|
|
2726
2763
|
calculator,
|
|
@@ -2730,7 +2767,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2730
2767
|
}, opts));
|
|
2731
2768
|
}
|
|
2732
2769
|
scale(num) {
|
|
2733
|
-
const { sharer } = __classPrivateFieldGet$
|
|
2770
|
+
const { sharer } = __classPrivateFieldGet$5(this, _Renderer_opts, "f");
|
|
2734
2771
|
if (!sharer) {
|
|
2735
2772
|
return;
|
|
2736
2773
|
}
|
|
@@ -2755,21 +2792,24 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2755
2792
|
}
|
|
2756
2793
|
}
|
|
2757
2794
|
setLoadItemMap(itemMap) {
|
|
2758
|
-
__classPrivateFieldGet$
|
|
2795
|
+
__classPrivateFieldGet$5(this, _Renderer_loader, "f").setLoadItemMap(itemMap);
|
|
2759
2796
|
}
|
|
2760
2797
|
getLoadItemMap() {
|
|
2761
|
-
return __classPrivateFieldGet$
|
|
2798
|
+
return __classPrivateFieldGet$5(this, _Renderer_loader, "f").getLoadItemMap();
|
|
2799
|
+
}
|
|
2800
|
+
getLoader() {
|
|
2801
|
+
return __classPrivateFieldGet$5(this, _Renderer_loader, "f");
|
|
2762
2802
|
}
|
|
2763
2803
|
}
|
|
2764
2804
|
_Renderer_opts = /* @__PURE__ */ new WeakMap(), _Renderer_loader = /* @__PURE__ */ new WeakMap(), _Renderer_instances = /* @__PURE__ */ new WeakSet(), _Renderer_init = function _Renderer_init2() {
|
|
2765
|
-
const loader = __classPrivateFieldGet$
|
|
2805
|
+
const loader = __classPrivateFieldGet$5(this, _Renderer_loader, "f");
|
|
2766
2806
|
loader.on("load", (e) => {
|
|
2767
2807
|
this.trigger("load", e);
|
|
2768
2808
|
});
|
|
2769
2809
|
loader.on("error", () => {
|
|
2770
2810
|
});
|
|
2771
2811
|
};
|
|
2772
|
-
var __classPrivateFieldSet$
|
|
2812
|
+
var __classPrivateFieldSet$4 = function(receiver, state, value, kind, f) {
|
|
2773
2813
|
if (kind === "m")
|
|
2774
2814
|
throw new TypeError("Private method is not writable");
|
|
2775
2815
|
if (kind === "a" && !f)
|
|
@@ -2778,7 +2818,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2778
2818
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2779
2819
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
2780
2820
|
};
|
|
2781
|
-
var __classPrivateFieldGet$
|
|
2821
|
+
var __classPrivateFieldGet$4 = function(receiver, state, kind, f) {
|
|
2782
2822
|
if (kind === "a" && !f)
|
|
2783
2823
|
throw new TypeError("Private accessor was defined without a getter");
|
|
2784
2824
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -2789,10 +2829,10 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2789
2829
|
class Calculator {
|
|
2790
2830
|
constructor(opts) {
|
|
2791
2831
|
_Calculator_opts.set(this, void 0);
|
|
2792
|
-
__classPrivateFieldSet$
|
|
2832
|
+
__classPrivateFieldSet$4(this, _Calculator_opts, opts, "f");
|
|
2793
2833
|
}
|
|
2794
2834
|
destroy() {
|
|
2795
|
-
__classPrivateFieldSet$
|
|
2835
|
+
__classPrivateFieldSet$4(this, _Calculator_opts, null, "f");
|
|
2796
2836
|
}
|
|
2797
2837
|
elementSize(size, viewScaleInfo, viewSizeInfo) {
|
|
2798
2838
|
return calcViewElementSize(size, { viewScaleInfo, viewSizeInfo });
|
|
@@ -2801,7 +2841,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2801
2841
|
return isElementInView(elem, { viewScaleInfo, viewSizeInfo });
|
|
2802
2842
|
}
|
|
2803
2843
|
isPointInElement(p, elem, viewScaleInfo, viewSizeInfo) {
|
|
2804
|
-
const context2d = __classPrivateFieldGet$
|
|
2844
|
+
const context2d = __classPrivateFieldGet$4(this, _Calculator_opts, "f").viewContext;
|
|
2805
2845
|
return isViewPointInElement(p, {
|
|
2806
2846
|
context2d,
|
|
2807
2847
|
element: elem,
|
|
@@ -2810,12 +2850,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2810
2850
|
});
|
|
2811
2851
|
}
|
|
2812
2852
|
getPointElement(p, opts) {
|
|
2813
|
-
const context2d = __classPrivateFieldGet$
|
|
2853
|
+
const context2d = __classPrivateFieldGet$4(this, _Calculator_opts, "f").viewContext;
|
|
2814
2854
|
return getViewPointAtElement(p, Object.assign(Object.assign({}, opts), { context2d }));
|
|
2815
2855
|
}
|
|
2816
2856
|
}
|
|
2817
2857
|
_Calculator_opts = /* @__PURE__ */ new WeakMap();
|
|
2818
|
-
var __classPrivateFieldSet$
|
|
2858
|
+
var __classPrivateFieldSet$3 = function(receiver, state, value, kind, f) {
|
|
2819
2859
|
if (kind === "m")
|
|
2820
2860
|
throw new TypeError("Private method is not writable");
|
|
2821
2861
|
if (kind === "a" && !f)
|
|
@@ -2824,7 +2864,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2824
2864
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2825
2865
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
2826
2866
|
};
|
|
2827
|
-
var __classPrivateFieldGet$
|
|
2867
|
+
var __classPrivateFieldGet$3 = function(receiver, state, kind, f) {
|
|
2828
2868
|
if (kind === "a" && !f)
|
|
2829
2869
|
throw new TypeError("Private accessor was defined without a getter");
|
|
2830
2870
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -2842,11 +2882,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2842
2882
|
_BoardWatcher_opts.set(this, void 0);
|
|
2843
2883
|
_BoardWatcher_store.set(this, void 0);
|
|
2844
2884
|
_BoardWatcher_onWheel.set(this, (e) => {
|
|
2845
|
-
if (!__classPrivateFieldGet$
|
|
2885
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2846
2886
|
return;
|
|
2847
2887
|
}
|
|
2848
|
-
const point = __classPrivateFieldGet$
|
|
2849
|
-
if (!__classPrivateFieldGet$
|
|
2888
|
+
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2889
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2850
2890
|
return;
|
|
2851
2891
|
}
|
|
2852
2892
|
e.preventDefault();
|
|
@@ -2860,125 +2900,125 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2860
2900
|
}
|
|
2861
2901
|
});
|
|
2862
2902
|
_BoardWatcher_onContextMenu.set(this, (e) => {
|
|
2863
|
-
if (!__classPrivateFieldGet$
|
|
2903
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2864
2904
|
return;
|
|
2865
2905
|
}
|
|
2866
2906
|
e.preventDefault();
|
|
2867
|
-
const point = __classPrivateFieldGet$
|
|
2868
|
-
if (!__classPrivateFieldGet$
|
|
2907
|
+
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2908
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2869
2909
|
return;
|
|
2870
2910
|
}
|
|
2871
2911
|
});
|
|
2872
2912
|
_BoardWatcher_onClick.set(this, (e) => {
|
|
2873
|
-
if (!__classPrivateFieldGet$
|
|
2913
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2874
2914
|
return;
|
|
2875
2915
|
}
|
|
2876
2916
|
e.preventDefault();
|
|
2877
|
-
const point = __classPrivateFieldGet$
|
|
2878
|
-
if (!__classPrivateFieldGet$
|
|
2917
|
+
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2918
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2879
2919
|
return;
|
|
2880
2920
|
}
|
|
2881
2921
|
const maxLimitTime = 500;
|
|
2882
2922
|
const t = Date.now();
|
|
2883
|
-
const preClickPoint = __classPrivateFieldGet$
|
|
2923
|
+
const preClickPoint = __classPrivateFieldGet$3(this, _BoardWatcher_store, "f").get("prevClickPoint");
|
|
2884
2924
|
if (preClickPoint && t - preClickPoint.t <= maxLimitTime && Math.abs(preClickPoint.x - point.x) <= 5 && Math.abs(preClickPoint.y - point.y) <= 5) {
|
|
2885
2925
|
this.trigger("doubleClick", { point });
|
|
2886
2926
|
} else {
|
|
2887
|
-
__classPrivateFieldGet$
|
|
2927
|
+
__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").set("prevClickPoint", point);
|
|
2888
2928
|
}
|
|
2889
2929
|
});
|
|
2890
2930
|
_BoardWatcher_onPointLeave.set(this, (e) => {
|
|
2891
|
-
__classPrivateFieldGet$
|
|
2892
|
-
if (!__classPrivateFieldGet$
|
|
2931
|
+
__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").set("hasPointDown", false);
|
|
2932
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2893
2933
|
return;
|
|
2894
2934
|
}
|
|
2895
2935
|
e.preventDefault();
|
|
2896
|
-
const point = __classPrivateFieldGet$
|
|
2936
|
+
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2897
2937
|
this.trigger("pointLeave", { point });
|
|
2898
2938
|
});
|
|
2899
2939
|
_BoardWatcher_onPointEnd.set(this, (e) => {
|
|
2900
|
-
__classPrivateFieldGet$
|
|
2901
|
-
if (!__classPrivateFieldGet$
|
|
2940
|
+
__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").set("hasPointDown", false);
|
|
2941
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2902
2942
|
return;
|
|
2903
2943
|
}
|
|
2904
2944
|
e.preventDefault();
|
|
2905
|
-
const point = __classPrivateFieldGet$
|
|
2945
|
+
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2906
2946
|
this.trigger("pointEnd", { point });
|
|
2907
2947
|
});
|
|
2908
2948
|
_BoardWatcher_onPointMove.set(this, (e) => {
|
|
2909
|
-
if (!__classPrivateFieldGet$
|
|
2949
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2910
2950
|
return;
|
|
2911
2951
|
}
|
|
2912
2952
|
e.preventDefault();
|
|
2913
2953
|
e.stopPropagation();
|
|
2914
|
-
const point = __classPrivateFieldGet$
|
|
2915
|
-
if (!__classPrivateFieldGet$
|
|
2916
|
-
if (__classPrivateFieldGet$
|
|
2954
|
+
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2955
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2956
|
+
if (__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").get("hasPointDown")) {
|
|
2917
2957
|
this.trigger("pointLeave", { point });
|
|
2918
|
-
__classPrivateFieldGet$
|
|
2958
|
+
__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").set("hasPointDown", false);
|
|
2919
2959
|
}
|
|
2920
2960
|
return;
|
|
2921
2961
|
}
|
|
2922
|
-
if (__classPrivateFieldGet$
|
|
2962
|
+
if (__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").get("hasPointDown") !== true) {
|
|
2923
2963
|
return;
|
|
2924
2964
|
}
|
|
2925
2965
|
this.trigger("pointMove", { point });
|
|
2926
2966
|
});
|
|
2927
2967
|
_BoardWatcher_onPointStart.set(this, (e) => {
|
|
2928
|
-
if (!__classPrivateFieldGet$
|
|
2968
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2929
2969
|
return;
|
|
2930
2970
|
}
|
|
2931
2971
|
e.preventDefault();
|
|
2932
|
-
const point = __classPrivateFieldGet$
|
|
2933
|
-
if (!__classPrivateFieldGet$
|
|
2972
|
+
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2973
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2934
2974
|
return;
|
|
2935
2975
|
}
|
|
2936
|
-
__classPrivateFieldGet$
|
|
2976
|
+
__classPrivateFieldGet$3(this, _BoardWatcher_store, "f").set("hasPointDown", true);
|
|
2937
2977
|
this.trigger("pointStart", { point });
|
|
2938
2978
|
});
|
|
2939
2979
|
_BoardWatcher_onHover.set(this, (e) => {
|
|
2940
|
-
if (!__classPrivateFieldGet$
|
|
2980
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2941
2981
|
return;
|
|
2942
2982
|
}
|
|
2943
2983
|
e.preventDefault();
|
|
2944
|
-
const point = __classPrivateFieldGet$
|
|
2945
|
-
if (!__classPrivateFieldGet$
|
|
2984
|
+
const point = __classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2985
|
+
if (!__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2946
2986
|
return;
|
|
2947
2987
|
}
|
|
2948
2988
|
this.trigger("hover", { point });
|
|
2949
2989
|
});
|
|
2950
2990
|
const store = new Store({ defaultStorage: { hasPointDown: false, prevClickPoint: null } });
|
|
2951
|
-
__classPrivateFieldSet$
|
|
2952
|
-
__classPrivateFieldSet$
|
|
2953
|
-
__classPrivateFieldGet$
|
|
2991
|
+
__classPrivateFieldSet$3(this, _BoardWatcher_store, store, "f");
|
|
2992
|
+
__classPrivateFieldSet$3(this, _BoardWatcher_opts, opts, "f");
|
|
2993
|
+
__classPrivateFieldGet$3(this, _BoardWatcher_instances, "m", _BoardWatcher_init).call(this);
|
|
2954
2994
|
}
|
|
2955
2995
|
destroy() {
|
|
2956
2996
|
const container = window;
|
|
2957
|
-
container.removeEventListener("mousemove", __classPrivateFieldGet$
|
|
2958
|
-
container.removeEventListener("mousedown", __classPrivateFieldGet$
|
|
2959
|
-
container.removeEventListener("mousemove", __classPrivateFieldGet$
|
|
2960
|
-
container.removeEventListener("mouseup", __classPrivateFieldGet$
|
|
2961
|
-
container.removeEventListener("mouseleave", __classPrivateFieldGet$
|
|
2962
|
-
container.removeEventListener("wheel", __classPrivateFieldGet$
|
|
2963
|
-
container.removeEventListener("click", __classPrivateFieldGet$
|
|
2964
|
-
container.removeEventListener("contextmenu", __classPrivateFieldGet$
|
|
2997
|
+
container.removeEventListener("mousemove", __classPrivateFieldGet$3(this, _BoardWatcher_onHover, "f"));
|
|
2998
|
+
container.removeEventListener("mousedown", __classPrivateFieldGet$3(this, _BoardWatcher_onPointStart, "f"));
|
|
2999
|
+
container.removeEventListener("mousemove", __classPrivateFieldGet$3(this, _BoardWatcher_onPointMove, "f"));
|
|
3000
|
+
container.removeEventListener("mouseup", __classPrivateFieldGet$3(this, _BoardWatcher_onPointEnd, "f"));
|
|
3001
|
+
container.removeEventListener("mouseleave", __classPrivateFieldGet$3(this, _BoardWatcher_onPointLeave, "f"));
|
|
3002
|
+
container.removeEventListener("wheel", __classPrivateFieldGet$3(this, _BoardWatcher_onWheel, "f"));
|
|
3003
|
+
container.removeEventListener("click", __classPrivateFieldGet$3(this, _BoardWatcher_onClick, "f"));
|
|
3004
|
+
container.removeEventListener("contextmenu", __classPrivateFieldGet$3(this, _BoardWatcher_onContextMenu, "f"));
|
|
2965
3005
|
this.destroy();
|
|
2966
3006
|
}
|
|
2967
3007
|
}
|
|
2968
3008
|
_BoardWatcher_opts = /* @__PURE__ */ new WeakMap(), _BoardWatcher_store = /* @__PURE__ */ new WeakMap(), _BoardWatcher_onWheel = /* @__PURE__ */ new WeakMap(), _BoardWatcher_onContextMenu = /* @__PURE__ */ new WeakMap(), _BoardWatcher_onClick = /* @__PURE__ */ new WeakMap(), _BoardWatcher_onPointLeave = /* @__PURE__ */ new WeakMap(), _BoardWatcher_onPointEnd = /* @__PURE__ */ new WeakMap(), _BoardWatcher_onPointMove = /* @__PURE__ */ new WeakMap(), _BoardWatcher_onPointStart = /* @__PURE__ */ new WeakMap(), _BoardWatcher_onHover = /* @__PURE__ */ new WeakMap(), _BoardWatcher_instances = /* @__PURE__ */ new WeakSet(), _BoardWatcher_init = function _BoardWatcher_init2() {
|
|
2969
3009
|
const container = window;
|
|
2970
|
-
container.addEventListener("mousemove", __classPrivateFieldGet$
|
|
2971
|
-
container.addEventListener("mousedown", __classPrivateFieldGet$
|
|
2972
|
-
container.addEventListener("mousemove", __classPrivateFieldGet$
|
|
2973
|
-
container.addEventListener("mouseup", __classPrivateFieldGet$
|
|
2974
|
-
container.addEventListener("mouseleave", __classPrivateFieldGet$
|
|
2975
|
-
container.addEventListener("wheel", __classPrivateFieldGet$
|
|
2976
|
-
container.addEventListener("click", __classPrivateFieldGet$
|
|
2977
|
-
container.addEventListener("contextmenu", __classPrivateFieldGet$
|
|
3010
|
+
container.addEventListener("mousemove", __classPrivateFieldGet$3(this, _BoardWatcher_onHover, "f"));
|
|
3011
|
+
container.addEventListener("mousedown", __classPrivateFieldGet$3(this, _BoardWatcher_onPointStart, "f"));
|
|
3012
|
+
container.addEventListener("mousemove", __classPrivateFieldGet$3(this, _BoardWatcher_onPointMove, "f"));
|
|
3013
|
+
container.addEventListener("mouseup", __classPrivateFieldGet$3(this, _BoardWatcher_onPointEnd, "f"));
|
|
3014
|
+
container.addEventListener("mouseleave", __classPrivateFieldGet$3(this, _BoardWatcher_onPointLeave, "f"));
|
|
3015
|
+
container.addEventListener("wheel", __classPrivateFieldGet$3(this, _BoardWatcher_onWheel, "f"), { passive: false });
|
|
3016
|
+
container.addEventListener("click", __classPrivateFieldGet$3(this, _BoardWatcher_onClick, "f"));
|
|
3017
|
+
container.addEventListener("contextmenu", __classPrivateFieldGet$3(this, _BoardWatcher_onContextMenu, "f"));
|
|
2978
3018
|
}, _BoardWatcher_isInTarget = function _BoardWatcher_isInTarget2(e) {
|
|
2979
|
-
return e.target === __classPrivateFieldGet$
|
|
3019
|
+
return e.target === __classPrivateFieldGet$3(this, _BoardWatcher_opts, "f").boardContent.boardContext.canvas;
|
|
2980
3020
|
}, _BoardWatcher_getPoint = function _BoardWatcher_getPoint2(e) {
|
|
2981
|
-
const boardCanvas = __classPrivateFieldGet$
|
|
3021
|
+
const boardCanvas = __classPrivateFieldGet$3(this, _BoardWatcher_opts, "f").boardContent.boardContext.canvas;
|
|
2982
3022
|
const rect = boardCanvas.getBoundingClientRect();
|
|
2983
3023
|
const p = {
|
|
2984
3024
|
x: e.clientX - rect.left,
|
|
@@ -2987,14 +3027,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2987
3027
|
};
|
|
2988
3028
|
return p;
|
|
2989
3029
|
}, _BoardWatcher_isVaildPoint = function _BoardWatcher_isVaildPoint2(p) {
|
|
2990
|
-
const viewSize = __classPrivateFieldGet$
|
|
3030
|
+
const viewSize = __classPrivateFieldGet$3(this, _BoardWatcher_opts, "f").sharer.getActiveViewSizeInfo();
|
|
2991
3031
|
const { width, height } = viewSize;
|
|
2992
3032
|
if (isBoardAvailableNum(p.x) && isBoardAvailableNum(p.y) && p.x <= width && p.y <= height) {
|
|
2993
3033
|
return true;
|
|
2994
3034
|
}
|
|
2995
3035
|
return false;
|
|
2996
3036
|
};
|
|
2997
|
-
var __classPrivateFieldSet$
|
|
3037
|
+
var __classPrivateFieldSet$2 = function(receiver, state, value, kind, f) {
|
|
2998
3038
|
if (kind === "m")
|
|
2999
3039
|
throw new TypeError("Private method is not writable");
|
|
3000
3040
|
if (kind === "a" && !f)
|
|
@@ -3003,7 +3043,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3003
3043
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3004
3044
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3005
3045
|
};
|
|
3006
|
-
var __classPrivateFieldGet$
|
|
3046
|
+
var __classPrivateFieldGet$2 = function(receiver, state, kind, f) {
|
|
3007
3047
|
if (kind === "a" && !f)
|
|
3008
3048
|
throw new TypeError("Private accessor was defined without a getter");
|
|
3009
3049
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -3034,134 +3074,105 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3034
3074
|
const sharedStore = new Store({
|
|
3035
3075
|
defaultStorage: {}
|
|
3036
3076
|
});
|
|
3037
|
-
__classPrivateFieldSet$
|
|
3038
|
-
__classPrivateFieldSet$
|
|
3077
|
+
__classPrivateFieldSet$2(this, _Sharer_activeStore, activeStore, "f");
|
|
3078
|
+
__classPrivateFieldSet$2(this, _Sharer_sharedStore, sharedStore, "f");
|
|
3039
3079
|
}
|
|
3040
3080
|
getActiveStorage(key2) {
|
|
3041
|
-
return __classPrivateFieldGet$
|
|
3081
|
+
return __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get(key2);
|
|
3042
3082
|
}
|
|
3043
3083
|
setActiveStorage(key2, storage) {
|
|
3044
|
-
return __classPrivateFieldGet$
|
|
3084
|
+
return __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set(key2, storage);
|
|
3045
3085
|
}
|
|
3046
3086
|
getActiveStoreSnapshot() {
|
|
3047
|
-
return __classPrivateFieldGet$
|
|
3087
|
+
return __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").getSnapshot();
|
|
3048
3088
|
}
|
|
3049
3089
|
getSharedStorage(key2) {
|
|
3050
|
-
return __classPrivateFieldGet$
|
|
3090
|
+
return __classPrivateFieldGet$2(this, _Sharer_sharedStore, "f").get(key2);
|
|
3051
3091
|
}
|
|
3052
3092
|
setSharedStorage(key2, storage) {
|
|
3053
|
-
return __classPrivateFieldGet$
|
|
3093
|
+
return __classPrivateFieldGet$2(this, _Sharer_sharedStore, "f").set(key2, storage);
|
|
3054
3094
|
}
|
|
3055
3095
|
getSharedStoreSnapshot() {
|
|
3056
|
-
return __classPrivateFieldGet$
|
|
3096
|
+
return __classPrivateFieldGet$2(this, _Sharer_sharedStore, "f").getSnapshot();
|
|
3057
3097
|
}
|
|
3058
3098
|
getActiveViewScaleInfo() {
|
|
3059
3099
|
const viewScaleInfo = {
|
|
3060
|
-
scale: __classPrivateFieldGet$
|
|
3061
|
-
offsetTop: __classPrivateFieldGet$
|
|
3062
|
-
offsetBottom: __classPrivateFieldGet$
|
|
3063
|
-
offsetLeft: __classPrivateFieldGet$
|
|
3064
|
-
offsetRight: __classPrivateFieldGet$
|
|
3100
|
+
scale: __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get("scale"),
|
|
3101
|
+
offsetTop: __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get("offsetTop"),
|
|
3102
|
+
offsetBottom: __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get("offsetBottom"),
|
|
3103
|
+
offsetLeft: __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get("offsetLeft"),
|
|
3104
|
+
offsetRight: __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get("offsetRight")
|
|
3065
3105
|
};
|
|
3066
3106
|
return viewScaleInfo;
|
|
3067
3107
|
}
|
|
3068
3108
|
setActiveViewScaleInfo(viewScaleInfo) {
|
|
3069
3109
|
const { scale, offsetTop, offsetBottom, offsetLeft, offsetRight } = viewScaleInfo;
|
|
3070
|
-
__classPrivateFieldGet$
|
|
3071
|
-
__classPrivateFieldGet$
|
|
3072
|
-
__classPrivateFieldGet$
|
|
3073
|
-
__classPrivateFieldGet$
|
|
3074
|
-
__classPrivateFieldGet$
|
|
3110
|
+
__classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set("scale", scale);
|
|
3111
|
+
__classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set("offsetTop", offsetTop);
|
|
3112
|
+
__classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set("offsetBottom", offsetBottom);
|
|
3113
|
+
__classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set("offsetLeft", offsetLeft);
|
|
3114
|
+
__classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set("offsetRight", offsetRight);
|
|
3075
3115
|
}
|
|
3076
3116
|
setActiveViewSizeInfo(size) {
|
|
3077
|
-
__classPrivateFieldGet$
|
|
3078
|
-
__classPrivateFieldGet$
|
|
3079
|
-
__classPrivateFieldGet$
|
|
3080
|
-
__classPrivateFieldGet$
|
|
3081
|
-
__classPrivateFieldGet$
|
|
3117
|
+
__classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set("width", size.width);
|
|
3118
|
+
__classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set("height", size.height);
|
|
3119
|
+
__classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set("devicePixelRatio", size.devicePixelRatio);
|
|
3120
|
+
__classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set("contextWidth", size.contextWidth);
|
|
3121
|
+
__classPrivateFieldGet$2(this, _Sharer_activeStore, "f").set("contextHeight", size.contextHeight);
|
|
3082
3122
|
}
|
|
3083
3123
|
getActiveViewSizeInfo() {
|
|
3084
3124
|
const sizeInfo = {
|
|
3085
|
-
width: __classPrivateFieldGet$
|
|
3086
|
-
height: __classPrivateFieldGet$
|
|
3087
|
-
devicePixelRatio: __classPrivateFieldGet$
|
|
3088
|
-
contextWidth: __classPrivateFieldGet$
|
|
3089
|
-
contextHeight: __classPrivateFieldGet$
|
|
3125
|
+
width: __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get("width"),
|
|
3126
|
+
height: __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get("height"),
|
|
3127
|
+
devicePixelRatio: __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get("devicePixelRatio"),
|
|
3128
|
+
contextWidth: __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get("contextWidth"),
|
|
3129
|
+
contextHeight: __classPrivateFieldGet$2(this, _Sharer_activeStore, "f").get("contextHeight")
|
|
3090
3130
|
};
|
|
3091
3131
|
return sizeInfo;
|
|
3092
3132
|
}
|
|
3093
3133
|
}
|
|
3094
3134
|
_Sharer_activeStore = /* @__PURE__ */ new WeakMap(), _Sharer_sharedStore = /* @__PURE__ */ new WeakMap();
|
|
3135
|
+
var __classPrivateFieldSet$1 = function(receiver, state, value, kind, f) {
|
|
3136
|
+
if (kind === "m")
|
|
3137
|
+
throw new TypeError("Private method is not writable");
|
|
3138
|
+
if (kind === "a" && !f)
|
|
3139
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
3140
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3141
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3142
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3143
|
+
};
|
|
3144
|
+
var __classPrivateFieldGet$1 = function(receiver, state, kind, f) {
|
|
3145
|
+
if (kind === "a" && !f)
|
|
3146
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
3147
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3148
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3149
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3150
|
+
};
|
|
3151
|
+
var _Viewer_instances, _Viewer_opts, _Viewer_drawFrameSnapshotQueue, _Viewer_drawFrameStatus, _Viewer_init, _Viewer_drawAnimationFrame;
|
|
3095
3152
|
const { requestAnimationFrame } = window;
|
|
3096
3153
|
class Viewer extends EventEmitter {
|
|
3097
3154
|
constructor(opts) {
|
|
3098
3155
|
super();
|
|
3099
|
-
this
|
|
3100
|
-
this
|
|
3101
|
-
this
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
const { renderer } = this._opts;
|
|
3106
|
-
renderer.on("load", () => {
|
|
3107
|
-
this.drawFrame();
|
|
3108
|
-
});
|
|
3109
|
-
}
|
|
3110
|
-
_drawAnimationFrame() {
|
|
3111
|
-
if (this._drawFrameStatus === "DRAWING" || this._drawFrameSnapshotQueue.length === 0) {
|
|
3112
|
-
return;
|
|
3113
|
-
} else {
|
|
3114
|
-
this._drawFrameStatus = "DRAWING";
|
|
3115
|
-
}
|
|
3116
|
-
const snapshot = this._drawFrameSnapshotQueue.shift();
|
|
3117
|
-
const { renderer, boardContent, beforeDrawFrame, afterDrawFrame } = this._opts;
|
|
3118
|
-
if (snapshot) {
|
|
3119
|
-
const { scale, offsetTop, offsetBottom, offsetLeft, offsetRight, width, height, contextHeight, contextWidth, devicePixelRatio } = snapshot.activeStore;
|
|
3120
|
-
if (snapshot === null || snapshot === void 0 ? void 0 : snapshot.activeStore.data) {
|
|
3121
|
-
renderer.drawData(snapshot.activeStore.data, {
|
|
3122
|
-
viewScaleInfo: {
|
|
3123
|
-
scale,
|
|
3124
|
-
offsetTop,
|
|
3125
|
-
offsetBottom,
|
|
3126
|
-
offsetLeft,
|
|
3127
|
-
offsetRight
|
|
3128
|
-
},
|
|
3129
|
-
viewSizeInfo: {
|
|
3130
|
-
width,
|
|
3131
|
-
height,
|
|
3132
|
-
contextHeight,
|
|
3133
|
-
contextWidth,
|
|
3134
|
-
devicePixelRatio
|
|
3135
|
-
}
|
|
3136
|
-
});
|
|
3137
|
-
}
|
|
3138
|
-
beforeDrawFrame({ snapshot });
|
|
3139
|
-
boardContent.drawView();
|
|
3140
|
-
afterDrawFrame({ snapshot });
|
|
3141
|
-
}
|
|
3142
|
-
if (this._drawFrameSnapshotQueue.length === 0) {
|
|
3143
|
-
this._drawFrameStatus = "COMPLETE";
|
|
3144
|
-
return;
|
|
3145
|
-
}
|
|
3146
|
-
if (this._drawFrameStatus = "DRAWING") {
|
|
3147
|
-
requestAnimationFrame(() => {
|
|
3148
|
-
this._drawAnimationFrame();
|
|
3149
|
-
});
|
|
3150
|
-
}
|
|
3156
|
+
_Viewer_instances.add(this);
|
|
3157
|
+
_Viewer_opts.set(this, void 0);
|
|
3158
|
+
_Viewer_drawFrameSnapshotQueue.set(this, []);
|
|
3159
|
+
_Viewer_drawFrameStatus.set(this, "FREE");
|
|
3160
|
+
__classPrivateFieldSet$1(this, _Viewer_opts, opts, "f");
|
|
3161
|
+
__classPrivateFieldGet$1(this, _Viewer_instances, "m", _Viewer_init).call(this);
|
|
3151
3162
|
}
|
|
3152
3163
|
drawFrame() {
|
|
3153
|
-
const { sharer } = this
|
|
3164
|
+
const { sharer } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3154
3165
|
const activeStore = sharer.getActiveStoreSnapshot();
|
|
3155
3166
|
const sharedStore = sharer.getSharedStoreSnapshot();
|
|
3156
|
-
this.
|
|
3167
|
+
__classPrivateFieldGet$1(this, _Viewer_drawFrameSnapshotQueue, "f").push({
|
|
3157
3168
|
activeStore,
|
|
3158
3169
|
sharedStore
|
|
3159
3170
|
});
|
|
3160
|
-
this.
|
|
3171
|
+
__classPrivateFieldGet$1(this, _Viewer_instances, "m", _Viewer_drawAnimationFrame).call(this);
|
|
3161
3172
|
}
|
|
3162
3173
|
scale(opts) {
|
|
3163
3174
|
const { scale, point } = opts;
|
|
3164
|
-
const { sharer } = this
|
|
3175
|
+
const { sharer } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3165
3176
|
const { moveX, moveY } = viewScale({
|
|
3166
3177
|
scale,
|
|
3167
3178
|
point,
|
|
@@ -3172,7 +3183,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3172
3183
|
return { moveX, moveY };
|
|
3173
3184
|
}
|
|
3174
3185
|
scroll(opts) {
|
|
3175
|
-
const { sharer } = this
|
|
3186
|
+
const { sharer } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3176
3187
|
const prevViewScaleInfo = sharer.getActiveViewScaleInfo();
|
|
3177
3188
|
const { moveX, moveY } = opts;
|
|
3178
3189
|
const viewSizeInfo = sharer.getActiveViewSizeInfo();
|
|
@@ -3186,7 +3197,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3186
3197
|
return viewScaleInfo;
|
|
3187
3198
|
}
|
|
3188
3199
|
updateViewScaleInfo(opts) {
|
|
3189
|
-
const { sharer } = this
|
|
3200
|
+
const { sharer } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3190
3201
|
const viewScaleInfo = calcViewScaleInfo(opts, {
|
|
3191
3202
|
viewSizeInfo: sharer.getActiveViewSizeInfo()
|
|
3192
3203
|
});
|
|
@@ -3194,11 +3205,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3194
3205
|
return viewScaleInfo;
|
|
3195
3206
|
}
|
|
3196
3207
|
resize(viewSize = {}) {
|
|
3197
|
-
const { sharer } = this
|
|
3208
|
+
const { sharer } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3198
3209
|
const originViewSize = sharer.getActiveViewSizeInfo();
|
|
3199
3210
|
const newViewSize = Object.assign(Object.assign({}, originViewSize), viewSize);
|
|
3200
3211
|
const { width, height, devicePixelRatio } = newViewSize;
|
|
3201
|
-
const { underContext, boardContext, helperContext, viewContext } = this.
|
|
3212
|
+
const { underContext, boardContext, helperContext, viewContext } = __classPrivateFieldGet$1(this, _Viewer_opts, "f").boardContent;
|
|
3202
3213
|
boardContext.canvas.width = width * devicePixelRatio;
|
|
3203
3214
|
boardContext.canvas.height = height * devicePixelRatio;
|
|
3204
3215
|
boardContext.canvas.style.width = `${width}px`;
|
|
@@ -3213,6 +3224,55 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3213
3224
|
return newViewSize;
|
|
3214
3225
|
}
|
|
3215
3226
|
}
|
|
3227
|
+
_Viewer_opts = /* @__PURE__ */ new WeakMap(), _Viewer_drawFrameSnapshotQueue = /* @__PURE__ */ new WeakMap(), _Viewer_drawFrameStatus = /* @__PURE__ */ new WeakMap(), _Viewer_instances = /* @__PURE__ */ new WeakSet(), _Viewer_init = function _Viewer_init2() {
|
|
3228
|
+
const { renderer } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3229
|
+
renderer.on("load", () => {
|
|
3230
|
+
this.drawFrame();
|
|
3231
|
+
});
|
|
3232
|
+
}, _Viewer_drawAnimationFrame = function _Viewer_drawAnimationFrame2() {
|
|
3233
|
+
if (__classPrivateFieldGet$1(this, _Viewer_drawFrameStatus, "f") === "DRAWING" || __classPrivateFieldGet$1(this, _Viewer_drawFrameSnapshotQueue, "f").length === 0) {
|
|
3234
|
+
return;
|
|
3235
|
+
} else {
|
|
3236
|
+
__classPrivateFieldSet$1(this, _Viewer_drawFrameStatus, "DRAWING", "f");
|
|
3237
|
+
}
|
|
3238
|
+
const snapshot = __classPrivateFieldGet$1(this, _Viewer_drawFrameSnapshotQueue, "f").shift();
|
|
3239
|
+
const { renderer, boardContent, beforeDrawFrame, afterDrawFrame } = __classPrivateFieldGet$1(this, _Viewer_opts, "f");
|
|
3240
|
+
if (snapshot) {
|
|
3241
|
+
const { scale, offsetTop, offsetBottom, offsetLeft, offsetRight, width, height, contextHeight, contextWidth, devicePixelRatio } = snapshot.activeStore;
|
|
3242
|
+
const viewScaleInfo = {
|
|
3243
|
+
scale,
|
|
3244
|
+
offsetTop,
|
|
3245
|
+
offsetBottom,
|
|
3246
|
+
offsetLeft,
|
|
3247
|
+
offsetRight
|
|
3248
|
+
};
|
|
3249
|
+
const viewSizeInfo = {
|
|
3250
|
+
width,
|
|
3251
|
+
height,
|
|
3252
|
+
contextHeight,
|
|
3253
|
+
contextWidth,
|
|
3254
|
+
devicePixelRatio
|
|
3255
|
+
};
|
|
3256
|
+
if (snapshot === null || snapshot === void 0 ? void 0 : snapshot.activeStore.data) {
|
|
3257
|
+
renderer.drawData(snapshot.activeStore.data, {
|
|
3258
|
+
viewScaleInfo,
|
|
3259
|
+
viewSizeInfo
|
|
3260
|
+
});
|
|
3261
|
+
}
|
|
3262
|
+
beforeDrawFrame({ snapshot });
|
|
3263
|
+
boardContent.drawView();
|
|
3264
|
+
afterDrawFrame({ snapshot });
|
|
3265
|
+
}
|
|
3266
|
+
if (__classPrivateFieldGet$1(this, _Viewer_drawFrameSnapshotQueue, "f").length === 0) {
|
|
3267
|
+
__classPrivateFieldSet$1(this, _Viewer_drawFrameStatus, "COMPLETE", "f");
|
|
3268
|
+
return;
|
|
3269
|
+
}
|
|
3270
|
+
if (__classPrivateFieldSet$1(this, _Viewer_drawFrameStatus, "DRAWING", "f")) {
|
|
3271
|
+
requestAnimationFrame(() => {
|
|
3272
|
+
__classPrivateFieldGet$1(this, _Viewer_instances, "m", _Viewer_drawAnimationFrame2).call(this);
|
|
3273
|
+
});
|
|
3274
|
+
}
|
|
3275
|
+
};
|
|
3216
3276
|
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
3217
3277
|
if (kind === "m")
|
|
3218
3278
|
throw new TypeError("Private method is not writable");
|
|
@@ -4755,7 +4815,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4755
4815
|
eventHub.off(middlewareEventSelectClear, selectClearCallback);
|
|
4756
4816
|
},
|
|
4757
4817
|
hover: (e) => {
|
|
4758
|
-
var _a, _b;
|
|
4818
|
+
var _a, _b, _c, _d, _e;
|
|
4759
4819
|
const resizeType = sharer.getSharedStorage(keyResizeType);
|
|
4760
4820
|
const actionType = sharer.getSharedStorage(keyActionType);
|
|
4761
4821
|
const groupQueue = sharer.getSharedStorage(keyGroupQueue);
|
|
@@ -4817,7 +4877,16 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4817
4877
|
})
|
|
4818
4878
|
});
|
|
4819
4879
|
triggerCursor(target);
|
|
4820
|
-
if (target.type ===
|
|
4880
|
+
if (target.type === null) {
|
|
4881
|
+
return;
|
|
4882
|
+
}
|
|
4883
|
+
if (target.type === "over-element" && sharer.getSharedStorage(keyActionType) === "select" && target.elements.length === 1 && target.elements[0].uuid === ((_c = (_b = getActiveElements()) == null ? void 0 : _b[0]) == null ? void 0 : _c.uuid)) {
|
|
4884
|
+
return;
|
|
4885
|
+
}
|
|
4886
|
+
if (target.type === "over-element" && sharer.getSharedStorage(keyActionType) === null && target.elements.length === 1 && target.elements[0].uuid === ((_d = sharer.getSharedStorage(keyHoverElement)) == null ? void 0 : _d.uuid)) {
|
|
4887
|
+
return;
|
|
4888
|
+
}
|
|
4889
|
+
if (target.type === "over-element" && ((_e = target == null ? void 0 : target.elements) == null ? void 0 : _e.length) === 1) {
|
|
4821
4890
|
sharer.setSharedStorage(keyHoverElement, target.elements[0]);
|
|
4822
4891
|
updateHoverElement(target.elements[0]);
|
|
4823
4892
|
viewer.drawFrame();
|