@visactor/vrender-core 0.19.19 → 0.19.20
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/cjs/common/segment/catmull-rom-close.d.ts +41 -0
- package/cjs/common/segment/catmull-rom-close.js +81 -0
- package/cjs/common/segment/catmull-rom-close.js.map +1 -0
- package/cjs/common/segment/catmull-rom.d.ts +38 -0
- package/cjs/common/segment/catmull-rom.js +97 -0
- package/cjs/common/segment/catmull-rom.js.map +1 -0
- package/cjs/common/segment/index.d.ts +2 -1
- package/cjs/common/segment/index.js +8 -1
- package/cjs/common/segment/index.js.map +1 -1
- package/cjs/graphic/arc.d.ts +1 -1
- package/cjs/graphic/arc.js +8 -2
- package/cjs/graphic/arc.js.map +1 -1
- package/cjs/graphic/area.js +1 -1
- package/cjs/graphic/area.js.map +1 -1
- package/cjs/graphic/config.js +4 -2
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/line.js +1 -1
- package/cjs/graphic/line.js.map +1 -1
- package/cjs/interface/graphic/arc.d.ts +2 -2
- package/cjs/interface/graphic/arc.js.map +1 -1
- package/cjs/interface/graphic/arc3d.d.ts +1 -1
- package/cjs/interface/graphic/arc3d.js.map +1 -1
- package/cjs/interface/graphic/area.d.ts +1 -0
- package/cjs/interface/graphic/area.js.map +1 -1
- package/cjs/interface/graphic/line.d.ts +1 -0
- package/cjs/interface/graphic/line.js.map +1 -1
- package/cjs/render/contributions/render/arc-render.js +1 -1
- package/cjs/render/contributions/render/arc-render.js.map +1 -1
- package/cjs/render/contributions/render/area-render.js +19 -6
- package/cjs/render/contributions/render/area-render.js.map +1 -1
- package/cjs/render/contributions/render/line-render.js +6 -3
- package/cjs/render/contributions/render/line-render.js.map +1 -1
- package/cjs/render/contributions/render/utils.js +1 -1
- package/cjs/render/contributions/render/utils.js.map +1 -1
- package/dist/index.es.js +251 -32
- package/es/common/segment/catmull-rom-close.d.ts +41 -0
- package/es/common/segment/catmull-rom-close.js +74 -0
- package/es/common/segment/catmull-rom-close.js.map +1 -0
- package/es/common/segment/catmull-rom.d.ts +38 -0
- package/es/common/segment/catmull-rom.js +92 -0
- package/es/common/segment/catmull-rom.js.map +1 -0
- package/es/common/segment/index.d.ts +2 -1
- package/es/common/segment/index.js +11 -0
- package/es/common/segment/index.js.map +1 -1
- package/es/graphic/arc.d.ts +1 -1
- package/es/graphic/arc.js +8 -3
- package/es/graphic/arc.js.map +1 -1
- package/es/graphic/area.js +1 -1
- package/es/graphic/area.js.map +1 -1
- package/es/graphic/config.js +4 -2
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/line.js +1 -1
- package/es/graphic/line.js.map +1 -1
- package/es/interface/graphic/arc.d.ts +2 -2
- package/es/interface/graphic/arc.js.map +1 -1
- package/es/interface/graphic/arc3d.d.ts +1 -1
- package/es/interface/graphic/arc3d.js.map +1 -1
- package/es/interface/graphic/area.d.ts +1 -0
- package/es/interface/graphic/area.js.map +1 -1
- package/es/interface/graphic/line.d.ts +1 -0
- package/es/interface/graphic/line.js.map +1 -1
- package/es/render/contributions/render/arc-render.js +2 -2
- package/es/render/contributions/render/arc-render.js.map +1 -1
- package/es/render/contributions/render/area-render.js +22 -5
- package/es/render/contributions/render/area-render.js.map +1 -1
- package/es/render/contributions/render/line-render.js +6 -3
- package/es/render/contributions/render/line-render.js.map +1 -1
- package/es/render/contributions/render/utils.js +1 -1
- package/es/render/contributions/render/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, Matrix, pi2, Logger, pi, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, has, isUndefined, isArray, cos, sin, pointAt, isNumber, getDecimalPlaces, isValidNumber, clamp, getAngleByPoint, isNumberClose, isNil, Bounds, getIntersectPoint, Color, DEFAULT_COLORS, normalTransform, isValidUrl, isBase64,
|
|
1
|
+
import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, has, isUndefined, isArray, cos, sin, pointAt, isNumber, getDecimalPlaces, isValidNumber, clamp, getAngleByPoint, isNumberClose, isNil, Bounds, getIntersectPoint, Color, DEFAULT_COLORS, normalTransform, isValidUrl, isBase64, acos, sqrt, LRU, lowerCamelCaseToMiddle, clampAngleByRadian, asin, transformBoundsWithMatrix, arrayEqual, getRectIntersect, isRectIntersect, calculateAnchorOfBounds, styleStringToObject, merge } from '@visactor/vutils';
|
|
2
2
|
|
|
3
3
|
class Generator {
|
|
4
4
|
static GenAutoIncrementId() {
|
|
@@ -2212,7 +2212,7 @@ function genLinearTypeSegments(path, points) {
|
|
|
2212
2212
|
return genCurveSegments(path, points, 1);
|
|
2213
2213
|
}
|
|
2214
2214
|
|
|
2215
|
-
function point$
|
|
2215
|
+
function point$3(curveClass, x, y, defined, p) {
|
|
2216
2216
|
curveClass.context.bezierCurveTo((2 * curveClass._x0 + curveClass._x1) / 3, (2 * curveClass._y0 + curveClass._y1) / 3, (curveClass._x0 + 2 * curveClass._x1) / 3, (curveClass._y0 + 2 * curveClass._y1) / 3, (curveClass._x0 + 4 * curveClass._x1 + x) / 6, (curveClass._y0 + 4 * curveClass._y1 + y) / 6, defined, curveClass.lastPoint1);
|
|
2217
2217
|
}
|
|
2218
2218
|
class Basis {
|
|
@@ -2234,7 +2234,7 @@ class Basis {
|
|
|
2234
2234
|
lineEnd() {
|
|
2235
2235
|
switch (this._point) {
|
|
2236
2236
|
case 2:
|
|
2237
|
-
point$
|
|
2237
|
+
point$3(this, this._x1 * 6 - (this._x0 + 4 * this._x1), this._y1 * 6 - (this._y0 + 4 * this._y1), this._lastDefined1 !== false && this._lastDefined2 !== false, this.lastPoint1);
|
|
2238
2238
|
}
|
|
2239
2239
|
if (this._line || (this._line !== 0 && this._point === 1)) {
|
|
2240
2240
|
this.context.closePath();
|
|
@@ -2255,7 +2255,7 @@ class Basis {
|
|
|
2255
2255
|
this._point = 2;
|
|
2256
2256
|
break;
|
|
2257
2257
|
default:
|
|
2258
|
-
point$
|
|
2258
|
+
point$3(this, x, y, this._lastDefined1 !== false && this._lastDefined2 !== false);
|
|
2259
2259
|
break;
|
|
2260
2260
|
}
|
|
2261
2261
|
(this._x0 = this._x1), (this._x1 = x);
|
|
@@ -2301,7 +2301,7 @@ function slope2(curveClass, t) {
|
|
|
2301
2301
|
const h = curveClass._x1 - curveClass._x0;
|
|
2302
2302
|
return h ? ((3 * (curveClass._y1 - curveClass._y0)) / h - t) / 2 : t;
|
|
2303
2303
|
}
|
|
2304
|
-
function point$
|
|
2304
|
+
function point$2(curveClass, t0, t1, defined, p) {
|
|
2305
2305
|
const x0 = curveClass._x0;
|
|
2306
2306
|
const y0 = curveClass._y0;
|
|
2307
2307
|
const x1 = curveClass._x1;
|
|
@@ -2331,7 +2331,7 @@ class MonotoneX {
|
|
|
2331
2331
|
this.context.lineTo(this._x1, this._y1, this._lastDefined1 !== false && this._lastDefined2 !== false, this.lastPoint1);
|
|
2332
2332
|
break;
|
|
2333
2333
|
case 3:
|
|
2334
|
-
point$
|
|
2334
|
+
point$2(this, this._t0, slope2(this, this._t0), this._lastDefined1 !== false && this._lastDefined2 !== false, this.lastPoint1);
|
|
2335
2335
|
break;
|
|
2336
2336
|
}
|
|
2337
2337
|
if (this._line || (this._line !== 0 && this._point === 1)) {
|
|
@@ -2355,10 +2355,10 @@ class MonotoneX {
|
|
|
2355
2355
|
break;
|
|
2356
2356
|
case 2:
|
|
2357
2357
|
this._point = 3;
|
|
2358
|
-
point$
|
|
2358
|
+
point$2(this, slope2(this, (t1 = slope3(this, x, y))), t1, this._lastDefined1 !== false && this._lastDefined2 !== false);
|
|
2359
2359
|
break;
|
|
2360
2360
|
default:
|
|
2361
|
-
point$
|
|
2361
|
+
point$2(this, this._t0, (t1 = slope3(this, x, y)), this._lastDefined1 !== false && this._lastDefined2 !== false);
|
|
2362
2362
|
break;
|
|
2363
2363
|
}
|
|
2364
2364
|
(this._x0 = this._x1), (this._x1 = x);
|
|
@@ -2510,6 +2510,195 @@ function genLinearClosedTypeSegments(path, points) {
|
|
|
2510
2510
|
return genCurveSegments(path, points, 1);
|
|
2511
2511
|
}
|
|
2512
2512
|
|
|
2513
|
+
function point$1(curveClass, x, y, defined, p) {
|
|
2514
|
+
let x1 = curveClass._x1;
|
|
2515
|
+
let y1 = curveClass._y1;
|
|
2516
|
+
let x2 = curveClass._x2;
|
|
2517
|
+
let y2 = curveClass._y2;
|
|
2518
|
+
if (curveClass._l01_a > epsilon) {
|
|
2519
|
+
const a = 2 * curveClass._l01_2a + 3 * curveClass._l01_a * curveClass._l12_a + curveClass._l12_2a;
|
|
2520
|
+
const n = 3 * curveClass._l01_a * (curveClass._l01_a + curveClass._l12_a);
|
|
2521
|
+
x1 = (x1 * a - curveClass._x0 * curveClass._l12_2a + curveClass._x2 * curveClass._l01_2a) / n;
|
|
2522
|
+
y1 = (y1 * a - curveClass._y0 * curveClass._l12_2a + curveClass._y2 * curveClass._l01_2a) / n;
|
|
2523
|
+
}
|
|
2524
|
+
if (curveClass._l23_a > epsilon) {
|
|
2525
|
+
const b = 2 * curveClass._l23_2a + 3 * curveClass._l23_a * curveClass._l12_a + curveClass._l12_2a;
|
|
2526
|
+
const m = 3 * curveClass._l23_a * (curveClass._l23_a + curveClass._l12_a);
|
|
2527
|
+
x2 = (x2 * b + curveClass._x1 * curveClass._l23_2a - x * curveClass._l12_2a) / m;
|
|
2528
|
+
y2 = (y2 * b + curveClass._y1 * curveClass._l23_2a - y * curveClass._l12_2a) / m;
|
|
2529
|
+
}
|
|
2530
|
+
curveClass.context.bezierCurveTo(x1, y1, x2, y2, curveClass._x2, curveClass._y2, defined, curveClass.lastPoint1);
|
|
2531
|
+
}
|
|
2532
|
+
class CatmullRom {
|
|
2533
|
+
constructor(context, alpha = 0.5, startPoint) {
|
|
2534
|
+
this.context = context;
|
|
2535
|
+
this.startPoint = startPoint;
|
|
2536
|
+
this._alpha = alpha;
|
|
2537
|
+
}
|
|
2538
|
+
areaStart() {
|
|
2539
|
+
this._line = 0;
|
|
2540
|
+
}
|
|
2541
|
+
areaEnd() {
|
|
2542
|
+
this._line = NaN;
|
|
2543
|
+
}
|
|
2544
|
+
lineStart() {
|
|
2545
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN;
|
|
2546
|
+
this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
2547
|
+
}
|
|
2548
|
+
lineEnd() {
|
|
2549
|
+
switch (this._point) {
|
|
2550
|
+
case 2:
|
|
2551
|
+
this.context.lineTo(this._x2, this._y2, this._lastDefined1 !== false && this._lastDefined2 !== false, this.lastPoint1);
|
|
2552
|
+
break;
|
|
2553
|
+
case 3:
|
|
2554
|
+
this.point({ x: this._x2, y: this._y2 });
|
|
2555
|
+
break;
|
|
2556
|
+
}
|
|
2557
|
+
if (this._line || (this._line !== 0 && this._point === 1)) {
|
|
2558
|
+
this.context.closePath();
|
|
2559
|
+
}
|
|
2560
|
+
this._line = 1 - this._line;
|
|
2561
|
+
}
|
|
2562
|
+
point(p) {
|
|
2563
|
+
const { x, y } = p;
|
|
2564
|
+
if (this._point) {
|
|
2565
|
+
const x23 = this._x2 - x;
|
|
2566
|
+
const y23 = this._y2 - y;
|
|
2567
|
+
this._l23_a = Math.sqrt((this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)));
|
|
2568
|
+
}
|
|
2569
|
+
switch (this._point) {
|
|
2570
|
+
case 0:
|
|
2571
|
+
this._point = 1;
|
|
2572
|
+
this._line
|
|
2573
|
+
? this.context.lineTo(x, y, this._lastDefined1 !== false && this._lastDefined2 !== false)
|
|
2574
|
+
: this.context.moveTo(x, y);
|
|
2575
|
+
break;
|
|
2576
|
+
case 1:
|
|
2577
|
+
this._point = 2;
|
|
2578
|
+
break;
|
|
2579
|
+
case 2:
|
|
2580
|
+
this._point = 3;
|
|
2581
|
+
default:
|
|
2582
|
+
point$1(this, x, y, this._lastDefined1 !== false && this._lastDefined2 !== false);
|
|
2583
|
+
break;
|
|
2584
|
+
}
|
|
2585
|
+
(this._l01_a = this._l12_a), (this._l12_a = this._l23_a);
|
|
2586
|
+
(this._l01_2a = this._l12_2a), (this._l12_2a = this._l23_2a);
|
|
2587
|
+
(this._x0 = this._x1), (this._x1 = this._x2), (this._x2 = x);
|
|
2588
|
+
(this._y0 = this._y1), (this._y1 = this._y2), (this._y2 = y);
|
|
2589
|
+
this._lastDefined1 = this._lastDefined2;
|
|
2590
|
+
this._lastDefined2 = p.defined;
|
|
2591
|
+
this.lastPoint0 = this.lastPoint1;
|
|
2592
|
+
this.lastPoint1 = p;
|
|
2593
|
+
}
|
|
2594
|
+
tryUpdateLength() {
|
|
2595
|
+
return this.context.tryUpdateLength();
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
function commonGenCatmullRomSegments(type, cons) {
|
|
2599
|
+
return function genCatmullRomSegments(points, alpha, params = {}) {
|
|
2600
|
+
const { direction, startPoint } = params;
|
|
2601
|
+
if (points.length < 2 - Number(!!startPoint)) {
|
|
2602
|
+
return null;
|
|
2603
|
+
}
|
|
2604
|
+
if (points.length < 3 - Number(!!startPoint)) {
|
|
2605
|
+
return genLinearSegments(points, params);
|
|
2606
|
+
}
|
|
2607
|
+
const segContext = genSegContext(type, direction, points);
|
|
2608
|
+
const gatmullRom = new cons(segContext, alpha, startPoint);
|
|
2609
|
+
genCurveSegments(gatmullRom, points, 2);
|
|
2610
|
+
return segContext;
|
|
2611
|
+
};
|
|
2612
|
+
}
|
|
2613
|
+
const genCatmullRomSegments = commonGenCatmullRomSegments('catmullRom', CatmullRom);
|
|
2614
|
+
|
|
2615
|
+
class CatmullRomClosed {
|
|
2616
|
+
constructor(context, alpha = 0.5, startPoint) {
|
|
2617
|
+
this.context = context;
|
|
2618
|
+
this.startPoint = startPoint;
|
|
2619
|
+
this._alpha = alpha;
|
|
2620
|
+
}
|
|
2621
|
+
areaStart() {
|
|
2622
|
+
this._line = 0;
|
|
2623
|
+
}
|
|
2624
|
+
areaEnd() {
|
|
2625
|
+
this._line = NaN;
|
|
2626
|
+
}
|
|
2627
|
+
lineStart() {
|
|
2628
|
+
this._x0 =
|
|
2629
|
+
this._x1 =
|
|
2630
|
+
this._x2 =
|
|
2631
|
+
this._x3 =
|
|
2632
|
+
this._x4 =
|
|
2633
|
+
this._x5 =
|
|
2634
|
+
this._y0 =
|
|
2635
|
+
this._y1 =
|
|
2636
|
+
this._y2 =
|
|
2637
|
+
this._y3 =
|
|
2638
|
+
this._y4 =
|
|
2639
|
+
this._y5 =
|
|
2640
|
+
NaN;
|
|
2641
|
+
this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
2642
|
+
}
|
|
2643
|
+
lineEnd() {
|
|
2644
|
+
switch (this._point) {
|
|
2645
|
+
case 1: {
|
|
2646
|
+
this.context.moveTo(this._x3, this._y3, this.lastPoint1);
|
|
2647
|
+
this.context.closePath();
|
|
2648
|
+
break;
|
|
2649
|
+
}
|
|
2650
|
+
case 2: {
|
|
2651
|
+
this.context.lineTo(this._x3, this._y3, this._lastDefined1 !== false && this._lastDefined2 !== false, this.lastPoint1);
|
|
2652
|
+
this.context.closePath();
|
|
2653
|
+
break;
|
|
2654
|
+
}
|
|
2655
|
+
case 3: {
|
|
2656
|
+
this.point({ x: this._x3, y: this._y3 });
|
|
2657
|
+
this.point({ x: this._x4, y: this._y4 });
|
|
2658
|
+
this.point({ x: this._x5, y: this._y5 });
|
|
2659
|
+
break;
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
point(p) {
|
|
2664
|
+
const { x, y } = p;
|
|
2665
|
+
if (this._point) {
|
|
2666
|
+
const x23 = this._x2 - x;
|
|
2667
|
+
const y23 = this._y2 - y;
|
|
2668
|
+
this._l23_a = Math.sqrt((this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)));
|
|
2669
|
+
}
|
|
2670
|
+
switch (this._point) {
|
|
2671
|
+
case 0:
|
|
2672
|
+
this._point = 1;
|
|
2673
|
+
(this._x3 = x), (this._y3 = y);
|
|
2674
|
+
break;
|
|
2675
|
+
case 1:
|
|
2676
|
+
this._point = 2;
|
|
2677
|
+
this.context.moveTo((this._x4 = x), (this._y4 = y), p);
|
|
2678
|
+
break;
|
|
2679
|
+
case 2:
|
|
2680
|
+
this._point = 3;
|
|
2681
|
+
(this._x5 = x), (this._y5 = y);
|
|
2682
|
+
break;
|
|
2683
|
+
default:
|
|
2684
|
+
point$1(this, x, y, this._lastDefined1 !== false && this._lastDefined2 !== false);
|
|
2685
|
+
break;
|
|
2686
|
+
}
|
|
2687
|
+
(this._l01_a = this._l12_a), (this._l12_a = this._l23_a);
|
|
2688
|
+
(this._l01_2a = this._l12_2a), (this._l12_2a = this._l23_2a);
|
|
2689
|
+
(this._x0 = this._x1), (this._x1 = this._x2), (this._x2 = x);
|
|
2690
|
+
(this._y0 = this._y1), (this._y1 = this._y2), (this._y2 = y);
|
|
2691
|
+
this._lastDefined1 = this._lastDefined2;
|
|
2692
|
+
this._lastDefined2 = p.defined;
|
|
2693
|
+
this.lastPoint0 = this.lastPoint1;
|
|
2694
|
+
this.lastPoint1 = p;
|
|
2695
|
+
}
|
|
2696
|
+
tryUpdateLength() {
|
|
2697
|
+
return this.context.tryUpdateLength();
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
const genCatmullRomClosedSegments = commonGenCatmullRomSegments('catmullRomClosed', CatmullRomClosed);
|
|
2701
|
+
|
|
2513
2702
|
class CurveContext {
|
|
2514
2703
|
constructor(path) {
|
|
2515
2704
|
this.path = path;
|
|
@@ -2560,6 +2749,7 @@ class CurveContext {
|
|
|
2560
2749
|
}
|
|
2561
2750
|
|
|
2562
2751
|
function calcLineCache$1(points, curveType, params) {
|
|
2752
|
+
var _a, _b;
|
|
2563
2753
|
switch (curveType) {
|
|
2564
2754
|
case 'linear':
|
|
2565
2755
|
return genLinearSegments(points, params);
|
|
@@ -2575,6 +2765,10 @@ function calcLineCache$1(points, curveType, params) {
|
|
|
2575
2765
|
return genStepSegments(points, 0, params);
|
|
2576
2766
|
case 'stepAfter':
|
|
2577
2767
|
return genStepSegments(points, 1, params);
|
|
2768
|
+
case 'catmullRom':
|
|
2769
|
+
return genCatmullRomSegments(points, (_a = params === null || params === void 0 ? void 0 : params.curveTension) !== null && _a !== void 0 ? _a : 0.5, params);
|
|
2770
|
+
case 'catmullRomClosed':
|
|
2771
|
+
return genCatmullRomClosedSegments(points, (_b = params === null || params === void 0 ? void 0 : params.curveTension) !== null && _b !== void 0 ? _b : 0.5, params);
|
|
2578
2772
|
case 'linearClosed':
|
|
2579
2773
|
return genLinearClosedSegments(points, params);
|
|
2580
2774
|
default:
|
|
@@ -3160,11 +3354,11 @@ function rewriteProto(obj, c) {
|
|
|
3160
3354
|
Object.setPrototypeOf(obj, c);
|
|
3161
3355
|
}
|
|
3162
3356
|
const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), { startAngle: 0, endAngle: pi2, innerRadius: 0, outerRadius: 1, innerPadding: 0, outerPadding: 0, cornerRadius: 0, padRadius: 0, padAngle: 0, cap: false, forceShowCap: false });
|
|
3163
|
-
const DefaultAreaAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, closePath: false });
|
|
3357
|
+
const DefaultAreaAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, closePath: false, curveTension: 1 });
|
|
3164
3358
|
const DefaultCircleAttribute = Object.assign(Object.assign({}, DefaultAttribute), { radius: 1, startAngle: 0, endAngle: pi2 });
|
|
3165
3359
|
const DefaultGroupAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, cornerRadius: 0, path: [], clip: false, visibleAll: true, display: 'relative', flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'flex-start', alignItems: 'flex-start', alignContent: 'flex-start', baseOpacity: 1 });
|
|
3166
3360
|
const DefaultGlyphAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: '', width: 0, height: 0, cornerRadius: 0, clip: false });
|
|
3167
|
-
const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, clipRangeByDimension: 'default', closePath: false });
|
|
3361
|
+
const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, clipRangeByDimension: 'default', closePath: false, curveTension: 1 });
|
|
3168
3362
|
const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), { path: new CustomPath2D(), customPath: () => {
|
|
3169
3363
|
Logger.getInstance().warn('空函数');
|
|
3170
3364
|
} });
|
|
@@ -13229,11 +13423,12 @@ function drawArcPath$1(arc, context, cx, cy, outerRadius, innerRadius, partStrok
|
|
|
13229
13423
|
}
|
|
13230
13424
|
else {
|
|
13231
13425
|
const cornerRadius = arc.getParsedCornerRadius();
|
|
13426
|
+
const cornerRadiusIsArray = isArray(cornerRadius);
|
|
13232
13427
|
const { outerDeltaAngle, innerDeltaAngle, outerStartAngle, outerEndAngle, innerEndAngle, innerStartAngle } = arc.getParsePadAngle(startAngle, endAngle);
|
|
13233
|
-
const outerCornerRadiusStart = cornerRadius;
|
|
13234
|
-
const outerCornerRadiusEnd = cornerRadius;
|
|
13235
|
-
const innerCornerRadiusEnd = cornerRadius;
|
|
13236
|
-
const innerCornerRadiusStart = cornerRadius;
|
|
13428
|
+
const outerCornerRadiusStart = cornerRadiusIsArray ? cornerRadius[0] : cornerRadius;
|
|
13429
|
+
const outerCornerRadiusEnd = cornerRadiusIsArray ? cornerRadius[1] : cornerRadius;
|
|
13430
|
+
const innerCornerRadiusEnd = cornerRadiusIsArray ? cornerRadius[2] : cornerRadius;
|
|
13431
|
+
const innerCornerRadiusStart = cornerRadiusIsArray ? cornerRadius[3] : cornerRadius;
|
|
13237
13432
|
const maxOuterCornerRadius = Math.max(outerCornerRadiusEnd, outerCornerRadiusStart);
|
|
13238
13433
|
const maxInnerCornerRadius = Math.max(innerCornerRadiusEnd, innerCornerRadiusStart);
|
|
13239
13434
|
let limitedOcr = maxOuterCornerRadius;
|
|
@@ -15435,7 +15630,7 @@ function createSymbol(attributes) {
|
|
|
15435
15630
|
return new Symbol$1(attributes);
|
|
15436
15631
|
}
|
|
15437
15632
|
|
|
15438
|
-
const LINE_UPDATE_TAG_KEY = ['segments', 'points', 'curveType', ...GRAPHIC_UPDATE_TAG_KEY];
|
|
15633
|
+
const LINE_UPDATE_TAG_KEY = ['segments', 'points', 'curveType', 'curveTension', ...GRAPHIC_UPDATE_TAG_KEY];
|
|
15439
15634
|
let Line$1 = class Line extends Graphic {
|
|
15440
15635
|
constructor(params = {}) {
|
|
15441
15636
|
super(params);
|
|
@@ -17158,7 +17353,7 @@ function createPath(attributes) {
|
|
|
17158
17353
|
return new Path(attributes);
|
|
17159
17354
|
}
|
|
17160
17355
|
|
|
17161
|
-
const AREA_UPDATE_TAG_KEY = ['segments', 'points', 'curveType', ...GRAPHIC_UPDATE_TAG_KEY];
|
|
17356
|
+
const AREA_UPDATE_TAG_KEY = ['segments', 'points', 'curveType', 'curveTension', ...GRAPHIC_UPDATE_TAG_KEY];
|
|
17162
17357
|
class Area extends Graphic {
|
|
17163
17358
|
constructor(params) {
|
|
17164
17359
|
super(params);
|
|
@@ -17307,9 +17502,25 @@ class Arc extends Graphic {
|
|
|
17307
17502
|
return 0;
|
|
17308
17503
|
}
|
|
17309
17504
|
const deltaRadius = Math.abs(outerRadius - innerRadius);
|
|
17310
|
-
|
|
17311
|
-
|
|
17312
|
-
|
|
17505
|
+
const parseCR = (cornerRadius) => {
|
|
17506
|
+
return Math.min(isNumber(cornerRadius, true)
|
|
17507
|
+
? cornerRadius
|
|
17508
|
+
: (deltaRadius * parseFloat(cornerRadius)) / 100, deltaRadius / 2);
|
|
17509
|
+
};
|
|
17510
|
+
if (isArray(cornerRadius)) {
|
|
17511
|
+
const crList = cornerRadius.map(cr => parseCR(cr) || 0);
|
|
17512
|
+
if (crList.length === 0) {
|
|
17513
|
+
return [crList[0], crList[0], crList[0], crList[0]];
|
|
17514
|
+
}
|
|
17515
|
+
else if (crList.length === 2) {
|
|
17516
|
+
return [crList[0], crList[1], crList[0], crList[1]];
|
|
17517
|
+
}
|
|
17518
|
+
else if (crList.length === 3) {
|
|
17519
|
+
crList.push(0);
|
|
17520
|
+
}
|
|
17521
|
+
return crList;
|
|
17522
|
+
}
|
|
17523
|
+
return parseCR(cornerRadius);
|
|
17313
17524
|
}
|
|
17314
17525
|
getParsedAngle() {
|
|
17315
17526
|
const arcTheme = getTheme(this).arc;
|
|
@@ -20528,11 +20739,12 @@ let DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
|
|
|
20528
20739
|
innerRadius = temp;
|
|
20529
20740
|
}
|
|
20530
20741
|
const cornerRadius = arc.getParsedCornerRadius();
|
|
20742
|
+
const cornerRadiusIsArray = isArray(cornerRadius);
|
|
20531
20743
|
const { outerDeltaAngle, innerDeltaAngle, outerStartAngle, outerEndAngle, innerEndAngle, innerStartAngle } = arc.getParsePadAngle(startAngle, endAngle);
|
|
20532
|
-
const outerCornerRadiusStart = cornerRadius;
|
|
20533
|
-
const outerCornerRadiusEnd = cornerRadius;
|
|
20534
|
-
const innerCornerRadiusEnd = cornerRadius;
|
|
20535
|
-
const innerCornerRadiusStart = cornerRadius;
|
|
20744
|
+
const outerCornerRadiusStart = cornerRadiusIsArray ? cornerRadius[0] : cornerRadius;
|
|
20745
|
+
const outerCornerRadiusEnd = cornerRadiusIsArray ? cornerRadius[1] : cornerRadius;
|
|
20746
|
+
const innerCornerRadiusEnd = cornerRadiusIsArray ? cornerRadius[2] : cornerRadius;
|
|
20747
|
+
const innerCornerRadiusStart = cornerRadiusIsArray ? cornerRadius[3] : cornerRadius;
|
|
20536
20748
|
const maxOuterCornerRadius = Math.max(outerCornerRadiusEnd, outerCornerRadiusStart);
|
|
20537
20749
|
const maxInnerCornerRadius = Math.max(innerCornerRadiusEnd, innerCornerRadiusStart);
|
|
20538
20750
|
let limitedOcr = maxOuterCornerRadius;
|
|
@@ -21136,7 +21348,7 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
|
|
|
21136
21348
|
}
|
|
21137
21349
|
drawShape(line, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
21138
21350
|
const lineAttribute = getTheme(line, params === null || params === void 0 ? void 0 : params.theme).line;
|
|
21139
|
-
const { fill = lineAttribute.fill, stroke = lineAttribute.stroke, fillOpacity = lineAttribute.fillOpacity, strokeOpacity = lineAttribute.strokeOpacity, segments, points, closePath } = line.attribute;
|
|
21351
|
+
const { fill = lineAttribute.fill, stroke = lineAttribute.stroke, fillOpacity = lineAttribute.fillOpacity, strokeOpacity = lineAttribute.strokeOpacity, segments, points, closePath, curveTension = lineAttribute.curveTension } = line.attribute;
|
|
21140
21352
|
const data = this.valid(line, lineAttribute, fillCb, strokeCb);
|
|
21141
21353
|
if (!data) {
|
|
21142
21354
|
return;
|
|
@@ -21181,7 +21393,8 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
|
|
|
21181
21393
|
startPoint.defined = lastSeg.curves[lastSeg.curves.length - 1].defined;
|
|
21182
21394
|
}
|
|
21183
21395
|
const data = calcLineCache$1(seg.points, curveType, {
|
|
21184
|
-
startPoint
|
|
21396
|
+
startPoint,
|
|
21397
|
+
curveTension
|
|
21185
21398
|
});
|
|
21186
21399
|
lastSeg = data;
|
|
21187
21400
|
return data;
|
|
@@ -21205,7 +21418,7 @@ let DefaultCanvasLineRender = class DefaultCanvasLineRender extends BaseRender {
|
|
|
21205
21418
|
}
|
|
21206
21419
|
}
|
|
21207
21420
|
else if (points && points.length) {
|
|
21208
|
-
line.cache = calcLineCache$1(_points, curveType);
|
|
21421
|
+
line.cache = calcLineCache$1(_points, curveType, { curveTension });
|
|
21209
21422
|
}
|
|
21210
21423
|
else {
|
|
21211
21424
|
line.cache = null;
|
|
@@ -21543,6 +21756,7 @@ const defaultAreaTextureRenderContribution = new DefaultAreaTextureRenderContrib
|
|
|
21543
21756
|
const defaultAreaBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
|
|
21544
21757
|
|
|
21545
21758
|
function calcLineCache(points, curveType, params) {
|
|
21759
|
+
var _a, _b;
|
|
21546
21760
|
switch (curveType) {
|
|
21547
21761
|
case 'linear':
|
|
21548
21762
|
return genLinearSegments(points, params);
|
|
@@ -21558,6 +21772,10 @@ function calcLineCache(points, curveType, params) {
|
|
|
21558
21772
|
return genStepSegments(points, 0, params);
|
|
21559
21773
|
case 'stepAfter':
|
|
21560
21774
|
return genStepSegments(points, 1, params);
|
|
21775
|
+
case 'catmullRom':
|
|
21776
|
+
return genCatmullRomSegments(points, (_a = params === null || params === void 0 ? void 0 : params.curveTension) !== null && _a !== void 0 ? _a : 0.5, params);
|
|
21777
|
+
case 'catmullRomClosed':
|
|
21778
|
+
return genCatmullRomClosedSegments(points, (_b = params === null || params === void 0 ? void 0 : params.curveTension) !== null && _b !== void 0 ? _b : 0.5, params);
|
|
21561
21779
|
case 'linearClosed':
|
|
21562
21780
|
return genLinearClosedSegments(points, params);
|
|
21563
21781
|
default:
|
|
@@ -21636,7 +21854,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
21636
21854
|
drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
21637
21855
|
var _a, _b, _c, _d, _e, _f;
|
|
21638
21856
|
const areaAttribute = getTheme(area, params === null || params === void 0 ? void 0 : params.theme).area;
|
|
21639
|
-
const { fill = areaAttribute.fill, stroke = areaAttribute.stroke, fillOpacity = areaAttribute.fillOpacity, z = areaAttribute.z, strokeOpacity = areaAttribute.strokeOpacity } = area.attribute;
|
|
21857
|
+
const { fill = areaAttribute.fill, stroke = areaAttribute.stroke, fillOpacity = areaAttribute.fillOpacity, z = areaAttribute.z, strokeOpacity = areaAttribute.strokeOpacity, curveTension = areaAttribute.curveTension } = area.attribute;
|
|
21640
21858
|
const data = this.valid(area, areaAttribute, fillCb, strokeCb);
|
|
21641
21859
|
if (!data) {
|
|
21642
21860
|
return;
|
|
@@ -21670,7 +21888,8 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
21670
21888
|
startPoint.y = lastTopSeg.endY;
|
|
21671
21889
|
}
|
|
21672
21890
|
const data = calcLineCache(seg.points, curveType, {
|
|
21673
|
-
startPoint
|
|
21891
|
+
startPoint,
|
|
21892
|
+
curveTension
|
|
21674
21893
|
});
|
|
21675
21894
|
lastTopSeg = data;
|
|
21676
21895
|
return data;
|
|
@@ -21697,7 +21916,7 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
21697
21916
|
});
|
|
21698
21917
|
}
|
|
21699
21918
|
if (bottomPoints.length > 1) {
|
|
21700
|
-
lastBottomSeg = calcLineCache(bottomPoints, curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType);
|
|
21919
|
+
lastBottomSeg = calcLineCache(bottomPoints, curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType, { curveTension });
|
|
21701
21920
|
bottomCaches.unshift(lastBottomSeg);
|
|
21702
21921
|
}
|
|
21703
21922
|
}
|
|
@@ -21715,8 +21934,8 @@ let DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
|
21715
21934
|
y: (_f = points[i].y1) !== null && _f !== void 0 ? _f : points[i].y
|
|
21716
21935
|
});
|
|
21717
21936
|
}
|
|
21718
|
-
const topCache = calcLineCache(topPoints, curveType);
|
|
21719
|
-
const bottomCache = calcLineCache(bottomPoints, curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType);
|
|
21937
|
+
const topCache = calcLineCache(topPoints, curveType, { curveTension });
|
|
21938
|
+
const bottomCache = calcLineCache(bottomPoints, curveType === 'stepBefore' ? 'stepAfter' : curveType === 'stepAfter' ? 'stepBefore' : curveType, { curveTension });
|
|
21720
21939
|
area.cacheArea = { top: topCache, bottom: bottomCache };
|
|
21721
21940
|
}
|
|
21722
21941
|
else {
|
|
@@ -29260,4 +29479,4 @@ function registerWrapTextGraphic() {
|
|
|
29260
29479
|
graphicCreator.RegisterGraphicCreator('wrapText', createWrapText);
|
|
29261
29480
|
}
|
|
29262
29481
|
|
|
29263
|
-
export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MatrixAllocate, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VGlobal, VWindow, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache$1 as calcLineCache, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getContextFont, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, imageModule, incrementalAddTo, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, layerService, lineModule, lookAt, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiply, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$
|
|
29482
|
+
export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MatrixAllocate, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VGlobal, VWindow, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache$1 as calcLineCache, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getContextFont, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, imageModule, incrementalAddTo, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, layerService, lineModule, lookAt, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiply, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerGlyphGraphic, registerGroupGraphic, registerImageGraphic, registerLineGraphic, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerSymbolGraphic, registerTextGraphic, registerWrapTextGraphic, renderCommandList, rewriteProto, richtextModule, rotateX, rotateY, runFill, runStroke, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformKeys, transformMat4, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type IPointLike } from '@visactor/vutils';
|
|
2
|
+
import type { ICurvedSegment, IGenSegmentParams, ISegPath2D } from '../../interface/curve';
|
|
3
|
+
export declare class CatmullRomClosed implements ICurvedSegment {
|
|
4
|
+
private _lastDefined1?;
|
|
5
|
+
private _lastDefined2?;
|
|
6
|
+
context: ISegPath2D;
|
|
7
|
+
protected startPoint?: IPointLike;
|
|
8
|
+
lastPoint0?: IPointLike;
|
|
9
|
+
lastPoint1?: IPointLike;
|
|
10
|
+
constructor(context: ISegPath2D, alpha?: number, startPoint?: IPointLike);
|
|
11
|
+
_alpha: number;
|
|
12
|
+
_x: number;
|
|
13
|
+
_y: number;
|
|
14
|
+
_x0: number;
|
|
15
|
+
_x1: number;
|
|
16
|
+
_y0: number;
|
|
17
|
+
_y1: number;
|
|
18
|
+
_x2: number;
|
|
19
|
+
_y2: number;
|
|
20
|
+
_x3: number;
|
|
21
|
+
_y3: number;
|
|
22
|
+
_x4: number;
|
|
23
|
+
_y4: number;
|
|
24
|
+
_x5: number;
|
|
25
|
+
_y5: number;
|
|
26
|
+
_line: number;
|
|
27
|
+
_point: number;
|
|
28
|
+
_l01_a: number;
|
|
29
|
+
_l12_a: number;
|
|
30
|
+
_l23_a: number;
|
|
31
|
+
_l01_2a: number;
|
|
32
|
+
_l12_2a: number;
|
|
33
|
+
_l23_2a: number;
|
|
34
|
+
areaStart(): void;
|
|
35
|
+
areaEnd(): void;
|
|
36
|
+
lineStart(): void;
|
|
37
|
+
lineEnd(): void;
|
|
38
|
+
point(p: IPointLike): void;
|
|
39
|
+
tryUpdateLength(): number;
|
|
40
|
+
}
|
|
41
|
+
export declare const genCatmullRomClosedSegments: (points: IPointLike[], alpha: number, params?: IGenSegmentParams) => ISegPath2D;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { commonGenCatmullRomSegments, point } from "./catmull-rom";
|
|
2
|
+
|
|
3
|
+
export class CatmullRomClosed {
|
|
4
|
+
constructor(context, alpha = .5, startPoint) {
|
|
5
|
+
this.context = context, this.startPoint = startPoint, this._alpha = alpha;
|
|
6
|
+
}
|
|
7
|
+
areaStart() {
|
|
8
|
+
this._line = 0;
|
|
9
|
+
}
|
|
10
|
+
areaEnd() {
|
|
11
|
+
this._line = NaN;
|
|
12
|
+
}
|
|
13
|
+
lineStart() {
|
|
14
|
+
this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN,
|
|
15
|
+
this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
16
|
+
}
|
|
17
|
+
lineEnd() {
|
|
18
|
+
switch (this._point) {
|
|
19
|
+
case 1:
|
|
20
|
+
this.context.moveTo(this._x3, this._y3, this.lastPoint1), this.context.closePath();
|
|
21
|
+
break;
|
|
22
|
+
|
|
23
|
+
case 2:
|
|
24
|
+
this.context.lineTo(this._x3, this._y3, !1 !== this._lastDefined1 && !1 !== this._lastDefined2, this.lastPoint1),
|
|
25
|
+
this.context.closePath();
|
|
26
|
+
break;
|
|
27
|
+
|
|
28
|
+
case 3:
|
|
29
|
+
this.point({
|
|
30
|
+
x: this._x3,
|
|
31
|
+
y: this._y3
|
|
32
|
+
}), this.point({
|
|
33
|
+
x: this._x4,
|
|
34
|
+
y: this._y4
|
|
35
|
+
}), this.point({
|
|
36
|
+
x: this._x5,
|
|
37
|
+
y: this._y5
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
point(p) {
|
|
42
|
+
const {x: x, y: y} = p;
|
|
43
|
+
if (this._point) {
|
|
44
|
+
const x23 = this._x2 - x, y23 = this._y2 - y;
|
|
45
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
|
|
46
|
+
}
|
|
47
|
+
switch (this._point) {
|
|
48
|
+
case 0:
|
|
49
|
+
this._point = 1, this._x3 = x, this._y3 = y;
|
|
50
|
+
break;
|
|
51
|
+
|
|
52
|
+
case 1:
|
|
53
|
+
this._point = 2, this.context.moveTo(this._x4 = x, this._y4 = y, p);
|
|
54
|
+
break;
|
|
55
|
+
|
|
56
|
+
case 2:
|
|
57
|
+
this._point = 3, this._x5 = x, this._y5 = y;
|
|
58
|
+
break;
|
|
59
|
+
|
|
60
|
+
default:
|
|
61
|
+
point(this, x, y, !1 !== this._lastDefined1 && !1 !== this._lastDefined2, p);
|
|
62
|
+
}
|
|
63
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a,
|
|
64
|
+
this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = x,
|
|
65
|
+
this._y0 = this._y1, this._y1 = this._y2, this._y2 = y, this._lastDefined1 = this._lastDefined2,
|
|
66
|
+
this._lastDefined2 = p.defined, this.lastPoint0 = this.lastPoint1, this.lastPoint1 = p;
|
|
67
|
+
}
|
|
68
|
+
tryUpdateLength() {
|
|
69
|
+
return this.context.tryUpdateLength();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const genCatmullRomClosedSegments = commonGenCatmullRomSegments("catmullRomClosed", CatmullRomClosed);
|
|
74
|
+
//# sourceMappingURL=catmull-rom-close.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/common/segment/catmull-rom-close.ts"],"names":[],"mappings":"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","file":"catmull-rom-close.js","sourcesContent":["import { epsilon, type IPointLike } from '@visactor/vutils';\nimport { genLinearSegments } from './linear';\nimport { genCurveSegments, genSegContext } from './common';\nimport type { ICurvedSegment, IGenSegmentParams, ILinearSegment, ISegPath2D } from '../../interface/curve';\nimport { commonGenCatmullRomSegments, point } from './catmull-rom';\n\nexport class CatmullRomClosed implements ICurvedSegment {\n private _lastDefined1?: boolean;\n private _lastDefined2?: boolean;\n declare context: ISegPath2D;\n\n protected startPoint?: IPointLike;\n lastPoint0?: IPointLike;\n lastPoint1?: IPointLike;\n\n constructor(context: ISegPath2D, alpha: number = 0.5, startPoint?: IPointLike) {\n this.context = context;\n this.startPoint = startPoint;\n this._alpha = alpha;\n }\n _alpha: number;\n _x: number;\n _y: number;\n _x0: number;\n _x1: number;\n _y0: number;\n _y1: number;\n _x2: number;\n _y2: number;\n _x3: number;\n _y3: number;\n _x4: number;\n _y4: number;\n _x5: number;\n _y5: number;\n _line: number;\n _point: number;\n _l01_a: number;\n _l12_a: number;\n _l23_a: number;\n _l01_2a: number;\n _l12_2a: number;\n _l23_2a: number;\n\n areaStart() {\n this._line = 0;\n }\n areaEnd() {\n this._line = NaN;\n }\n lineStart() {\n this._x0 =\n this._x1 =\n this._x2 =\n this._x3 =\n this._x4 =\n this._x5 =\n this._y0 =\n this._y1 =\n this._y2 =\n this._y3 =\n this._y4 =\n this._y5 =\n NaN;\n this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;\n }\n lineEnd() {\n switch (this._point) {\n case 1: {\n this.context.moveTo(this._x3, this._y3, this.lastPoint1);\n this.context.closePath();\n break;\n }\n case 2: {\n this.context.lineTo(\n this._x3,\n this._y3,\n this._lastDefined1 !== false && this._lastDefined2 !== false,\n this.lastPoint1\n );\n this.context.closePath();\n break;\n }\n case 3: {\n this.point({ x: this._x3, y: this._y3 });\n this.point({ x: this._x4, y: this._y4 });\n this.point({ x: this._x5, y: this._y5 });\n break;\n }\n }\n }\n point(p: IPointLike): void {\n const { x, y } = p;\n\n if (this._point) {\n const x23 = this._x2 - x;\n const y23 = this._y2 - y;\n this._l23_a = Math.sqrt((this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)));\n }\n\n switch (this._point) {\n case 0:\n this._point = 1;\n (this._x3 = x), (this._y3 = y);\n break;\n case 1:\n this._point = 2;\n this.context.moveTo((this._x4 = x), (this._y4 = y), p);\n break;\n case 2:\n this._point = 3;\n (this._x5 = x), (this._y5 = y);\n break;\n default:\n point(this as any, x, y, this._lastDefined1 !== false && this._lastDefined2 !== false, p);\n break;\n }\n\n (this._l01_a = this._l12_a), (this._l12_a = this._l23_a);\n (this._l01_2a = this._l12_2a), (this._l12_2a = this._l23_2a);\n (this._x0 = this._x1), (this._x1 = this._x2), (this._x2 = x);\n (this._y0 = this._y1), (this._y1 = this._y2), (this._y2 = y);\n\n this._lastDefined1 = this._lastDefined2;\n this._lastDefined2 = p.defined;\n this.lastPoint0 = this.lastPoint1;\n this.lastPoint1 = p;\n }\n\n tryUpdateLength(): number {\n return this.context.tryUpdateLength();\n }\n}\n\n// export function genCatmullRomClosedTypeSegments(path: ILinearSegment, points: IPointLike[]): void {\n// return genCurveSegments(path, points, 2);\n// }\n\nexport const genCatmullRomClosedSegments = commonGenCatmullRomSegments('catmullRomClosed', CatmullRomClosed);\n\n// export function genCatmullRomClosedSegments(\n// points: IPointLike[],\n// alpha: number,\n// params: IGenSegmentParams = {}\n// ): ISegPath2D | null {\n// const { direction, startPoint } = params;\n// if (points.length < 2 - Number(!!startPoint)) {\n// return null;\n// }\n// if (points.length < 3 - Number(!!startPoint)) {\n// return genLinearSegments(points, params);\n// }\n\n// const segContext = genSegContext('catmullRom', direction, points);\n\n// const gatmullRom = new CatmullRomClosed(segContext, alpha, startPoint);\n\n// genCatmullRomClosedTypeSegments(gatmullRom, points);\n\n// return segContext;\n// }\n"]}
|