@amcharts/amcharts5 5.15.1 → 5.15.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/.internal/charts/xy/series/ColumnSeries.d.ts +1 -0
- package/.internal/charts/xy/series/ColumnSeries.d.ts.map +1 -1
- package/.internal/charts/xy/series/ColumnSeries.js +17 -0
- package/.internal/charts/xy/series/ColumnSeries.js.map +1 -1
- package/.internal/core/Registry.js +1 -1
- package/.internal/core/Registry.js.map +1 -1
- package/.internal/core/render/backend/CanvasRenderer.d.ts.map +1 -1
- package/.internal/core/render/backend/CanvasRenderer.js +232 -223
- package/.internal/core/render/backend/CanvasRenderer.js.map +1 -1
- package/CHANGELOG.md +9 -0
- package/examples/javascript/flow-arc-horizontal/package.json +1 -1
- package/examples/javascript/flow-arc-vertical/package.json +1 -1
- package/examples/javascript/flow-chord/package.json +1 -1
- package/examples/javascript/flow-chord-directed/package.json +1 -1
- package/examples/javascript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/javascript/flow-sankey/package.json +1 -1
- package/examples/javascript/gantt/package.json +1 -1
- package/examples/javascript/gantt-multilevel/package.json +1 -1
- package/examples/javascript/gantt-simple/package.json +1 -1
- package/examples/javascript/gauge/package.json +1 -1
- package/examples/javascript/gauge-bands/package.json +1 -1
- package/examples/javascript/hierarchy-force-directed/package.json +1 -1
- package/examples/javascript/hierarchy-pack/package.json +1 -1
- package/examples/javascript/hierarchy-partition/package.json +1 -1
- package/examples/javascript/hierarchy-sunburst/package.json +1 -1
- package/examples/javascript/hierarchy-tree/package.json +1 -1
- package/examples/javascript/hierarchy-treemap/package.json +1 -1
- package/examples/javascript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/javascript/jest/package.json +1 -1
- package/examples/javascript/json-pie/package.json +1 -1
- package/examples/javascript/json-xy/package.json +1 -1
- package/examples/javascript/map-animating-along-lines/package.json +1 -1
- package/examples/javascript/map-clustered-points/package.json +1 -1
- package/examples/javascript/map-day-and-night/package.json +1 -1
- package/examples/javascript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/javascript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/javascript/map-with-bubbles/package.json +1 -1
- package/examples/javascript/map-zoom-to-country/package.json +1 -1
- package/examples/javascript/misc-40-charts/package.json +1 -1
- package/examples/javascript/misc-microchart-grid/package.json +1 -1
- package/examples/javascript/pie-chart/package.json +1 -1
- package/examples/javascript/pie-donut-chart/package.json +1 -1
- package/examples/javascript/pie-variable-radius/package.json +1 -1
- package/examples/javascript/radar-column-iwatch-style/package.json +1 -1
- package/examples/javascript/radar-heat-map/package.json +1 -1
- package/examples/javascript/radar-line/package.json +1 -1
- package/examples/javascript/radar-time-line/package.json +1 -1
- package/examples/javascript/sliced-funnel/package.json +1 -1
- package/examples/javascript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/javascript/sliced-pyramid/package.json +1 -1
- package/examples/javascript/stock-chart/package.json +1 -1
- package/examples/javascript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/javascript/stock-chart-data-granularity/package.json +1 -1
- package/examples/javascript/stock-chart-data-grouping/package.json +1 -1
- package/examples/javascript/stock-chart-intraday/package.json +1 -1
- package/examples/javascript/stock-chart-live/package.json +1 -1
- package/examples/javascript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/javascript/timeline-horizontal-serpentine-chart/package.json +1 -1
- package/examples/javascript/timeline-linear-process-diagram/package.json +1 -1
- package/examples/javascript/timeline-serpentine-chart/package.json +1 -1
- package/examples/javascript/timeline-spiral-chart/package.json +1 -1
- package/examples/javascript/venn-diagram/package.json +1 -1
- package/examples/javascript/wordcloud-with-data/package.json +1 -1
- package/examples/javascript/wordcloud-with-text/package.json +1 -1
- package/examples/javascript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/javascript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/javascript/xy-bubble/package.json +1 -1
- package/examples/javascript/xy-candlestick/package.json +1 -1
- package/examples/javascript/xy-clustered-column/package.json +1 -1
- package/examples/javascript/xy-column/package.json +1 -1
- package/examples/javascript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/javascript/xy-data-grouping/package.json +1 -1
- package/examples/javascript/xy-draggable-range/package.json +1 -1
- package/examples/javascript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/javascript/xy-dumbbell plot/package.json +1 -1
- package/examples/javascript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/javascript/xy-line/package.json +1 -1
- package/examples/javascript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/javascript/xy-live-data/package.json +1 -1
- package/examples/javascript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/javascript/xy-ohlc/package.json +1 -1
- package/examples/javascript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/javascript/xy-smoothed-line/package.json +1 -1
- package/examples/javascript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/javascript/xy-stacked-column/package.json +1 -1
- package/examples/javascript/xy-stacked-step/package.json +1 -1
- package/examples/javascript/xy-stock/package.json +1 -1
- package/examples/javascript/xy-stock-comparing/package.json +1 -1
- package/examples/typescript/flow-arc-horizontal/package.json +1 -1
- package/examples/typescript/flow-arc-vertical/package.json +1 -1
- package/examples/typescript/flow-chord/package.json +1 -1
- package/examples/typescript/flow-chord-directed/package.json +1 -1
- package/examples/typescript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/typescript/flow-sankey/package.json +1 -1
- package/examples/typescript/gantt/package.json +1 -1
- package/examples/typescript/gantt-multilevel/package.json +1 -1
- package/examples/typescript/gantt-simple/package.json +1 -1
- package/examples/typescript/gauge/package.json +1 -1
- package/examples/typescript/gauge-bands/package.json +1 -1
- package/examples/typescript/hierarchy-force-directed/package.json +1 -1
- package/examples/typescript/hierarchy-pack/package.json +1 -1
- package/examples/typescript/hierarchy-partition/package.json +1 -1
- package/examples/typescript/hierarchy-sunburst/package.json +1 -1
- package/examples/typescript/hierarchy-tree/package.json +1 -1
- package/examples/typescript/hierarchy-treemap/package.json +1 -1
- package/examples/typescript/hierarchy-voronoi-treemap/package.json +1 -1
- package/examples/typescript/jest/package.json +1 -1
- package/examples/typescript/json-pie/package.json +1 -1
- package/examples/typescript/json-xy/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/package.json +1 -1
- package/examples/typescript/map-clustered-points/package.json +1 -1
- package/examples/typescript/map-day-and-night/package.json +1 -1
- package/examples/typescript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/typescript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/typescript/map-with-bubbles/package.json +1 -1
- package/examples/typescript/map-zoom-to-country/package.json +1 -1
- package/examples/typescript/misc-40-charts/package.json +1 -1
- package/examples/typescript/misc-microchart-grid/package.json +1 -1
- package/examples/typescript/pie-chart/package.json +1 -1
- package/examples/typescript/pie-donut-chart/package.json +1 -1
- package/examples/typescript/pie-variable-radius/package.json +1 -1
- package/examples/typescript/radar-column-iwatch-style/package.json +1 -1
- package/examples/typescript/radar-heat-map/package.json +1 -1
- package/examples/typescript/radar-line/package.json +1 -1
- package/examples/typescript/radar-time-line/package.json +1 -1
- package/examples/typescript/sliced-funnel/package.json +1 -1
- package/examples/typescript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/typescript/sliced-pyramid/package.json +1 -1
- package/examples/typescript/stock-chart/package.json +1 -1
- package/examples/typescript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/typescript/stock-chart-data-granularity/package.json +1 -1
- package/examples/typescript/stock-chart-data-grouping/package.json +1 -1
- package/examples/typescript/stock-chart-intraday/package.json +1 -1
- package/examples/typescript/stock-chart-live/package.json +1 -1
- package/examples/typescript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/typescript/timeline-horizontal-serpentine-chart/package.json +1 -1
- package/examples/typescript/timeline-linear-process-diagram/package.json +1 -1
- package/examples/typescript/timeline-serpentine-chart/package.json +1 -1
- package/examples/typescript/timeline-spiral-chart/package.json +1 -1
- package/examples/typescript/venn-diagram/package.json +1 -1
- package/examples/typescript/wordcloud-with-data/package.json +1 -1
- package/examples/typescript/wordcloud-with-text/package.json +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/typescript/xy-bubble/package.json +1 -1
- package/examples/typescript/xy-candlestick/package.json +1 -1
- package/examples/typescript/xy-clustered-column/package.json +1 -1
- package/examples/typescript/xy-column/package.json +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/typescript/xy-data-grouping/package.json +1 -1
- package/examples/typescript/xy-draggable-range/package.json +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/typescript/xy-dumbbell plot/package.json +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/typescript/xy-line/package.json +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/typescript/xy-live-data/package.json +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/typescript/xy-ohlc/package.json +1 -1
- package/examples/typescript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/typescript/xy-smoothed-line/package.json +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/typescript/xy-stacked-column/package.json +1 -1
- package/examples/typescript/xy-stacked-step/package.json +1 -1
- package/examples/typescript/xy-stock/package.json +1 -1
- package/examples/typescript/xy-stock-comparing/package.json +1 -1
- package/package.json +1 -1
|
@@ -1543,232 +1543,241 @@ export class CanvasGraphics extends CanvasDisplayObject {
|
|
|
1543
1543
|
let qcpy = null;
|
|
1544
1544
|
const SEGMENTS_REGEXP = /([MmZzLlHhVvCcSsQqTtAa])([^MmZzLlHhVvCcSsQqTtAa]*)/g;
|
|
1545
1545
|
const ARGS_REGEXP = /[\u0009\u0020\u000A\u000C\u000D]*([\+\-]?[0-9]*\.?[0-9]+(?:[eE][\+\-]?[0-9]+)?)[\u0009\u0020\u000A\u000C\u000D]*,?/g;
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
y
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
checkEvenArgs(name, args.length, 2);
|
|
1578
|
-
x += +args[0];
|
|
1579
|
-
y += +args[1];
|
|
1580
|
-
this.moveTo(x, y);
|
|
1581
|
-
for (let i = 2; i < args.length; i += 2) {
|
|
1582
|
-
x += +args[i];
|
|
1583
|
-
y += +args[i + 1];
|
|
1584
|
-
this.lineTo(x, y);
|
|
1585
|
-
}
|
|
1586
|
-
break;
|
|
1587
|
-
case "L":
|
|
1588
|
-
checkEvenArgs(name, args.length, 2);
|
|
1589
|
-
for (let i = 0; i < args.length; i += 2) {
|
|
1590
|
-
x = +args[i];
|
|
1591
|
-
y = +args[i + 1];
|
|
1592
|
-
this.lineTo(x, y);
|
|
1593
|
-
}
|
|
1594
|
-
break;
|
|
1595
|
-
case "l":
|
|
1596
|
-
checkEvenArgs(name, args.length, 2);
|
|
1597
|
-
for (let i = 0; i < args.length; i += 2) {
|
|
1598
|
-
x += +args[i];
|
|
1599
|
-
y += +args[i + 1];
|
|
1600
|
-
this.lineTo(x, y);
|
|
1601
|
-
}
|
|
1602
|
-
break;
|
|
1603
|
-
case "H":
|
|
1604
|
-
checkMinArgs(name, args.length, 1);
|
|
1605
|
-
for (let i = 0; i < args.length; ++i) {
|
|
1606
|
-
x = +args[i];
|
|
1607
|
-
this.lineTo(x, y);
|
|
1608
|
-
}
|
|
1609
|
-
break;
|
|
1610
|
-
case "h":
|
|
1611
|
-
checkMinArgs(name, args.length, 1);
|
|
1612
|
-
for (let i = 0; i < args.length; ++i) {
|
|
1613
|
-
x += +args[i];
|
|
1614
|
-
this.lineTo(x, y);
|
|
1615
|
-
}
|
|
1616
|
-
break;
|
|
1617
|
-
case "V":
|
|
1618
|
-
checkMinArgs(name, args.length, 1);
|
|
1619
|
-
for (let i = 0; i < args.length; ++i) {
|
|
1620
|
-
y = +args[i];
|
|
1621
|
-
this.lineTo(x, y);
|
|
1622
|
-
}
|
|
1623
|
-
break;
|
|
1624
|
-
case "v":
|
|
1625
|
-
checkMinArgs(name, args.length, 1);
|
|
1626
|
-
for (let i = 0; i < args.length; ++i) {
|
|
1627
|
-
y += +args[i];
|
|
1628
|
-
this.lineTo(x, y);
|
|
1629
|
-
}
|
|
1630
|
-
break;
|
|
1631
|
-
case "C":
|
|
1632
|
-
checkEvenArgs(name, args.length, 6);
|
|
1633
|
-
for (let i = 0; i < args.length; i += 6) {
|
|
1634
|
-
const x1 = +args[i];
|
|
1635
|
-
const y1 = +args[i + 1];
|
|
1636
|
-
cpx = +args[i + 2];
|
|
1637
|
-
cpy = +args[i + 3];
|
|
1638
|
-
x = +args[i + 4];
|
|
1639
|
-
y = +args[i + 5];
|
|
1640
|
-
this.bezierCurveTo(x1, y1, cpx, cpy, x, y);
|
|
1641
|
-
}
|
|
1642
|
-
break;
|
|
1643
|
-
case "c":
|
|
1644
|
-
checkEvenArgs(name, args.length, 6);
|
|
1645
|
-
for (let i = 0; i < args.length; i += 6) {
|
|
1646
|
-
const x1 = +args[i] + x;
|
|
1647
|
-
const y1 = +args[i + 1] + y;
|
|
1648
|
-
cpx = +args[i + 2] + x;
|
|
1649
|
-
cpy = +args[i + 3] + y;
|
|
1650
|
-
x += +args[i + 4];
|
|
1651
|
-
y += +args[i + 5];
|
|
1652
|
-
this.bezierCurveTo(x1, y1, cpx, cpy, x, y);
|
|
1653
|
-
}
|
|
1654
|
-
break;
|
|
1655
|
-
case "S":
|
|
1656
|
-
checkEvenArgs(name, args.length, 4);
|
|
1657
|
-
if (cpx === null || cpy === null) {
|
|
1658
|
-
cpx = x;
|
|
1659
|
-
cpy = y;
|
|
1660
|
-
}
|
|
1661
|
-
for (let i = 0; i < args.length; i += 4) {
|
|
1662
|
-
const x1 = 2 * x - cpx;
|
|
1663
|
-
const y1 = 2 * y - cpy;
|
|
1664
|
-
cpx = +args[i];
|
|
1665
|
-
cpy = +args[i + 1];
|
|
1666
|
-
x = +args[i + 2];
|
|
1667
|
-
y = +args[i + 3];
|
|
1668
|
-
this.bezierCurveTo(x1, y1, cpx, cpy, x, y);
|
|
1669
|
-
}
|
|
1670
|
-
break;
|
|
1671
|
-
case "s":
|
|
1672
|
-
checkEvenArgs(name, args.length, 4);
|
|
1673
|
-
if (cpx === null || cpy === null) {
|
|
1674
|
-
cpx = x;
|
|
1675
|
-
cpy = y;
|
|
1676
|
-
}
|
|
1677
|
-
for (let i = 0; i < args.length; i += 4) {
|
|
1678
|
-
const x1 = 2 * x - cpx;
|
|
1679
|
-
const y1 = 2 * y - cpy;
|
|
1680
|
-
cpx = +args[i] + x;
|
|
1681
|
-
cpy = +args[i + 1] + y;
|
|
1682
|
-
x += +args[i + 2];
|
|
1683
|
-
y += +args[i + 3];
|
|
1684
|
-
this.bezierCurveTo(x1, y1, cpx, cpy, x, y);
|
|
1685
|
-
}
|
|
1686
|
-
break;
|
|
1687
|
-
case "Q":
|
|
1688
|
-
checkEvenArgs(name, args.length, 4);
|
|
1689
|
-
for (let i = 0; i < args.length; i += 4) {
|
|
1690
|
-
qcpx = +args[i];
|
|
1691
|
-
qcpy = +args[i + 1];
|
|
1692
|
-
x = +args[i + 2];
|
|
1693
|
-
y = +args[i + 3];
|
|
1694
|
-
this.quadraticCurveTo(qcpx, qcpy, x, y);
|
|
1695
|
-
}
|
|
1696
|
-
break;
|
|
1697
|
-
case "q":
|
|
1698
|
-
checkEvenArgs(name, args.length, 4);
|
|
1699
|
-
for (let i = 0; i < args.length; i += 4) {
|
|
1700
|
-
qcpx = +args[i] + x;
|
|
1701
|
-
qcpy = +args[i + 1] + y;
|
|
1702
|
-
x += +args[i + 2];
|
|
1703
|
-
y += +args[i + 3];
|
|
1704
|
-
this.quadraticCurveTo(qcpx, qcpy, x, y);
|
|
1705
|
-
}
|
|
1706
|
-
break;
|
|
1707
|
-
case "T":
|
|
1708
|
-
checkEvenArgs(name, args.length, 2);
|
|
1709
|
-
if (qcpx === null || qcpy === null) {
|
|
1710
|
-
qcpx = x;
|
|
1711
|
-
qcpy = y;
|
|
1712
|
-
}
|
|
1713
|
-
for (let i = 0; i < args.length; i += 2) {
|
|
1714
|
-
qcpx = 2 * x - qcpx;
|
|
1715
|
-
qcpy = 2 * y - qcpy;
|
|
1716
|
-
x = +args[i];
|
|
1717
|
-
y = +args[i + 1];
|
|
1718
|
-
this.quadraticCurveTo(qcpx, qcpy, x, y);
|
|
1719
|
-
}
|
|
1720
|
-
break;
|
|
1721
|
-
case "t":
|
|
1722
|
-
checkEvenArgs(name, args.length, 2);
|
|
1723
|
-
if (qcpx === null || qcpy === null) {
|
|
1724
|
-
qcpx = x;
|
|
1725
|
-
qcpy = y;
|
|
1726
|
-
}
|
|
1727
|
-
for (let i = 0; i < args.length; i += 2) {
|
|
1728
|
-
qcpx = 2 * x - qcpx;
|
|
1729
|
-
qcpy = 2 * y - qcpy;
|
|
1730
|
-
x += +args[i];
|
|
1731
|
-
y += +args[i + 1];
|
|
1732
|
-
this.quadraticCurveTo(qcpx, qcpy, x, y);
|
|
1733
|
-
}
|
|
1734
|
-
break;
|
|
1735
|
-
case "A":
|
|
1736
|
-
case "a":
|
|
1737
|
-
const relative = (name === "a");
|
|
1738
|
-
splitArcFlags(args);
|
|
1739
|
-
checkEvenArgs(name, args.length, 7);
|
|
1740
|
-
for (let i = 0; i < args.length; i += 7) {
|
|
1741
|
-
let cx = +args[i + 5];
|
|
1742
|
-
let cy = +args[i + 6];
|
|
1743
|
-
if (relative) {
|
|
1744
|
-
cx += x;
|
|
1745
|
-
cy += y;
|
|
1546
|
+
// Hack needed to undo any operations if the SVG parsing fails
|
|
1547
|
+
const length = this._operations.length;
|
|
1548
|
+
try {
|
|
1549
|
+
let match;
|
|
1550
|
+
while ((match = SEGMENTS_REGEXP.exec(path)) !== null) {
|
|
1551
|
+
const name = match[1];
|
|
1552
|
+
const rest = match[2];
|
|
1553
|
+
const args = [];
|
|
1554
|
+
while ((match = ARGS_REGEXP.exec(rest)) !== null) {
|
|
1555
|
+
args.push(match[1]);
|
|
1556
|
+
}
|
|
1557
|
+
// Reset control point
|
|
1558
|
+
if (name !== "S" && name !== "s" && name !== "C" && name !== "c") {
|
|
1559
|
+
cpx = null;
|
|
1560
|
+
cpy = null;
|
|
1561
|
+
}
|
|
1562
|
+
// Reset control point
|
|
1563
|
+
if (name !== "Q" && name !== "q" && name !== "T" && name !== "t") {
|
|
1564
|
+
qcpx = null;
|
|
1565
|
+
qcpy = null;
|
|
1566
|
+
}
|
|
1567
|
+
switch (name) {
|
|
1568
|
+
case "M":
|
|
1569
|
+
checkEvenArgs(name, args.length, 2);
|
|
1570
|
+
x = +args[0];
|
|
1571
|
+
y = +args[1];
|
|
1572
|
+
this.moveTo(x, y);
|
|
1573
|
+
for (let i = 2; i < args.length; i += 2) {
|
|
1574
|
+
x = +args[i];
|
|
1575
|
+
y = +args[i + 1];
|
|
1576
|
+
this.lineTo(x, y);
|
|
1746
1577
|
}
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1578
|
+
break;
|
|
1579
|
+
case "m":
|
|
1580
|
+
checkEvenArgs(name, args.length, 2);
|
|
1581
|
+
x += +args[0];
|
|
1582
|
+
y += +args[1];
|
|
1583
|
+
this.moveTo(x, y);
|
|
1584
|
+
for (let i = 2; i < args.length; i += 2) {
|
|
1585
|
+
x += +args[i];
|
|
1586
|
+
y += +args[i + 1];
|
|
1587
|
+
this.lineTo(x, y);
|
|
1588
|
+
}
|
|
1589
|
+
break;
|
|
1590
|
+
case "L":
|
|
1591
|
+
checkEvenArgs(name, args.length, 2);
|
|
1592
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
1593
|
+
x = +args[i];
|
|
1594
|
+
y = +args[i + 1];
|
|
1595
|
+
this.lineTo(x, y);
|
|
1596
|
+
}
|
|
1597
|
+
break;
|
|
1598
|
+
case "l":
|
|
1599
|
+
checkEvenArgs(name, args.length, 2);
|
|
1600
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
1601
|
+
x += +args[i];
|
|
1602
|
+
y += +args[i + 1];
|
|
1603
|
+
this.lineTo(x, y);
|
|
1604
|
+
}
|
|
1605
|
+
break;
|
|
1606
|
+
case "H":
|
|
1607
|
+
checkMinArgs(name, args.length, 1);
|
|
1608
|
+
for (let i = 0; i < args.length; ++i) {
|
|
1609
|
+
x = +args[i];
|
|
1610
|
+
this.lineTo(x, y);
|
|
1611
|
+
}
|
|
1612
|
+
break;
|
|
1613
|
+
case "h":
|
|
1614
|
+
checkMinArgs(name, args.length, 1);
|
|
1615
|
+
for (let i = 0; i < args.length; ++i) {
|
|
1616
|
+
x += +args[i];
|
|
1617
|
+
this.lineTo(x, y);
|
|
1618
|
+
}
|
|
1619
|
+
break;
|
|
1620
|
+
case "V":
|
|
1621
|
+
checkMinArgs(name, args.length, 1);
|
|
1622
|
+
for (let i = 0; i < args.length; ++i) {
|
|
1623
|
+
y = +args[i];
|
|
1624
|
+
this.lineTo(x, y);
|
|
1625
|
+
}
|
|
1626
|
+
break;
|
|
1627
|
+
case "v":
|
|
1628
|
+
checkMinArgs(name, args.length, 1);
|
|
1629
|
+
for (let i = 0; i < args.length; ++i) {
|
|
1630
|
+
y += +args[i];
|
|
1631
|
+
this.lineTo(x, y);
|
|
1632
|
+
}
|
|
1633
|
+
break;
|
|
1634
|
+
case "C":
|
|
1635
|
+
checkEvenArgs(name, args.length, 6);
|
|
1636
|
+
for (let i = 0; i < args.length; i += 6) {
|
|
1637
|
+
const x1 = +args[i];
|
|
1638
|
+
const y1 = +args[i + 1];
|
|
1639
|
+
cpx = +args[i + 2];
|
|
1640
|
+
cpy = +args[i + 3];
|
|
1641
|
+
x = +args[i + 4];
|
|
1642
|
+
y = +args[i + 5];
|
|
1643
|
+
this.bezierCurveTo(x1, y1, cpx, cpy, x, y);
|
|
1644
|
+
}
|
|
1645
|
+
break;
|
|
1646
|
+
case "c":
|
|
1647
|
+
checkEvenArgs(name, args.length, 6);
|
|
1648
|
+
for (let i = 0; i < args.length; i += 6) {
|
|
1649
|
+
const x1 = +args[i] + x;
|
|
1650
|
+
const y1 = +args[i + 1] + y;
|
|
1651
|
+
cpx = +args[i + 2] + x;
|
|
1652
|
+
cpy = +args[i + 3] + y;
|
|
1653
|
+
x += +args[i + 4];
|
|
1654
|
+
y += +args[i + 5];
|
|
1655
|
+
this.bezierCurveTo(x1, y1, cpx, cpy, x, y);
|
|
1656
|
+
}
|
|
1657
|
+
break;
|
|
1658
|
+
case "S":
|
|
1659
|
+
checkEvenArgs(name, args.length, 4);
|
|
1660
|
+
if (cpx === null || cpy === null) {
|
|
1661
|
+
cpx = x;
|
|
1662
|
+
cpy = y;
|
|
1663
|
+
}
|
|
1664
|
+
for (let i = 0; i < args.length; i += 4) {
|
|
1665
|
+
const x1 = 2 * x - cpx;
|
|
1666
|
+
const y1 = 2 * y - cpy;
|
|
1667
|
+
cpx = +args[i];
|
|
1668
|
+
cpy = +args[i + 1];
|
|
1669
|
+
x = +args[i + 2];
|
|
1670
|
+
y = +args[i + 3];
|
|
1671
|
+
this.bezierCurveTo(x1, y1, cpx, cpy, x, y);
|
|
1672
|
+
}
|
|
1673
|
+
break;
|
|
1674
|
+
case "s":
|
|
1675
|
+
checkEvenArgs(name, args.length, 4);
|
|
1676
|
+
if (cpx === null || cpy === null) {
|
|
1677
|
+
cpx = x;
|
|
1678
|
+
cpy = y;
|
|
1679
|
+
}
|
|
1680
|
+
for (let i = 0; i < args.length; i += 4) {
|
|
1681
|
+
const x1 = 2 * x - cpx;
|
|
1682
|
+
const y1 = 2 * y - cpy;
|
|
1683
|
+
cpx = +args[i] + x;
|
|
1684
|
+
cpy = +args[i + 1] + y;
|
|
1685
|
+
x += +args[i + 2];
|
|
1686
|
+
y += +args[i + 3];
|
|
1687
|
+
this.bezierCurveTo(x1, y1, cpx, cpy, x, y);
|
|
1688
|
+
}
|
|
1689
|
+
break;
|
|
1690
|
+
case "Q":
|
|
1691
|
+
checkEvenArgs(name, args.length, 4);
|
|
1692
|
+
for (let i = 0; i < args.length; i += 4) {
|
|
1693
|
+
qcpx = +args[i];
|
|
1694
|
+
qcpy = +args[i + 1];
|
|
1695
|
+
x = +args[i + 2];
|
|
1696
|
+
y = +args[i + 3];
|
|
1697
|
+
this.quadraticCurveTo(qcpx, qcpy, x, y);
|
|
1698
|
+
}
|
|
1699
|
+
break;
|
|
1700
|
+
case "q":
|
|
1701
|
+
checkEvenArgs(name, args.length, 4);
|
|
1702
|
+
for (let i = 0; i < args.length; i += 4) {
|
|
1703
|
+
qcpx = +args[i] + x;
|
|
1704
|
+
qcpy = +args[i + 1] + y;
|
|
1705
|
+
x += +args[i + 2];
|
|
1706
|
+
y += +args[i + 3];
|
|
1707
|
+
this.quadraticCurveTo(qcpx, qcpy, x, y);
|
|
1708
|
+
}
|
|
1709
|
+
break;
|
|
1710
|
+
case "T":
|
|
1711
|
+
checkEvenArgs(name, args.length, 2);
|
|
1712
|
+
if (qcpx === null || qcpy === null) {
|
|
1713
|
+
qcpx = x;
|
|
1714
|
+
qcpy = y;
|
|
1715
|
+
}
|
|
1716
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
1717
|
+
qcpx = 2 * x - qcpx;
|
|
1718
|
+
qcpy = 2 * y - qcpy;
|
|
1719
|
+
x = +args[i];
|
|
1720
|
+
y = +args[i + 1];
|
|
1721
|
+
this.quadraticCurveTo(qcpx, qcpy, x, y);
|
|
1722
|
+
}
|
|
1723
|
+
break;
|
|
1724
|
+
case "t":
|
|
1725
|
+
checkEvenArgs(name, args.length, 2);
|
|
1726
|
+
if (qcpx === null || qcpy === null) {
|
|
1727
|
+
qcpx = x;
|
|
1728
|
+
qcpy = y;
|
|
1729
|
+
}
|
|
1730
|
+
for (let i = 0; i < args.length; i += 2) {
|
|
1731
|
+
qcpx = 2 * x - qcpx;
|
|
1732
|
+
qcpy = 2 * y - qcpy;
|
|
1733
|
+
x += +args[i];
|
|
1734
|
+
y += +args[i + 1];
|
|
1735
|
+
this.quadraticCurveTo(qcpx, qcpy, x, y);
|
|
1736
|
+
}
|
|
1737
|
+
break;
|
|
1738
|
+
case "A":
|
|
1739
|
+
case "a":
|
|
1740
|
+
const relative = (name === "a");
|
|
1741
|
+
splitArcFlags(args);
|
|
1742
|
+
checkEvenArgs(name, args.length, 7);
|
|
1743
|
+
for (let i = 0; i < args.length; i += 7) {
|
|
1744
|
+
let cx = +args[i + 5];
|
|
1745
|
+
let cy = +args[i + 6];
|
|
1746
|
+
if (relative) {
|
|
1747
|
+
cx += x;
|
|
1748
|
+
cy += y;
|
|
1749
|
+
}
|
|
1750
|
+
const bs = arcToBezier({
|
|
1751
|
+
px: x,
|
|
1752
|
+
py: y,
|
|
1753
|
+
rx: +args[i],
|
|
1754
|
+
ry: +args[i + 1],
|
|
1755
|
+
xAxisRotation: +args[i + 2],
|
|
1756
|
+
largeArcFlag: assertBinary(+args[i + 3]),
|
|
1757
|
+
sweepFlag: assertBinary(+args[i + 4]),
|
|
1758
|
+
cx,
|
|
1759
|
+
cy,
|
|
1760
|
+
});
|
|
1761
|
+
$array.each(bs, (b) => {
|
|
1762
|
+
this.bezierCurveTo(b.x1, b.y1, b.x2, b.y2, b.x, b.y);
|
|
1763
|
+
x = b.x;
|
|
1764
|
+
y = b.y;
|
|
1765
|
+
});
|
|
1766
|
+
}
|
|
1767
|
+
break;
|
|
1768
|
+
case "Z":
|
|
1769
|
+
case "z":
|
|
1770
|
+
checkArgs(name, args.length, 0);
|
|
1771
|
+
this.closePath();
|
|
1772
|
+
break;
|
|
1773
|
+
}
|
|
1770
1774
|
}
|
|
1771
1775
|
}
|
|
1776
|
+
catch (e) {
|
|
1777
|
+
// Undo any operations back to before `svgPath` was called
|
|
1778
|
+
this._operations.length = length;
|
|
1779
|
+
console.warn("Error when parsing svgPath:\n " + e.message + "\n" + path);
|
|
1780
|
+
}
|
|
1772
1781
|
}
|
|
1773
1782
|
_runPath(context) {
|
|
1774
1783
|
context.beginPath();
|