@visactor/vtable-plugins 1.17.7-alpha.1 → 1.17.7-alpha.2
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/vtable-plugins.js +100 -1115
- package/dist/vtable-plugins.min.js +1 -1
- package/package.json +4 -4
package/dist/vtable-plugins.js
CHANGED
|
@@ -1525,13 +1525,10 @@
|
|
|
1525
1525
|
|
|
1526
1526
|
class CurvePath {
|
|
1527
1527
|
constructor() {
|
|
1528
|
-
this.
|
|
1529
|
-
}
|
|
1530
|
-
get curves() {
|
|
1531
|
-
return this._curves;
|
|
1528
|
+
this.curves = [], this.bounds = new AABBBounds();
|
|
1532
1529
|
}
|
|
1533
1530
|
getCurveLengths() {
|
|
1534
|
-
return this.
|
|
1531
|
+
return this.curves.map(curve => curve.getLength());
|
|
1535
1532
|
}
|
|
1536
1533
|
getPointAt(t) {
|
|
1537
1534
|
return {
|
|
@@ -1773,83 +1770,7 @@
|
|
|
1773
1770
|
y = cubicCalc(p0.y, p1.y, p2.y, p3.y, t);
|
|
1774
1771
|
return new Point(x, y);
|
|
1775
1772
|
}
|
|
1776
|
-
function quadCalc(p0, p1, p2, t) {
|
|
1777
|
-
const one = 1 - t;
|
|
1778
|
-
return one * one * p0 + 2 * one * t * p1 + t * t * p2;
|
|
1779
|
-
}
|
|
1780
|
-
function quadPointAt(p0, p1, p2, t) {
|
|
1781
|
-
const x = quadCalc(p0.x, p1.x, p2.x, t),
|
|
1782
|
-
y = quadCalc(p0.y, p1.y, p2.y, t);
|
|
1783
|
-
return new Point(x, y);
|
|
1784
|
-
}
|
|
1785
|
-
function quadLength(p0, p1, p2, iterationCount) {
|
|
1786
|
-
return snapLength([p0.x, p1.x, p2.x], [p0.y, p1.y, p2.y]);
|
|
1787
|
-
}
|
|
1788
1773
|
|
|
1789
|
-
class QuadraticBezierCurve extends Curve {
|
|
1790
|
-
constructor(p0, p1, p2) {
|
|
1791
|
-
super(), this.type = CurveTypeEnum.QuadraticBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2;
|
|
1792
|
-
}
|
|
1793
|
-
_validPoint() {
|
|
1794
|
-
return Number.isFinite(this.p0.x + this.p0.y + this.p1.x + this.p1.y + this.p2.x + this.p2.y);
|
|
1795
|
-
}
|
|
1796
|
-
getPointAt(t) {
|
|
1797
|
-
if (!1 !== this.defined) return quadPointAt(this.p0, this.p1, this.p2, t);
|
|
1798
|
-
throw new Error("defined为false的点不能getPointAt");
|
|
1799
|
-
}
|
|
1800
|
-
calcLength() {
|
|
1801
|
-
return this._validPoint() ? quadLength(this.p0, this.p1, this.p2) : 60;
|
|
1802
|
-
}
|
|
1803
|
-
calcProjLength(direction) {
|
|
1804
|
-
return direction === Direction.ROW ? abs(this.p0.x - this.p2.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p2.y) : 0;
|
|
1805
|
-
}
|
|
1806
|
-
getAngleAt(t) {
|
|
1807
|
-
const minT = max(t - .01, 0),
|
|
1808
|
-
maxT = min(t + .01, 1),
|
|
1809
|
-
minP = this.getPointAt(minT),
|
|
1810
|
-
maxP = this.getPointAt(maxT);
|
|
1811
|
-
return atan2(maxP.y - minP.y, maxP.x - minP.x);
|
|
1812
|
-
}
|
|
1813
|
-
draw(path, x, y, sx, sy, percent) {
|
|
1814
|
-
if (path.moveTo(this.p0.x * sx + x, this.p0.y * sy + y), percent >= 1) path.quadraticCurveTo(this.p1.x * sx + x, this.p1.y * sy + y, this.p2.x * sx + x, this.p2.y * sy + y);else if (percent > 0) {
|
|
1815
|
-
const [curve1] = divideQuad(this, percent);
|
|
1816
|
-
path.quadraticCurveTo(curve1.p1.x * sx + x, curve1.p1.y * sy + y, curve1.p2.x * sx + x, curve1.p2.y * sy + y);
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
getYAt(x) {
|
|
1820
|
-
throw new Error("QuadraticBezierCurve暂不支持getYAt");
|
|
1821
|
-
}
|
|
1822
|
-
includeX(x) {
|
|
1823
|
-
throw new Error("QuadraticBezierCurve暂不支持includeX");
|
|
1824
|
-
}
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
function divideCubic(curve, t) {
|
|
1828
|
-
const {
|
|
1829
|
-
p0: p0,
|
|
1830
|
-
p1: p1,
|
|
1831
|
-
p2: p2,
|
|
1832
|
-
p3: p3
|
|
1833
|
-
} = curve,
|
|
1834
|
-
pt = cubicPointAt(p0, p1, p2, p3, t),
|
|
1835
|
-
c1 = PointService.pointAtPP(p0, p1, t),
|
|
1836
|
-
c2 = PointService.pointAtPP(p1, p2, t),
|
|
1837
|
-
c3 = PointService.pointAtPP(p2, p3, t),
|
|
1838
|
-
c12 = PointService.pointAtPP(c1, c2, t),
|
|
1839
|
-
c23 = PointService.pointAtPP(c2, c3, t);
|
|
1840
|
-
return [new CubicBezierCurve(p0, c1, c12, pt), new CubicBezierCurve(pt, c23, c3, p3)];
|
|
1841
|
-
}
|
|
1842
|
-
function divideQuad(curve, t) {
|
|
1843
|
-
const {
|
|
1844
|
-
p0: p0,
|
|
1845
|
-
p1: p1,
|
|
1846
|
-
p2: p2
|
|
1847
|
-
} = curve,
|
|
1848
|
-
pt = quadPointAt(p0, p1, p2, t),
|
|
1849
|
-
c1 = PointService.pointAtPP(p0, p1, t),
|
|
1850
|
-
c2 = PointService.pointAtPP(p1, p2, t);
|
|
1851
|
-
return [new QuadraticBezierCurve(p0, c1, pt), new QuadraticBezierCurve(pt, c2, p2)];
|
|
1852
|
-
}
|
|
1853
1774
|
class CubicBezierCurve extends Curve {
|
|
1854
1775
|
constructor(p0, p1, p2, p3) {
|
|
1855
1776
|
super(), this.type = CurveTypeEnum.CubicBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2, this.p3 = p3;
|
|
@@ -1874,22 +1795,6 @@
|
|
|
1874
1795
|
maxP = this.getPointAt(maxT);
|
|
1875
1796
|
return atan2(maxP.y - minP.y, maxP.x - minP.x);
|
|
1876
1797
|
}
|
|
1877
|
-
draw(path, x, y, sx, sy, percent) {
|
|
1878
|
-
if (path.moveTo(this.p0.x * sx + x, this.p0.y * sy + y), percent >= 1) path.bezierCurveTo(this.p1.x * sx + x, this.p1.y * sy + y, this.p2.x * sx + x, this.p2.y * sy + y, this.p3.x * sx + x, this.p3.y * sy + y);else if (percent > 0) {
|
|
1879
|
-
const [curve1] = divideCubic(this, percent);
|
|
1880
|
-
path.bezierCurveTo(curve1.p1.x * sx + x, curve1.p1.y * sy + y, curve1.p2.x * sx + x, curve1.p2.y * sy + y, curve1.p3.x * sx + x, curve1.p3.y * sy + y);
|
|
1881
|
-
}
|
|
1882
|
-
}
|
|
1883
|
-
includeX(x) {
|
|
1884
|
-
const minX = min(this.p0.x, this.p1.x, this.p2.x, this.p3.x),
|
|
1885
|
-
maxX = max(this.p0.x, this.p1.x, this.p2.x, this.p3.x);
|
|
1886
|
-
return x >= minX && x <= maxX;
|
|
1887
|
-
}
|
|
1888
|
-
getYAt(x) {
|
|
1889
|
-
const minX = min(this.p0.x, this.p1.x, this.p2.x, this.p3.x),
|
|
1890
|
-
t = (x - minX) / (max(this.p0.x, this.p1.x, this.p2.x, this.p3.x) - minX);
|
|
1891
|
-
return this.getPointAt(t).y;
|
|
1892
|
-
}
|
|
1893
1798
|
}
|
|
1894
1799
|
|
|
1895
1800
|
class LineCurve extends Curve {
|
|
@@ -1912,25 +1817,6 @@
|
|
|
1912
1817
|
calcProjLength(direction) {
|
|
1913
1818
|
return direction === Direction.ROW ? abs(this.p0.x - this.p1.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p1.y) : 0;
|
|
1914
1819
|
}
|
|
1915
|
-
draw(path, x, y, sx, sy, percent) {
|
|
1916
|
-
if (path.moveTo(this.p0.x * sx + x, this.p0.y * sy + y), percent >= 1) path.lineTo(this.p1.x * sx + x, this.p1.y * sy + y);else if (percent > 0) {
|
|
1917
|
-
const p = this.getPointAt(percent);
|
|
1918
|
-
path.lineTo(p.x * sx + x, p.y * sy + y);
|
|
1919
|
-
}
|
|
1920
|
-
}
|
|
1921
|
-
includeX(x) {
|
|
1922
|
-
return x >= this.p0.x && x <= this.p1.x || x >= this.p1.x && x <= this.p0.x;
|
|
1923
|
-
}
|
|
1924
|
-
getYAt(x) {
|
|
1925
|
-
if (this.includeX(x)) {
|
|
1926
|
-
let minP = this.p0,
|
|
1927
|
-
maxP = this.p1;
|
|
1928
|
-
this.p0.x > this.p1.x && (minP = this.p1, maxP = this.p0);
|
|
1929
|
-
const percent = (x - minP.x) / (maxP.x - minP.x);
|
|
1930
|
-
return minP.y + percent * (maxP.y - minP.y);
|
|
1931
|
-
}
|
|
1932
|
-
return 1 / 0;
|
|
1933
|
-
}
|
|
1934
1820
|
}
|
|
1935
1821
|
|
|
1936
1822
|
class SegContext {
|
|
@@ -2269,7 +2155,7 @@
|
|
|
2269
2155
|
default:
|
|
2270
2156
|
if (this._t <= 0) this.context.lineTo(this._x, y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);else {
|
|
2271
2157
|
const x1 = this._x * (1 - this._t) + x * this._t;
|
|
2272
|
-
|
|
2158
|
+
this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
|
|
2273
2159
|
}
|
|
2274
2160
|
}
|
|
2275
2161
|
this._lastDefined = p.defined, this._x = x, this._y = y, this.lastPoint = p;
|
|
@@ -2467,45 +2353,6 @@
|
|
|
2467
2353
|
}
|
|
2468
2354
|
const genCatmullRomClosedSegments = commonGenCatmullRomSegments("catmullRomClosed", CatmullRomClosed);
|
|
2469
2355
|
|
|
2470
|
-
class CurveContext {
|
|
2471
|
-
constructor(path) {
|
|
2472
|
-
this.path = path, this._lastX = this._lastY = this._startX = this._startY = 0;
|
|
2473
|
-
}
|
|
2474
|
-
moveTo(x, y) {
|
|
2475
|
-
return this._lastX = this._startX = x, this._lastY = this._startY = y, this;
|
|
2476
|
-
}
|
|
2477
|
-
lineTo(x, y) {
|
|
2478
|
-
const curve = this.addLinearCurve(x, y);
|
|
2479
|
-
this.path.addCurve(curve), this._lastX = x, this._lastY = y;
|
|
2480
|
-
}
|
|
2481
|
-
addLinearCurve(x, y) {
|
|
2482
|
-
return new LineCurve(new Point(this._lastX, this._lastY), new Point(x, y));
|
|
2483
|
-
}
|
|
2484
|
-
quadraticCurveTo(aCPx, aCPy, aX, aY) {
|
|
2485
|
-
const curve = new QuadraticBezierCurve(new Point(this._lastX, this._lastY), new Point(aCPx, aCPy), new Point(aX, aY));
|
|
2486
|
-
this.path.addCurve(curve), this._lastX = aX, this._lastY = aY;
|
|
2487
|
-
}
|
|
2488
|
-
bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
|
|
2489
|
-
const curve = new CubicBezierCurve(new Point(this._lastX, this._lastY), new Point(cp1x, cp1y), new Point(cp2x, cp2y), new Point(x, y));
|
|
2490
|
-
this.path.addCurve(curve), this._lastX = x, this._lastY = y;
|
|
2491
|
-
}
|
|
2492
|
-
arcTo(aX1, aY1, aX2, aY2, aRadius) {
|
|
2493
|
-
throw new Error("CurveContext不支持调用arcTo");
|
|
2494
|
-
}
|
|
2495
|
-
ellipse(aX, aY, xRadius, yRadius, aRotation, aStartAngle, aEndAngle, aClockwise) {
|
|
2496
|
-
throw new Error("CurveContext不支持调用ellipse");
|
|
2497
|
-
}
|
|
2498
|
-
rect(x, y, w, h) {
|
|
2499
|
-
throw new Error("CurveContext不支持调用rect");
|
|
2500
|
-
}
|
|
2501
|
-
arc(x, y, radius, startAngle, endAngle, counterclockwise) {
|
|
2502
|
-
throw new Error("CurveContext不支持调用arc");
|
|
2503
|
-
}
|
|
2504
|
-
closePath() {
|
|
2505
|
-
this.path.curves.length < 2 || this.lineTo(this._startX, this._startY);
|
|
2506
|
-
}
|
|
2507
|
-
}
|
|
2508
|
-
|
|
2509
2356
|
function calcLineCache(points, curveType, params) {
|
|
2510
2357
|
var _a, _b;
|
|
2511
2358
|
switch (curveType) {
|
|
@@ -2537,9 +2384,6 @@
|
|
|
2537
2384
|
constructor(ctx) {
|
|
2538
2385
|
super(), this.commandList = [], ctx && (this._ctx = ctx), this._boundsContext = new BoundsContext(this.bounds);
|
|
2539
2386
|
}
|
|
2540
|
-
get curves() {
|
|
2541
|
-
return this.tryBuildCurves();
|
|
2542
|
-
}
|
|
2543
2387
|
setCtx(ctx) {
|
|
2544
2388
|
this._ctx = ctx;
|
|
2545
2389
|
}
|
|
@@ -2571,21 +2415,14 @@
|
|
|
2571
2415
|
return this.commandList.push([enumCommandMap.Z]), this._ctx && this._ctx.closePath(), this;
|
|
2572
2416
|
}
|
|
2573
2417
|
addCurve(curve) {
|
|
2574
|
-
this.
|
|
2418
|
+
this.curves.push(curve);
|
|
2575
2419
|
}
|
|
2576
2420
|
clear() {
|
|
2577
|
-
this.transformCbList = null, this.commandList.length = 0, this.
|
|
2421
|
+
this.transformCbList = null, this.commandList.length = 0, this.curves.length = 0;
|
|
2578
2422
|
}
|
|
2579
2423
|
beginPath() {
|
|
2580
2424
|
this.clear();
|
|
2581
2425
|
}
|
|
2582
|
-
tryBuildCurves() {
|
|
2583
|
-
if (!this._curves || !this._curves.length) {
|
|
2584
|
-
const curveContext = new CurveContext(this);
|
|
2585
|
-
renderCommandList(this.commandList, curveContext, 0, 0, 1, 1);
|
|
2586
|
-
}
|
|
2587
|
-
return this._curves;
|
|
2588
|
-
}
|
|
2589
2426
|
toString() {
|
|
2590
2427
|
if (!this.toStringCbList) {
|
|
2591
2428
|
const list = [];
|
|
@@ -2616,7 +2453,7 @@
|
|
|
2616
2453
|
} = line.attribute;
|
|
2617
2454
|
if (!points) return;
|
|
2618
2455
|
const cache = calcLineCache(points, curveType);
|
|
2619
|
-
"x" === clipRangeByDimension ? this.direction = Direction.ROW : "y" === clipRangeByDimension ? this.direction = Direction.COLUMN : "auto" === clipRangeByDimension && (this.direction = cache.direction), this.
|
|
2456
|
+
"x" === clipRangeByDimension ? this.direction = Direction.ROW : "y" === clipRangeByDimension ? this.direction = Direction.COLUMN : "auto" === clipRangeByDimension && (this.direction = cache.direction), this.curves = cache.curves;
|
|
2620
2457
|
}
|
|
2621
2458
|
fromCustomPath2D(path, x, y, sX, sY) {
|
|
2622
2459
|
return this.clear(), this._runCommandList(path.commandList, x, y, sX, sY), this._updateBounds(), this;
|
|
@@ -2704,10 +2541,10 @@
|
|
|
2704
2541
|
x = current[5], y = current[6], controlX = current[3], controlY = current[4], this.bezierCurveTo(current[1] + l, current[2] + t, controlX + l, controlY + t, x + l, y + t);
|
|
2705
2542
|
break;
|
|
2706
2543
|
case "s":
|
|
2707
|
-
tempX = x + current[3], tempY = y + current[4],
|
|
2544
|
+
tempX = x + current[3], tempY = y + current[4], controlX = 2 * x - controlX, controlY = 2 * y - controlY, this.bezierCurveTo(controlX + l, controlY + t, x + current[1] + l, y + current[2] + t, tempX + l, tempY + t), controlX = x + current[1], controlY = y + current[2], x = tempX, y = tempY;
|
|
2708
2545
|
break;
|
|
2709
2546
|
case "S":
|
|
2710
|
-
tempX = current[3], tempY = current[4],
|
|
2547
|
+
tempX = current[3], tempY = current[4], controlX = 2 * x - controlX, controlY = 2 * y - controlY, this.bezierCurveTo(controlX + l, controlY + t, current[1] + l, current[2] + t, tempX + l, tempY + t), x = tempX, y = tempY, controlX = current[1], controlY = current[2];
|
|
2711
2548
|
break;
|
|
2712
2549
|
case "q":
|
|
2713
2550
|
tempX = x + current[3], tempY = y + current[4], controlX = x + current[1], controlY = y + current[2], this.quadraticCurveTo(controlX + l, controlY + t, tempX + l, tempY + t), x = tempX, y = tempY;
|
|
@@ -2779,29 +2616,21 @@
|
|
|
2779
2616
|
}
|
|
2780
2617
|
getLength() {
|
|
2781
2618
|
if (this.direction === Direction.COLUMN) {
|
|
2782
|
-
if (!this.
|
|
2783
|
-
const sc = this.
|
|
2784
|
-
ec = this.
|
|
2619
|
+
if (!this.curves.length) return 0;
|
|
2620
|
+
const sc = this.curves[0],
|
|
2621
|
+
ec = this.curves[this.curves.length - 1];
|
|
2785
2622
|
return abs(sc.p0.y - ec.p1.y);
|
|
2786
2623
|
}
|
|
2787
2624
|
if (this.direction === Direction.ROW) {
|
|
2788
|
-
if (!this.
|
|
2789
|
-
const sc = this.
|
|
2790
|
-
ec = this.
|
|
2625
|
+
if (!this.curves.length) return 0;
|
|
2626
|
+
const sc = this.curves[0],
|
|
2627
|
+
ec = this.curves[this.curves.length - 1];
|
|
2791
2628
|
return abs(sc.p0.x - ec.p1.x);
|
|
2792
2629
|
}
|
|
2793
|
-
return this.
|
|
2794
|
-
}
|
|
2795
|
-
getYAt(x) {
|
|
2796
|
-
if (!this.curves) return 1 / 0;
|
|
2797
|
-
for (let i = 0; i < this.curves.length; i++) {
|
|
2798
|
-
const curve = this.curves[i];
|
|
2799
|
-
if (curve.includeX(x)) return curve.getYAt(x);
|
|
2800
|
-
}
|
|
2801
|
-
return 1 / 0;
|
|
2630
|
+
return this.curves.reduce((l, c) => l + c.getLength(), 0);
|
|
2802
2631
|
}
|
|
2803
2632
|
getAttrAt(distance) {
|
|
2804
|
-
if (!this.
|
|
2633
|
+
if (!this.curves) return {
|
|
2805
2634
|
pos: {
|
|
2806
2635
|
x: 0,
|
|
2807
2636
|
y: 0
|
|
@@ -2810,8 +2639,8 @@
|
|
|
2810
2639
|
};
|
|
2811
2640
|
let curve,
|
|
2812
2641
|
_dis = 0;
|
|
2813
|
-
for (let i = 0; i < this.
|
|
2814
|
-
curve = this.
|
|
2642
|
+
for (let i = 0; i < this.curves.length; i++) {
|
|
2643
|
+
curve = this.curves[i];
|
|
2815
2644
|
const cl = curve.getLength(this.direction);
|
|
2816
2645
|
if (_dis + cl >= distance) break;
|
|
2817
2646
|
_dis += cl;
|
|
@@ -2822,21 +2651,6 @@
|
|
|
2822
2651
|
angle: curve.getAngleAt(t)
|
|
2823
2652
|
};
|
|
2824
2653
|
}
|
|
2825
|
-
drawWithClipRange(ctx, size, x, y, clipRange) {
|
|
2826
|
-
this.tryBuildCurves();
|
|
2827
|
-
const totalLen = this.getLength() * clipRange;
|
|
2828
|
-
let currLen = 0;
|
|
2829
|
-
for (let i = 0; i < this._curves.length; i++) {
|
|
2830
|
-
const curve = this._curves[i],
|
|
2831
|
-
cl = curve.getLength(this.direction);
|
|
2832
|
-
if (!(currLen + cl <= totalLen)) {
|
|
2833
|
-
const percent = 1 - (currLen + cl - totalLen) / cl;
|
|
2834
|
-
curve.draw(ctx, x, y, size, size, percent);
|
|
2835
|
-
break;
|
|
2836
|
-
}
|
|
2837
|
-
curve.draw(ctx, x, y, size, size, 1), currLen += cl;
|
|
2838
|
-
}
|
|
2839
|
-
}
|
|
2840
2654
|
}
|
|
2841
2655
|
const temp = ["l", 0, 0, 0, 0, 0, 0, 0];
|
|
2842
2656
|
function scale(current, sX, sY) {
|
|
@@ -2934,9 +2748,6 @@
|
|
|
2934
2748
|
forceBoundsHeight: void 0,
|
|
2935
2749
|
opacity: 1,
|
|
2936
2750
|
background: null,
|
|
2937
|
-
autoAnimateTexture: !1,
|
|
2938
|
-
textureRatio: 1,
|
|
2939
|
-
textureOptions: null,
|
|
2940
2751
|
backgroundOpacity: 1,
|
|
2941
2752
|
backgroundCornerRadius: 0,
|
|
2942
2753
|
texture: null,
|
|
@@ -2945,13 +2756,7 @@
|
|
|
2945
2756
|
texturePadding: 2,
|
|
2946
2757
|
backgroundMode: "no-repeat",
|
|
2947
2758
|
backgroundFit: !0,
|
|
2948
|
-
backgroundKeepAspectRatio: !1,
|
|
2949
|
-
backgroundClip: !0,
|
|
2950
|
-
backgroundScale: 1,
|
|
2951
|
-
backgroundOffsetX: 0,
|
|
2952
|
-
backgroundOffsetY: 0,
|
|
2953
2759
|
blur: 0,
|
|
2954
|
-
filter: "",
|
|
2955
2760
|
cursor: null,
|
|
2956
2761
|
html: null,
|
|
2957
2762
|
react: null
|
|
@@ -2988,8 +2793,7 @@
|
|
|
2988
2793
|
globalCompositeOperation: "",
|
|
2989
2794
|
overflow: "hidden",
|
|
2990
2795
|
shadowPickMode: "graphic",
|
|
2991
|
-
keepStrokeScale: !1
|
|
2992
|
-
clipConfig: null
|
|
2796
|
+
keepStrokeScale: !1
|
|
2993
2797
|
}, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
|
|
2994
2798
|
const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
2995
2799
|
startAngle: 0,
|
|
@@ -3030,8 +2834,7 @@
|
|
|
3030
2834
|
justifyContent: "flex-start",
|
|
3031
2835
|
alignItems: "flex-start",
|
|
3032
2836
|
alignContent: "flex-start",
|
|
3033
|
-
baseOpacity: 1
|
|
3034
|
-
cornerType: "round"
|
|
2837
|
+
baseOpacity: 1
|
|
3035
2838
|
});
|
|
3036
2839
|
const DefaultGlyphAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
3037
2840
|
path: "",
|
|
@@ -3052,7 +2855,6 @@
|
|
|
3052
2855
|
const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
3053
2856
|
path: new CustomPath2D(),
|
|
3054
2857
|
fillStrokeOrder: 1,
|
|
3055
|
-
clipRange: 1,
|
|
3056
2858
|
customPath: () => {
|
|
3057
2859
|
Logger.getInstance().warn("空函数");
|
|
3058
2860
|
}
|
|
@@ -3068,8 +2870,7 @@
|
|
|
3068
2870
|
x1: 0,
|
|
3069
2871
|
y1: 0,
|
|
3070
2872
|
strokeBoundsBuffer: 0,
|
|
3071
|
-
cornerRadius: 0
|
|
3072
|
-
cornerType: "round"
|
|
2873
|
+
cornerRadius: 0
|
|
3073
2874
|
});
|
|
3074
2875
|
Object.assign(Object.assign({}, DefaultAttribute), {
|
|
3075
2876
|
width: 0,
|
|
@@ -3077,24 +2878,19 @@
|
|
|
3077
2878
|
x1: 0,
|
|
3078
2879
|
y1: 0,
|
|
3079
2880
|
cornerRadius: 0,
|
|
3080
|
-
length: 0
|
|
3081
|
-
cornerType: "round"
|
|
2881
|
+
length: 0
|
|
3082
2882
|
});
|
|
3083
2883
|
const DefaultSymbolAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
3084
2884
|
symbolType: "circle",
|
|
3085
2885
|
size: 10,
|
|
3086
|
-
keepDirIn3d: !0
|
|
3087
|
-
clipRange: 1
|
|
2886
|
+
keepDirIn3d: !0
|
|
3088
2887
|
});
|
|
3089
2888
|
const DefaultTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), {
|
|
3090
2889
|
strokeBoundsBuffer: 0,
|
|
3091
2890
|
keepDirIn3d: !0
|
|
3092
2891
|
});
|
|
3093
2892
|
const DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), {
|
|
3094
|
-
upgradeAttrs: null,
|
|
3095
2893
|
editable: !1,
|
|
3096
|
-
editOptions: null,
|
|
3097
|
-
ascentDescentMode: "actual",
|
|
3098
2894
|
width: 300,
|
|
3099
2895
|
height: 300,
|
|
3100
2896
|
ellipsis: !0,
|
|
@@ -3114,13 +2910,10 @@
|
|
|
3114
2910
|
repeatY: "no-repeat",
|
|
3115
2911
|
image: "",
|
|
3116
2912
|
width: 0,
|
|
3117
|
-
height: 0
|
|
3118
|
-
maxWidth: 500,
|
|
3119
|
-
maxHeight: 500
|
|
2913
|
+
height: 0
|
|
3120
2914
|
}, DefaultAttribute), {
|
|
3121
2915
|
fill: !0,
|
|
3122
|
-
cornerRadius: 0
|
|
3123
|
-
cornerType: "round"
|
|
2916
|
+
cornerRadius: 0
|
|
3124
2917
|
});
|
|
3125
2918
|
const DefaultRichTextIconAttribute = Object.assign(Object.assign({}, DefaultImageAttribute), {
|
|
3126
2919
|
backgroundShowMode: "never",
|
|
@@ -3800,26 +3593,8 @@
|
|
|
3800
3593
|
return (t *= 2) < 1 ? amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period) * -.5 : amplitude * Math.pow(2, -10 * (t -= 1)) * Math.sin((t - s) * pi2 / period) * .5 + 1;
|
|
3801
3594
|
};
|
|
3802
3595
|
}
|
|
3803
|
-
static registerFunc(name, func) {
|
|
3804
|
-
Easing[name] = func;
|
|
3805
|
-
}
|
|
3806
|
-
}
|
|
3807
|
-
function flicker(t, n) {
|
|
3808
|
-
const step = 1 / n;
|
|
3809
|
-
let flag = 1;
|
|
3810
|
-
for (; t > step;) t -= step, flag *= -1;
|
|
3811
|
-
const v = flag * t / step;
|
|
3812
|
-
return v > 0 ? v : 1 + v;
|
|
3813
3596
|
}
|
|
3814
|
-
Easing.quadIn = Easing.getPowIn(2), Easing.quadOut = Easing.getPowOut(2), Easing.quadInOut = Easing.getPowInOut(2), Easing.cubicIn = Easing.getPowIn(3), Easing.cubicOut = Easing.getPowOut(3), Easing.cubicInOut = Easing.getPowInOut(3), Easing.quartIn = Easing.getPowIn(4), Easing.quartOut = Easing.getPowOut(4), Easing.quartInOut = Easing.getPowInOut(4), Easing.quintIn = Easing.getPowIn(5), Easing.quintOut = Easing.getPowOut(5), Easing.quintInOut = Easing.getPowInOut(5), Easing.backIn = Easing.getBackIn(1.7), Easing.backOut = Easing.getBackOut(1.7), Easing.backInOut = Easing.getBackInOut(1.7), Easing.elasticIn = Easing.getElasticIn(1, .3), Easing.elasticOut = Easing.getElasticOut(1, .3), Easing.elasticInOut = Easing.getElasticInOut(1, .3 * 1.5)
|
|
3815
|
-
const c4 = 2 * Math.PI / 3;
|
|
3816
|
-
return 0 === x ? 0 : 1 === x ? 1 : Math.pow(2, -10 * x) * Math.sin((10 * x - .75) * c4) + 1;
|
|
3817
|
-
}, Easing.easeInOutElastic = x => {
|
|
3818
|
-
const c5 = 2 * Math.PI / 4.5;
|
|
3819
|
-
return 0 === x ? 0 : 1 === x ? 1 : x < .5 ? -Math.pow(2, 20 * x - 10) * Math.sin((20 * x - 11.125) * c5) / 2 : Math.pow(2, -20 * x + 10) * Math.sin((20 * x - 11.125) * c5) / 2 + 1;
|
|
3820
|
-
};
|
|
3821
|
-
for (let i = 0; i < 10; i++) Easing[`flicker${i}`] = t => flicker(t, i);
|
|
3822
|
-
for (let i = 2; i < 10; i++) Easing[`aIn${i}`] = t => i * t * t + (1 - i) * t;
|
|
3597
|
+
Easing.quadIn = Easing.getPowIn(2), Easing.quadOut = Easing.getPowOut(2), Easing.quadInOut = Easing.getPowInOut(2), Easing.cubicIn = Easing.getPowIn(3), Easing.cubicOut = Easing.getPowOut(3), Easing.cubicInOut = Easing.getPowInOut(3), Easing.quartIn = Easing.getPowIn(4), Easing.quartOut = Easing.getPowOut(4), Easing.quartInOut = Easing.getPowInOut(4), Easing.quintIn = Easing.getPowIn(5), Easing.quintOut = Easing.getPowOut(5), Easing.quintInOut = Easing.getPowInOut(5), Easing.backIn = Easing.getBackIn(1.7), Easing.backOut = Easing.getBackOut(1.7), Easing.backInOut = Easing.getBackInOut(1.7), Easing.elasticIn = Easing.getElasticIn(1, .3), Easing.elasticOut = Easing.getElasticOut(1, .3), Easing.elasticInOut = Easing.getElasticInOut(1, .3 * 1.5);
|
|
3823
3598
|
|
|
3824
3599
|
class DefaultTimeline {
|
|
3825
3600
|
constructor() {
|
|
@@ -3898,7 +3673,7 @@
|
|
|
3898
3673
|
let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
|
|
3899
3674
|
let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
|
|
3900
3675
|
let slience = arguments.length > 2 ? arguments[2] : undefined;
|
|
3901
|
-
this.id = id, this.timeline = timeline
|
|
3676
|
+
this.id = id, this.timeline = timeline, this.status = AnimateStatus.INITIAL, this.tailAnimate = new SubAnimate(this), this.subAnimates = [this.tailAnimate], this.timeScale = 1, this.rawPosition = -1, this._startTime = 0, this._duringTime = 0, this.timeline.addAnimate(this), this.slience = slience;
|
|
3902
3677
|
}
|
|
3903
3678
|
setTimeline(timeline) {
|
|
3904
3679
|
timeline !== this.timeline && (this.timeline.removeAnimate(this, !1), timeline.addAnimate(this));
|
|
@@ -4094,7 +3869,7 @@
|
|
|
4094
3869
|
(null == duration || duration < 0) && (duration = 0);
|
|
4095
3870
|
const easingFunc = "string" == typeof easing ? Easing[easing] : easing,
|
|
4096
3871
|
step = this._addStep(duration, null, easingFunc);
|
|
4097
|
-
return step.type = AnimateStepType.to, this._appendProps(props, step, !!params && params.tempProps), step.propKeys || (step.propKeys = Object.keys(step.props)), params && params.noPreventAttrs || this.target.animates
|
|
3872
|
+
return step.type = AnimateStepType.to, this._appendProps(props, step, !!params && params.tempProps), step.propKeys || (step.propKeys = Object.keys(step.props)), params && params.noPreventAttrs || this.target.animates.forEach(a => {
|
|
4098
3873
|
a.id !== this.animate.id && a.preventAttrs(step.propKeys);
|
|
4099
3874
|
}), this;
|
|
4100
3875
|
}
|
|
@@ -4473,785 +4248,7 @@
|
|
|
4473
4248
|
}
|
|
4474
4249
|
ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [], ResourceLoader.onLoadSuccessCb = [];
|
|
4475
4250
|
|
|
4476
|
-
|
|
4477
|
-
bounds(size, bounds) {
|
|
4478
|
-
if (isNumber$1(size)) {
|
|
4479
|
-
const halfS = size / 2;
|
|
4480
|
-
bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
|
|
4481
|
-
} else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
|
|
4482
|
-
}
|
|
4483
|
-
parseSize(size) {
|
|
4484
|
-
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
4485
|
-
}
|
|
4486
|
-
}
|
|
4487
|
-
|
|
4488
|
-
function circle(ctx, r, x, y, z) {
|
|
4489
|
-
return z ? ctx.arc(x, y, r, 0, tau, !1, z) : ctx.arc(x, y, r, 0, tau), !1;
|
|
4490
|
-
}
|
|
4491
|
-
class CircleSymbol extends BaseSymbol {
|
|
4492
|
-
constructor() {
|
|
4493
|
-
super(...arguments), this.type = "circle", this.pathStr = "M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0";
|
|
4494
|
-
}
|
|
4495
|
-
draw(ctx, size, x, y, z) {
|
|
4496
|
-
return circle(ctx, this.parseSize(size) / 2, x, y, z);
|
|
4497
|
-
}
|
|
4498
|
-
drawOffset(ctx, size, x, y, offset, z) {
|
|
4499
|
-
return circle(ctx, this.parseSize(size) / 2 + offset, x, y, z);
|
|
4500
|
-
}
|
|
4501
|
-
drawToSvgPath(size, x, y, z) {
|
|
4502
|
-
const r = this.parseSize(size) / 2;
|
|
4503
|
-
return `M ${x - r}, ${y} a ${r},${r} 0 1,0 ${2 * r},0 a ${r},${r} 0 1,0 -${2 * r},0`;
|
|
4504
|
-
}
|
|
4505
|
-
}
|
|
4506
|
-
var circle$1 = new CircleSymbol();
|
|
4507
|
-
|
|
4508
|
-
function cross(ctx, r, x, y, z) {
|
|
4509
|
-
return ctx.moveTo(-3 * r + x, -r + y, z), ctx.lineTo(-r + x, -r + y, z), ctx.lineTo(-r + x, -3 * r + y, z), ctx.lineTo(r + x, -3 * r + y, z), ctx.lineTo(r + x, -r + y, z), ctx.lineTo(3 * r + x, -r + y, z), ctx.lineTo(3 * r + x, r + y, z), ctx.lineTo(r + x, r + y, z), ctx.lineTo(r + x, 3 * r + y, z), ctx.lineTo(-r + x, 3 * r + y, z), ctx.lineTo(-r + x, r + y, z), ctx.lineTo(-3 * r + x, r + y, z), ctx.closePath(), !0;
|
|
4510
|
-
}
|
|
4511
|
-
function crossOffset(ctx, r, x, y, offset, z) {
|
|
4512
|
-
return ctx.moveTo(-3 * r + x - offset, -r + y - offset, z), ctx.lineTo(-r + x - offset, -r + y - offset, z), ctx.lineTo(-r + x - offset, -3 * r + y - offset, z), ctx.lineTo(r + x + offset, -3 * r + y - offset, z), ctx.lineTo(r + x + offset, -r + y - offset, z), ctx.lineTo(3 * r + x + offset, -r + y - offset, z), ctx.lineTo(3 * r + x + offset, r + y + offset, z), ctx.lineTo(r + x + offset, r + y + offset, z), ctx.lineTo(r + x + offset, 3 * r + y + offset, z), ctx.lineTo(-r + x - offset, 3 * r + y + offset, z), ctx.lineTo(-r + x - offset, r + y + offset, z), ctx.lineTo(-3 * r + x - offset, r + y + offset, z), ctx.closePath(), !0;
|
|
4513
|
-
}
|
|
4514
|
-
class CrossSymbol extends BaseSymbol {
|
|
4515
|
-
constructor() {
|
|
4516
|
-
super(...arguments), this.type = "cross", this.pathStr = "M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z";
|
|
4517
|
-
}
|
|
4518
|
-
draw(ctx, size, x, y, z) {
|
|
4519
|
-
return cross(ctx, this.parseSize(size) / 6, x, y, z);
|
|
4520
|
-
}
|
|
4521
|
-
drawOffset(ctx, size, x, y, offset, z) {
|
|
4522
|
-
return crossOffset(ctx, this.parseSize(size) / 6, x, y, offset, z);
|
|
4523
|
-
}
|
|
4524
|
-
}
|
|
4525
|
-
var cross$1 = new CrossSymbol();
|
|
4526
|
-
|
|
4527
|
-
function diamond(ctx, r, x, y, z) {
|
|
4528
|
-
return ctx.moveTo(x, y - r, z), ctx.lineTo(r + x, y, z), ctx.lineTo(x, y + r, z), ctx.lineTo(x - r, y, z), ctx.closePath(), !0;
|
|
4529
|
-
}
|
|
4530
|
-
class DiamondSymbol extends BaseSymbol {
|
|
4531
|
-
constructor() {
|
|
4532
|
-
super(...arguments), this.type = "diamond", this.pathStr = "M-0.5,0L0,-0.5L0.5,0L0,0.5Z";
|
|
4533
|
-
}
|
|
4534
|
-
draw(ctx, size, x, y, z) {
|
|
4535
|
-
return diamond(ctx, this.parseSize(size) / 2, x, y, z);
|
|
4536
|
-
}
|
|
4537
|
-
drawFitDir(ctx, size, x, y, z) {
|
|
4538
|
-
return diamond(ctx, this.parseSize(size) / 2, x, y, z);
|
|
4539
|
-
}
|
|
4540
|
-
drawOffset(ctx, size, x, y, offset, z) {
|
|
4541
|
-
return diamond(ctx, this.parseSize(size) / 2 + offset, x, y, z);
|
|
4542
|
-
}
|
|
4543
|
-
}
|
|
4544
|
-
var diamond$1 = new DiamondSymbol();
|
|
4545
|
-
|
|
4546
|
-
function square(ctx, r, x, y) {
|
|
4547
|
-
const wh = 2 * r;
|
|
4548
|
-
return ctx.rect(x - r, y - r, wh, wh), !1;
|
|
4549
|
-
}
|
|
4550
|
-
class SquareSymbol extends BaseSymbol {
|
|
4551
|
-
constructor() {
|
|
4552
|
-
super(...arguments), this.type = "square", this.pathStr = "M-0.5,-0.5h1v1h-1Z";
|
|
4553
|
-
}
|
|
4554
|
-
draw(ctx, size, x, y) {
|
|
4555
|
-
return square(ctx, this.parseSize(size) / 2, x, y);
|
|
4556
|
-
}
|
|
4557
|
-
drawOffset(ctx, size, x, y, offset) {
|
|
4558
|
-
return square(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
4559
|
-
}
|
|
4560
|
-
}
|
|
4561
|
-
var square$1 = new SquareSymbol();
|
|
4562
|
-
|
|
4563
|
-
function trianglUpOffset(ctx, r, x, y) {
|
|
4564
|
-
let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
4565
|
-
return ctx.moveTo(x + r + 2 * offset, r + y + offset), ctx.lineTo(x - r - 2 * offset, r + y + offset), ctx.lineTo(x, y - r - 2 * offset), ctx.closePath(), !0;
|
|
4566
|
-
}
|
|
4567
|
-
class TriangleUpSymbol extends BaseSymbol {
|
|
4568
|
-
constructor() {
|
|
4569
|
-
super(...arguments), this.type = "triangleUp", this.pathStr = "M0.5,0.5 L-0.5,0.5 L0,-0.5 Z";
|
|
4570
|
-
}
|
|
4571
|
-
draw(ctx, size, x, y) {
|
|
4572
|
-
return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
4573
|
-
}
|
|
4574
|
-
drawOffset(ctx, size, x, y, offset) {
|
|
4575
|
-
return trianglUpOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
4576
|
-
}
|
|
4577
|
-
}
|
|
4578
|
-
var triangleUp = new TriangleUpSymbol();
|
|
4579
|
-
|
|
4580
|
-
class TriangleSymbol extends TriangleUpSymbol {
|
|
4581
|
-
constructor() {
|
|
4582
|
-
super(...arguments), this.type = "triangle";
|
|
4583
|
-
}
|
|
4584
|
-
}
|
|
4585
|
-
var triangle = new TriangleSymbol();
|
|
4586
|
-
|
|
4587
|
-
const kr = Math.sin(Math.PI / 10) / Math.sin(7 * Math.PI / 10),
|
|
4588
|
-
kx = Math.sin(tau / 10) * kr,
|
|
4589
|
-
ky = -Math.cos(tau / 10) * kr;
|
|
4590
|
-
function star(ctx, r, transX, transY) {
|
|
4591
|
-
const x = kx * r,
|
|
4592
|
-
y = ky * r;
|
|
4593
|
-
ctx.moveTo(transX, -r + transY), ctx.lineTo(x + transX, y + transY);
|
|
4594
|
-
for (let i = 1; i < 5; ++i) {
|
|
4595
|
-
const a = tau * i / 5,
|
|
4596
|
-
c = Math.cos(a),
|
|
4597
|
-
s = Math.sin(a);
|
|
4598
|
-
ctx.lineTo(s * r + transX, -c * r + transY), ctx.lineTo(c * x - s * y + transX, s * x + c * y + transY);
|
|
4599
|
-
}
|
|
4600
|
-
return ctx.closePath(), !0;
|
|
4601
|
-
}
|
|
4602
|
-
class StarSymbol extends BaseSymbol {
|
|
4603
|
-
constructor() {
|
|
4604
|
-
super(...arguments), this.type = "star", this.pathStr = "M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z";
|
|
4605
|
-
}
|
|
4606
|
-
draw(ctx, size, transX, transY) {
|
|
4607
|
-
return star(ctx, this.parseSize(size) / 2, transX, transY);
|
|
4608
|
-
}
|
|
4609
|
-
drawOffset(ctx, size, transX, transY, offset) {
|
|
4610
|
-
return star(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
4611
|
-
}
|
|
4612
|
-
}
|
|
4613
|
-
var star$1 = new StarSymbol();
|
|
4614
|
-
|
|
4615
|
-
const sqrt3$1 = sqrt(3);
|
|
4616
|
-
function arrow(ctx, r, transX, transY) {
|
|
4617
|
-
const triangleH = r,
|
|
4618
|
-
trangleBottomSide = triangleH / sqrt3$1,
|
|
4619
|
-
rectW = trangleBottomSide / 5,
|
|
4620
|
-
rectH = r;
|
|
4621
|
-
return ctx.moveTo(0 + transX, -triangleH + transY), ctx.lineTo(trangleBottomSide / 2 + transX, transY), ctx.lineTo(rectW / 2 + transX, transY), ctx.lineTo(rectW / 2 + transX, rectH + transY), ctx.lineTo(-rectW / 2 + transX, rectH + transY), ctx.lineTo(-rectW / 2 + transX, transY), ctx.lineTo(-trangleBottomSide / 2 + transX, transY), ctx.closePath(), !0;
|
|
4622
|
-
}
|
|
4623
|
-
class ArrowSymbol extends BaseSymbol {
|
|
4624
|
-
constructor() {
|
|
4625
|
-
super(...arguments), this.type = "arrow", this.pathStr = "M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z";
|
|
4626
|
-
}
|
|
4627
|
-
draw(ctx, size, transX, transY) {
|
|
4628
|
-
return arrow(ctx, this.parseSize(size) / 2, transX, transY);
|
|
4629
|
-
}
|
|
4630
|
-
drawOffset(ctx, size, transX, transY, offset) {
|
|
4631
|
-
return arrow(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
4632
|
-
}
|
|
4633
|
-
}
|
|
4634
|
-
var arrow$1 = new ArrowSymbol();
|
|
4635
|
-
|
|
4636
|
-
function wedge(ctx, r, transX, transY) {
|
|
4637
|
-
const h = 2 * r;
|
|
4638
|
-
return ctx.moveTo(transX, -r + transY), ctx.lineTo(h / 3 / 2 + transX, r + transY), ctx.lineTo(-h / 3 / 2 + transX, r + transY), ctx.closePath(), !0;
|
|
4639
|
-
}
|
|
4640
|
-
class WedgeSymbol extends BaseSymbol {
|
|
4641
|
-
constructor() {
|
|
4642
|
-
super(...arguments), this.type = "wedge", this.pathStr = "M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z";
|
|
4643
|
-
}
|
|
4644
|
-
draw(ctx, size, transX, transY) {
|
|
4645
|
-
return wedge(ctx, this.parseSize(size) / 2, transX, transY);
|
|
4646
|
-
}
|
|
4647
|
-
drawOffset(ctx, size, transX, transY, offset) {
|
|
4648
|
-
return wedge(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
4649
|
-
}
|
|
4650
|
-
}
|
|
4651
|
-
var wedge$1 = new WedgeSymbol();
|
|
4652
|
-
|
|
4653
|
-
function stroke(ctx, r, transX, transY) {
|
|
4654
|
-
return ctx.moveTo(-r + transX, transY), ctx.lineTo(transX, r + transY), !1;
|
|
4655
|
-
}
|
|
4656
|
-
class StrokeSymbol extends BaseSymbol {
|
|
4657
|
-
constructor() {
|
|
4658
|
-
super(...arguments), this.type = "stroke", this.pathStr = "";
|
|
4659
|
-
}
|
|
4660
|
-
draw(ctx, size, transX, transY) {
|
|
4661
|
-
return stroke(ctx, this.parseSize(size) / 2, transX, transY);
|
|
4662
|
-
}
|
|
4663
|
-
drawOffset(ctx, size, transX, transY, offset) {
|
|
4664
|
-
return stroke(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
4665
|
-
}
|
|
4666
|
-
}
|
|
4667
|
-
var stroke$1 = new StrokeSymbol();
|
|
4668
|
-
|
|
4669
|
-
const c = -.5,
|
|
4670
|
-
s = sqrt(3) / 2,
|
|
4671
|
-
k = 1 / sqrt(12);
|
|
4672
|
-
function wye(ctx, r, transX, transY) {
|
|
4673
|
-
const x0 = r / 2,
|
|
4674
|
-
y0 = r * k,
|
|
4675
|
-
x1 = x0,
|
|
4676
|
-
y1 = r * k + r,
|
|
4677
|
-
x2 = -x1,
|
|
4678
|
-
y2 = y1;
|
|
4679
|
-
return ctx.moveTo(x0 + transX, y0 + transY), ctx.lineTo(x1 + transX, y1 + transY), ctx.lineTo(x2 + transX, y2 + transY), ctx.lineTo(c * x0 - s * y0 + transX, s * x0 + c * y0 + transY), ctx.lineTo(c * x1 - s * y1 + transX, s * x1 + c * y1 + transY), ctx.lineTo(c * x2 - s * y2 + transX, s * x2 + c * y2 + transY), ctx.lineTo(c * x0 + s * y0 + transX, c * y0 - s * x0 + transY), ctx.lineTo(c * x1 + s * y1 + transX, c * y1 - s * x1 + transY), ctx.lineTo(c * x2 + s * y2 + transX, c * y2 - s * x2 + transY), ctx.closePath(), !1;
|
|
4680
|
-
}
|
|
4681
|
-
class WyeSymbol extends BaseSymbol {
|
|
4682
|
-
constructor() {
|
|
4683
|
-
super(...arguments), this.type = "wye", this.pathStr = "M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z";
|
|
4684
|
-
}
|
|
4685
|
-
draw(ctx, size, transX, transY) {
|
|
4686
|
-
return wye(ctx, this.parseSize(size) / 2, transX, transY);
|
|
4687
|
-
}
|
|
4688
|
-
drawOffset(ctx, size, transX, transY, offset) {
|
|
4689
|
-
return wye(ctx, this.parseSize(size) / 2 + offset, transX, transY);
|
|
4690
|
-
}
|
|
4691
|
-
}
|
|
4692
|
-
var wye$1 = new WyeSymbol();
|
|
4693
|
-
|
|
4694
|
-
function trianglLeftOffset(ctx, r, x, y, offset) {
|
|
4695
|
-
return ctx.moveTo(-r + x - 2 * offset, y), ctx.lineTo(r + x + offset, r + y + 2 * offset), ctx.lineTo(r + x + offset, y - r - 2 * offset), ctx.closePath(), !0;
|
|
4696
|
-
}
|
|
4697
|
-
class TriangleLeftSymbol extends BaseSymbol {
|
|
4698
|
-
constructor() {
|
|
4699
|
-
super(...arguments), this.type = "triangleLeft", this.pathStr = "M-0.5,0 L0.5,0.5 L0.5,-0.5 Z";
|
|
4700
|
-
}
|
|
4701
|
-
draw(ctx, size, x, y) {
|
|
4702
|
-
return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, 0);
|
|
4703
|
-
}
|
|
4704
|
-
drawOffset(ctx, size, x, y, offset) {
|
|
4705
|
-
return trianglLeftOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
4706
|
-
}
|
|
4707
|
-
}
|
|
4708
|
-
var triangleLeft = new TriangleLeftSymbol();
|
|
4709
|
-
|
|
4710
|
-
function trianglRightOffset(ctx, r, x, y) {
|
|
4711
|
-
let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
4712
|
-
return ctx.moveTo(x - r - offset, r + y + 2 * offset), ctx.lineTo(r + x + 2 * offset, y), ctx.lineTo(x - r - offset, y - r - 2 * offset), ctx.closePath(), !0;
|
|
4713
|
-
}
|
|
4714
|
-
class TriangleRightSymbol extends BaseSymbol {
|
|
4715
|
-
constructor() {
|
|
4716
|
-
super(...arguments), this.type = "triangleRight", this.pathStr = "M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z";
|
|
4717
|
-
}
|
|
4718
|
-
draw(ctx, size, x, y) {
|
|
4719
|
-
return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
4720
|
-
}
|
|
4721
|
-
drawOffset(ctx, size, x, y, offset) {
|
|
4722
|
-
return trianglRightOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
4723
|
-
}
|
|
4724
|
-
}
|
|
4725
|
-
var triangleRight = new TriangleRightSymbol();
|
|
4726
|
-
|
|
4727
|
-
function trianglDownOffset(ctx, r, x, y) {
|
|
4728
|
-
let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
4729
|
-
return ctx.moveTo(x - r - 2 * offset, y - r - offset), ctx.lineTo(x + r + 2 * offset, y - r - offset), ctx.lineTo(x, y + r + 2 * offset), ctx.closePath(), !0;
|
|
4730
|
-
}
|
|
4731
|
-
class TriangleDownSymbol extends BaseSymbol {
|
|
4732
|
-
constructor() {
|
|
4733
|
-
super(...arguments), this.type = "triangleDown", this.pathStr = "M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z";
|
|
4734
|
-
}
|
|
4735
|
-
draw(ctx, size, x, y) {
|
|
4736
|
-
return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y);
|
|
4737
|
-
}
|
|
4738
|
-
drawOffset(ctx, size, x, y, offset) {
|
|
4739
|
-
return trianglDownOffset(ctx, this.parseSize(size) / 2, x, y, offset);
|
|
4740
|
-
}
|
|
4741
|
-
}
|
|
4742
|
-
var triangleDown = new TriangleDownSymbol();
|
|
4743
|
-
|
|
4744
|
-
const sqrt3 = sqrt(3);
|
|
4745
|
-
function thinTriangle(ctx, r, x, y) {
|
|
4746
|
-
const h = r * sqrt3;
|
|
4747
|
-
return ctx.moveTo(x, y + -h / 3 * 2), ctx.lineTo(r + x, y + h), ctx.lineTo(x - r, y + h), ctx.closePath(), !0;
|
|
4748
|
-
}
|
|
4749
|
-
class ThinTriangleSymbol extends BaseSymbol {
|
|
4750
|
-
constructor() {
|
|
4751
|
-
super(...arguments), this.type = "thinTriangle", this.pathStr = "M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z";
|
|
4752
|
-
}
|
|
4753
|
-
draw(ctx, size, x, y) {
|
|
4754
|
-
return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3, x, y);
|
|
4755
|
-
}
|
|
4756
|
-
drawOffset(ctx, size, x, y, offset) {
|
|
4757
|
-
return thinTriangle(ctx, this.parseSize(size) / 2 / sqrt3 + offset, x, y);
|
|
4758
|
-
}
|
|
4759
|
-
}
|
|
4760
|
-
var thinTriangle$1 = new ThinTriangleSymbol();
|
|
4761
|
-
|
|
4762
|
-
function arrow2Left(ctx, r, transX, transY) {
|
|
4763
|
-
const r2 = 2 * r;
|
|
4764
|
-
return ctx.moveTo(r + transX, transY - r2), ctx.lineTo(transX - r, transY), ctx.lineTo(r + transX, r2 + transY), !0;
|
|
4765
|
-
}
|
|
4766
|
-
class Arrow2LeftSymbol extends BaseSymbol {
|
|
4767
|
-
constructor() {
|
|
4768
|
-
super(...arguments), this.type = "arrow2Left", this.pathStr = "M 0.25 -0.5 L -0.25 0 l 0.25 0.5";
|
|
4769
|
-
}
|
|
4770
|
-
draw(ctx, size, transX, transY) {
|
|
4771
|
-
return arrow2Left(ctx, this.parseSize(size) / 4, transX, transY);
|
|
4772
|
-
}
|
|
4773
|
-
drawOffset(ctx, size, transX, transY, offset) {
|
|
4774
|
-
return arrow2Left(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
4775
|
-
}
|
|
4776
|
-
}
|
|
4777
|
-
var arrow2Left$1 = new Arrow2LeftSymbol();
|
|
4778
|
-
|
|
4779
|
-
function arrow2Right(ctx, r, transX, transY) {
|
|
4780
|
-
const r2 = 2 * r;
|
|
4781
|
-
return ctx.moveTo(transX - r, transY - r2), ctx.lineTo(transX + r, transY), ctx.lineTo(transX - r, r2 + transY), !0;
|
|
4782
|
-
}
|
|
4783
|
-
class Arrow2RightSymbol extends BaseSymbol {
|
|
4784
|
-
constructor() {
|
|
4785
|
-
super(...arguments), this.type = "arrow2Right", this.pathStr = "M -0.25 -0.5 l 0.25 0 l -0.25 0.5";
|
|
4786
|
-
}
|
|
4787
|
-
draw(ctx, size, transX, transY) {
|
|
4788
|
-
return arrow2Right(ctx, this.parseSize(size) / 4, transX, transY);
|
|
4789
|
-
}
|
|
4790
|
-
drawOffset(ctx, size, transX, transY, offset) {
|
|
4791
|
-
return arrow2Right(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
4792
|
-
}
|
|
4793
|
-
}
|
|
4794
|
-
var arrow2Right$1 = new Arrow2RightSymbol();
|
|
4795
|
-
|
|
4796
|
-
function arrow2Up(ctx, r, transX, transY) {
|
|
4797
|
-
const r2 = 2 * r;
|
|
4798
|
-
return ctx.moveTo(transX - r2, transY + r), ctx.lineTo(transX, transY - r), ctx.lineTo(transX + r2, transY + r), !0;
|
|
4799
|
-
}
|
|
4800
|
-
class Arrow2UpSymbol extends BaseSymbol {
|
|
4801
|
-
constructor() {
|
|
4802
|
-
super(...arguments), this.type = "arrow2Up", this.pathStr = "M -0.5 0.25 L 0 -0.25 l 0.5 0.25";
|
|
4803
|
-
}
|
|
4804
|
-
draw(ctx, size, transX, transY) {
|
|
4805
|
-
return arrow2Up(ctx, this.parseSize(size) / 4, transX, transY);
|
|
4806
|
-
}
|
|
4807
|
-
drawOffset(ctx, size, transX, transY, offset) {
|
|
4808
|
-
return arrow2Up(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
4809
|
-
}
|
|
4810
|
-
}
|
|
4811
|
-
var arrow2Up$1 = new Arrow2UpSymbol();
|
|
4812
|
-
|
|
4813
|
-
function arrow2Down(ctx, r, transX, transY) {
|
|
4814
|
-
const r2 = 2 * r;
|
|
4815
|
-
return ctx.moveTo(transX - r2, transY - r), ctx.lineTo(transX, transY + r), ctx.lineTo(transX + r2, transY - r), !0;
|
|
4816
|
-
}
|
|
4817
|
-
class Arrow2DownSymbol extends BaseSymbol {
|
|
4818
|
-
constructor() {
|
|
4819
|
-
super(...arguments), this.type = "arrow2Down", this.pathStr = "M -0.5 -0.25 L 0 0.25 l 0.5 -0.25";
|
|
4820
|
-
}
|
|
4821
|
-
draw(ctx, size, transX, transY) {
|
|
4822
|
-
return arrow2Down(ctx, this.parseSize(size) / 4, transX, transY);
|
|
4823
|
-
}
|
|
4824
|
-
drawOffset(ctx, size, transX, transY, offset) {
|
|
4825
|
-
return arrow2Down(ctx, this.parseSize(size) / 4 + offset, transX, transY);
|
|
4826
|
-
}
|
|
4827
|
-
}
|
|
4828
|
-
var arrow2Down$1 = new Arrow2DownSymbol();
|
|
4829
|
-
|
|
4830
|
-
function lineV(ctx, r, x, y, z) {
|
|
4831
|
-
return ctx.moveTo(x, y - r), ctx.lineTo(x, y + r), !0;
|
|
4832
|
-
}
|
|
4833
|
-
class LineVSymbol extends BaseSymbol {
|
|
4834
|
-
constructor() {
|
|
4835
|
-
super(...arguments), this.type = "lineV", this.pathStr = "M0,-0.5L0,0.5";
|
|
4836
|
-
}
|
|
4837
|
-
draw(ctx, size, x, y, z) {
|
|
4838
|
-
return lineV(ctx, this.parseSize(size) / 2, x, y);
|
|
4839
|
-
}
|
|
4840
|
-
drawOffset(ctx, size, x, y, offset, z) {
|
|
4841
|
-
return lineV(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
4842
|
-
}
|
|
4843
|
-
drawToSvgPath(size, x, y, z) {
|
|
4844
|
-
const r = this.parseSize(size) / 2;
|
|
4845
|
-
return `M ${x}, ${y - r} L ${x},${y + r}`;
|
|
4846
|
-
}
|
|
4847
|
-
}
|
|
4848
|
-
var lineV$1 = new LineVSymbol();
|
|
4849
|
-
|
|
4850
|
-
function lineH(ctx, r, x, y, z) {
|
|
4851
|
-
return ctx.moveTo(x - r, y), ctx.lineTo(x + r, y), !0;
|
|
4852
|
-
}
|
|
4853
|
-
class LineHSymbol extends BaseSymbol {
|
|
4854
|
-
constructor() {
|
|
4855
|
-
super(...arguments), this.type = "lineH", this.pathStr = "M-0.5,0L0.5,0";
|
|
4856
|
-
}
|
|
4857
|
-
draw(ctx, size, x, y, z) {
|
|
4858
|
-
return lineH(ctx, this.parseSize(size) / 2, x, y);
|
|
4859
|
-
}
|
|
4860
|
-
drawOffset(ctx, size, x, y, offset, z) {
|
|
4861
|
-
return lineH(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
4862
|
-
}
|
|
4863
|
-
drawToSvgPath(size, x, y, z) {
|
|
4864
|
-
const r = this.parseSize(size) / 2;
|
|
4865
|
-
return `M ${x - r}, ${y} L ${x + r},${y}`;
|
|
4866
|
-
}
|
|
4867
|
-
}
|
|
4868
|
-
var lineH$1 = new LineHSymbol();
|
|
4869
|
-
|
|
4870
|
-
function close(ctx, r, x, y, z) {
|
|
4871
|
-
return ctx.moveTo(x - r, y - r), ctx.lineTo(x + r, y + r), ctx.moveTo(x + r, y - r), ctx.lineTo(x - r, y + r), !0;
|
|
4872
|
-
}
|
|
4873
|
-
class CloseSymbol extends BaseSymbol {
|
|
4874
|
-
constructor() {
|
|
4875
|
-
super(...arguments), this.type = "close", this.pathStr = "M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5";
|
|
4876
|
-
}
|
|
4877
|
-
draw(ctx, size, x, y, z) {
|
|
4878
|
-
return close(ctx, this.parseSize(size) / 2, x, y);
|
|
4879
|
-
}
|
|
4880
|
-
drawOffset(ctx, size, x, y, offset, z) {
|
|
4881
|
-
return close(ctx, this.parseSize(size) / 2 + offset, x, y);
|
|
4882
|
-
}
|
|
4883
|
-
drawToSvgPath(size, x, y, z) {
|
|
4884
|
-
const r = this.parseSize(size) / 2;
|
|
4885
|
-
return `M ${x - r}, ${y - r} L ${x + r},${y + r} M ${x + r}, ${y - r} L ${x - r},${y + r}`;
|
|
4886
|
-
}
|
|
4887
|
-
}
|
|
4888
|
-
var close$1 = new CloseSymbol();
|
|
4889
|
-
|
|
4890
|
-
function rectSizeArray(ctx, size, x, y) {
|
|
4891
|
-
return ctx.rect(x - size[0] / 2, y - size[1] / 2, size[0], size[1]), !1;
|
|
4892
|
-
}
|
|
4893
|
-
function rectSize(ctx, size, x, y) {
|
|
4894
|
-
const w = size,
|
|
4895
|
-
h = size / 2;
|
|
4896
|
-
return ctx.rect(x - w / 2, y - h / 2, w, h), !1;
|
|
4897
|
-
}
|
|
4898
|
-
class RectSymbol extends BaseSymbol {
|
|
4899
|
-
constructor() {
|
|
4900
|
-
super(...arguments), this.type = "rect", this.pathStr = "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z";
|
|
4901
|
-
}
|
|
4902
|
-
draw(ctx, size, x, y) {
|
|
4903
|
-
return isNumber$1(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
|
|
4904
|
-
}
|
|
4905
|
-
drawWithClipRange(ctx, size, x, y, clipRange, z, cb) {
|
|
4906
|
-
isNumber$1(size) && (size = [size, size / 2]);
|
|
4907
|
-
const drawLength = 2 * (size[0] + size[1]) * clipRange,
|
|
4908
|
-
points = [{
|
|
4909
|
-
x: x + size[0] / 2,
|
|
4910
|
-
y: y - size[1] / 2
|
|
4911
|
-
}, {
|
|
4912
|
-
x: x + size[0] / 2,
|
|
4913
|
-
y: y + size[1] / 2
|
|
4914
|
-
}, {
|
|
4915
|
-
x: x - size[0] / 2,
|
|
4916
|
-
y: y + size[1] / 2
|
|
4917
|
-
}, {
|
|
4918
|
-
x: x - size[0] / 2,
|
|
4919
|
-
y: y - size[1] / 2
|
|
4920
|
-
}];
|
|
4921
|
-
let currLength = 0,
|
|
4922
|
-
lastP = points[3];
|
|
4923
|
-
ctx.moveTo(lastP.x, lastP.y);
|
|
4924
|
-
for (let i = 0; i < points.length; i++) {
|
|
4925
|
-
const p = points[i],
|
|
4926
|
-
len = Math.sqrt((p.x - lastP.x) * (p.x - lastP.x) + (p.y - lastP.y) * (p.y - lastP.y));
|
|
4927
|
-
if (currLength + len > drawLength) {
|
|
4928
|
-
const dx = (p.x - lastP.x) * (drawLength - currLength) / len,
|
|
4929
|
-
dy = (p.y - lastP.y) * (drawLength - currLength) / len;
|
|
4930
|
-
ctx.lineTo(lastP.x + dx, lastP.y + dy);
|
|
4931
|
-
break;
|
|
4932
|
-
}
|
|
4933
|
-
ctx.lineTo(p.x, p.y), lastP = p, currLength += len;
|
|
4934
|
-
}
|
|
4935
|
-
return !1;
|
|
4936
|
-
}
|
|
4937
|
-
drawOffset(ctx, size, x, y, offset) {
|
|
4938
|
-
return isNumber$1(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
|
|
4939
|
-
}
|
|
4940
|
-
}
|
|
4941
|
-
var rect = new RectSymbol();
|
|
4942
|
-
|
|
4943
|
-
const tempBounds$1 = new AABBBounds();
|
|
4944
|
-
class CustomSymbolClass {
|
|
4945
|
-
constructor(type, path) {
|
|
4946
|
-
let isSvg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
|
|
4947
|
-
this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
|
|
4948
|
-
}
|
|
4949
|
-
drawOffset(ctx, size, x, y, offset, z, cb) {
|
|
4950
|
-
return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
4951
|
-
ctx.beginPath(), renderCommandList(item.path.commandList, ctx, x, y, size, size), cb && cb(item.path, item.attribute);
|
|
4952
|
-
}), !1) : (renderCommandList(this.path.commandList, ctx, x, y, size + offset, size + offset), !1);
|
|
4953
|
-
}
|
|
4954
|
-
draw(ctx, size, x, y, z, cb) {
|
|
4955
|
-
return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
4956
|
-
}
|
|
4957
|
-
parseSize(size) {
|
|
4958
|
-
return isNumber$1(size) ? size : Math.min(size[0], size[1]);
|
|
4959
|
-
}
|
|
4960
|
-
drawWithClipRange(ctx, size, x, y, clipRange, z, cb) {
|
|
4961
|
-
return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
4962
|
-
item.path.drawWithClipRange(ctx, size, x, y, clipRange), cb && cb(item.path, item.attribute);
|
|
4963
|
-
}), !1) : (this.path.drawWithClipRange(ctx, size, x, y, clipRange), !1);
|
|
4964
|
-
}
|
|
4965
|
-
bounds(size, bounds) {
|
|
4966
|
-
if (size = this.parseSize(size), this.isSvg) {
|
|
4967
|
-
if (!this.svgCache) return;
|
|
4968
|
-
return bounds.clear(), void this.svgCache.forEach(_ref => {
|
|
4969
|
-
let {
|
|
4970
|
-
path: path
|
|
4971
|
-
} = _ref;
|
|
4972
|
-
tempBounds$1.x1 = path.bounds.x1 * size, tempBounds$1.y1 = path.bounds.y1 * size, tempBounds$1.x2 = path.bounds.x2 * size, tempBounds$1.y2 = path.bounds.y2 * size, bounds.union(tempBounds$1);
|
|
4973
|
-
});
|
|
4974
|
-
}
|
|
4975
|
-
this.path.bounds && (bounds.x1 = this.path.bounds.x1 * size, bounds.y1 = this.path.bounds.y1 * size, bounds.x2 = this.path.bounds.x2 * size, bounds.y2 = this.path.bounds.y2 * size);
|
|
4976
|
-
}
|
|
4977
|
-
}
|
|
4978
|
-
|
|
4979
|
-
const builtinSymbols = [circle$1, cross$1, diamond$1, square$1, thinTriangle$1, triangle, star$1, arrow$1, wedge$1, stroke$1, wye$1, triangleLeft, triangleRight, triangleUp, triangleDown, arrow2Left$1, arrow2Right$1, arrow2Up$1, arrow2Down$1, rect, lineV$1, lineH$1, close$1];
|
|
4980
|
-
const builtinSymbolsMap = {};
|
|
4981
|
-
builtinSymbols.forEach(symbol => {
|
|
4982
|
-
builtinSymbolsMap[symbol.type] = symbol;
|
|
4983
|
-
});
|
|
4984
|
-
const builtInSymbolStrMap = {
|
|
4985
|
-
arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
|
|
4986
|
-
arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
|
|
4987
|
-
rectRound: "M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",
|
|
4988
|
-
roundLine: "M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"
|
|
4989
|
-
};
|
|
4990
|
-
|
|
4991
|
-
function getAllMatches(string, regex) {
|
|
4992
|
-
const matches = [];
|
|
4993
|
-
let match = regex.exec(string);
|
|
4994
|
-
for (; match;) {
|
|
4995
|
-
const allmatches = [];
|
|
4996
|
-
allmatches.startIndex = regex.lastIndex - match[0].length;
|
|
4997
|
-
const len = match.length;
|
|
4998
|
-
for (let index = 0; index < len; index++) allmatches.push(match[index]);
|
|
4999
|
-
matches.push(allmatches), match = regex.exec(string);
|
|
5000
|
-
}
|
|
5001
|
-
return matches;
|
|
5002
|
-
}
|
|
5003
|
-
|
|
5004
|
-
class XmlNode {
|
|
5005
|
-
constructor(tagname) {
|
|
5006
|
-
this.tagname = tagname, this.child = [], this[":@"] = {};
|
|
5007
|
-
}
|
|
5008
|
-
add(key, val) {
|
|
5009
|
-
"__proto__" === key && (key = "#__proto__"), this.child.push({
|
|
5010
|
-
[key]: val
|
|
5011
|
-
});
|
|
5012
|
-
}
|
|
5013
|
-
addChild(node) {
|
|
5014
|
-
"__proto__" === node.tagname && (node.tagname = "#__proto__"), node[":@"] && Object.keys(node[":@"]).length > 0 ? this.child.push({
|
|
5015
|
-
[node.tagname]: node.child,
|
|
5016
|
-
":@": node[":@"]
|
|
5017
|
-
}) : this.child.push({
|
|
5018
|
-
[node.tagname]: node.child
|
|
5019
|
-
});
|
|
5020
|
-
}
|
|
5021
|
-
}
|
|
5022
|
-
function findClosingIndex(xmlData, str, i, errMsg) {
|
|
5023
|
-
const closingIndex = xmlData.indexOf(str, i);
|
|
5024
|
-
if (-1 === closingIndex) throw new Error(errMsg);
|
|
5025
|
-
return closingIndex + str.length - 1;
|
|
5026
|
-
}
|
|
5027
|
-
function tagExpWithClosingIndex(xmlData, i) {
|
|
5028
|
-
let closingChar = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ">";
|
|
5029
|
-
let attrBoundary,
|
|
5030
|
-
tagExp = "";
|
|
5031
|
-
for (let index = i; index < xmlData.length; index++) {
|
|
5032
|
-
let ch = xmlData[index];
|
|
5033
|
-
if (attrBoundary) ch === attrBoundary && (attrBoundary = "");else if ('"' === ch || "'" === ch) attrBoundary = ch;else if (ch === closingChar[0]) {
|
|
5034
|
-
if (!closingChar[1]) return {
|
|
5035
|
-
data: tagExp,
|
|
5036
|
-
index: index
|
|
5037
|
-
};
|
|
5038
|
-
if (xmlData[index + 1] === closingChar[1]) return {
|
|
5039
|
-
data: tagExp,
|
|
5040
|
-
index: index
|
|
5041
|
-
};
|
|
5042
|
-
} else "\t" === ch && (ch = " ");
|
|
5043
|
-
tagExp += ch;
|
|
5044
|
-
}
|
|
5045
|
-
}
|
|
5046
|
-
function readTagExp(xmlData, i, removeNSPrefix) {
|
|
5047
|
-
let closingChar = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ">";
|
|
5048
|
-
const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
|
|
5049
|
-
if (!result) return;
|
|
5050
|
-
let tagExp = result.data;
|
|
5051
|
-
const closeIndex = result.index,
|
|
5052
|
-
separatorIndex = tagExp.search(/\s/);
|
|
5053
|
-
let tagName = tagExp,
|
|
5054
|
-
attrExpPresent = !0;
|
|
5055
|
-
-1 !== separatorIndex && (tagName = tagExp.substr(0, separatorIndex).replace(/\s\s*$/, ""), tagExp = tagExp.substr(separatorIndex + 1));
|
|
5056
|
-
const rawTagName = tagName;
|
|
5057
|
-
if (removeNSPrefix) {
|
|
5058
|
-
const colonIndex = tagName.indexOf(":");
|
|
5059
|
-
-1 !== colonIndex && (tagName = tagName.substr(colonIndex + 1), attrExpPresent = tagName !== result.data.substr(colonIndex + 1));
|
|
5060
|
-
}
|
|
5061
|
-
return {
|
|
5062
|
-
tagName: tagName,
|
|
5063
|
-
tagExp: tagExp,
|
|
5064
|
-
closeIndex: closeIndex,
|
|
5065
|
-
attrExpPresent: attrExpPresent,
|
|
5066
|
-
rawTagName: rawTagName
|
|
5067
|
-
};
|
|
5068
|
-
}
|
|
5069
|
-
const attrsRegx = new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?", "gm");
|
|
5070
|
-
class OrderedObjParser {
|
|
5071
|
-
constructor(options) {
|
|
5072
|
-
this.currentNode = null, this.options = options, this.tagsNodeStack = [], this.docTypeEntities = {};
|
|
5073
|
-
}
|
|
5074
|
-
addChild(currentNode, childNode, jPath) {
|
|
5075
|
-
const result = childNode.tagname;
|
|
5076
|
-
"string" == typeof result ? (childNode.tagname = result, currentNode.addChild(childNode)) : currentNode.addChild(childNode);
|
|
5077
|
-
}
|
|
5078
|
-
buildAttributesMap(attrStr, jPath, tagName) {
|
|
5079
|
-
const attrs = {};
|
|
5080
|
-
if (!attrStr) return;
|
|
5081
|
-
const matches = getAllMatches(attrStr, attrsRegx),
|
|
5082
|
-
len = matches.length;
|
|
5083
|
-
for (let i = 0; i < len; i++) {
|
|
5084
|
-
const attrName = matches[i][1],
|
|
5085
|
-
oldVal = matches[i][4],
|
|
5086
|
-
aName = attrName;
|
|
5087
|
-
attrName && (attrs[aName] = void 0 === oldVal || (isNaN(oldVal) ? oldVal : Number(oldVal)));
|
|
5088
|
-
}
|
|
5089
|
-
return attrs;
|
|
5090
|
-
}
|
|
5091
|
-
parseXml(xmlData) {
|
|
5092
|
-
xmlData = xmlData.replace(/\r\n?/g, "\n");
|
|
5093
|
-
const xmlObj = new XmlNode("!xml");
|
|
5094
|
-
let currentNode = xmlObj,
|
|
5095
|
-
textData = "",
|
|
5096
|
-
jPath = "";
|
|
5097
|
-
for (let i = 0; i < xmlData.length; i++) {
|
|
5098
|
-
if ("<" === xmlData[i]) {
|
|
5099
|
-
if ("/" === xmlData[i + 1]) {
|
|
5100
|
-
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed."),
|
|
5101
|
-
propIndex = jPath.lastIndexOf(".");
|
|
5102
|
-
jPath = jPath.substring(0, propIndex), currentNode = this.tagsNodeStack.pop(), currentNode && currentNode.child && textData && currentNode.child[currentNode.child.length - 1][":@"] && (currentNode.child[currentNode.child.length - 1][":@"].text = textData), textData = "", i = closeIndex;
|
|
5103
|
-
} else if ("?" === xmlData[i + 1]) {
|
|
5104
|
-
i = readTagExp(xmlData, i, !1, "?>").closeIndex + 1;
|
|
5105
|
-
} else if ("!--" === xmlData.substr(i + 1, 3)) {
|
|
5106
|
-
i = findClosingIndex(xmlData, "--\x3e", i + 4, "Comment is not closed.");
|
|
5107
|
-
} else {
|
|
5108
|
-
const result = readTagExp(xmlData, i, !1);
|
|
5109
|
-
let tagName = result.tagName,
|
|
5110
|
-
tagExp = result.tagExp;
|
|
5111
|
-
const attrExpPresent = result.attrExpPresent,
|
|
5112
|
-
closeIndex = result.closeIndex;
|
|
5113
|
-
if (tagName !== xmlObj.tagname && (jPath += jPath ? "." + tagName : tagName), tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
|
|
5114
|
-
"/" === tagName[tagName.length - 1] ? (tagName = tagName.substr(0, tagName.length - 1), jPath = jPath.substr(0, jPath.length - 1), tagExp = tagName) : tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
5115
|
-
const childNode = new XmlNode(tagName);
|
|
5116
|
-
tagName !== tagExp && attrExpPresent && (childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName)), this.addChild(currentNode, childNode, jPath), jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
5117
|
-
} else {
|
|
5118
|
-
const childNode = new XmlNode(tagName);
|
|
5119
|
-
this.tagsNodeStack.push(currentNode), tagName !== tagExp && attrExpPresent && (childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName)), this.addChild(currentNode, childNode, jPath), currentNode = childNode;
|
|
5120
|
-
}
|
|
5121
|
-
textData = "", i = closeIndex;
|
|
5122
|
-
}
|
|
5123
|
-
} else textData += xmlData[i];
|
|
5124
|
-
}
|
|
5125
|
-
return xmlObj.child;
|
|
5126
|
-
}
|
|
5127
|
-
}
|
|
5128
|
-
|
|
5129
|
-
function prettify(node, options) {
|
|
5130
|
-
return compress(node);
|
|
5131
|
-
}
|
|
5132
|
-
function compress(arr, jPath) {
|
|
5133
|
-
const compressedObj = {};
|
|
5134
|
-
for (let i = 0; i < arr.length; i++) {
|
|
5135
|
-
const tagObj = arr[i],
|
|
5136
|
-
property = propName(tagObj);
|
|
5137
|
-
if (void 0 !== property && tagObj[property]) {
|
|
5138
|
-
const val = compress(tagObj[property]);
|
|
5139
|
-
isLeafTag(val);
|
|
5140
|
-
tagObj[":@"] && assignAttributes(val, tagObj[":@"]), void 0 !== compressedObj[property] && compressedObj.hasOwnProperty(property) ? (Array.isArray(compressedObj[property]) || (compressedObj[property] = [compressedObj[property]]), compressedObj[property].push(val)) : compressedObj[property] = val;
|
|
5141
|
-
}
|
|
5142
|
-
}
|
|
5143
|
-
return compressedObj;
|
|
5144
|
-
}
|
|
5145
|
-
function propName(obj) {
|
|
5146
|
-
const keys = Object.keys(obj);
|
|
5147
|
-
for (let i = 0; i < keys.length; i++) {
|
|
5148
|
-
const key = keys[i];
|
|
5149
|
-
if (":@" !== key) return key;
|
|
5150
|
-
}
|
|
5151
|
-
}
|
|
5152
|
-
function assignAttributes(obj, attrMap, jpath) {
|
|
5153
|
-
if (attrMap) {
|
|
5154
|
-
const keys = Object.keys(attrMap),
|
|
5155
|
-
len = keys.length;
|
|
5156
|
-
for (let i = 0; i < len; i++) {
|
|
5157
|
-
const atrrName = keys[i];
|
|
5158
|
-
obj[atrrName] = attrMap[atrrName];
|
|
5159
|
-
}
|
|
5160
|
-
}
|
|
5161
|
-
}
|
|
5162
|
-
function isLeafTag(obj) {
|
|
5163
|
-
return 0 === Object.keys(obj).length;
|
|
5164
|
-
}
|
|
5165
|
-
|
|
5166
|
-
class XMLParser {
|
|
5167
|
-
constructor(options) {
|
|
5168
|
-
this.options = Object.assign({}, XMLParser.defaultOptions, options);
|
|
5169
|
-
}
|
|
5170
|
-
valid(xml) {
|
|
5171
|
-
return xml.startsWith("<");
|
|
5172
|
-
}
|
|
5173
|
-
parse(xmlData) {
|
|
5174
|
-
if (!this.valid) return !1;
|
|
5175
|
-
const orderedResult = new OrderedObjParser(this.options).parseXml(xmlData);
|
|
5176
|
-
return prettify(orderedResult, this.options);
|
|
5177
|
-
}
|
|
5178
|
-
}
|
|
5179
|
-
XMLParser.defaultOptions = {};
|
|
5180
|
-
function isSvg(str) {
|
|
5181
|
-
return str.startsWith("<svg") || str.startsWith("<?xml");
|
|
5182
|
-
}
|
|
5183
|
-
|
|
5184
|
-
undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
5185
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5186
|
-
function fulfilled(value) {
|
|
5187
|
-
try {
|
|
5188
|
-
step(generator.next(value));
|
|
5189
|
-
} catch (e) {
|
|
5190
|
-
reject(e);
|
|
5191
|
-
}
|
|
5192
|
-
}
|
|
5193
|
-
function rejected(value) {
|
|
5194
|
-
try {
|
|
5195
|
-
step(generator.throw(value));
|
|
5196
|
-
} catch (e) {
|
|
5197
|
-
reject(e);
|
|
5198
|
-
}
|
|
5199
|
-
}
|
|
5200
|
-
function step(result) {
|
|
5201
|
-
var value;
|
|
5202
|
-
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
|
|
5203
|
-
resolve(value);
|
|
5204
|
-
})).then(fulfilled, rejected);
|
|
5205
|
-
}
|
|
5206
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5207
|
-
});
|
|
5208
|
-
};
|
|
5209
|
-
let NUMBER_TYPE = 0;
|
|
5210
|
-
function genNumberType() {
|
|
5211
|
-
return NUMBER_TYPE++;
|
|
5212
|
-
}
|
|
5213
|
-
var TextDirection;
|
|
5214
|
-
!function (TextDirection) {
|
|
5215
|
-
TextDirection[TextDirection.HORIZONTAL = 0] = "HORIZONTAL", TextDirection[TextDirection.VERTICAL = 1] = "VERTICAL";
|
|
5216
|
-
}(TextDirection || (TextDirection = {}));
|
|
5217
|
-
const rotateCharList = ["…", "(", ")", "—", "【", "】", "「", "」", "《", "》"],
|
|
5218
|
-
rotateCharMap = new Map();
|
|
5219
|
-
rotateCharList.forEach(c => rotateCharMap.set(c, !0));
|
|
5220
|
-
const noRotateCharList = [""],
|
|
5221
|
-
noRotateCharMap = new Map();
|
|
5222
|
-
noRotateCharList.forEach(c => noRotateCharMap.set(c, !0));
|
|
5223
|
-
|
|
5224
|
-
genNumberType();
|
|
5225
|
-
genNumberType();
|
|
5226
|
-
genNumberType();
|
|
5227
|
-
genNumberType();
|
|
5228
|
-
genNumberType();
|
|
5229
|
-
genNumberType();
|
|
5230
|
-
genNumberType();
|
|
5231
|
-
genNumberType();
|
|
5232
|
-
genNumberType();
|
|
5233
|
-
genNumberType();
|
|
5234
|
-
genNumberType();
|
|
5235
|
-
const RECT_NUMBER_TYPE = genNumberType();
|
|
5236
|
-
genNumberType();
|
|
5237
|
-
genNumberType();
|
|
5238
|
-
genNumberType();
|
|
5239
|
-
genNumberType();
|
|
5240
|
-
const SVG_PARSE_ATTRIBUTE_MAP = {
|
|
5241
|
-
"stroke-linecap": "lineCap",
|
|
5242
|
-
"stroke-linejoin": "lineJoin",
|
|
5243
|
-
"stroke-dasharray": "lineDash",
|
|
5244
|
-
"stroke-dashoffset": "lineDashOffset",
|
|
5245
|
-
"stroke-width": "lineWidth",
|
|
5246
|
-
"fill-opacity": "fillOpacity",
|
|
5247
|
-
"stroke-opacity": "strokeOpacity",
|
|
5248
|
-
stroke: "stroke",
|
|
5249
|
-
fill: "fill"
|
|
5250
|
-
};
|
|
5251
|
-
const SVG_PARSE_ATTRIBUTE_MAP_KEYS = Object.keys(SVG_PARSE_ATTRIBUTE_MAP);
|
|
5252
|
-
|
|
5253
|
-
const _tempBounds = new AABBBounds(),
|
|
5254
|
-
tempMatrix = new Matrix(),
|
|
4251
|
+
const tempMatrix = new Matrix(),
|
|
5255
4252
|
tempBounds = new AABBBounds();
|
|
5256
4253
|
const GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible"];
|
|
5257
4254
|
const tempConstantXYKey = ["x", "y"],
|
|
@@ -5297,7 +4294,7 @@
|
|
|
5297
4294
|
}
|
|
5298
4295
|
}
|
|
5299
4296
|
get AABBBounds() {
|
|
5300
|
-
return this.tryUpdateAABBBounds();
|
|
4297
|
+
return this.tryUpdateAABBBounds("imprecise" === this.attribute.boundsMode);
|
|
5301
4298
|
}
|
|
5302
4299
|
get OBBBounds() {
|
|
5303
4300
|
return this.tryUpdateOBBBounds();
|
|
@@ -5341,13 +4338,12 @@
|
|
|
5341
4338
|
onAnimateBind(animate) {
|
|
5342
4339
|
this._emitCustomEvent("animate-bind", animate);
|
|
5343
4340
|
}
|
|
5344
|
-
tryUpdateAABBBounds() {
|
|
5345
|
-
const full = "imprecise" === this.attribute.boundsMode;
|
|
4341
|
+
tryUpdateAABBBounds(full) {
|
|
5346
4342
|
if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
|
|
5347
4343
|
if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
|
|
5348
4344
|
application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
|
|
5349
4345
|
const bounds = this.doUpdateAABBBounds(full);
|
|
5350
|
-
return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0),
|
|
4346
|
+
return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), bounds;
|
|
5351
4347
|
}
|
|
5352
4348
|
tryUpdateOBBBounds() {
|
|
5353
4349
|
if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
|
|
@@ -5363,58 +4359,6 @@
|
|
|
5363
4359
|
doUpdateOBBBounds() {
|
|
5364
4360
|
return this._OBBBounds;
|
|
5365
4361
|
}
|
|
5366
|
-
getClipPath() {
|
|
5367
|
-
const {
|
|
5368
|
-
clipConfig: clipConfig
|
|
5369
|
-
} = this.attribute;
|
|
5370
|
-
if (!clipConfig) return null;
|
|
5371
|
-
this.clipPathMap || (this.clipPathMap = new Map());
|
|
5372
|
-
const {
|
|
5373
|
-
shape: shape
|
|
5374
|
-
} = clipConfig;
|
|
5375
|
-
let path = this.clipPathMap.get(shape) || null;
|
|
5376
|
-
return path || (this.clipPathMap.size > 10 && this.clipPathMap.clear(), path = this.parsePath(shape), path && this.clipPathMap.set(shape, path)), path;
|
|
5377
|
-
}
|
|
5378
|
-
parsePath(symbolType) {
|
|
5379
|
-
if (!symbolType) return null;
|
|
5380
|
-
let path = builtinSymbolsMap[symbolType];
|
|
5381
|
-
if (path) return path;
|
|
5382
|
-
if (path = Graphic.userSymbolMap[symbolType], path) return path;
|
|
5383
|
-
const _symbolType = builtInSymbolStrMap[symbolType];
|
|
5384
|
-
if (!0 === isSvg(symbolType = _symbolType || symbolType)) {
|
|
5385
|
-
const parser = new XMLParser(),
|
|
5386
|
-
{
|
|
5387
|
-
svg: svg
|
|
5388
|
-
} = parser.parse(symbolType);
|
|
5389
|
-
if (!svg) return null;
|
|
5390
|
-
const path = isArray$1(svg.path) ? svg.path : [svg.path];
|
|
5391
|
-
_tempBounds.clear();
|
|
5392
|
-
const cacheList = [];
|
|
5393
|
-
path.forEach(item => {
|
|
5394
|
-
const cache = new CustomPath2D().fromString(item.d),
|
|
5395
|
-
attribute = {};
|
|
5396
|
-
SVG_PARSE_ATTRIBUTE_MAP_KEYS.forEach(k => {
|
|
5397
|
-
item[k] && (attribute[SVG_PARSE_ATTRIBUTE_MAP[k]] = item[k]);
|
|
5398
|
-
}), cacheList.push({
|
|
5399
|
-
path: cache,
|
|
5400
|
-
attribute: attribute
|
|
5401
|
-
}), _tempBounds.union(cache.bounds);
|
|
5402
|
-
});
|
|
5403
|
-
const width = _tempBounds.width(),
|
|
5404
|
-
height = _tempBounds.height(),
|
|
5405
|
-
scale = 1 / max(width, height);
|
|
5406
|
-
cacheList.forEach(cache => cache.path.transform(0, 0, scale, scale));
|
|
5407
|
-
const _parsedPath = new CustomSymbolClass(symbolType, cacheList, !0);
|
|
5408
|
-
return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
|
|
5409
|
-
}
|
|
5410
|
-
const cache = new CustomPath2D().fromString(symbolType),
|
|
5411
|
-
width = cache.bounds.width(),
|
|
5412
|
-
height = cache.bounds.height(),
|
|
5413
|
-
scale = 1 / max(width, height);
|
|
5414
|
-
cache.transform(0, 0, scale, scale);
|
|
5415
|
-
const _parsedPath = new CustomSymbolClass(symbolType, cache);
|
|
5416
|
-
return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
|
|
5417
|
-
}
|
|
5418
4362
|
doUpdateAABBBounds(full) {
|
|
5419
4363
|
this.updateAABBBoundsStamp++;
|
|
5420
4364
|
const graphicTheme = this.getGraphicTheme();
|
|
@@ -5623,9 +4567,8 @@
|
|
|
5623
4567
|
return this;
|
|
5624
4568
|
}
|
|
5625
4569
|
animate(params) {
|
|
5626
|
-
var _a;
|
|
5627
4570
|
this.animates || (this.animates = new Map());
|
|
5628
|
-
const animate = new Animate(null == params ? void 0 : params.id,
|
|
4571
|
+
const animate = new Animate(null == params ? void 0 : params.id, this.stage && this.stage.getTimeline(), null == params ? void 0 : params.slience);
|
|
5629
4572
|
if (animate.bind(this), params) {
|
|
5630
4573
|
const {
|
|
5631
4574
|
onStart: onStart,
|
|
@@ -5636,14 +4579,14 @@
|
|
|
5636
4579
|
null != onStart && animate.onStart(onStart), null != onFrame && animate.onFrame(onFrame), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove), animate.interpolateFunc = params.interpolate;
|
|
5637
4580
|
}
|
|
5638
4581
|
return this.animates.set(animate.id, animate), animate.onRemove(() => {
|
|
5639
|
-
|
|
4582
|
+
this.animates.delete(animate.id);
|
|
5640
4583
|
}), animate;
|
|
5641
4584
|
}
|
|
5642
4585
|
onAttributeUpdate(context) {
|
|
5643
4586
|
context && context.skipUpdateCallback || (application.graphicService.onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
|
|
5644
4587
|
}
|
|
5645
4588
|
update(d) {
|
|
5646
|
-
d ? (d.bounds && this.tryUpdateAABBBounds(), d.trans && this.tryUpdateLocalTransMatrix()) : (this.tryUpdateAABBBounds(), this.tryUpdateLocalTransMatrix());
|
|
4589
|
+
d ? (d.bounds && this.tryUpdateAABBBounds("imprecise" === this.attribute.boundsMode), d.trans && this.tryUpdateLocalTransMatrix()) : (this.tryUpdateAABBBounds("imprecise" === this.attribute.boundsMode), this.tryUpdateLocalTransMatrix());
|
|
5647
4590
|
}
|
|
5648
4591
|
hasState(stateName) {
|
|
5649
4592
|
return !(!this.currentStates || !this.currentStates.length) && (!!isNil$1(stateName) || this.currentStates.includes(stateName));
|
|
@@ -5701,10 +4644,9 @@
|
|
|
5701
4644
|
this.hasState() && this.normalAttrs ? (this.currentStates = [], this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0)) : this.currentStates = [], this.normalAttrs = null;
|
|
5702
4645
|
}
|
|
5703
4646
|
removeState(stateName, hasAnimation) {
|
|
5704
|
-
if (this.currentStates) {
|
|
5705
|
-
const
|
|
5706
|
-
|
|
5707
|
-
newStates.length !== this.currentStates.length && this.useStates(newStates, hasAnimation);
|
|
4647
|
+
if ((this.currentStates ? this.currentStates.indexOf(stateName) : -1) >= 0) {
|
|
4648
|
+
const currentStates = this.currentStates.filter(state => state !== stateName);
|
|
4649
|
+
this.useStates(currentStates, hasAnimation);
|
|
5708
4650
|
}
|
|
5709
4651
|
}
|
|
5710
4652
|
toggleState(stateName, hasAnimation) {
|
|
@@ -5841,7 +4783,7 @@
|
|
|
5841
4783
|
if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
|
|
5842
4784
|
const timeline = stage.getTimeline();
|
|
5843
4785
|
this.animates.forEach(a => {
|
|
5844
|
-
a.
|
|
4786
|
+
a.setTimeline(timeline);
|
|
5845
4787
|
});
|
|
5846
4788
|
}
|
|
5847
4789
|
this._onSetStage && this._onSetStage(this, stage, layer), application.graphicService.onSetStage(this, stage);
|
|
@@ -5888,7 +4830,7 @@
|
|
|
5888
4830
|
}), step.parsedProps = nextParsedProps;
|
|
5889
4831
|
}
|
|
5890
4832
|
defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio) {
|
|
5891
|
-
if (Number.isFinite(nextStepVal)
|
|
4833
|
+
if (Number.isFinite(nextStepVal)) return nextAttributes[key] = lastStepVal + (nextStepVal - lastStepVal) * ratio, !0;
|
|
5892
4834
|
if ("fill" === key) {
|
|
5893
4835
|
nextParsedProps || (nextParsedProps = {});
|
|
5894
4836
|
const fillColorArray = nextParsedProps.fillColorArray,
|
|
@@ -5913,20 +4855,6 @@
|
|
|
5913
4855
|
});
|
|
5914
4856
|
return color && (nextAttributes[key] = color), !0;
|
|
5915
4857
|
}
|
|
5916
|
-
if (Array.isArray(nextStepVal) && nextStepVal.length === lastStepVal.length) {
|
|
5917
|
-
const nextList = [];
|
|
5918
|
-
let valid = !0;
|
|
5919
|
-
for (let i = 0; i < nextStepVal.length; i++) {
|
|
5920
|
-
const v = lastStepVal[i],
|
|
5921
|
-
val = v + (nextStepVal[i] - v) * ratio;
|
|
5922
|
-
if (!Number.isFinite(val)) {
|
|
5923
|
-
valid = !1;
|
|
5924
|
-
break;
|
|
5925
|
-
}
|
|
5926
|
-
nextList.push(val);
|
|
5927
|
-
}
|
|
5928
|
-
valid && (nextAttributes[key] = nextList);
|
|
5929
|
-
}
|
|
5930
4858
|
return !1;
|
|
5931
4859
|
}
|
|
5932
4860
|
_interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {}
|
|
@@ -5945,7 +4873,7 @@
|
|
|
5945
4873
|
return shadowRoot && (shadowRoot.shadowHost = this), this.shadowRoot = null != shadowRoot ? shadowRoot : application.graphicService.creator.shadowRoot(this), this.addUpdateBoundTag(), this.shadowRoot.setStage(this.stage, this.layer), this.shadowRoot;
|
|
5946
4874
|
}
|
|
5947
4875
|
detachShadow() {
|
|
5948
|
-
this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot
|
|
4876
|
+
this.shadowRoot && (this.addUpdateBoundTag(), this.shadowRoot = null);
|
|
5949
4877
|
}
|
|
5950
4878
|
toJson() {
|
|
5951
4879
|
return {
|
|
@@ -5997,7 +4925,7 @@
|
|
|
5997
4925
|
});
|
|
5998
4926
|
}
|
|
5999
4927
|
release() {
|
|
6000
|
-
this.releaseStatus = "released",
|
|
4928
|
+
this.releaseStatus = "released", application.graphicService.onRelease(this);
|
|
6001
4929
|
}
|
|
6002
4930
|
_emitCustomEvent(type, context) {
|
|
6003
4931
|
var _a, _b;
|
|
@@ -6010,7 +4938,64 @@
|
|
|
6010
4938
|
function backgroundNotImage(image) {
|
|
6011
4939
|
return !(!image.fill && !image.stroke);
|
|
6012
4940
|
}
|
|
6013
|
-
Graphic.
|
|
4941
|
+
Graphic.mixin(EventTarget);
|
|
4942
|
+
|
|
4943
|
+
undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
|
|
4944
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4945
|
+
function fulfilled(value) {
|
|
4946
|
+
try {
|
|
4947
|
+
step(generator.next(value));
|
|
4948
|
+
} catch (e) {
|
|
4949
|
+
reject(e);
|
|
4950
|
+
}
|
|
4951
|
+
}
|
|
4952
|
+
function rejected(value) {
|
|
4953
|
+
try {
|
|
4954
|
+
step(generator.throw(value));
|
|
4955
|
+
} catch (e) {
|
|
4956
|
+
reject(e);
|
|
4957
|
+
}
|
|
4958
|
+
}
|
|
4959
|
+
function step(result) {
|
|
4960
|
+
var value;
|
|
4961
|
+
result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P(function (resolve) {
|
|
4962
|
+
resolve(value);
|
|
4963
|
+
})).then(fulfilled, rejected);
|
|
4964
|
+
}
|
|
4965
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
4966
|
+
});
|
|
4967
|
+
};
|
|
4968
|
+
let NUMBER_TYPE = 0;
|
|
4969
|
+
function genNumberType() {
|
|
4970
|
+
return NUMBER_TYPE++;
|
|
4971
|
+
}
|
|
4972
|
+
var TextDirection;
|
|
4973
|
+
!function (TextDirection) {
|
|
4974
|
+
TextDirection[TextDirection.HORIZONTAL = 0] = "HORIZONTAL", TextDirection[TextDirection.VERTICAL = 1] = "VERTICAL";
|
|
4975
|
+
}(TextDirection || (TextDirection = {}));
|
|
4976
|
+
const rotateCharList = ["…", "(", ")", "—", "【", "】", "「", "」", "《", "》"],
|
|
4977
|
+
rotateCharMap = new Map();
|
|
4978
|
+
rotateCharList.forEach(c => rotateCharMap.set(c, !0));
|
|
4979
|
+
const noRotateCharList = [""],
|
|
4980
|
+
noRotateCharMap = new Map();
|
|
4981
|
+
noRotateCharList.forEach(c => noRotateCharMap.set(c, !0));
|
|
4982
|
+
|
|
4983
|
+
genNumberType();
|
|
4984
|
+
genNumberType();
|
|
4985
|
+
genNumberType();
|
|
4986
|
+
genNumberType();
|
|
4987
|
+
genNumberType();
|
|
4988
|
+
genNumberType();
|
|
4989
|
+
genNumberType();
|
|
4990
|
+
genNumberType();
|
|
4991
|
+
genNumberType();
|
|
4992
|
+
genNumberType();
|
|
4993
|
+
genNumberType();
|
|
4994
|
+
const RECT_NUMBER_TYPE = genNumberType();
|
|
4995
|
+
genNumberType();
|
|
4996
|
+
genNumberType();
|
|
4997
|
+
genNumberType();
|
|
4998
|
+
genNumberType();
|
|
6014
4999
|
|
|
6015
5000
|
const updateBoundsOfCommonOuterBorder = (attribute, theme, aabbBounds) => {
|
|
6016
5001
|
const {
|