@idraw/core 0.4.0-beta.5 → 0.4.0-beta.7
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/index.d.ts +2 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/middleware/dragger/index.js +1 -0
- package/dist/esm/middleware/ruler/index.js +1 -0
- package/dist/esm/middleware/scaler/index.js +1 -0
- package/dist/esm/middleware/scroller/index.js +1 -0
- package/dist/esm/middleware/selector/index.d.ts +1 -0
- package/dist/esm/middleware/selector/index.js +8 -0
- package/dist/esm/middleware/text-editor/index.js +1 -0
- package/dist/index.global.js +407 -250
- package/dist/index.global.min.js +1 -1
- package/package.json +5 -5
package/dist/index.global.js
CHANGED
|
@@ -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$8 = 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$8 = 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$8(this, _Context2D_ctx, ctx, "f");
|
|
383
|
+
__classPrivateFieldSet$8(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$8(this, _Context2D_opts, "f").devicePixelRatio;
|
|
387
387
|
}
|
|
388
388
|
$doPixelRatio(num) {
|
|
389
|
-
return __classPrivateFieldGet$
|
|
389
|
+
return __classPrivateFieldGet$8(this, _Context2D_opts, "f").devicePixelRatio * num;
|
|
390
390
|
}
|
|
391
391
|
$getContext() {
|
|
392
|
-
return __classPrivateFieldGet$
|
|
392
|
+
return __classPrivateFieldGet$8(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$8(this, _Context2D_ctx, "f").font = `${strList.join(" ")}`;
|
|
402
402
|
}
|
|
403
403
|
$getOffscreenCanvas() {
|
|
404
|
-
return __classPrivateFieldGet$
|
|
404
|
+
return __classPrivateFieldGet$8(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$8(this, _Context2D_ctx, "f");
|
|
409
409
|
canvas.width = width * devicePixelRatio;
|
|
410
410
|
canvas.height = height * devicePixelRatio;
|
|
411
|
-
__classPrivateFieldSet$
|
|
411
|
+
__classPrivateFieldSet$8(this, _Context2D_opts, Object.assign(Object.assign({}, __classPrivateFieldGet$8(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$8(this, _Context2D_opts, "f");
|
|
421
|
+
const { width, height } = __classPrivateFieldGet$8(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$8(this, _Context2D_ctx, "f").canvas;
|
|
430
430
|
}
|
|
431
431
|
get fillStyle() {
|
|
432
|
-
return __classPrivateFieldGet$
|
|
432
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").fillStyle;
|
|
433
433
|
}
|
|
434
434
|
set fillStyle(value) {
|
|
435
|
-
__classPrivateFieldGet$
|
|
435
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").fillStyle = value;
|
|
436
436
|
}
|
|
437
437
|
get strokeStyle() {
|
|
438
|
-
return __classPrivateFieldGet$
|
|
438
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").strokeStyle;
|
|
439
439
|
}
|
|
440
440
|
set strokeStyle(color2) {
|
|
441
|
-
__classPrivateFieldGet$
|
|
441
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").strokeStyle = color2;
|
|
442
442
|
}
|
|
443
443
|
get lineWidth() {
|
|
444
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
444
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$8(this, _Context2D_ctx, "f").lineWidth);
|
|
445
445
|
}
|
|
446
446
|
set lineWidth(w2) {
|
|
447
|
-
__classPrivateFieldGet$
|
|
447
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").lineWidth = this.$doPixelRatio(w2);
|
|
448
448
|
}
|
|
449
449
|
get textAlign() {
|
|
450
|
-
return __classPrivateFieldGet$
|
|
450
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").textAlign;
|
|
451
451
|
}
|
|
452
452
|
set textAlign(align) {
|
|
453
|
-
__classPrivateFieldGet$
|
|
453
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").textAlign = align;
|
|
454
454
|
}
|
|
455
455
|
get textBaseline() {
|
|
456
|
-
return __classPrivateFieldGet$
|
|
456
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").textBaseline;
|
|
457
457
|
}
|
|
458
458
|
set textBaseline(baseline) {
|
|
459
|
-
__classPrivateFieldGet$
|
|
459
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").textBaseline = baseline;
|
|
460
460
|
}
|
|
461
461
|
get globalAlpha() {
|
|
462
|
-
return __classPrivateFieldGet$
|
|
462
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").globalAlpha;
|
|
463
463
|
}
|
|
464
464
|
set globalAlpha(alpha) {
|
|
465
|
-
__classPrivateFieldGet$
|
|
465
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").globalAlpha = alpha;
|
|
466
466
|
}
|
|
467
467
|
get shadowColor() {
|
|
468
|
-
return __classPrivateFieldGet$
|
|
468
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").shadowColor;
|
|
469
469
|
}
|
|
470
470
|
set shadowColor(color2) {
|
|
471
|
-
__classPrivateFieldGet$
|
|
471
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").shadowColor = color2;
|
|
472
472
|
}
|
|
473
473
|
get shadowOffsetX() {
|
|
474
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
474
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$8(this, _Context2D_ctx, "f").shadowOffsetX);
|
|
475
475
|
}
|
|
476
476
|
set shadowOffsetX(offsetX) {
|
|
477
|
-
__classPrivateFieldGet$
|
|
477
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").shadowOffsetX = this.$doPixelRatio(offsetX);
|
|
478
478
|
}
|
|
479
479
|
get shadowOffsetY() {
|
|
480
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
480
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$8(this, _Context2D_ctx, "f").shadowOffsetY);
|
|
481
481
|
}
|
|
482
482
|
set shadowOffsetY(offsetY) {
|
|
483
|
-
__classPrivateFieldGet$
|
|
483
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").shadowOffsetY = this.$doPixelRatio(offsetY);
|
|
484
484
|
}
|
|
485
485
|
get shadowBlur() {
|
|
486
|
-
return this.$undoPixelRatio(__classPrivateFieldGet$
|
|
486
|
+
return this.$undoPixelRatio(__classPrivateFieldGet$8(this, _Context2D_ctx, "f").shadowBlur);
|
|
487
487
|
}
|
|
488
488
|
set shadowBlur(blur) {
|
|
489
|
-
__classPrivateFieldGet$
|
|
489
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").shadowBlur = this.$doPixelRatio(blur);
|
|
490
490
|
}
|
|
491
491
|
get lineCap() {
|
|
492
|
-
return __classPrivateFieldGet$
|
|
492
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").lineCap;
|
|
493
493
|
}
|
|
494
494
|
set lineCap(lineCap) {
|
|
495
|
-
__classPrivateFieldGet$
|
|
495
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").lineCap = lineCap;
|
|
496
496
|
}
|
|
497
497
|
get globalCompositeOperation() {
|
|
498
|
-
return __classPrivateFieldGet$
|
|
498
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").globalCompositeOperation;
|
|
499
499
|
}
|
|
500
500
|
set globalCompositeOperation(operations) {
|
|
501
|
-
__classPrivateFieldGet$
|
|
501
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").globalCompositeOperation = operations;
|
|
502
502
|
}
|
|
503
503
|
fill(...args) {
|
|
504
|
-
return __classPrivateFieldGet$
|
|
504
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").fill(...args);
|
|
505
505
|
}
|
|
506
506
|
arc(x2, y2, radius, startAngle, endAngle, anticlockwise) {
|
|
507
|
-
return __classPrivateFieldGet$
|
|
507
|
+
return __classPrivateFieldGet$8(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$8(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$8(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$8(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$8(this, _Context2D_ctx, "f").beginPath();
|
|
520
520
|
}
|
|
521
521
|
closePath() {
|
|
522
|
-
return __classPrivateFieldGet$
|
|
522
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").closePath();
|
|
523
523
|
}
|
|
524
524
|
lineTo(x2, y2) {
|
|
525
|
-
return __classPrivateFieldGet$
|
|
525
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").lineTo(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
526
526
|
}
|
|
527
527
|
moveTo(x2, y2) {
|
|
528
|
-
return __classPrivateFieldGet$
|
|
528
|
+
return __classPrivateFieldGet$8(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$8(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$8(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$8(this, _Context2D_ctx, "f").setLineDash(dash);
|
|
539
539
|
}
|
|
540
540
|
stroke(path) {
|
|
541
|
-
return path ? __classPrivateFieldGet$
|
|
541
|
+
return path ? __classPrivateFieldGet$8(this, _Context2D_ctx, "f").stroke(path) : __classPrivateFieldGet$8(this, _Context2D_ctx, "f").stroke();
|
|
542
542
|
}
|
|
543
543
|
translate(x2, y2) {
|
|
544
|
-
return __classPrivateFieldGet$
|
|
544
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").translate(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
545
545
|
}
|
|
546
546
|
rotate(angle2) {
|
|
547
|
-
return __classPrivateFieldGet$
|
|
547
|
+
return __classPrivateFieldGet$8(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$8(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$8(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$8(this, _Context2D_ctx, "f").createPattern(image, repetition);
|
|
567
567
|
}
|
|
568
568
|
measureText(text2) {
|
|
569
|
-
const textMetrics = __classPrivateFieldGet$
|
|
569
|
+
const textMetrics = __classPrivateFieldGet$8(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$8(this, _Context2D_ctx, "f").fillText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(maxWidth));
|
|
575
575
|
} else {
|
|
576
|
-
return __classPrivateFieldGet$
|
|
576
|
+
return __classPrivateFieldGet$8(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$8(this, _Context2D_ctx, "f").strokeText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2), this.$doPixelRatio(maxWidth));
|
|
582
582
|
} else {
|
|
583
|
-
return __classPrivateFieldGet$
|
|
583
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").strokeText(text2, this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
save() {
|
|
587
|
-
__classPrivateFieldGet$
|
|
587
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").save();
|
|
588
588
|
}
|
|
589
589
|
restore() {
|
|
590
|
-
__classPrivateFieldGet$
|
|
590
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").restore();
|
|
591
591
|
}
|
|
592
592
|
scale(ratioX, ratioY) {
|
|
593
|
-
__classPrivateFieldGet$
|
|
593
|
+
__classPrivateFieldGet$8(this, _Context2D_ctx, "f").scale(ratioX, ratioY);
|
|
594
594
|
}
|
|
595
595
|
circle(x2, y2, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise) {
|
|
596
|
-
__classPrivateFieldGet$
|
|
596
|
+
__classPrivateFieldGet$8(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$8(this, _Context2D_ctx, "f").isPointInPath(this.$doPixelRatio(x2), this.$doPixelRatio(y2));
|
|
600
600
|
}
|
|
601
601
|
clip(...args) {
|
|
602
|
-
return __classPrivateFieldGet$
|
|
602
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").clip(...args);
|
|
603
603
|
}
|
|
604
604
|
setTransform(a, b, c, d, e, f) {
|
|
605
|
-
return __classPrivateFieldGet$
|
|
605
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").setTransform(a, b, c, d, e, f);
|
|
606
606
|
}
|
|
607
607
|
getTransform() {
|
|
608
|
-
return __classPrivateFieldGet$
|
|
608
|
+
return __classPrivateFieldGet$8(this, _Context2D_ctx, "f").getTransform();
|
|
609
609
|
}
|
|
610
610
|
createLinearGradient(x0, y0, x1, y1) {
|
|
611
|
-
return __classPrivateFieldGet$
|
|
611
|
+
return __classPrivateFieldGet$8(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$8(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$8(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,22 +697,40 @@ var __privateMethod = (obj, member, method) => {
|
|
|
697
697
|
return content;
|
|
698
698
|
}
|
|
699
699
|
}
|
|
700
|
+
var __classPrivateFieldSet$7 = function(receiver, state, value, kind, f) {
|
|
701
|
+
if (kind === "m")
|
|
702
|
+
throw new TypeError("Private method is not writable");
|
|
703
|
+
if (kind === "a" && !f)
|
|
704
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
705
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
706
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
707
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
708
|
+
};
|
|
709
|
+
var __classPrivateFieldGet$7 = function(receiver, state, kind, f) {
|
|
710
|
+
if (kind === "a" && !f)
|
|
711
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
712
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
713
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
714
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
715
|
+
};
|
|
716
|
+
var _EventEmitter_listeners;
|
|
700
717
|
class EventEmitter {
|
|
701
718
|
constructor() {
|
|
702
|
-
this
|
|
719
|
+
_EventEmitter_listeners.set(this, void 0);
|
|
720
|
+
__classPrivateFieldSet$7(this, _EventEmitter_listeners, /* @__PURE__ */ new Map(), "f");
|
|
703
721
|
}
|
|
704
722
|
on(eventKey, callback) {
|
|
705
|
-
if (this.
|
|
706
|
-
const callbacks = this.
|
|
723
|
+
if (__classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").has(eventKey)) {
|
|
724
|
+
const callbacks = __classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").get(eventKey) || [];
|
|
707
725
|
callbacks === null || callbacks === void 0 ? void 0 : callbacks.push(callback);
|
|
708
|
-
this.
|
|
726
|
+
__classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").set(eventKey, callbacks);
|
|
709
727
|
} else {
|
|
710
|
-
this.
|
|
728
|
+
__classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").set(eventKey, [callback]);
|
|
711
729
|
}
|
|
712
730
|
}
|
|
713
731
|
off(eventKey, callback) {
|
|
714
|
-
if (this.
|
|
715
|
-
const callbacks = this.
|
|
732
|
+
if (__classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").has(eventKey)) {
|
|
733
|
+
const callbacks = __classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").get(eventKey);
|
|
716
734
|
if (Array.isArray(callbacks)) {
|
|
717
735
|
for (let i = 0; i < (callbacks === null || callbacks === void 0 ? void 0 : callbacks.length); i++) {
|
|
718
736
|
if (callbacks[i] === callback) {
|
|
@@ -721,11 +739,11 @@ var __privateMethod = (obj, member, method) => {
|
|
|
721
739
|
}
|
|
722
740
|
}
|
|
723
741
|
}
|
|
724
|
-
this.
|
|
742
|
+
__classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").set(eventKey, callbacks || []);
|
|
725
743
|
}
|
|
726
744
|
}
|
|
727
745
|
trigger(eventKey, e) {
|
|
728
|
-
const callbacks = this.
|
|
746
|
+
const callbacks = __classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").get(eventKey);
|
|
729
747
|
if (Array.isArray(callbacks)) {
|
|
730
748
|
callbacks.forEach((cb) => {
|
|
731
749
|
cb(e);
|
|
@@ -736,15 +754,19 @@ var __privateMethod = (obj, member, method) => {
|
|
|
736
754
|
}
|
|
737
755
|
}
|
|
738
756
|
has(name) {
|
|
739
|
-
if (this.
|
|
740
|
-
const list = this.
|
|
757
|
+
if (__classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").has(name)) {
|
|
758
|
+
const list = __classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").get(name);
|
|
741
759
|
if (Array.isArray(list) && list.length > 0) {
|
|
742
760
|
return true;
|
|
743
761
|
}
|
|
744
762
|
}
|
|
745
763
|
return false;
|
|
746
764
|
}
|
|
765
|
+
destroy() {
|
|
766
|
+
__classPrivateFieldGet$7(this, _EventEmitter_listeners, "f").clear();
|
|
767
|
+
}
|
|
747
768
|
}
|
|
769
|
+
_EventEmitter_listeners = /* @__PURE__ */ new WeakMap();
|
|
748
770
|
function calcDistance(start, end) {
|
|
749
771
|
const distance = (start.x - end.x) * (start.x - end.x) + (start.y - end.y) * (start.y - end.y);
|
|
750
772
|
return distance === 0 ? distance : Math.sqrt(distance);
|
|
@@ -755,27 +777,50 @@ var __privateMethod = (obj, member, method) => {
|
|
|
755
777
|
y: p1.y + (p2.y - p1.y) / 2
|
|
756
778
|
};
|
|
757
779
|
}
|
|
780
|
+
var __classPrivateFieldSet$6 = function(receiver, state, value, kind, f) {
|
|
781
|
+
if (kind === "m")
|
|
782
|
+
throw new TypeError("Private method is not writable");
|
|
783
|
+
if (kind === "a" && !f)
|
|
784
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
785
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
786
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
787
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
788
|
+
};
|
|
789
|
+
var __classPrivateFieldGet$6 = function(receiver, state, kind, f) {
|
|
790
|
+
if (kind === "a" && !f)
|
|
791
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
792
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
793
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
794
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
795
|
+
};
|
|
796
|
+
var _Store_instances, _Store_temp, _Store_backUpDefaultStorage, _Store_createTempStorage;
|
|
758
797
|
class Store {
|
|
759
798
|
constructor(opts) {
|
|
760
|
-
|
|
761
|
-
this
|
|
799
|
+
_Store_instances.add(this);
|
|
800
|
+
_Store_temp.set(this, void 0);
|
|
801
|
+
_Store_backUpDefaultStorage.set(this, void 0);
|
|
802
|
+
__classPrivateFieldSet$6(this, _Store_backUpDefaultStorage, deepClone(opts.defaultStorage), "f");
|
|
803
|
+
__classPrivateFieldSet$6(this, _Store_temp, __classPrivateFieldGet$6(this, _Store_instances, "m", _Store_createTempStorage).call(this), "f");
|
|
762
804
|
}
|
|
763
805
|
set(name, value) {
|
|
764
|
-
this
|
|
806
|
+
__classPrivateFieldGet$6(this, _Store_temp, "f")[name] = value;
|
|
765
807
|
}
|
|
766
808
|
get(name) {
|
|
767
|
-
return this
|
|
809
|
+
return __classPrivateFieldGet$6(this, _Store_temp, "f")[name];
|
|
768
810
|
}
|
|
769
811
|
getSnapshot() {
|
|
770
|
-
return deepClone(this
|
|
812
|
+
return deepClone(__classPrivateFieldGet$6(this, _Store_temp, "f"));
|
|
771
813
|
}
|
|
772
814
|
clear() {
|
|
773
|
-
this
|
|
815
|
+
__classPrivateFieldSet$6(this, _Store_temp, __classPrivateFieldGet$6(this, _Store_instances, "m", _Store_createTempStorage).call(this), "f");
|
|
774
816
|
}
|
|
775
|
-
|
|
776
|
-
|
|
817
|
+
destroy() {
|
|
818
|
+
__classPrivateFieldSet$6(this, _Store_temp, null, "f");
|
|
777
819
|
}
|
|
778
820
|
}
|
|
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$6(this, _Store_backUpDefaultStorage, "f"));
|
|
823
|
+
};
|
|
779
824
|
function getViewScaleInfoFromSnapshot(snapshot) {
|
|
780
825
|
const { activeStore } = snapshot;
|
|
781
826
|
const sacelInfo = {
|
|
@@ -2453,14 +2498,14 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2453
2498
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2454
2499
|
});
|
|
2455
2500
|
};
|
|
2456
|
-
var __classPrivateFieldGet$
|
|
2501
|
+
var __classPrivateFieldGet$5 = function(receiver, state, kind, f) {
|
|
2457
2502
|
if (kind === "a" && !f)
|
|
2458
2503
|
throw new TypeError("Private accessor was defined without a getter");
|
|
2459
2504
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
2460
2505
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
2461
2506
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2462
2507
|
};
|
|
2463
|
-
var __classPrivateFieldSet$
|
|
2508
|
+
var __classPrivateFieldSet$5 = function(receiver, state, value, kind, f) {
|
|
2464
2509
|
if (kind === "m")
|
|
2465
2510
|
throw new TypeError("Private method is not writable");
|
|
2466
2511
|
if (kind === "a" && !f)
|
|
@@ -2496,7 +2541,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2496
2541
|
_Loader_loadFuncMap.set(this, {});
|
|
2497
2542
|
_Loader_currentLoadItemMap.set(this, {});
|
|
2498
2543
|
_Loader_storageLoadItemMap.set(this, {});
|
|
2499
|
-
__classPrivateFieldGet$
|
|
2544
|
+
__classPrivateFieldGet$5(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "image", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
2500
2545
|
var _a;
|
|
2501
2546
|
const src = ((_a = assets[elem.detail.src]) === null || _a === void 0 ? void 0 : _a.value) || elem.detail.src;
|
|
2502
2547
|
const content = yield loadImage(src);
|
|
@@ -2506,7 +2551,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2506
2551
|
content
|
|
2507
2552
|
};
|
|
2508
2553
|
}));
|
|
2509
|
-
__classPrivateFieldGet$
|
|
2554
|
+
__classPrivateFieldGet$5(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "html", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
2510
2555
|
var _b;
|
|
2511
2556
|
const html2 = ((_b = assets[elem.detail.html]) === null || _b === void 0 ? void 0 : _b.value) || elem.detail.html;
|
|
2512
2557
|
const content = yield loadHTML(html2, {
|
|
@@ -2519,7 +2564,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2519
2564
|
content
|
|
2520
2565
|
};
|
|
2521
2566
|
}));
|
|
2522
|
-
__classPrivateFieldGet$
|
|
2567
|
+
__classPrivateFieldGet$5(this, _Loader_instances, "m", _Loader_registerLoadFunc).call(this, "svg", (elem, assets) => __awaiter(this, void 0, void 0, function* () {
|
|
2523
2568
|
var _c;
|
|
2524
2569
|
const svg2 = ((_c = assets[elem.detail.svg]) === null || _c === void 0 ? void 0 : _c.value) || elem.detail.svg;
|
|
2525
2570
|
const content = yield loadSVG(svg2);
|
|
@@ -2530,28 +2575,33 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2530
2575
|
};
|
|
2531
2576
|
}));
|
|
2532
2577
|
}
|
|
2578
|
+
destroy() {
|
|
2579
|
+
__classPrivateFieldSet$5(this, _Loader_loadFuncMap, null, "f");
|
|
2580
|
+
__classPrivateFieldSet$5(this, _Loader_currentLoadItemMap, null, "f");
|
|
2581
|
+
__classPrivateFieldSet$5(this, _Loader_storageLoadItemMap, null, "f");
|
|
2582
|
+
}
|
|
2533
2583
|
load(element, assets) {
|
|
2534
|
-
if (__classPrivateFieldGet$
|
|
2584
|
+
if (__classPrivateFieldGet$5(this, _Loader_instances, "m", _Loader_isExistingErrorStorage).call(this, element)) {
|
|
2535
2585
|
return;
|
|
2536
2586
|
}
|
|
2537
2587
|
if (supportElementTypes.includes(element.type)) {
|
|
2538
|
-
__classPrivateFieldGet$
|
|
2588
|
+
__classPrivateFieldGet$5(this, _Loader_instances, "m", _Loader_loadResource).call(this, element, assets);
|
|
2539
2589
|
}
|
|
2540
2590
|
}
|
|
2541
2591
|
getContent(element) {
|
|
2542
2592
|
var _a, _b;
|
|
2543
2593
|
const assetId = getAssetIdFromElement(element);
|
|
2544
|
-
return ((_b = (_a = __classPrivateFieldGet$
|
|
2594
|
+
return ((_b = (_a = __classPrivateFieldGet$5(this, _Loader_storageLoadItemMap, "f")) === null || _a === void 0 ? void 0 : _a[assetId]) === null || _b === void 0 ? void 0 : _b.content) || null;
|
|
2545
2595
|
}
|
|
2546
2596
|
getLoadItemMap() {
|
|
2547
|
-
return __classPrivateFieldGet$
|
|
2597
|
+
return __classPrivateFieldGet$5(this, _Loader_storageLoadItemMap, "f");
|
|
2548
2598
|
}
|
|
2549
2599
|
setLoadItemMap(itemMap) {
|
|
2550
|
-
__classPrivateFieldSet$
|
|
2600
|
+
__classPrivateFieldSet$5(this, _Loader_storageLoadItemMap, itemMap, "f");
|
|
2551
2601
|
}
|
|
2552
2602
|
}
|
|
2553
2603
|
_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) {
|
|
2554
|
-
__classPrivateFieldGet$
|
|
2604
|
+
__classPrivateFieldGet$5(this, _Loader_loadFuncMap, "f")[type] = func;
|
|
2555
2605
|
}, _Loader_getLoadElementSource = function _Loader_getLoadElementSource2(element) {
|
|
2556
2606
|
var _a, _b, _c;
|
|
2557
2607
|
let source = null;
|
|
@@ -2571,62 +2621,62 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2571
2621
|
error: null,
|
|
2572
2622
|
startTime: -1,
|
|
2573
2623
|
endTime: -1,
|
|
2574
|
-
source: __classPrivateFieldGet$
|
|
2624
|
+
source: __classPrivateFieldGet$5(this, _Loader_instances, "m", _Loader_getLoadElementSource).call(this, element)
|
|
2575
2625
|
};
|
|
2576
2626
|
}, _Loader_emitLoad = function _Loader_emitLoad2(item) {
|
|
2577
2627
|
const assetId = getAssetIdFromElement(item.element);
|
|
2578
|
-
const storageItem = __classPrivateFieldGet$
|
|
2628
|
+
const storageItem = __classPrivateFieldGet$5(this, _Loader_storageLoadItemMap, "f")[assetId];
|
|
2579
2629
|
if (storageItem) {
|
|
2580
2630
|
if (storageItem.startTime < item.startTime) {
|
|
2581
|
-
__classPrivateFieldGet$
|
|
2631
|
+
__classPrivateFieldGet$5(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
2582
2632
|
this.trigger("load", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
2583
2633
|
}
|
|
2584
2634
|
} else {
|
|
2585
|
-
__classPrivateFieldGet$
|
|
2635
|
+
__classPrivateFieldGet$5(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
2586
2636
|
this.trigger("load", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
2587
2637
|
}
|
|
2588
2638
|
}, _Loader_emitError = function _Loader_emitError2(item) {
|
|
2589
2639
|
const assetId = getAssetIdFromElement(item.element);
|
|
2590
|
-
const storageItem = __classPrivateFieldGet$
|
|
2640
|
+
const storageItem = __classPrivateFieldGet$5(this, _Loader_storageLoadItemMap, "f")[assetId];
|
|
2591
2641
|
if (storageItem) {
|
|
2592
2642
|
if (storageItem.startTime < item.startTime) {
|
|
2593
|
-
__classPrivateFieldGet$
|
|
2643
|
+
__classPrivateFieldGet$5(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
2594
2644
|
this.trigger("error", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
2595
2645
|
}
|
|
2596
2646
|
} else {
|
|
2597
|
-
__classPrivateFieldGet$
|
|
2647
|
+
__classPrivateFieldGet$5(this, _Loader_storageLoadItemMap, "f")[assetId] = item;
|
|
2598
2648
|
this.trigger("error", Object.assign(Object.assign({}, item), { countTime: item.endTime - item.startTime }));
|
|
2599
2649
|
}
|
|
2600
2650
|
}, _Loader_loadResource = function _Loader_loadResource2(element, assets) {
|
|
2601
|
-
const item = __classPrivateFieldGet$
|
|
2651
|
+
const item = __classPrivateFieldGet$5(this, _Loader_instances, "m", _Loader_createLoadItem).call(this, element);
|
|
2602
2652
|
const assetId = getAssetIdFromElement(element);
|
|
2603
|
-
__classPrivateFieldGet$
|
|
2604
|
-
const loadFunc = __classPrivateFieldGet$
|
|
2653
|
+
__classPrivateFieldGet$5(this, _Loader_currentLoadItemMap, "f")[assetId] = item;
|
|
2654
|
+
const loadFunc = __classPrivateFieldGet$5(this, _Loader_loadFuncMap, "f")[element.type];
|
|
2605
2655
|
if (typeof loadFunc === "function") {
|
|
2606
2656
|
item.startTime = Date.now();
|
|
2607
2657
|
loadFunc(element, assets).then((result) => {
|
|
2608
2658
|
item.content = result.content;
|
|
2609
2659
|
item.endTime = Date.now();
|
|
2610
2660
|
item.status = "load";
|
|
2611
|
-
__classPrivateFieldGet$
|
|
2661
|
+
__classPrivateFieldGet$5(this, _Loader_instances, "m", _Loader_emitLoad).call(this, item);
|
|
2612
2662
|
}).catch((err) => {
|
|
2613
2663
|
console.warn(`Load element source "${item.source}" fail`, err, element);
|
|
2614
2664
|
item.endTime = Date.now();
|
|
2615
2665
|
item.status = "error";
|
|
2616
2666
|
item.error = err;
|
|
2617
|
-
__classPrivateFieldGet$
|
|
2667
|
+
__classPrivateFieldGet$5(this, _Loader_instances, "m", _Loader_emitError).call(this, item);
|
|
2618
2668
|
});
|
|
2619
2669
|
}
|
|
2620
2670
|
}, _Loader_isExistingErrorStorage = function _Loader_isExistingErrorStorage2(element) {
|
|
2621
2671
|
var _a;
|
|
2622
2672
|
const assetId = getAssetIdFromElement(element);
|
|
2623
|
-
const existItem = (_a = __classPrivateFieldGet$
|
|
2624
|
-
if (existItem && existItem.status === "error" && existItem.source && existItem.source === __classPrivateFieldGet$
|
|
2673
|
+
const existItem = (_a = __classPrivateFieldGet$5(this, _Loader_currentLoadItemMap, "f")) === null || _a === void 0 ? void 0 : _a[assetId];
|
|
2674
|
+
if (existItem && existItem.status === "error" && existItem.source && existItem.source === __classPrivateFieldGet$5(this, _Loader_instances, "m", _Loader_getLoadElementSource).call(this, element)) {
|
|
2625
2675
|
return true;
|
|
2626
2676
|
}
|
|
2627
2677
|
return false;
|
|
2628
2678
|
};
|
|
2629
|
-
var __classPrivateFieldSet$
|
|
2679
|
+
var __classPrivateFieldSet$4 = function(receiver, state, value, kind, f) {
|
|
2630
2680
|
if (kind === "m")
|
|
2631
2681
|
throw new TypeError("Private method is not writable");
|
|
2632
2682
|
if (kind === "a" && !f)
|
|
@@ -2635,7 +2685,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2635
2685
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2636
2686
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
2637
2687
|
};
|
|
2638
|
-
var __classPrivateFieldGet$
|
|
2688
|
+
var __classPrivateFieldGet$4 = function(receiver, state, kind, f) {
|
|
2639
2689
|
if (kind === "a" && !f)
|
|
2640
2690
|
throw new TypeError("Private accessor was defined without a getter");
|
|
2641
2691
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
@@ -2649,16 +2699,21 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2649
2699
|
_Renderer_instances.add(this);
|
|
2650
2700
|
_Renderer_opts.set(this, void 0);
|
|
2651
2701
|
_Renderer_loader.set(this, new Loader());
|
|
2652
|
-
__classPrivateFieldSet$
|
|
2653
|
-
__classPrivateFieldGet$
|
|
2702
|
+
__classPrivateFieldSet$4(this, _Renderer_opts, opts, "f");
|
|
2703
|
+
__classPrivateFieldGet$4(this, _Renderer_instances, "m", _Renderer_init).call(this);
|
|
2704
|
+
}
|
|
2705
|
+
destroy() {
|
|
2706
|
+
__classPrivateFieldSet$4(this, _Renderer_opts, null, "f");
|
|
2707
|
+
__classPrivateFieldGet$4(this, _Renderer_loader, "f").destroy();
|
|
2708
|
+
__classPrivateFieldSet$4(this, _Renderer_loader, null, "f");
|
|
2654
2709
|
}
|
|
2655
2710
|
updateOptions(opts) {
|
|
2656
|
-
__classPrivateFieldSet$
|
|
2711
|
+
__classPrivateFieldSet$4(this, _Renderer_opts, opts, "f");
|
|
2657
2712
|
}
|
|
2658
2713
|
drawData(data, opts) {
|
|
2659
|
-
const loader = __classPrivateFieldGet$
|
|
2660
|
-
const { calculator } = __classPrivateFieldGet$
|
|
2661
|
-
const viewContext = __classPrivateFieldGet$
|
|
2714
|
+
const loader = __classPrivateFieldGet$4(this, _Renderer_loader, "f");
|
|
2715
|
+
const { calculator } = __classPrivateFieldGet$4(this, _Renderer_opts, "f");
|
|
2716
|
+
const viewContext = __classPrivateFieldGet$4(this, _Renderer_opts, "f").viewContext;
|
|
2662
2717
|
viewContext.clearRect(0, 0, viewContext.canvas.width, viewContext.canvas.height);
|
|
2663
2718
|
const parentElementSize = {
|
|
2664
2719
|
x: 0,
|
|
@@ -2675,7 +2730,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2675
2730
|
}, opts));
|
|
2676
2731
|
}
|
|
2677
2732
|
scale(num) {
|
|
2678
|
-
const { sharer } = __classPrivateFieldGet$
|
|
2733
|
+
const { sharer } = __classPrivateFieldGet$4(this, _Renderer_opts, "f");
|
|
2679
2734
|
if (!sharer) {
|
|
2680
2735
|
return;
|
|
2681
2736
|
}
|
|
@@ -2700,23 +2755,44 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2700
2755
|
}
|
|
2701
2756
|
}
|
|
2702
2757
|
setLoadItemMap(itemMap) {
|
|
2703
|
-
__classPrivateFieldGet$
|
|
2758
|
+
__classPrivateFieldGet$4(this, _Renderer_loader, "f").setLoadItemMap(itemMap);
|
|
2704
2759
|
}
|
|
2705
2760
|
getLoadItemMap() {
|
|
2706
|
-
return __classPrivateFieldGet$
|
|
2761
|
+
return __classPrivateFieldGet$4(this, _Renderer_loader, "f").getLoadItemMap();
|
|
2707
2762
|
}
|
|
2708
2763
|
}
|
|
2709
2764
|
_Renderer_opts = /* @__PURE__ */ new WeakMap(), _Renderer_loader = /* @__PURE__ */ new WeakMap(), _Renderer_instances = /* @__PURE__ */ new WeakSet(), _Renderer_init = function _Renderer_init2() {
|
|
2710
|
-
const loader = __classPrivateFieldGet$
|
|
2765
|
+
const loader = __classPrivateFieldGet$4(this, _Renderer_loader, "f");
|
|
2711
2766
|
loader.on("load", (e) => {
|
|
2712
2767
|
this.trigger("load", e);
|
|
2713
2768
|
});
|
|
2714
2769
|
loader.on("error", () => {
|
|
2715
2770
|
});
|
|
2716
2771
|
};
|
|
2772
|
+
var __classPrivateFieldSet$3 = function(receiver, state, value, kind, f) {
|
|
2773
|
+
if (kind === "m")
|
|
2774
|
+
throw new TypeError("Private method is not writable");
|
|
2775
|
+
if (kind === "a" && !f)
|
|
2776
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
2777
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
2778
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2779
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
2780
|
+
};
|
|
2781
|
+
var __classPrivateFieldGet$3 = function(receiver, state, kind, f) {
|
|
2782
|
+
if (kind === "a" && !f)
|
|
2783
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
2784
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
2785
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
2786
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2787
|
+
};
|
|
2788
|
+
var _Calculator_opts;
|
|
2717
2789
|
class Calculator {
|
|
2718
2790
|
constructor(opts) {
|
|
2719
|
-
this
|
|
2791
|
+
_Calculator_opts.set(this, void 0);
|
|
2792
|
+
__classPrivateFieldSet$3(this, _Calculator_opts, opts, "f");
|
|
2793
|
+
}
|
|
2794
|
+
destroy() {
|
|
2795
|
+
__classPrivateFieldSet$3(this, _Calculator_opts, null, "f");
|
|
2720
2796
|
}
|
|
2721
2797
|
elementSize(size, viewScaleInfo, viewSizeInfo) {
|
|
2722
2798
|
return calcViewElementSize(size, { viewScaleInfo, viewSizeInfo });
|
|
@@ -2725,7 +2801,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2725
2801
|
return isElementInView(elem, { viewScaleInfo, viewSizeInfo });
|
|
2726
2802
|
}
|
|
2727
2803
|
isPointInElement(p, elem, viewScaleInfo, viewSizeInfo) {
|
|
2728
|
-
const context2d = this.
|
|
2804
|
+
const context2d = __classPrivateFieldGet$3(this, _Calculator_opts, "f").viewContext;
|
|
2729
2805
|
return isViewPointInElement(p, {
|
|
2730
2806
|
context2d,
|
|
2731
2807
|
element: elem,
|
|
@@ -2734,152 +2810,207 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2734
2810
|
});
|
|
2735
2811
|
}
|
|
2736
2812
|
getPointElement(p, opts) {
|
|
2737
|
-
const context2d = this.
|
|
2813
|
+
const context2d = __classPrivateFieldGet$3(this, _Calculator_opts, "f").viewContext;
|
|
2738
2814
|
return getViewPointAtElement(p, Object.assign(Object.assign({}, opts), { context2d }));
|
|
2739
2815
|
}
|
|
2740
2816
|
}
|
|
2817
|
+
_Calculator_opts = /* @__PURE__ */ new WeakMap();
|
|
2818
|
+
var __classPrivateFieldSet$2 = function(receiver, state, value, kind, f) {
|
|
2819
|
+
if (kind === "m")
|
|
2820
|
+
throw new TypeError("Private method is not writable");
|
|
2821
|
+
if (kind === "a" && !f)
|
|
2822
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
2823
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
2824
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2825
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
2826
|
+
};
|
|
2827
|
+
var __classPrivateFieldGet$2 = function(receiver, state, kind, f) {
|
|
2828
|
+
if (kind === "a" && !f)
|
|
2829
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
2830
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
2831
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
2832
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2833
|
+
};
|
|
2834
|
+
var _BoardWatcher_instances, _BoardWatcher_opts, _BoardWatcher_store, _BoardWatcher_init, _BoardWatcher_onWheel, _BoardWatcher_onContextMenu, _BoardWatcher_onClick, _BoardWatcher_onPointLeave, _BoardWatcher_onPointEnd, _BoardWatcher_onPointMove, _BoardWatcher_onPointStart, _BoardWatcher_onHover, _BoardWatcher_isInTarget, _BoardWatcher_getPoint, _BoardWatcher_isVaildPoint;
|
|
2741
2835
|
function isBoardAvailableNum(num) {
|
|
2742
2836
|
return num > 0 || num < 0 || num === 0;
|
|
2743
2837
|
}
|
|
2744
2838
|
class BoardWatcher extends EventEmitter {
|
|
2745
2839
|
constructor(opts) {
|
|
2746
2840
|
super();
|
|
2747
|
-
|
|
2748
|
-
this
|
|
2749
|
-
this
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
_init() {
|
|
2753
|
-
const container = window;
|
|
2754
|
-
container.addEventListener("mousemove", (e) => {
|
|
2755
|
-
if (!this._isInTarget(e)) {
|
|
2841
|
+
_BoardWatcher_instances.add(this);
|
|
2842
|
+
_BoardWatcher_opts.set(this, void 0);
|
|
2843
|
+
_BoardWatcher_store.set(this, void 0);
|
|
2844
|
+
_BoardWatcher_onWheel.set(this, (e) => {
|
|
2845
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2756
2846
|
return;
|
|
2757
2847
|
}
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
if (!this._isVaildPoint(point)) {
|
|
2848
|
+
const point = __classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2849
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2761
2850
|
return;
|
|
2762
2851
|
}
|
|
2763
|
-
|
|
2852
|
+
e.preventDefault();
|
|
2853
|
+
e.stopPropagation();
|
|
2854
|
+
const deltaX = e.deltaX > 0 || e.deltaX < 0 ? e.deltaX : 0;
|
|
2855
|
+
const deltaY = e.deltaY > 0 || e.deltaY < 0 ? e.deltaY : 0;
|
|
2856
|
+
if (e.ctrlKey === true && this.has("wheelScale")) {
|
|
2857
|
+
this.trigger("wheelScale", { deltaX, deltaY, point });
|
|
2858
|
+
} else if (this.has("wheel")) {
|
|
2859
|
+
this.trigger("wheel", { deltaX, deltaY, point });
|
|
2860
|
+
}
|
|
2764
2861
|
});
|
|
2765
|
-
|
|
2766
|
-
if (!this.
|
|
2862
|
+
_BoardWatcher_onContextMenu.set(this, (e) => {
|
|
2863
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2767
2864
|
return;
|
|
2768
2865
|
}
|
|
2769
2866
|
e.preventDefault();
|
|
2770
|
-
const point = this.
|
|
2771
|
-
if (!this.
|
|
2867
|
+
const point = __classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2868
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2772
2869
|
return;
|
|
2773
2870
|
}
|
|
2774
|
-
this._store.set("hasPointDown", true);
|
|
2775
|
-
this.trigger("pointStart", { point });
|
|
2776
2871
|
});
|
|
2777
|
-
|
|
2778
|
-
if (!this.
|
|
2872
|
+
_BoardWatcher_onClick.set(this, (e) => {
|
|
2873
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2779
2874
|
return;
|
|
2780
2875
|
}
|
|
2781
2876
|
e.preventDefault();
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
if (!this._isVaildPoint(point)) {
|
|
2785
|
-
if (this._store.get("hasPointDown")) {
|
|
2786
|
-
this.trigger("pointLeave", { point });
|
|
2787
|
-
this._store.set("hasPointDown", false);
|
|
2788
|
-
}
|
|
2877
|
+
const point = __classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2878
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2789
2879
|
return;
|
|
2790
2880
|
}
|
|
2791
|
-
|
|
2792
|
-
|
|
2881
|
+
const maxLimitTime = 500;
|
|
2882
|
+
const t = Date.now();
|
|
2883
|
+
const preClickPoint = __classPrivateFieldGet$2(this, _BoardWatcher_store, "f").get("prevClickPoint");
|
|
2884
|
+
if (preClickPoint && t - preClickPoint.t <= maxLimitTime && Math.abs(preClickPoint.x - point.x) <= 5 && Math.abs(preClickPoint.y - point.y) <= 5) {
|
|
2885
|
+
this.trigger("doubleClick", { point });
|
|
2886
|
+
} else {
|
|
2887
|
+
__classPrivateFieldGet$2(this, _BoardWatcher_store, "f").set("prevClickPoint", point);
|
|
2793
2888
|
}
|
|
2794
|
-
this.trigger("pointMove", { point });
|
|
2795
2889
|
});
|
|
2796
|
-
|
|
2797
|
-
this.
|
|
2798
|
-
if (!this.
|
|
2890
|
+
_BoardWatcher_onPointLeave.set(this, (e) => {
|
|
2891
|
+
__classPrivateFieldGet$2(this, _BoardWatcher_store, "f").set("hasPointDown", false);
|
|
2892
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2799
2893
|
return;
|
|
2800
2894
|
}
|
|
2801
2895
|
e.preventDefault();
|
|
2802
|
-
const point = this.
|
|
2803
|
-
this.trigger("
|
|
2896
|
+
const point = __classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2897
|
+
this.trigger("pointLeave", { point });
|
|
2804
2898
|
});
|
|
2805
|
-
|
|
2806
|
-
this.
|
|
2807
|
-
if (!this.
|
|
2899
|
+
_BoardWatcher_onPointEnd.set(this, (e) => {
|
|
2900
|
+
__classPrivateFieldGet$2(this, _BoardWatcher_store, "f").set("hasPointDown", false);
|
|
2901
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2808
2902
|
return;
|
|
2809
2903
|
}
|
|
2810
2904
|
e.preventDefault();
|
|
2811
|
-
const point = this.
|
|
2812
|
-
this.trigger("
|
|
2905
|
+
const point = __classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2906
|
+
this.trigger("pointEnd", { point });
|
|
2813
2907
|
});
|
|
2814
|
-
|
|
2815
|
-
if (!this.
|
|
2816
|
-
return;
|
|
2817
|
-
}
|
|
2818
|
-
const point = this._getPoint(e);
|
|
2819
|
-
if (!this._isVaildPoint(point)) {
|
|
2908
|
+
_BoardWatcher_onPointMove.set(this, (e) => {
|
|
2909
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2820
2910
|
return;
|
|
2821
2911
|
}
|
|
2822
2912
|
e.preventDefault();
|
|
2823
2913
|
e.stopPropagation();
|
|
2824
|
-
const
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2914
|
+
const point = __classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2915
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2916
|
+
if (__classPrivateFieldGet$2(this, _BoardWatcher_store, "f").get("hasPointDown")) {
|
|
2917
|
+
this.trigger("pointLeave", { point });
|
|
2918
|
+
__classPrivateFieldGet$2(this, _BoardWatcher_store, "f").set("hasPointDown", false);
|
|
2919
|
+
}
|
|
2920
|
+
return;
|
|
2830
2921
|
}
|
|
2831
|
-
|
|
2832
|
-
container.addEventListener("click", (e) => {
|
|
2833
|
-
if (!this._isInTarget(e)) {
|
|
2922
|
+
if (__classPrivateFieldGet$2(this, _BoardWatcher_store, "f").get("hasPointDown") !== true) {
|
|
2834
2923
|
return;
|
|
2835
2924
|
}
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2925
|
+
this.trigger("pointMove", { point });
|
|
2926
|
+
});
|
|
2927
|
+
_BoardWatcher_onPointStart.set(this, (e) => {
|
|
2928
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2839
2929
|
return;
|
|
2840
2930
|
}
|
|
2841
|
-
|
|
2842
|
-
const
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
this.trigger("doubleClick", { point });
|
|
2846
|
-
} else {
|
|
2847
|
-
this._store.set("prevClickPoint", point);
|
|
2931
|
+
e.preventDefault();
|
|
2932
|
+
const point = __classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2933
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2934
|
+
return;
|
|
2848
2935
|
}
|
|
2936
|
+
__classPrivateFieldGet$2(this, _BoardWatcher_store, "f").set("hasPointDown", true);
|
|
2937
|
+
this.trigger("pointStart", { point });
|
|
2849
2938
|
});
|
|
2850
|
-
|
|
2851
|
-
if (!this.
|
|
2939
|
+
_BoardWatcher_onHover.set(this, (e) => {
|
|
2940
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isInTarget).call(this, e)) {
|
|
2852
2941
|
return;
|
|
2853
2942
|
}
|
|
2854
2943
|
e.preventDefault();
|
|
2855
|
-
const point = this.
|
|
2856
|
-
if (!this.
|
|
2944
|
+
const point = __classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_getPoint).call(this, e);
|
|
2945
|
+
if (!__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_isVaildPoint).call(this, point)) {
|
|
2857
2946
|
return;
|
|
2858
2947
|
}
|
|
2948
|
+
this.trigger("hover", { point });
|
|
2859
2949
|
});
|
|
2950
|
+
const store = new Store({ defaultStorage: { hasPointDown: false, prevClickPoint: null } });
|
|
2951
|
+
__classPrivateFieldSet$2(this, _BoardWatcher_store, store, "f");
|
|
2952
|
+
__classPrivateFieldSet$2(this, _BoardWatcher_opts, opts, "f");
|
|
2953
|
+
__classPrivateFieldGet$2(this, _BoardWatcher_instances, "m", _BoardWatcher_init).call(this);
|
|
2860
2954
|
}
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2955
|
+
destroy() {
|
|
2956
|
+
const container = window;
|
|
2957
|
+
container.removeEventListener("mousemove", __classPrivateFieldGet$2(this, _BoardWatcher_onHover, "f"));
|
|
2958
|
+
container.removeEventListener("mousedown", __classPrivateFieldGet$2(this, _BoardWatcher_onPointStart, "f"));
|
|
2959
|
+
container.removeEventListener("mousemove", __classPrivateFieldGet$2(this, _BoardWatcher_onPointMove, "f"));
|
|
2960
|
+
container.removeEventListener("mouseup", __classPrivateFieldGet$2(this, _BoardWatcher_onPointEnd, "f"));
|
|
2961
|
+
container.removeEventListener("mouseleave", __classPrivateFieldGet$2(this, _BoardWatcher_onPointLeave, "f"));
|
|
2962
|
+
container.removeEventListener("wheel", __classPrivateFieldGet$2(this, _BoardWatcher_onWheel, "f"));
|
|
2963
|
+
container.removeEventListener("click", __classPrivateFieldGet$2(this, _BoardWatcher_onClick, "f"));
|
|
2964
|
+
container.removeEventListener("contextmenu", __classPrivateFieldGet$2(this, _BoardWatcher_onContextMenu, "f"));
|
|
2965
|
+
this.destroy();
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
_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
|
+
const container = window;
|
|
2970
|
+
container.addEventListener("mousemove", __classPrivateFieldGet$2(this, _BoardWatcher_onHover, "f"));
|
|
2971
|
+
container.addEventListener("mousedown", __classPrivateFieldGet$2(this, _BoardWatcher_onPointStart, "f"));
|
|
2972
|
+
container.addEventListener("mousemove", __classPrivateFieldGet$2(this, _BoardWatcher_onPointMove, "f"));
|
|
2973
|
+
container.addEventListener("mouseup", __classPrivateFieldGet$2(this, _BoardWatcher_onPointEnd, "f"));
|
|
2974
|
+
container.addEventListener("mouseleave", __classPrivateFieldGet$2(this, _BoardWatcher_onPointLeave, "f"));
|
|
2975
|
+
container.addEventListener("wheel", __classPrivateFieldGet$2(this, _BoardWatcher_onWheel, "f"), { passive: false });
|
|
2976
|
+
container.addEventListener("click", __classPrivateFieldGet$2(this, _BoardWatcher_onClick, "f"));
|
|
2977
|
+
container.addEventListener("contextmenu", __classPrivateFieldGet$2(this, _BoardWatcher_onContextMenu, "f"));
|
|
2978
|
+
}, _BoardWatcher_isInTarget = function _BoardWatcher_isInTarget2(e) {
|
|
2979
|
+
return e.target === __classPrivateFieldGet$2(this, _BoardWatcher_opts, "f").boardContent.boardContext.canvas;
|
|
2980
|
+
}, _BoardWatcher_getPoint = function _BoardWatcher_getPoint2(e) {
|
|
2981
|
+
const boardCanvas = __classPrivateFieldGet$2(this, _BoardWatcher_opts, "f").boardContent.boardContext.canvas;
|
|
2982
|
+
const rect = boardCanvas.getBoundingClientRect();
|
|
2983
|
+
const p = {
|
|
2984
|
+
x: e.clientX - rect.left,
|
|
2985
|
+
y: e.clientY - rect.top,
|
|
2986
|
+
t: Date.now()
|
|
2987
|
+
};
|
|
2988
|
+
return p;
|
|
2989
|
+
}, _BoardWatcher_isVaildPoint = function _BoardWatcher_isVaildPoint2(p) {
|
|
2990
|
+
const viewSize = __classPrivateFieldGet$2(this, _BoardWatcher_opts, "f").sharer.getActiveViewSizeInfo();
|
|
2991
|
+
const { width, height } = viewSize;
|
|
2992
|
+
if (isBoardAvailableNum(p.x) && isBoardAvailableNum(p.y) && p.x <= width && p.y <= height) {
|
|
2993
|
+
return true;
|
|
2881
2994
|
}
|
|
2882
|
-
|
|
2995
|
+
return false;
|
|
2996
|
+
};
|
|
2997
|
+
var __classPrivateFieldSet$1 = function(receiver, state, value, kind, f) {
|
|
2998
|
+
if (kind === "m")
|
|
2999
|
+
throw new TypeError("Private method is not writable");
|
|
3000
|
+
if (kind === "a" && !f)
|
|
3001
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
3002
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3003
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3004
|
+
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
3005
|
+
};
|
|
3006
|
+
var __classPrivateFieldGet$1 = function(receiver, state, kind, f) {
|
|
3007
|
+
if (kind === "a" && !f)
|
|
3008
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
3009
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
3010
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3011
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
3012
|
+
};
|
|
3013
|
+
var _Sharer_activeStore, _Sharer_sharedStore;
|
|
2883
3014
|
const defaultActiveStorage = {
|
|
2884
3015
|
width: 0,
|
|
2885
3016
|
height: 0,
|
|
@@ -2895,69 +3026,72 @@ var __privateMethod = (obj, member, method) => {
|
|
|
2895
3026
|
};
|
|
2896
3027
|
class Sharer {
|
|
2897
3028
|
constructor() {
|
|
3029
|
+
_Sharer_activeStore.set(this, void 0);
|
|
3030
|
+
_Sharer_sharedStore.set(this, void 0);
|
|
2898
3031
|
const activeStore = new Store({
|
|
2899
3032
|
defaultStorage: defaultActiveStorage
|
|
2900
3033
|
});
|
|
2901
3034
|
const sharedStore = new Store({
|
|
2902
3035
|
defaultStorage: {}
|
|
2903
3036
|
});
|
|
2904
|
-
this
|
|
2905
|
-
this
|
|
3037
|
+
__classPrivateFieldSet$1(this, _Sharer_activeStore, activeStore, "f");
|
|
3038
|
+
__classPrivateFieldSet$1(this, _Sharer_sharedStore, sharedStore, "f");
|
|
2906
3039
|
}
|
|
2907
3040
|
getActiveStorage(key2) {
|
|
2908
|
-
return this.
|
|
3041
|
+
return __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get(key2);
|
|
2909
3042
|
}
|
|
2910
3043
|
setActiveStorage(key2, storage) {
|
|
2911
|
-
return this.
|
|
3044
|
+
return __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set(key2, storage);
|
|
2912
3045
|
}
|
|
2913
3046
|
getActiveStoreSnapshot() {
|
|
2914
|
-
return this.
|
|
3047
|
+
return __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").getSnapshot();
|
|
2915
3048
|
}
|
|
2916
3049
|
getSharedStorage(key2) {
|
|
2917
|
-
return this.
|
|
3050
|
+
return __classPrivateFieldGet$1(this, _Sharer_sharedStore, "f").get(key2);
|
|
2918
3051
|
}
|
|
2919
3052
|
setSharedStorage(key2, storage) {
|
|
2920
|
-
return this.
|
|
3053
|
+
return __classPrivateFieldGet$1(this, _Sharer_sharedStore, "f").set(key2, storage);
|
|
2921
3054
|
}
|
|
2922
3055
|
getSharedStoreSnapshot() {
|
|
2923
|
-
return this.
|
|
3056
|
+
return __classPrivateFieldGet$1(this, _Sharer_sharedStore, "f").getSnapshot();
|
|
2924
3057
|
}
|
|
2925
3058
|
getActiveViewScaleInfo() {
|
|
2926
3059
|
const viewScaleInfo = {
|
|
2927
|
-
scale: this.
|
|
2928
|
-
offsetTop: this.
|
|
2929
|
-
offsetBottom: this.
|
|
2930
|
-
offsetLeft: this.
|
|
2931
|
-
offsetRight: this.
|
|
3060
|
+
scale: __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get("scale"),
|
|
3061
|
+
offsetTop: __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get("offsetTop"),
|
|
3062
|
+
offsetBottom: __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get("offsetBottom"),
|
|
3063
|
+
offsetLeft: __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get("offsetLeft"),
|
|
3064
|
+
offsetRight: __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get("offsetRight")
|
|
2932
3065
|
};
|
|
2933
3066
|
return viewScaleInfo;
|
|
2934
3067
|
}
|
|
2935
3068
|
setActiveViewScaleInfo(viewScaleInfo) {
|
|
2936
3069
|
const { scale, offsetTop, offsetBottom, offsetLeft, offsetRight } = viewScaleInfo;
|
|
2937
|
-
this.
|
|
2938
|
-
this.
|
|
2939
|
-
this.
|
|
2940
|
-
this.
|
|
2941
|
-
this.
|
|
3070
|
+
__classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set("scale", scale);
|
|
3071
|
+
__classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set("offsetTop", offsetTop);
|
|
3072
|
+
__classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set("offsetBottom", offsetBottom);
|
|
3073
|
+
__classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set("offsetLeft", offsetLeft);
|
|
3074
|
+
__classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set("offsetRight", offsetRight);
|
|
2942
3075
|
}
|
|
2943
3076
|
setActiveViewSizeInfo(size) {
|
|
2944
|
-
this.
|
|
2945
|
-
this.
|
|
2946
|
-
this.
|
|
2947
|
-
this.
|
|
2948
|
-
this.
|
|
3077
|
+
__classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set("width", size.width);
|
|
3078
|
+
__classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set("height", size.height);
|
|
3079
|
+
__classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set("devicePixelRatio", size.devicePixelRatio);
|
|
3080
|
+
__classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set("contextWidth", size.contextWidth);
|
|
3081
|
+
__classPrivateFieldGet$1(this, _Sharer_activeStore, "f").set("contextHeight", size.contextHeight);
|
|
2949
3082
|
}
|
|
2950
3083
|
getActiveViewSizeInfo() {
|
|
2951
3084
|
const sizeInfo = {
|
|
2952
|
-
width: this.
|
|
2953
|
-
height: this.
|
|
2954
|
-
devicePixelRatio: this.
|
|
2955
|
-
contextWidth: this.
|
|
2956
|
-
contextHeight: this.
|
|
3085
|
+
width: __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get("width"),
|
|
3086
|
+
height: __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get("height"),
|
|
3087
|
+
devicePixelRatio: __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get("devicePixelRatio"),
|
|
3088
|
+
contextWidth: __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get("contextWidth"),
|
|
3089
|
+
contextHeight: __classPrivateFieldGet$1(this, _Sharer_activeStore, "f").get("contextHeight")
|
|
2957
3090
|
};
|
|
2958
3091
|
return sizeInfo;
|
|
2959
3092
|
}
|
|
2960
3093
|
}
|
|
3094
|
+
_Sharer_activeStore = /* @__PURE__ */ new WeakMap(), _Sharer_sharedStore = /* @__PURE__ */ new WeakMap();
|
|
2961
3095
|
const { requestAnimationFrame } = window;
|
|
2962
3096
|
class Viewer extends EventEmitter {
|
|
2963
3097
|
constructor(opts) {
|
|
@@ -3142,6 +3276,12 @@ var __privateMethod = (obj, member, method) => {
|
|
|
3142
3276
|
__classPrivateFieldGet(this, _Board_instances, "m", _Board_init).call(this);
|
|
3143
3277
|
__classPrivateFieldGet(this, _Board_instances, "m", _Board_resetActiveMiddlewareObjs).call(this);
|
|
3144
3278
|
}
|
|
3279
|
+
destroy() {
|
|
3280
|
+
__classPrivateFieldGet(this, _Board_watcher, "f").destroy();
|
|
3281
|
+
__classPrivateFieldGet(this, _Board_renderer, "f").destroy();
|
|
3282
|
+
__classPrivateFieldGet(this, _Board_calculator, "f").destroy();
|
|
3283
|
+
__classPrivateFieldGet(this, _Board_eventHub, "f").destroy();
|
|
3284
|
+
}
|
|
3145
3285
|
getSharer() {
|
|
3146
3286
|
return __classPrivateFieldGet(this, _Board_sharer, "f");
|
|
3147
3287
|
}
|
|
@@ -4484,6 +4624,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4484
4624
|
showTextArea(e);
|
|
4485
4625
|
};
|
|
4486
4626
|
return {
|
|
4627
|
+
name: "@middleware/text-editor",
|
|
4487
4628
|
use() {
|
|
4488
4629
|
eventHub.on(middlewareEventTextEdit, textEditCallback);
|
|
4489
4630
|
},
|
|
@@ -4493,6 +4634,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4493
4634
|
};
|
|
4494
4635
|
};
|
|
4495
4636
|
const middlewareEventSelect = "@middleware/select";
|
|
4637
|
+
const middlewareEventSelectClear = "@middleware/select-clear";
|
|
4496
4638
|
const MiddlewareSelector = (opts) => {
|
|
4497
4639
|
const { viewer, sharer, boardContent, calculator, eventHub } = opts;
|
|
4498
4640
|
const { helperContext } = boardContent;
|
|
@@ -4598,12 +4740,19 @@ var __privateMethod = (obj, member, method) => {
|
|
|
4598
4740
|
viewer.drawFrame();
|
|
4599
4741
|
}
|
|
4600
4742
|
};
|
|
4743
|
+
const selectClearCallback = () => {
|
|
4744
|
+
clear();
|
|
4745
|
+
viewer.drawFrame();
|
|
4746
|
+
};
|
|
4601
4747
|
return {
|
|
4748
|
+
name: "@middleware/selector",
|
|
4602
4749
|
use() {
|
|
4603
4750
|
eventHub.on(middlewareEventSelect, selectCallback);
|
|
4751
|
+
eventHub.on(middlewareEventSelectClear, selectClearCallback);
|
|
4604
4752
|
},
|
|
4605
4753
|
disuse() {
|
|
4606
4754
|
eventHub.off(middlewareEventSelect, selectCallback);
|
|
4755
|
+
eventHub.off(middlewareEventSelectClear, selectClearCallback);
|
|
4607
4756
|
},
|
|
4608
4757
|
hover: (e) => {
|
|
4609
4758
|
var _a, _b;
|
|
@@ -5192,6 +5341,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5192
5341
|
});
|
|
5193
5342
|
};
|
|
5194
5343
|
return {
|
|
5344
|
+
name: "@middleware/scroller",
|
|
5195
5345
|
wheel: (e) => {
|
|
5196
5346
|
viewer.scroll({
|
|
5197
5347
|
moveX: 0 - e.deltaX,
|
|
@@ -5244,6 +5394,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5244
5394
|
const maxScale = 50;
|
|
5245
5395
|
const minScale = 0.05;
|
|
5246
5396
|
return {
|
|
5397
|
+
name: "@middleware/scaler",
|
|
5247
5398
|
wheelScale(e) {
|
|
5248
5399
|
const { deltaY, point } = e;
|
|
5249
5400
|
const { scale } = sharer.getActiveViewScaleInfo();
|
|
@@ -5466,6 +5617,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5466
5617
|
}
|
|
5467
5618
|
};
|
|
5468
5619
|
return {
|
|
5620
|
+
name: "@middleware/ruler",
|
|
5469
5621
|
use() {
|
|
5470
5622
|
eventHub.on(middlewareEventRuler, rulerCallback);
|
|
5471
5623
|
},
|
|
@@ -5499,6 +5651,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5499
5651
|
const { eventHub, sharer, viewer } = opts;
|
|
5500
5652
|
let isDragging = false;
|
|
5501
5653
|
return {
|
|
5654
|
+
name: "@middleware/dragger",
|
|
5502
5655
|
hover() {
|
|
5503
5656
|
if (isDragging === true) {
|
|
5504
5657
|
return;
|
|
@@ -5564,6 +5717,9 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5564
5717
|
eventHub
|
|
5565
5718
|
});
|
|
5566
5719
|
}
|
|
5720
|
+
destroy() {
|
|
5721
|
+
__privateGet(this, _board).destroy();
|
|
5722
|
+
}
|
|
5567
5723
|
use(middleware) {
|
|
5568
5724
|
__privateGet(this, _board).use(middleware);
|
|
5569
5725
|
}
|
|
@@ -5643,6 +5799,7 @@ var __privateMethod = (obj, member, method) => {
|
|
|
5643
5799
|
exports.middlewareEventRuler = middlewareEventRuler;
|
|
5644
5800
|
exports.middlewareEventScale = middlewareEventScale;
|
|
5645
5801
|
exports.middlewareEventSelect = middlewareEventSelect;
|
|
5802
|
+
exports.middlewareEventSelectClear = middlewareEventSelectClear;
|
|
5646
5803
|
exports.middlewareEventTextEdit = middlewareEventTextEdit;
|
|
5647
5804
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
5648
5805
|
return exports;
|