@visactor/react-vtable 1.18.4 → 1.19.0-alpha.0

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.
@@ -377,8 +377,7 @@
377
377
  };
378
378
  var isPlainObject$3 = isPlainObject$2;
379
379
 
380
- const isString$2 = function (value) {
381
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
380
+ const isString$2 = (value, fuzzy = !1) => {
382
381
  const type = typeof value;
383
382
  return fuzzy ? "string" === type : "string" === type || isType$3(value, "String");
384
383
  };
@@ -392,16 +391,13 @@
392
391
  };
393
392
  var isArrayLike$3 = isArrayLike$2;
394
393
 
395
- const isNumber$2 = function (value) {
396
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
394
+ const isNumber$2 = (value, fuzzy = !1) => {
397
395
  const type = typeof value;
398
396
  return fuzzy ? "number" === type : "number" === type || isType$3(value, "Number");
399
397
  };
400
398
  var isNumber$3 = isNumber$2;
401
399
 
402
- function baseMerge$1(target, source) {
403
- let shallowArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
404
- let skipTargetArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
400
+ function baseMerge$1(target, source, shallowArray = !1, skipTargetArray = !1) {
405
401
  if (source) {
406
402
  if (target === source) return;
407
403
  if (isValid$3(source) && "object" == typeof source) {
@@ -419,9 +415,7 @@
419
415
  }
420
416
  }
421
417
  }
422
- function baseMergeDeep$1(target, source, key) {
423
- let shallowArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
424
- let skipTargetArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
418
+ function baseMergeDeep$1(target, source, key, shallowArray = !1, skipTargetArray = !1) {
425
419
  const objValue = target[key],
426
420
  srcValue = source[key];
427
421
  let newValue = source[key],
@@ -442,11 +436,11 @@
442
436
  function eq$1(value, other) {
443
437
  return value === other || Number.isNaN(value) && Number.isNaN(other);
444
438
  }
445
- function merge$1(target) {
439
+ function merge$1(target, ...sources) {
446
440
  let sourceIndex = -1;
447
- const length = arguments.length <= 1 ? 0 : arguments.length - 1;
441
+ const length = sources.length;
448
442
  for (; ++sourceIndex < length;) {
449
- baseMerge$1(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
443
+ baseMerge$1(target, sources[sourceIndex], !0);
450
444
  }
451
445
  return target;
452
446
  }
@@ -543,8 +537,7 @@
543
537
  };
544
538
  };
545
539
 
546
- const styleStringToObject$1 = function () {
547
- let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
540
+ const styleStringToObject$1 = (styleStr = "") => {
548
541
  const res = {};
549
542
  return styleStr.split(";").forEach(item => {
550
543
  if (item) {
@@ -1307,12 +1300,9 @@
1307
1300
  }
1308
1301
  }
1309
1302
  function bindContributionProvider(bind, id) {
1310
- bind(ContributionProvider).toDynamicValue(_ref => {
1311
- let {
1312
- container: container
1313
- } = _ref;
1314
- return new ContributionProviderCache(id, container);
1315
- }).inSingletonScope().whenTargetNamed(id);
1303
+ bind(ContributionProvider).toDynamicValue(({
1304
+ container: container
1305
+ }) => new ContributionProviderCache(id, container)).inSingletonScope().whenTargetNamed(id);
1316
1306
  }
1317
1307
  class ContributionStore {
1318
1308
  static getStore(id) {
@@ -1382,10 +1372,7 @@
1382
1372
  }
1383
1373
 
1384
1374
  class SyncHook extends Hook {
1385
- call() {
1386
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1387
- args[_key] = arguments[_key];
1388
- }
1375
+ call(...args) {
1389
1376
  this.taps.map(t => t.fn).forEach(cb => cb(...args));
1390
1377
  }
1391
1378
  }
@@ -1393,6 +1380,9 @@
1393
1380
  const EnvContribution = Symbol.for("EnvContribution");
1394
1381
  const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
1395
1382
 
1383
+ class Application {}
1384
+ const application = new Application();
1385
+
1396
1386
  var MeasureModeEnum;
1397
1387
  !function (MeasureModeEnum) {
1398
1388
  MeasureModeEnum[MeasureModeEnum.estimate = 0] = "estimate", MeasureModeEnum[MeasureModeEnum.actualBounding = 1] = "actualBounding", MeasureModeEnum[MeasureModeEnum.fontBounding = 2] = "fontBounding";
@@ -1401,10 +1391,7 @@
1401
1391
  const isType = (value, type) => Object.prototype.toString.call(value) === `[object ${type}]`;
1402
1392
  var isType$1 = isType;
1403
1393
 
1404
- const isBoolean = function (value) {
1405
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1406
- return fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
1407
- };
1394
+ const isBoolean = (value, fuzzy = !1) => fuzzy ? "boolean" == typeof value : !0 === value || !1 === value || isType$1(value, "Boolean");
1408
1395
  var isBoolean$1 = isBoolean;
1409
1396
 
1410
1397
  const isFunction = value => "function" == typeof value;
@@ -1434,8 +1421,7 @@
1434
1421
  };
1435
1422
  var isPlainObject$1 = isPlainObject;
1436
1423
 
1437
- const isString = function (value) {
1438
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1424
+ const isString = (value, fuzzy = !1) => {
1439
1425
  const type = typeof value;
1440
1426
  return fuzzy ? "string" === type : "string" === type || isType$1(value, "String");
1441
1427
  };
@@ -1449,8 +1435,7 @@
1449
1435
  };
1450
1436
  var isArrayLike$1 = isArrayLike;
1451
1437
 
1452
- const isNumber = function (value) {
1453
- let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
1438
+ const isNumber = (value, fuzzy = !1) => {
1454
1439
  const type = typeof value;
1455
1440
  return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
1456
1441
  };
@@ -1475,24 +1460,18 @@
1475
1460
  };
1476
1461
  var isPrototype$1 = isPrototype;
1477
1462
 
1478
- const hasOwnProperty$1 = Object.prototype.hasOwnProperty;
1463
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
1479
1464
  function isEmpty(value) {
1480
1465
  if (isNil$1(value)) return !0;
1481
1466
  if (isArrayLike$1(value)) return !value.length;
1482
1467
  const type = getType$1(value);
1483
1468
  if ("Map" === type || "Set" === type) return !value.size;
1484
1469
  if (isPrototype$1(value)) return !Object.keys(value).length;
1485
- for (const key in value) if (hasOwnProperty$1.call(value, key)) return !1;
1470
+ for (const key in value) if (hasOwnProperty.call(value, key)) return !1;
1486
1471
  return !0;
1487
1472
  }
1488
1473
 
1489
- const hasOwnProperty = Object.prototype.hasOwnProperty,
1490
- has = (object, key) => null != object && hasOwnProperty.call(object, key);
1491
- var has$1 = has;
1492
-
1493
- function baseMerge(target, source) {
1494
- let shallowArray = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
1495
- let skipTargetArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
1474
+ function baseMerge(target, source, shallowArray = !1, skipTargetArray = !1) {
1496
1475
  if (source) {
1497
1476
  if (target === source) return;
1498
1477
  if (isValid$1(source) && "object" == typeof source) {
@@ -1510,9 +1489,7 @@
1510
1489
  }
1511
1490
  }
1512
1491
  }
1513
- function baseMergeDeep(target, source, key) {
1514
- let shallowArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
1515
- let skipTargetArray = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !1;
1492
+ function baseMergeDeep(target, source, key, shallowArray = !1, skipTargetArray = !1) {
1516
1493
  const objValue = target[key],
1517
1494
  srcValue = source[key];
1518
1495
  let newValue = source[key],
@@ -1533,11 +1510,11 @@
1533
1510
  function eq(value, other) {
1534
1511
  return value === other || Number.isNaN(value) && Number.isNaN(other);
1535
1512
  }
1536
- function merge(target) {
1513
+ function merge(target, ...sources) {
1537
1514
  let sourceIndex = -1;
1538
- const length = arguments.length <= 1 ? 0 : arguments.length - 1;
1515
+ const length = sources.length;
1539
1516
  for (; ++sourceIndex < length;) {
1540
- baseMerge(target, sourceIndex + 1 < 1 || arguments.length <= sourceIndex + 1 ? undefined : arguments[sourceIndex + 1], !0);
1517
+ baseMerge(target, sources[sourceIndex], !0);
1541
1518
  }
1542
1519
  return target;
1543
1520
  }
@@ -1574,9 +1551,7 @@
1574
1551
  static clearInstance() {
1575
1552
  Logger._instance = null;
1576
1553
  }
1577
- constructor() {
1578
- let level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : LoggerLevel.None;
1579
- let method = arguments.length > 1 ? arguments[1] : undefined;
1554
+ constructor(level = LoggerLevel.None, method) {
1580
1555
  this._onErrorHandler = [], this._level = level, this._method = method;
1581
1556
  }
1582
1557
  addErrorHandler(handler) {
@@ -1586,10 +1561,7 @@
1586
1561
  const index = this._onErrorHandler.findIndex(h => h === handler);
1587
1562
  index < 0 || this._onErrorHandler.splice(index, 1);
1588
1563
  }
1589
- callErrorHandler() {
1590
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1591
- args[_key] = arguments[_key];
1592
- }
1564
+ callErrorHandler(...args) {
1593
1565
  this._onErrorHandler.forEach(h => h(...args));
1594
1566
  }
1595
1567
  canLogInfo() {
@@ -1607,39 +1579,22 @@
1607
1579
  level(levelValue) {
1608
1580
  return arguments.length ? (this._level = +levelValue, this) : this._level;
1609
1581
  }
1610
- error() {
1582
+ error(...args) {
1611
1583
  var _a;
1612
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
1613
- args[_key2] = arguments[_key2];
1614
- }
1615
1584
  return this._level >= LoggerLevel.Error && (this._onErrorHandler.length ? this.callErrorHandler(...args) : log(null !== (_a = this._method) && void 0 !== _a ? _a : "error", "ERROR", args)), this;
1616
1585
  }
1617
- warn() {
1618
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
1619
- args[_key3] = arguments[_key3];
1620
- }
1586
+ warn(...args) {
1621
1587
  return this._level >= LoggerLevel.Warn && log(this._method || "warn", "WARN", args), this;
1622
1588
  }
1623
- info() {
1624
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
1625
- args[_key4] = arguments[_key4];
1626
- }
1589
+ info(...args) {
1627
1590
  return this._level >= LoggerLevel.Info && log(this._method || "log", "INFO", args), this;
1628
1591
  }
1629
- debug() {
1630
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
1631
- args[_key5] = arguments[_key5];
1632
- }
1592
+ debug(...args) {
1633
1593
  return this._level >= LoggerLevel.Debug && log(this._method || "log", "DEBUG", args), this;
1634
1594
  }
1635
1595
  }
1636
1596
  Logger._instance = null;
1637
1597
 
1638
- const clamp = function (input, min, max) {
1639
- return input < min ? min : input > max ? max : input;
1640
- };
1641
- var clamp$1 = clamp;
1642
-
1643
1598
  const epsilon = 1e-12;
1644
1599
  const pi = Math.PI;
1645
1600
  const halfPi$1 = pi / 2;
@@ -1658,11 +1613,7 @@
1658
1613
  }
1659
1614
 
1660
1615
  class Point {
1661
- constructor() {
1662
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1663
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1664
- let x1 = arguments.length > 2 ? arguments[2] : undefined;
1665
- let y1 = arguments.length > 3 ? arguments[3] : undefined;
1616
+ constructor(x = 0, y = 0, x1, y1) {
1666
1617
  this.x = 0, this.y = 0, this.x = x, this.y = y, this.x1 = x1, this.y1 = y1;
1667
1618
  }
1668
1619
  clone() {
@@ -1708,8 +1659,7 @@
1708
1659
  function radianToDegree(radian) {
1709
1660
  return 180 * radian / Math.PI;
1710
1661
  }
1711
- const clampRadian = function () {
1712
- let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1662
+ const clampRadian = (angle = 0) => {
1713
1663
  if (angle < 0) for (; angle < -tau;) angle += tau;else if (angle > 0) for (; angle > tau;) angle -= tau;
1714
1664
  return angle;
1715
1665
  };
@@ -1722,15 +1672,13 @@
1722
1672
  function getProjectionRadius(checkAxis, axis) {
1723
1673
  return Math.abs(axis[0] * checkAxis[0] + axis[1] * checkAxis[1]);
1724
1674
  }
1725
- function rotatePoint(_ref, rad) {
1726
- let {
1727
- x: x,
1728
- y: y
1729
- } = _ref;
1730
- let origin = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
1731
- x: 0,
1732
- y: 0
1733
- };
1675
+ function rotatePoint({
1676
+ x: x,
1677
+ y: y
1678
+ }, rad, origin = {
1679
+ x: 0,
1680
+ y: 0
1681
+ }) {
1734
1682
  return {
1735
1683
  x: (x - origin.x) * Math.cos(rad) - (y - origin.y) * Math.sin(rad) + origin.x,
1736
1684
  y: (x - origin.x) * Math.sin(rad) + (y - origin.y) * Math.cos(rad) + origin.y
@@ -1759,8 +1707,7 @@
1759
1707
  y: box.y2
1760
1708
  }, deg, cp)];
1761
1709
  }
1762
- function isRotateAABBIntersect(box1, box2) {
1763
- let isDeg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
1710
+ function isRotateAABBIntersect(box1, box2, isDeg = !1) {
1764
1711
  const rect1 = toRect(box1, isDeg),
1765
1712
  rect2 = toRect(box2, isDeg),
1766
1713
  vector = (start, end) => [end.x - start.x, end.y - start.y],
@@ -1781,9 +1728,17 @@
1781
1728
  return isCover((box1.x2 - box1.x1) / 2, deg11, A1B1, B1C1) && isCover((box1.y2 - box1.y1) / 2, deg12, A1B1, B1C1) && isCover((box2.x2 - box2.x1) / 2, deg21, AB, BC) && isCover((box2.y2 - box2.y1) / 2, deg22, AB, BC);
1782
1729
  }
1783
1730
 
1784
- function getContextFont(text) {
1785
- let defaultAttr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1786
- let fontSizeScale = arguments.length > 2 ? arguments[2] : undefined;
1731
+ function isPointInLine(x0, y0, x1, y1, x, y) {
1732
+ if (y > y0 && y > y1 || y < y0 && y < y1) return 0;
1733
+ if (y1 === y0) return 0;
1734
+ const t = (y - y0) / (y1 - y0);
1735
+ let dir = y1 < y0 ? 1 : -1;
1736
+ 1 !== t && 0 !== t || (dir = y1 < y0 ? .5 : -.5);
1737
+ const x_ = t * (x1 - x0) + x0;
1738
+ return x_ === x ? 1 / 0 : x_ > x ? dir : 0;
1739
+ }
1740
+
1741
+ function getContextFont(text, defaultAttr = {}, fontSizeScale) {
1787
1742
  fontSizeScale || (fontSizeScale = 1);
1788
1743
  const {
1789
1744
  fontStyle = defaultAttr.fontStyle,
@@ -1868,49 +1823,29 @@
1868
1823
  equals(b) {
1869
1824
  return this.x1 === b.x1 && this.y1 === b.y1 && this.x2 === b.x2 && this.y2 === b.y2;
1870
1825
  }
1871
- setValue() {
1872
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1873
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1874
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1875
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1826
+ setValue(x1 = 0, y1 = 0, x2 = 0, y2 = 0) {
1876
1827
  return this.x1 = x1, this.y1 = y1, this.x2 = x2, this.y2 = y2, this;
1877
1828
  }
1878
- set() {
1879
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1880
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1881
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1882
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1829
+ set(x1 = 0, y1 = 0, x2 = 0, y2 = 0) {
1883
1830
  return x2 < x1 ? (this.x2 = x1, this.x1 = x2) : (this.x1 = x1, this.x2 = x2), y2 < y1 ? (this.y2 = y1, this.y1 = y2) : (this.y1 = y1, this.y2 = y2), this;
1884
1831
  }
1885
- add() {
1886
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1887
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1832
+ add(x = 0, y = 0) {
1888
1833
  return x < this.x1 && (this.x1 = x), y < this.y1 && (this.y1 = y), x > this.x2 && (this.x2 = x), y > this.y2 && (this.y2 = y), this;
1889
1834
  }
1890
- expand() {
1891
- let d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1835
+ expand(d = 0) {
1892
1836
  return isArray$1(d) ? (this.y1 -= d[0], this.x2 += d[1], this.y2 += d[2], this.x1 -= d[3]) : (this.x1 -= d, this.y1 -= d, this.x2 += d, this.y2 += d), this;
1893
1837
  }
1894
1838
  round() {
1895
1839
  return this.x1 = Math.floor(this.x1), this.y1 = Math.floor(this.y1), this.x2 = Math.ceil(this.x2), this.y2 = Math.ceil(this.y2), this;
1896
1840
  }
1897
- translate() {
1898
- let dx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1899
- let dy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1841
+ translate(dx = 0, dy = 0) {
1900
1842
  return this.x1 += dx, this.x2 += dx, this.y1 += dy, this.y2 += dy, this;
1901
1843
  }
1902
- rotate() {
1903
- let angle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1904
- let x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1905
- let y = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1844
+ rotate(angle = 0, x = 0, y = 0) {
1906
1845
  const p = this.rotatedPoints(angle, x, y);
1907
1846
  return this.clear().add(p[0], p[1]).add(p[2], p[3]).add(p[4], p[5]).add(p[6], p[7]);
1908
1847
  }
1909
- scale() {
1910
- let sx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1911
- let sy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1912
- let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1913
- let y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1848
+ scale(sx = 0, sy = 0, x = 0, y = 0) {
1914
1849
  const p = this.scalePoints(sx, sy, x, y);
1915
1850
  return this.clear().add(p[0], p[1]).add(p[2], p[3]);
1916
1851
  }
@@ -1929,9 +1864,7 @@
1929
1864
  intersects(b) {
1930
1865
  return b && !(this.x2 < b.x1 || this.x1 > b.x2 || this.y2 < b.y1 || this.y1 > b.y2);
1931
1866
  }
1932
- contains() {
1933
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1934
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1867
+ contains(x = 0, y = 0) {
1935
1868
  return !(x < this.x1 || x > this.x2 || y < this.y1 || y > this.y2);
1936
1869
  }
1937
1870
  containsPoint(p) {
@@ -1943,12 +1876,10 @@
1943
1876
  height() {
1944
1877
  return this.empty() ? 0 : this.y2 - this.y1;
1945
1878
  }
1946
- scaleX() {
1947
- let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1879
+ scaleX(s = 0) {
1948
1880
  return this.x1 *= s, this.x2 *= s, this;
1949
1881
  }
1950
- scaleY() {
1951
- let s = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1882
+ scaleY(s = 0) {
1952
1883
  return this.y1 *= s, this.y2 *= s, this;
1953
1884
  }
1954
1885
  transformWithMatrix(matrix) {
@@ -1982,20 +1913,14 @@
1982
1913
  }
1983
1914
  class AABBBounds extends Bounds {}
1984
1915
  class OBBBounds extends Bounds {
1985
- constructor(bounds) {
1986
- let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1916
+ constructor(bounds, angle = 0) {
1987
1917
  var _a;
1988
1918
  super(bounds), bounds && (this.angle = null !== (_a = bounds.angle) && void 0 !== _a ? _a : angle);
1989
1919
  }
1990
1920
  intersects(b) {
1991
1921
  return isRotateAABBIntersect(this, b);
1992
1922
  }
1993
- setValue() {
1994
- let x1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
1995
- let y1 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
1996
- let x2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
1997
- let y2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1998
- let angle = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1923
+ setValue(x1 = 0, y1 = 0, x2 = 0, y2 = 0, angle = 0) {
1999
1924
  return super.setValue(x1, y1, x2, y2), this.angle = angle, this;
2000
1925
  }
2001
1926
  clone() {
@@ -2023,13 +1948,7 @@
2023
1948
  }
2024
1949
 
2025
1950
  class Matrix {
2026
- constructor() {
2027
- let a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2028
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
2029
- let c = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2030
- let d = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
2031
- let e = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
2032
- let f = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
1951
+ constructor(a = 1, b = 0, c = 0, d = 1, e = 0, f = 0) {
2033
1952
  this.a = a, this.b = b, this.c = c, this.d = d, this.e = e, this.f = f;
2034
1953
  }
2035
1954
  equalToMatrix(m2) {
@@ -2139,8 +2058,7 @@
2139
2058
  } = source;
2140
2059
  target.x = x * nextA + y * nextC + nextE, target.y = x * nextB + y * nextD + nextF;
2141
2060
  }
2142
- onlyTranslate() {
2143
- let scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2061
+ onlyTranslate(scale = 1) {
2144
2062
  return this.a === scale && 0 === this.b && 0 === this.c && this.d === scale;
2145
2063
  }
2146
2064
  clone() {
@@ -2191,404 +2109,6 @@
2191
2109
  out.a = scaleX * a1, out.b = scaleX * b1, out.c = scaleY * c1, out.d = scaleY * d1, out.e = oe + oa * rotateCenterX + oc * rotateCenterY - a1 * offsetX - c1 * offsetY, out.f = of + ob * rotateCenterX + od * rotateCenterY - b1 * offsetX - d1 * offsetY;
2192
2110
  }
2193
2111
 
2194
- function hslToRgb(h, s, l) {
2195
- s /= 100, l /= 100;
2196
- const c = (1 - Math.abs(2 * l - 1)) * s,
2197
- x = c * (1 - Math.abs(h / 60 % 2 - 1)),
2198
- m = l - c / 2;
2199
- let r = 0,
2200
- g = 0,
2201
- b = 0;
2202
- return 0 <= h && h < 60 ? (r = c, g = x, b = 0) : 60 <= h && h < 120 ? (r = x, g = c, b = 0) : 120 <= h && h < 180 ? (r = 0, g = c, b = x) : 180 <= h && h < 240 ? (r = 0, g = x, b = c) : 240 <= h && h < 300 ? (r = x, g = 0, b = c) : 300 <= h && h < 360 && (r = c, g = 0, b = x), r = Math.round(255 * (r + m)), g = Math.round(255 * (g + m)), b = Math.round(255 * (b + m)), {
2203
- r: r,
2204
- g: g,
2205
- b: b
2206
- };
2207
- }
2208
-
2209
- function rgbToHsl(r, g, b) {
2210
- r /= 255, g /= 255, b /= 255;
2211
- const cMin = Math.min(r, g, b),
2212
- cMax = Math.max(r, g, b),
2213
- delta = cMax - cMin;
2214
- let h = 0,
2215
- s = 0,
2216
- l = 0;
2217
- return h = 0 === delta ? 0 : cMax === r ? (g - b) / delta % 6 : cMax === g ? (b - r) / delta + 2 : (r - g) / delta + 4, h = Math.round(60 * h), h < 0 && (h += 360), l = (cMax + cMin) / 2, s = 0 === delta ? 0 : delta / (1 - Math.abs(2 * l - 1)), s = +(100 * s).toFixed(1), l = +(100 * l).toFixed(1), {
2218
- h: h,
2219
- s: s,
2220
- l: l
2221
- };
2222
- }
2223
-
2224
- const REG_HEX = /^#([0-9a-f]{3,8})$/,
2225
- DEFAULT_COLORS_OPACITY = {
2226
- transparent: 4294967040
2227
- };
2228
- const DEFAULT_COLORS = {
2229
- aliceblue: 15792383,
2230
- antiquewhite: 16444375,
2231
- aqua: 65535,
2232
- aquamarine: 8388564,
2233
- azure: 15794175,
2234
- beige: 16119260,
2235
- bisque: 16770244,
2236
- black: 0,
2237
- blanchedalmond: 16772045,
2238
- blue: 255,
2239
- blueviolet: 9055202,
2240
- brown: 10824234,
2241
- burlywood: 14596231,
2242
- cadetblue: 6266528,
2243
- chartreuse: 8388352,
2244
- chocolate: 13789470,
2245
- coral: 16744272,
2246
- cornflowerblue: 6591981,
2247
- cornsilk: 16775388,
2248
- crimson: 14423100,
2249
- cyan: 65535,
2250
- darkblue: 139,
2251
- darkcyan: 35723,
2252
- darkgoldenrod: 12092939,
2253
- darkgray: 11119017,
2254
- darkgreen: 25600,
2255
- darkgrey: 11119017,
2256
- darkkhaki: 12433259,
2257
- darkmagenta: 9109643,
2258
- darkolivegreen: 5597999,
2259
- darkorange: 16747520,
2260
- darkorchid: 10040012,
2261
- darkred: 9109504,
2262
- darksalmon: 15308410,
2263
- darkseagreen: 9419919,
2264
- darkslateblue: 4734347,
2265
- darkslategray: 3100495,
2266
- darkslategrey: 3100495,
2267
- darkturquoise: 52945,
2268
- darkviolet: 9699539,
2269
- deeppink: 16716947,
2270
- deepskyblue: 49151,
2271
- dimgray: 6908265,
2272
- dimgrey: 6908265,
2273
- dodgerblue: 2003199,
2274
- firebrick: 11674146,
2275
- floralwhite: 16775920,
2276
- forestgreen: 2263842,
2277
- fuchsia: 16711935,
2278
- gainsboro: 14474460,
2279
- ghostwhite: 16316671,
2280
- gold: 16766720,
2281
- goldenrod: 14329120,
2282
- gray: 8421504,
2283
- green: 32768,
2284
- greenyellow: 11403055,
2285
- grey: 8421504,
2286
- honeydew: 15794160,
2287
- hotpink: 16738740,
2288
- indianred: 13458524,
2289
- indigo: 4915330,
2290
- ivory: 16777200,
2291
- khaki: 15787660,
2292
- lavender: 15132410,
2293
- lavenderblush: 16773365,
2294
- lawngreen: 8190976,
2295
- lemonchiffon: 16775885,
2296
- lightblue: 11393254,
2297
- lightcoral: 15761536,
2298
- lightcyan: 14745599,
2299
- lightgoldenrodyellow: 16448210,
2300
- lightgray: 13882323,
2301
- lightgreen: 9498256,
2302
- lightgrey: 13882323,
2303
- lightpink: 16758465,
2304
- lightsalmon: 16752762,
2305
- lightseagreen: 2142890,
2306
- lightskyblue: 8900346,
2307
- lightslategray: 7833753,
2308
- lightslategrey: 7833753,
2309
- lightsteelblue: 11584734,
2310
- lightyellow: 16777184,
2311
- lime: 65280,
2312
- limegreen: 3329330,
2313
- linen: 16445670,
2314
- magenta: 16711935,
2315
- maroon: 8388608,
2316
- mediumaquamarine: 6737322,
2317
- mediumblue: 205,
2318
- mediumorchid: 12211667,
2319
- mediumpurple: 9662683,
2320
- mediumseagreen: 3978097,
2321
- mediumslateblue: 8087790,
2322
- mediumspringgreen: 64154,
2323
- mediumturquoise: 4772300,
2324
- mediumvioletred: 13047173,
2325
- midnightblue: 1644912,
2326
- mintcream: 16121850,
2327
- mistyrose: 16770273,
2328
- moccasin: 16770229,
2329
- navajowhite: 16768685,
2330
- navy: 128,
2331
- oldlace: 16643558,
2332
- olive: 8421376,
2333
- olivedrab: 7048739,
2334
- orange: 16753920,
2335
- orangered: 16729344,
2336
- orchid: 14315734,
2337
- palegoldenrod: 15657130,
2338
- palegreen: 10025880,
2339
- paleturquoise: 11529966,
2340
- palevioletred: 14381203,
2341
- papayawhip: 16773077,
2342
- peachpuff: 16767673,
2343
- peru: 13468991,
2344
- pink: 16761035,
2345
- plum: 14524637,
2346
- powderblue: 11591910,
2347
- purple: 8388736,
2348
- rebeccapurple: 6697881,
2349
- red: 16711680,
2350
- rosybrown: 12357519,
2351
- royalblue: 4286945,
2352
- saddlebrown: 9127187,
2353
- salmon: 16416882,
2354
- sandybrown: 16032864,
2355
- seagreen: 3050327,
2356
- seashell: 16774638,
2357
- sienna: 10506797,
2358
- silver: 12632256,
2359
- skyblue: 8900331,
2360
- slateblue: 6970061,
2361
- slategray: 7372944,
2362
- slategrey: 7372944,
2363
- snow: 16775930,
2364
- springgreen: 65407,
2365
- steelblue: 4620980,
2366
- tan: 13808780,
2367
- teal: 32896,
2368
- thistle: 14204888,
2369
- tomato: 16737095,
2370
- turquoise: 4251856,
2371
- violet: 15631086,
2372
- wheat: 16113331,
2373
- white: 16777215,
2374
- whitesmoke: 16119285,
2375
- yellow: 16776960,
2376
- yellowgreen: 10145074
2377
- };
2378
- function hex(value) {
2379
- return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
2380
- }
2381
- function rgb(value) {
2382
- return isNumber$1(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
2383
- }
2384
- function rgba(value) {
2385
- return isNumber$1(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
2386
- }
2387
- function SRGBToLinear(c) {
2388
- return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
2389
- }
2390
- function LinearToSRGB(c) {
2391
- return c < .0031308 ? 12.92 * c : 1.055 * Math.pow(c, .41666) - .055;
2392
- }
2393
- const setHex = (formatValue, forceHex) => {
2394
- const isHex = REG_HEX.exec(formatValue);
2395
- if (forceHex || isHex) {
2396
- const hex = parseInt(isHex[1], 16),
2397
- hexLength = isHex[1].length;
2398
- return 3 === hexLength ? new RGB((hex >> 8 & 15) + ((hex >> 8 & 15) << 4), (hex >> 4 & 15) + ((hex >> 4 & 15) << 4), (15 & hex) + ((15 & hex) << 4), 1) : 6 === hexLength ? rgb(hex) : 8 === hexLength ? new RGB(hex >> 24 & 255, hex >> 16 & 255, hex >> 8 & 255, (255 & hex) / 255) : null;
2399
- }
2400
- };
2401
- class Color {
2402
- static Brighter(source) {
2403
- let b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2404
- return 1 === b ? source : new Color(source).brighter(b).toRGBA();
2405
- }
2406
- static SetOpacity(source) {
2407
- let o = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2408
- return 1 === o ? source : new Color(source).setOpacity(o).toRGBA();
2409
- }
2410
- static getColorBrightness(source) {
2411
- let model = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "hsl";
2412
- const color = source instanceof Color ? source : new Color(source);
2413
- switch (model) {
2414
- case "hsv":
2415
- default:
2416
- return color.getHSVBrightness();
2417
- case "hsl":
2418
- return color.getHSLBrightness();
2419
- case "lum":
2420
- return color.getLuminance();
2421
- case "lum2":
2422
- return color.getLuminance2();
2423
- case "lum3":
2424
- return color.getLuminance3();
2425
- case "wcag":
2426
- return color.getLuminanceWCAG();
2427
- }
2428
- }
2429
- static parseColorString(value) {
2430
- if (isValid$1(DEFAULT_COLORS_OPACITY[value])) return rgba(DEFAULT_COLORS_OPACITY[value]);
2431
- if (isValid$1(DEFAULT_COLORS[value])) return rgb(DEFAULT_COLORS[value]);
2432
- const formatValue = `${value}`.trim().toLowerCase(),
2433
- hexRes = setHex(formatValue);
2434
- if (void 0 !== hexRes) return hexRes;
2435
- if (/^(rgb|RGB|rgba|RGBA)/.test(formatValue)) {
2436
- const aColor = formatValue.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g, "").split(",");
2437
- return new RGB(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10), parseFloat(aColor[3]));
2438
- }
2439
- if (/^(hsl|HSL|hsla|HSLA)/.test(formatValue)) {
2440
- const aColor = formatValue.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g, "").split(","),
2441
- rgb = hslToRgb(parseInt(aColor[0], 10), parseInt(aColor[1], 10), parseInt(aColor[2], 10));
2442
- return new RGB(rgb.r, rgb.g, rgb.b, parseFloat(aColor[3]));
2443
- }
2444
- }
2445
- constructor(value) {
2446
- const color = Color.parseColorString(value);
2447
- color ? this.color = color : (this.color = new RGB(255, 255, 255));
2448
- }
2449
- toRGBA() {
2450
- return this.color.formatRgb();
2451
- }
2452
- toString() {
2453
- return this.color.formatRgb();
2454
- }
2455
- toHex() {
2456
- return this.color.formatHex();
2457
- }
2458
- toHsl() {
2459
- return this.color.formatHsl();
2460
- }
2461
- brighter(k) {
2462
- const {
2463
- r: r,
2464
- g: g,
2465
- b: b
2466
- } = this.color;
2467
- return this.color.r = Math.max(0, Math.min(255, Math.floor(r * k))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * k))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * k))), this;
2468
- }
2469
- add(color) {
2470
- const {
2471
- r: r,
2472
- g: g,
2473
- b: b
2474
- } = this.color;
2475
- return this.color.r += Math.min(255, r + color.color.r), this.color.g += Math.min(255, g + color.color.g), this.color.b += Math.min(255, b + color.color.b), this;
2476
- }
2477
- sub(color) {
2478
- return this.color.r = Math.max(0, this.color.r - color.color.r), this.color.g = Math.max(0, this.color.g - color.color.g), this.color.b = Math.max(0, this.color.b - color.color.b), this;
2479
- }
2480
- multiply(color) {
2481
- const {
2482
- r: r,
2483
- g: g,
2484
- b: b
2485
- } = this.color;
2486
- return this.color.r = Math.max(0, Math.min(255, Math.floor(r * color.color.r))), this.color.g = Math.max(0, Math.min(255, Math.floor(g * color.color.g))), this.color.b = Math.max(0, Math.min(255, Math.floor(b * color.color.b))), this;
2487
- }
2488
- getHSVBrightness() {
2489
- return Math.max(this.color.r, this.color.g, this.color.b) / 255;
2490
- }
2491
- getHSLBrightness() {
2492
- return .5 * (Math.max(this.color.r, this.color.g, this.color.b) / 255 + Math.min(this.color.r, this.color.g, this.color.b) / 255);
2493
- }
2494
- setHsl(h, s, l) {
2495
- const opacity = this.color.opacity,
2496
- hsl = rgbToHsl(this.color.r, this.color.g, this.color.b),
2497
- rgb = hslToRgb(isNil$1(h) ? hsl.h : clamp$1(h, 0, 360), isNil$1(s) ? hsl.s : s >= 0 && s <= 1 ? 100 * s : s, isNil$1(l) ? hsl.l : l <= 1 && l >= 0 ? 100 * l : l);
2498
- return this.color = new RGB(rgb.r, rgb.g, rgb.b, opacity), this;
2499
- }
2500
- setRGB(r, g, b) {
2501
- return !isNil$1(r) && (this.color.r = r), !isNil$1(g) && (this.color.g = g), !isNil$1(b) && (this.color.b = b), this;
2502
- }
2503
- setHex(value) {
2504
- const formatValue = `${value}`.trim().toLowerCase(),
2505
- res = setHex(formatValue, !0);
2506
- return null != res ? res : this;
2507
- }
2508
- setColorName(name) {
2509
- const hex = DEFAULT_COLORS[name.toLowerCase()];
2510
- return void 0 !== hex ? this.setHex(hex) : (void 0), this;
2511
- }
2512
- setScalar(scalar) {
2513
- return this.color.r = scalar, this.color.g = scalar, this.color.b = scalar, this;
2514
- }
2515
- setOpacity() {
2516
- let o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
2517
- return this.color.opacity = o, this;
2518
- }
2519
- getLuminance() {
2520
- return (.2126 * this.color.r + .7152 * this.color.g + .0722 * this.color.b) / 255;
2521
- }
2522
- getLuminance2() {
2523
- return (.2627 * this.color.r + .678 * this.color.g + .0593 * this.color.b) / 255;
2524
- }
2525
- getLuminance3() {
2526
- return (.299 * this.color.r + .587 * this.color.g + .114 * this.color.b) / 255;
2527
- }
2528
- getLuminanceWCAG() {
2529
- const RsRGB = this.color.r / 255,
2530
- GsRGB = this.color.g / 255,
2531
- BsRGB = this.color.b / 255;
2532
- let R, G, B;
2533
- R = RsRGB <= .03928 ? RsRGB / 12.92 : Math.pow((RsRGB + .055) / 1.055, 2.4), G = GsRGB <= .03928 ? GsRGB / 12.92 : Math.pow((GsRGB + .055) / 1.055, 2.4), B = BsRGB <= .03928 ? BsRGB / 12.92 : Math.pow((BsRGB + .055) / 1.055, 2.4);
2534
- return .2126 * R + .7152 * G + .0722 * B;
2535
- }
2536
- clone() {
2537
- return new Color(this.color.toString());
2538
- }
2539
- copyGammaToLinear(color) {
2540
- let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2541
- return this.color.r = Math.pow(color.color.r, gammaFactor), this.color.g = Math.pow(color.color.g, gammaFactor), this.color.b = Math.pow(color.color.b, gammaFactor), this;
2542
- }
2543
- copyLinearToGamma(color) {
2544
- let gammaFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
2545
- const safeInverse = gammaFactor > 0 ? 1 / gammaFactor : 1;
2546
- return this.color.r = Math.pow(color.color.r, safeInverse), this.color.g = Math.pow(color.color.g, safeInverse), this.color.b = Math.pow(color.color.b, safeInverse), this;
2547
- }
2548
- convertGammaToLinear(gammaFactor) {
2549
- return this.copyGammaToLinear(this, gammaFactor), this;
2550
- }
2551
- convertLinearToGamma(gammaFactor) {
2552
- return this.copyLinearToGamma(this, gammaFactor), this;
2553
- }
2554
- copySRGBToLinear(color) {
2555
- return this.color.r = SRGBToLinear(color.color.r), this.color.g = SRGBToLinear(color.color.g), this.color.b = SRGBToLinear(color.color.b), this;
2556
- }
2557
- copyLinearToSRGB(color) {
2558
- return this.color.r = LinearToSRGB(color.color.r), this.color.g = LinearToSRGB(color.color.g), this.color.b = LinearToSRGB(color.color.b), this;
2559
- }
2560
- convertSRGBToLinear() {
2561
- return this.copySRGBToLinear(this), this;
2562
- }
2563
- convertLinearToSRGB() {
2564
- return this.copyLinearToSRGB(this), this;
2565
- }
2566
- }
2567
- class RGB {
2568
- constructor(r, g, b, opacity) {
2569
- this.r = isNaN(+r) ? 255 : Math.max(0, Math.min(255, +r)), this.g = isNaN(+g) ? 255 : Math.max(0, Math.min(255, +g)), this.b = isNaN(+b) ? 255 : Math.max(0, Math.min(255, +b)), isValid$1(opacity) ? this.opacity = isNaN(+opacity) ? 1 : Math.max(0, Math.min(1, +opacity)) : this.opacity = 1;
2570
- }
2571
- formatHex() {
2572
- return `#${hex(this.r) + hex(this.g) + hex(this.b) + (1 === this.opacity ? "" : hex(255 * this.opacity))}`;
2573
- }
2574
- formatRgb() {
2575
- const opacity = this.opacity;
2576
- return `${1 === opacity ? "rgb(" : "rgba("}${this.r},${this.g},${this.b}${1 === opacity ? ")" : `,${opacity})`}`;
2577
- }
2578
- formatHsl() {
2579
- const opacity = this.opacity,
2580
- {
2581
- h: h,
2582
- s: s,
2583
- l: l
2584
- } = rgbToHsl(this.r, this.g, this.b);
2585
- return `${1 === opacity ? "hsl(" : "hsla("}${h},${s}%,${l}%${1 === opacity ? ")" : `,${opacity})`}`;
2586
- }
2587
- toString() {
2588
- return this.formatHex();
2589
- }
2590
- }
2591
-
2592
2112
  function normalizePadding(padding) {
2593
2113
  if (isValidNumber$1(padding)) return [padding, padding, padding, padding];
2594
2114
  if (isArray$1(padding)) {
@@ -2619,8 +2139,7 @@
2619
2139
  return [0, 0, 0, 0];
2620
2140
  }
2621
2141
 
2622
- const styleStringToObject = function () {
2623
- let styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
2142
+ const styleStringToObject = (styleStr = "") => {
2624
2143
  const res = {};
2625
2144
  return styleStr.split(";").forEach(item => {
2626
2145
  if (item) {
@@ -2684,7 +2203,7 @@
2684
2203
  clear() {
2685
2204
  this.bounds.clear();
2686
2205
  }
2687
- release() {}
2206
+ release(...params) {}
2688
2207
  }
2689
2208
 
2690
2209
  class CurvePath {
@@ -2777,18 +2296,6 @@
2777
2296
  !function (AttributeUpdateType) {
2778
2297
  AttributeUpdateType[AttributeUpdateType.INIT = 0] = "INIT", AttributeUpdateType[AttributeUpdateType.DEFAULT = 1] = "DEFAULT", AttributeUpdateType[AttributeUpdateType.STATE = 2] = "STATE", AttributeUpdateType[AttributeUpdateType.ANIMATE_BIND = 10] = "ANIMATE_BIND", AttributeUpdateType[AttributeUpdateType.ANIMATE_PLAY = 11] = "ANIMATE_PLAY", AttributeUpdateType[AttributeUpdateType.ANIMATE_START = 12] = "ANIMATE_START", AttributeUpdateType[AttributeUpdateType.ANIMATE_UPDATE = 13] = "ANIMATE_UPDATE", AttributeUpdateType[AttributeUpdateType.ANIMATE_END = 14] = "ANIMATE_END", AttributeUpdateType[AttributeUpdateType.TRANSLATE = 20] = "TRANSLATE", AttributeUpdateType[AttributeUpdateType.TRANSLATE_TO = 21] = "TRANSLATE_TO", AttributeUpdateType[AttributeUpdateType.SCALE = 22] = "SCALE", AttributeUpdateType[AttributeUpdateType.SCALE_TO = 23] = "SCALE_TO", AttributeUpdateType[AttributeUpdateType.ROTATE = 24] = "ROTATE", AttributeUpdateType[AttributeUpdateType.ROTATE_TO = 25] = "ROTATE_TO";
2779
2298
  }(AttributeUpdateType || (AttributeUpdateType = {}));
2780
- var AnimateStatus;
2781
- !function (AnimateStatus) {
2782
- AnimateStatus[AnimateStatus.INITIAL = 0] = "INITIAL", AnimateStatus[AnimateStatus.RUNNING = 1] = "RUNNING", AnimateStatus[AnimateStatus.PAUSED = 2] = "PAUSED", AnimateStatus[AnimateStatus.END = 3] = "END";
2783
- }(AnimateStatus || (AnimateStatus = {}));
2784
- var AnimateMode;
2785
- !function (AnimateMode) {
2786
- AnimateMode[AnimateMode.NORMAL = 0] = "NORMAL", AnimateMode[AnimateMode.SET_ATTR_IMMEDIATELY = 1] = "SET_ATTR_IMMEDIATELY";
2787
- }(AnimateMode || (AnimateMode = {}));
2788
- var AnimateStepType;
2789
- !function (AnimateStepType) {
2790
- AnimateStepType.wait = "wait", AnimateStepType.from = "from", AnimateStepType.to = "to", AnimateStepType.customAnimate = "customAnimate";
2791
- }(AnimateStepType || (AnimateStepType = {}));
2792
2299
  var Direction;
2793
2300
  !function (Direction) {
2794
2301
  Direction[Direction.ROW = 1] = "ROW", Direction[Direction.COLUMN = 2] = "COLUMN";
@@ -2871,15 +2378,18 @@
2871
2378
  context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]);
2872
2379
  }
2873
2380
  }
2874
- const addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry) => {
2875
- const delta = Math.abs(endAngle - startAngle),
2876
- count = delta > .5 * Math.PI ? Math.ceil(2 * delta / Math.PI) : 1,
2877
- stepAngle = (endAngle - startAngle) / count;
2381
+ const addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry, counterclockwise = !1) => {
2382
+ const PI2 = 2 * Math.PI,
2383
+ sAngle = (startAngle % PI2 + PI2) % PI2;
2384
+ let deltaAngle,
2385
+ eAngle = (endAngle % PI2 + PI2) % PI2;
2386
+ counterclockwise ? (eAngle >= sAngle && (eAngle -= PI2), deltaAngle = eAngle - sAngle) : (eAngle <= sAngle && (eAngle += PI2), deltaAngle = eAngle - sAngle);
2387
+ const count = Math.ceil(Math.abs(deltaAngle) / (.5 * Math.PI)),
2388
+ stepAngle = deltaAngle / count;
2878
2389
  for (let i = 0; i < count; i++) {
2879
- const sa = startAngle + stepAngle * i,
2880
- ea = startAngle + stepAngle * (i + 1),
2881
- len = 4 * Math.tan(Math.abs(stepAngle) / 4) / 3,
2882
- dir = ea < sa ? -1 : 1,
2390
+ const sa = sAngle + stepAngle * i,
2391
+ ea = sAngle + stepAngle * (i + 1),
2392
+ len = 4 / 3 * Math.tan(Math.abs(stepAngle) / 4),
2883
2393
  c1 = Math.cos(sa),
2884
2394
  s1 = Math.sin(sa),
2885
2395
  c2 = Math.cos(ea),
@@ -2888,19 +2398,15 @@
2888
2398
  y1 = s1 * ry + cy,
2889
2399
  x4 = c2 * rx + cx,
2890
2400
  y4 = s2 * ry + cy,
2891
- hx = rx * len * dir,
2892
- hy = ry * len * dir;
2401
+ sign = counterclockwise ? -1 : 1,
2402
+ hx = rx * len * sign,
2403
+ hy = ry * len * sign;
2893
2404
  bezierPath.push(x1 - hx * s1, y1 + hy * c1, x4 + hx * s2, y4 - hy * c2, x4, y4);
2894
2405
  }
2895
2406
  };
2896
2407
 
2897
2408
  const commandFuncs = [(command, context, x, y, sx, sy, z) => context.arc(command[1] * sx + x, command[2] * sy + y, command[3] * (sx + sy) / 2, command[4], command[5], command[6], z), (command, context, x, y, sx, sy, z) => context.arcTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, command[5] * (sx + sy) / 2, z), (command, context, x, y, sx, sy, z) => context.bezierCurveTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, command[5] * sx + x, command[6] * sy + y, z), (command, context, x, y) => context.closePath(), (command, context, x, y, sx, sy) => context.ellipse(command[1] * sx + x, command[2] * sy + y, command[3] * sx, command[4] * sy, command[5], command[6], command[7], command[8]), (command, context, x, y, sx, sy, z) => context.lineTo(command[1] * sx + x, command[2] * sy + y, z), (command, context, x, y, sx, sy, z) => context.moveTo(command[1] * sx + x, command[2] * sy + y, z), (command, context, x, y, sx, sy, z) => context.quadraticCurveTo(command[1] * sx + x, command[2] * sy + y, command[3] * sx + x, command[4] * sy + y, z), (command, context, x, y, sx, sy, z) => context.rect(command[1] * sx + x, command[2] * sy + y, command[3] * sx, command[4] * sy, z)];
2898
- function renderCommandList(commandList, context) {
2899
- let x = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2900
- let y = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2901
- let sx = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
2902
- let sy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1;
2903
- let z = arguments.length > 6 ? arguments[6] : undefined;
2409
+ function renderCommandList(commandList, context, x = 0, y = 0, sx = 1, sy = 1, z) {
2904
2410
  for (let i = 0; i < commandList.length; i++) {
2905
2411
  const command = commandList[i];
2906
2412
  commandFuncs[command[0]](command, context, x, y, sx, sy, z);
@@ -2950,44 +2456,6 @@
2950
2456
  return snapLength([p0.x, p1.x, p2.x], [p0.y, p1.y, p2.y]);
2951
2457
  }
2952
2458
 
2953
- class QuadraticBezierCurve extends Curve {
2954
- constructor(p0, p1, p2) {
2955
- super(), this.type = CurveTypeEnum.QuadraticBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2;
2956
- }
2957
- _validPoint() {
2958
- return Number.isFinite(this.p0.x + this.p0.y + this.p1.x + this.p1.y + this.p2.x + this.p2.y);
2959
- }
2960
- getPointAt(t) {
2961
- if (!1 !== this.defined) return quadPointAt(this.p0, this.p1, this.p2, t);
2962
- throw new Error("defined为false的点不能getPointAt");
2963
- }
2964
- calcLength() {
2965
- return this._validPoint() ? quadLength(this.p0, this.p1, this.p2) : 60;
2966
- }
2967
- calcProjLength(direction) {
2968
- return direction === Direction.ROW ? abs(this.p0.x - this.p2.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p2.y) : 0;
2969
- }
2970
- getAngleAt(t) {
2971
- const minT = max(t - .01, 0),
2972
- maxT = min(t + .01, 1),
2973
- minP = this.getPointAt(minT),
2974
- maxP = this.getPointAt(maxT);
2975
- return atan2(maxP.y - minP.y, maxP.x - minP.x);
2976
- }
2977
- draw(path, x, y, sx, sy, percent) {
2978
- 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) {
2979
- const [curve1] = divideQuad(this, percent);
2980
- path.quadraticCurveTo(curve1.p1.x * sx + x, curve1.p1.y * sy + y, curve1.p2.x * sx + x, curve1.p2.y * sy + y);
2981
- }
2982
- }
2983
- getYAt(x) {
2984
- throw new Error("QuadraticBezierCurve暂不支持getYAt");
2985
- }
2986
- includeX(x) {
2987
- throw new Error("QuadraticBezierCurve暂不支持includeX");
2988
- }
2989
- }
2990
-
2991
2459
  function divideCubic(curve, t) {
2992
2460
  const {
2993
2461
  p0: p0,
@@ -3003,17 +2471,6 @@
3003
2471
  c23 = PointService.pointAtPP(c2, c3, t);
3004
2472
  return [new CubicBezierCurve(p0, c1, c12, pt), new CubicBezierCurve(pt, c23, c3, p3)];
3005
2473
  }
3006
- function divideQuad(curve, t) {
3007
- const {
3008
- p0: p0,
3009
- p1: p1,
3010
- p2: p2
3011
- } = curve,
3012
- pt = quadPointAt(p0, p1, p2, t),
3013
- c1 = PointService.pointAtPP(p0, p1, t),
3014
- c2 = PointService.pointAtPP(p1, p2, t);
3015
- return [new QuadraticBezierCurve(p0, c1, pt), new QuadraticBezierCurve(pt, c2, p2)];
3016
- }
3017
2474
  class CubicBezierCurve extends Curve {
3018
2475
  constructor(p0, p1, p2, p3) {
3019
2476
  super(), this.type = CurveTypeEnum.CubicBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2, this.p3 = p3;
@@ -3182,7 +2639,7 @@
3182
2639
  }
3183
2640
  }
3184
2641
 
3185
- function genCurveSegments(path, points) {
2642
+ function genCurveSegments(path, points, step = 1) {
3186
2643
  let defined0 = !1;
3187
2644
  for (let i = 0, n = points.length; i <= n; i++) i >= n === defined0 && ((defined0 = !defined0) ? path.lineStart() : path.lineEnd()), defined0 && path.point(points[i]);
3188
2645
  }
@@ -3225,8 +2682,7 @@
3225
2682
  return this.context.tryUpdateLength();
3226
2683
  }
3227
2684
  }
3228
- function genLinearSegments(points) {
3229
- let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2685
+ function genLinearSegments(points, params = {}) {
3230
2686
  const {
3231
2687
  direction: direction,
3232
2688
  startPoint: startPoint
@@ -3236,7 +2692,7 @@
3236
2692
  return genLinearTypeSegments(new Linear(segContext, startPoint), points), segContext;
3237
2693
  }
3238
2694
  function genLinearTypeSegments(path, points) {
3239
- return genCurveSegments(path, points);
2695
+ return genCurveSegments(path, points, 1);
3240
2696
  }
3241
2697
 
3242
2698
  function point$3(curveClass, x, y, defined, p) {
@@ -3279,10 +2735,9 @@
3279
2735
  }
3280
2736
  }
3281
2737
  function genBasisTypeSegments(path, points) {
3282
- return genCurveSegments(path, points);
2738
+ return genCurveSegments(path, points, 2);
3283
2739
  }
3284
- function genBasisSegments(points) {
3285
- let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2740
+ function genBasisSegments(points, params = {}) {
3286
2741
  const {
3287
2742
  direction: direction,
3288
2743
  startPoint: startPoint
@@ -3375,10 +2830,9 @@
3375
2830
  }
3376
2831
  }
3377
2832
  function genMonotoneXTypeSegments(path, points) {
3378
- return genCurveSegments(path, points);
2833
+ return genCurveSegments(path, points, 2);
3379
2834
  }
3380
- function genMonotoneXSegments(points) {
3381
- let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2835
+ function genMonotoneXSegments(points, params = {}) {
3382
2836
  const {
3383
2837
  direction: direction,
3384
2838
  startPoint: startPoint
@@ -3389,10 +2843,9 @@
3389
2843
  return genMonotoneXTypeSegments(new MonotoneX(segContext, startPoint), points), segContext;
3390
2844
  }
3391
2845
  function genMonotoneYTypeSegments(path, points) {
3392
- return genCurveSegments(path, points);
2846
+ return genCurveSegments(path, points, 2);
3393
2847
  }
3394
- function genMonotoneYSegments(points) {
3395
- let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2848
+ function genMonotoneYSegments(points, params = {}) {
3396
2849
  const {
3397
2850
  direction: direction,
3398
2851
  startPoint: startPoint
@@ -3403,10 +2856,8 @@
3403
2856
  return genMonotoneYTypeSegments(new MonotoneY(segContext, startPoint), points), segContext;
3404
2857
  }
3405
2858
 
3406
- let Step$1 = class Step {
3407
- constructor(context) {
3408
- let t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .5;
3409
- let startPoint = arguments.length > 2 ? arguments[2] : undefined;
2859
+ class Step {
2860
+ constructor(context, t = .5, startPoint) {
3410
2861
  this.context = context, this._t = t, this.startPoint = startPoint;
3411
2862
  }
3412
2863
  areaStart() {
@@ -3441,27 +2892,25 @@
3441
2892
  tryUpdateLength() {
3442
2893
  return this.context.tryUpdateLength();
3443
2894
  }
3444
- };
3445
- class StepClosed extends Step$1 {
2895
+ }
2896
+ class StepClosed extends Step {
3446
2897
  lineEnd() {
3447
2898
  this.context.closePath();
3448
2899
  }
3449
2900
  }
3450
- function genStepSegments(points, t) {
3451
- let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2901
+ function genStepSegments(points, t, params = {}) {
3452
2902
  const {
3453
2903
  direction: direction,
3454
2904
  startPoint: startPoint
3455
2905
  } = params;
3456
2906
  if (points.length < 2 - Number(!!startPoint)) return null;
3457
2907
  const segContext = new SegContext("step", null != direction ? direction : abs(points[points.length - 1].x - points[0].x) > abs(points[points.length - 1].y - points[0].y) ? Direction.ROW : Direction.COLUMN);
3458
- return genStepTypeSegments(new Step$1(segContext, t, startPoint), points), segContext;
2908
+ return genStepTypeSegments(new Step(segContext, t, startPoint), points), segContext;
3459
2909
  }
3460
2910
  function genStepTypeSegments(path, points) {
3461
- return genCurveSegments(path, points);
2911
+ return genCurveSegments(path, points, 1);
3462
2912
  }
3463
- function genStepClosedSegments(points, t) {
3464
- let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
2913
+ function genStepClosedSegments(points, t, params = {}) {
3465
2914
  const {
3466
2915
  direction: direction,
3467
2916
  startPoint: startPoint
@@ -3476,8 +2925,7 @@
3476
2925
  this.context.closePath();
3477
2926
  }
3478
2927
  }
3479
- function genLinearClosedSegments(points) {
3480
- let params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2928
+ function genLinearClosedSegments(points, params = {}) {
3481
2929
  const {
3482
2930
  direction: direction,
3483
2931
  startPoint: startPoint
@@ -3487,7 +2935,7 @@
3487
2935
  return genLinearClosedTypeSegments(new LinearClosed(segContext, startPoint), points), segContext;
3488
2936
  }
3489
2937
  function genLinearClosedTypeSegments(path, points) {
3490
- return genCurveSegments(path, points);
2938
+ return genCurveSegments(path, points, 1);
3491
2939
  }
3492
2940
 
3493
2941
  function point$1(curveClass, x, y, defined, p) {
@@ -3508,9 +2956,7 @@
3508
2956
  curveClass.context.bezierCurveTo(x1, y1, x2, y2, curveClass._x2, curveClass._y2, defined, curveClass.lastPoint1);
3509
2957
  }
3510
2958
  class CatmullRom {
3511
- constructor(context) {
3512
- let alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .5;
3513
- let startPoint = arguments.length > 2 ? arguments[2] : undefined;
2959
+ constructor(context, alpha = .5, startPoint) {
3514
2960
  this.context = context, this.startPoint = startPoint, this._alpha = alpha;
3515
2961
  }
3516
2962
  areaStart() {
@@ -3564,8 +3010,7 @@
3564
3010
  }
3565
3011
  }
3566
3012
  function commonGenCatmullRomSegments(type, cons) {
3567
- return function (points, alpha) {
3568
- let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
3013
+ return function (points, alpha, params = {}) {
3569
3014
  const {
3570
3015
  direction: direction,
3571
3016
  startPoint: startPoint
@@ -3574,15 +3019,13 @@
3574
3019
  if (points.length < 3 - Number(!!startPoint)) return genLinearSegments(points, params);
3575
3020
  const segContext = genSegContext(type, direction, points),
3576
3021
  gatmullRom = new cons(segContext, alpha, startPoint);
3577
- return genCurveSegments(gatmullRom, points), segContext;
3022
+ return genCurveSegments(gatmullRom, points, 2), segContext;
3578
3023
  };
3579
3024
  }
3580
3025
  const genCatmullRomSegments = commonGenCatmullRomSegments("catmullRom", CatmullRom);
3581
3026
 
3582
3027
  class CatmullRomClosed {
3583
- constructor(context) {
3584
- let alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .5;
3585
- let startPoint = arguments.length > 2 ? arguments[2] : undefined;
3028
+ constructor(context, alpha = .5, startPoint) {
3586
3029
  this.context = context, this.startPoint = startPoint, this._alpha = alpha;
3587
3030
  }
3588
3031
  areaStart() {
@@ -3646,6 +3089,55 @@
3646
3089
  }
3647
3090
  const genCatmullRomClosedSegments = commonGenCatmullRomSegments("catmullRomClosed", CatmullRomClosed);
3648
3091
 
3092
+ function divideQuad(curve, t) {
3093
+ const {
3094
+ p0: p0,
3095
+ p1: p1,
3096
+ p2: p2
3097
+ } = curve,
3098
+ pt = quadPointAt(p0, p1, p2, t),
3099
+ c1 = PointService.pointAtPP(p0, p1, t),
3100
+ c2 = PointService.pointAtPP(p1, p2, t);
3101
+ return [new QuadraticBezierCurve(p0, c1, pt), new QuadraticBezierCurve(pt, c2, p2)];
3102
+ }
3103
+ class QuadraticBezierCurve extends Curve {
3104
+ constructor(p0, p1, p2) {
3105
+ super(), this.type = CurveTypeEnum.QuadraticBezierCurve, this.p0 = p0, this.p1 = p1, this.p2 = p2;
3106
+ }
3107
+ _validPoint() {
3108
+ return Number.isFinite(this.p0.x + this.p0.y + this.p1.x + this.p1.y + this.p2.x + this.p2.y);
3109
+ }
3110
+ getPointAt(t) {
3111
+ if (!1 !== this.defined) return quadPointAt(this.p0, this.p1, this.p2, t);
3112
+ throw new Error("defined为false的点不能getPointAt");
3113
+ }
3114
+ calcLength() {
3115
+ return this._validPoint() ? quadLength(this.p0, this.p1, this.p2) : 60;
3116
+ }
3117
+ calcProjLength(direction) {
3118
+ return direction === Direction.ROW ? abs(this.p0.x - this.p2.x) : direction === Direction.COLUMN ? abs(this.p0.y - this.p2.y) : 0;
3119
+ }
3120
+ getAngleAt(t) {
3121
+ const minT = max(t - .01, 0),
3122
+ maxT = min(t + .01, 1),
3123
+ minP = this.getPointAt(minT),
3124
+ maxP = this.getPointAt(maxT);
3125
+ return atan2(maxP.y - minP.y, maxP.x - minP.x);
3126
+ }
3127
+ draw(path, x, y, sx, sy, percent) {
3128
+ 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) {
3129
+ const [curve1] = divideQuad(this, percent);
3130
+ path.quadraticCurveTo(curve1.p1.x * sx + x, curve1.p1.y * sy + y, curve1.p2.x * sx + x, curve1.p2.y * sy + y);
3131
+ }
3132
+ }
3133
+ getYAt(x) {
3134
+ throw new Error("QuadraticBezierCurve暂不支持getYAt");
3135
+ }
3136
+ includeX(x) {
3137
+ throw new Error("QuadraticBezierCurve暂不支持includeX");
3138
+ }
3139
+ }
3140
+
3649
3141
  class CurveContext {
3650
3142
  constructor(path) {
3651
3143
  this.path = path, this._lastX = this._lastY = this._startX = this._startY = 0;
@@ -3771,8 +3263,14 @@
3771
3263
  if (!this.toStringCbList) {
3772
3264
  const list = [];
3773
3265
  list[enumCommandMap.M] = cmd => `M${cmd[1]} ${cmd[2]}`, list[enumCommandMap.L] = cmd => `L${cmd[1]} ${cmd[2]}`, list[enumCommandMap.Q] = cmd => `Q${cmd[1]} ${cmd[2]} ${cmd[3]} ${cmd[4]}`, list[enumCommandMap.C] = cmd => `C${cmd[1]} ${cmd[2]} ${cmd[3]} ${cmd[4]} ${cmd[5]} ${cmd[6]}`, list[enumCommandMap.A] = cmd => {
3774
- const bezierPathList = [];
3775
- addArcToBezierPath(bezierPathList, cmd[4], cmd[5], cmd[1], cmd[2], cmd[3], cmd[3]);
3266
+ const bezierPathList = [],
3267
+ x = cmd[1],
3268
+ y = cmd[2],
3269
+ radius = cmd[3],
3270
+ startAngle = cmd[4],
3271
+ endAngle = cmd[5],
3272
+ counterclockwise = cmd[6];
3273
+ addArcToBezierPath(bezierPathList, startAngle, endAngle, x, y, radius, radius, counterclockwise);
3776
3274
  let path = "";
3777
3275
  for (let i = 0; i < bezierPathList.length; i += 6) path += `C${bezierPathList[i]} ${bezierPathList[i + 1]} ${bezierPathList[i + 2]} ${bezierPathList[i + 3]} ${bezierPathList[i + 4]} ${bezierPathList[i + 5]}`;
3778
3276
  return path;
@@ -3837,11 +3335,7 @@
3837
3335
  cmd[1] = cmd[1] * sx + x, cmd[2] = cmd[2] * sy + y, cmd[3] = cmd[3] * (sx + sy) / 2;
3838
3336
  }
3839
3337
  closePathTransform() {}
3840
- _runCommandStrList(commandStrList) {
3841
- let l = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3842
- let t = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
3843
- let sX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
3844
- let sY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
3338
+ _runCommandStrList(commandStrList, l = 0, t = 0, sX = 1, sY = 1) {
3845
3339
  let current,
3846
3340
  tempX,
3847
3341
  tempY,
@@ -3915,11 +3409,7 @@
3915
3409
  previous = current;
3916
3410
  }
3917
3411
  }
3918
- _runCommandList(commandList) {
3919
- let l = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3920
- let t = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
3921
- let sX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
3922
- let sY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
3412
+ _runCommandList(commandList, l = 0, t = 0, sX = 1, sY = 1) {
3923
3413
  if (0 !== l || 0 !== t || 1 !== sX || 1 !== sY) for (let i = 0, len = commandList.length; i < len; ++i) {
3924
3414
  const current = commandList[i].slice();
3925
3415
  switch (current[0]) {
@@ -4171,7 +3661,8 @@
4171
3661
  overflow: "hidden",
4172
3662
  shadowPickMode: "graphic",
4173
3663
  keepStrokeScale: !1,
4174
- clipConfig: null
3664
+ clipConfig: null,
3665
+ roughStyle: null
4175
3666
  }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
4176
3667
  const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
4177
3668
  startAngle: 0,
@@ -4329,9 +3820,6 @@
4329
3820
  opacity: 1
4330
3821
  });
4331
3822
 
4332
- class Application {}
4333
- const application = new Application();
4334
-
4335
3823
  const parse = function () {
4336
3824
  const tokens = {
4337
3825
  linearGradient: /^(linear\-gradient)/i,
@@ -4572,9 +4060,7 @@
4572
4060
  scaleY = Math.sign(d) * Math.sqrt(c * c + d * d);
4573
4061
  return scaleX + scaleY === 0 ? 0 : (strokeWidth = strokeWidth / Math.abs(scaleX + scaleY) * 2 * dpr, strokeWidth);
4574
4062
  }
4575
- function createColor(context, c, params) {
4576
- let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
4577
- let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
4063
+ function createColor(context, c, params, offsetX = 0, offsetY = 0) {
4578
4064
  var _a, _b, _c, _d;
4579
4065
  if (!c || !0 === c) return "black";
4580
4066
  let result, color;
@@ -4713,8 +4199,7 @@
4713
4199
  }
4714
4200
  return needTestLetter && (index = testLetter(desc, index)), index;
4715
4201
  }
4716
- function testLetter(string, index) {
4717
- let negativeWrongMatch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
4202
+ function testLetter(string, index, negativeWrongMatch = !1) {
4718
4203
  let i = index;
4719
4204
  for (; regLetter.test(string[i - 1]) && regLetter.test(string[i]) || regPunctuation.test(string[i]);) if (i--, i <= 0) return negativeWrongMatch ? testLetter2(string, index) : index;
4720
4205
  return i;
@@ -4724,8 +4209,7 @@
4724
4209
  for (; regLetter.test(string[i + 1]) && regLetter.test(string[i]) || regPunctuation.test(string[i]);) if (i++, i >= string.length) return i;
4725
4210
  return i + 1;
4726
4211
  }
4727
- function measureTextCanvas(text, character) {
4728
- let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "actual";
4212
+ function measureTextCanvas(text, character, mode = "actual") {
4729
4213
  var _a;
4730
4214
  if ("" === text) return {
4731
4215
  ascent: 0,
@@ -4754,6 +4238,355 @@
4754
4238
  function wrapCanvas(params) {
4755
4239
  return container.getNamed(CanvasFactory, application.global.env)(params);
4756
4240
  }
4241
+ const EPSILON_NUMERIC = 1e-4,
4242
+ THREE_SQRT = Math.sqrt(3),
4243
+ ONE_THIRD = 1 / 3;
4244
+ function isAroundZero(val) {
4245
+ return val > -EPSILON && val < EPSILON;
4246
+ }
4247
+ function isNotAroundZero(val) {
4248
+ return val > EPSILON || val < -EPSILON;
4249
+ }
4250
+ const _v0 = [0, 0],
4251
+ _v1 = [0, 0],
4252
+ _v2 = [0, 0];
4253
+ function distanceSquare(v1, v2) {
4254
+ return (v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1]);
4255
+ }
4256
+ function quadraticAt(p0, p1, p2, t) {
4257
+ const onet = 1 - t;
4258
+ return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
4259
+ }
4260
+ function cubicAt(p0, p1, p2, p3, t) {
4261
+ const onet = 1 - t;
4262
+ return onet * onet * (onet * p0 + 3 * t * p1) + t * t * (t * p3 + 3 * onet * p2);
4263
+ }
4264
+ function quadraticRootAt(p0, p1, p2, val, roots) {
4265
+ const a = p0 - 2 * p1 + p2,
4266
+ b = 2 * (p1 - p0),
4267
+ c = p0 - val;
4268
+ let n = 0;
4269
+ if (isAroundZero(a)) {
4270
+ if (isNotAroundZero(b)) {
4271
+ const t1 = -c / b;
4272
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
4273
+ }
4274
+ } else {
4275
+ const disc = b * b - 4 * a * c;
4276
+ if (isAroundZero(disc)) {
4277
+ const t1 = -b / (2 * a);
4278
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
4279
+ } else if (disc > 0) {
4280
+ const discSqrt = Math.sqrt(disc),
4281
+ t1 = (-b + discSqrt) / (2 * a),
4282
+ t2 = (-b - discSqrt) / (2 * a);
4283
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1), t2 >= 0 && t2 <= 1 && (roots[n++] = t2);
4284
+ }
4285
+ }
4286
+ return n;
4287
+ }
4288
+ function quadraticExtremum(p0, p1, p2) {
4289
+ const divider = p0 + p2 - 2 * p1;
4290
+ return 0 === divider ? .5 : (p0 - p1) / divider;
4291
+ }
4292
+ function quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
4293
+ let t = 0,
4294
+ interval = .005,
4295
+ d = 1 / 0;
4296
+ _v0[0] = x, _v0[1] = y;
4297
+ for (let _t = 0; _t < 1; _t += .05) {
4298
+ _v1[0] = quadraticAt(x0, x1, x2, _t), _v1[1] = quadraticAt(y0, y1, y2, _t);
4299
+ const d1 = distanceSquare(_v0, _v1);
4300
+ d1 < d && (t = _t, d = d1);
4301
+ }
4302
+ d = 1 / 0;
4303
+ for (let i = 0; i < 32 && !(interval < EPSILON_NUMERIC); i++) {
4304
+ const prev = t - interval,
4305
+ next = t + interval;
4306
+ _v1[0] = quadraticAt(x0, x1, x2, prev), _v1[1] = quadraticAt(y0, y1, y2, prev);
4307
+ const d1 = distanceSquare(_v1, _v0);
4308
+ if (prev >= 0 && d1 < d) t = prev, d = d1;else {
4309
+ _v2[0] = quadraticAt(x0, x1, x2, next), _v2[1] = quadraticAt(y0, y1, y2, next);
4310
+ const d2 = distanceSquare(_v2, _v0);
4311
+ next <= 1 && d2 < d ? (t = next, d = d2) : interval *= .5;
4312
+ }
4313
+ }
4314
+ return out && (out[0] = quadraticAt(x0, x1, x2, t), out[1] = quadraticAt(y0, y1, y2, t)), Math.sqrt(d);
4315
+ }
4316
+ function cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
4317
+ let prev,
4318
+ next,
4319
+ d1,
4320
+ d2,
4321
+ t = 0,
4322
+ interval = .005,
4323
+ d = 1 / 0;
4324
+ _v0[0] = x, _v0[1] = y;
4325
+ for (let _t = 0; _t < 1; _t += .05) _v1[0] = cubicAt(x0, x1, x2, x3, _t), _v1[1] = cubicAt(y0, y1, y2, y3, _t), d1 = distanceSquare(_v0, _v1), d1 < d && (t = _t, d = d1);
4326
+ d = 1 / 0;
4327
+ for (let i = 0; i < 32 && !(interval < EPSILON_NUMERIC); i++) prev = t - interval, next = t + interval, _v1[0] = cubicAt(x0, x1, x2, x3, prev), _v1[1] = cubicAt(y0, y1, y2, y3, prev), d1 = distanceSquare(_v1, _v0), prev >= 0 && d1 < d ? (t = prev, d = d1) : (_v2[0] = cubicAt(x0, x1, x2, x3, next), _v2[1] = cubicAt(y0, y1, y2, y3, next), d2 = distanceSquare(_v2, _v0), next <= 1 && d2 < d ? (t = next, d = d2) : interval *= .5);
4328
+ return out && (out[0] = cubicAt(x0, x1, x2, x3, t), out[1] = cubicAt(y0, y1, y2, y3, t)), Math.sqrt(d);
4329
+ }
4330
+ function normalizeRadian(angle) {
4331
+ return (angle %= pi2) < 0 && (angle += pi2), angle;
4332
+ }
4333
+ function containQuadStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
4334
+ if (0 === lineWidth) return !1;
4335
+ const _l = lineWidth;
4336
+ if (y > y0 + _l && y > y1 + _l && y > y2 + _l || y < y0 - _l && y < y1 - _l && y < y2 - _l || x > x0 + _l && x > x1 + _l && x > x2 + _l || x < x0 - _l && x < x1 - _l && x < x2 - _l) return !1;
4337
+ return quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, null) <= _l / 2;
4338
+ }
4339
+ function containCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
4340
+ if (0 === lineWidth) return !1;
4341
+ const _l = lineWidth;
4342
+ if (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l || y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l || x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l || x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l) return !1;
4343
+ return cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, null) <= _l / 2;
4344
+ }
4345
+ function containArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
4346
+ if (0 === lineWidth) return !1;
4347
+ const _l = lineWidth;
4348
+ x -= cx, y -= cy;
4349
+ const d = Math.sqrt(x * x + y * y);
4350
+ if (d - _l > r || d + _l < r) return !1;
4351
+ if (Math.abs(startAngle - endAngle) % pi2 < 1e-4) return !0;
4352
+ if (anticlockwise) {
4353
+ const tmp = startAngle;
4354
+ startAngle = normalizeRadian(endAngle), endAngle = normalizeRadian(tmp);
4355
+ } else startAngle = normalizeRadian(startAngle), endAngle = normalizeRadian(endAngle);
4356
+ startAngle > endAngle && (endAngle += pi2);
4357
+ let angle = Math.atan2(y, x);
4358
+ return angle < 0 && (angle += pi2), angle >= startAngle && angle <= endAngle || angle + pi2 >= startAngle && angle + pi2 <= endAngle;
4359
+ }
4360
+ function containLineStroke(x0, y0, x1, y1, lineWidth, x, y) {
4361
+ if (0 === lineWidth) return !1;
4362
+ const _l = lineWidth,
4363
+ _halfL = lineWidth / 2;
4364
+ let _a = 0,
4365
+ _b = x0;
4366
+ if (y > y0 + _halfL && y > y1 + _halfL || y < y0 - _halfL && y < y1 - _halfL || x > x0 + _halfL && x > x1 + _halfL || x < x0 - _halfL && x < x1 - _halfL) return !1;
4367
+ if (x0 === x1) return Math.abs(x - x0) <= _l / 2;
4368
+ _a = (y0 - y1) / (x0 - x1), _b = (x0 * y1 - x1 * y0) / (x0 - x1);
4369
+ const tmp = _a * x - y + _b;
4370
+ return tmp * tmp / (_a * _a + 1) <= _l / 2 * _l / 2;
4371
+ }
4372
+ const EPSILON = 1e-4;
4373
+ function cubicRootAt(p0, p1, p2, p3, val, roots) {
4374
+ const a = p3 + 3 * (p1 - p2) - p0,
4375
+ b = 3 * (p2 - 2 * p1 + p0),
4376
+ c = 3 * (p1 - p0),
4377
+ d = p0 - val,
4378
+ A = b * b - 3 * a * c,
4379
+ B = b * c - 9 * a * d,
4380
+ C = c * c - 3 * b * d;
4381
+ let n = 0;
4382
+ if (isAroundZero(A) && isAroundZero(B)) {
4383
+ if (isAroundZero(b)) roots[0] = 0;else {
4384
+ const t1 = -c / b;
4385
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
4386
+ }
4387
+ } else {
4388
+ const disc = B * B - 4 * A * C;
4389
+ if (isAroundZero(disc)) {
4390
+ const K = B / A,
4391
+ t1 = -b / a + K,
4392
+ t2 = -K / 2;
4393
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1), t2 >= 0 && t2 <= 1 && (roots[n++] = t2);
4394
+ } else if (disc > 0) {
4395
+ const discSqrt = Math.sqrt(disc);
4396
+ let Y1 = A * b + 1.5 * a * (-B + discSqrt),
4397
+ Y2 = A * b + 1.5 * a * (-B - discSqrt);
4398
+ Y1 = Y1 < 0 ? -Math.pow(-Y1, ONE_THIRD) : Math.pow(Y1, ONE_THIRD), Y2 = Y2 < 0 ? -Math.pow(-Y2, ONE_THIRD) : Math.pow(Y2, ONE_THIRD);
4399
+ const t1 = (-b - (Y1 + Y2)) / (3 * a);
4400
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
4401
+ } else {
4402
+ const T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A)),
4403
+ theta = Math.acos(T) / 3,
4404
+ ASqrt = Math.sqrt(A),
4405
+ tmp = Math.cos(theta),
4406
+ t1 = (-b - 2 * ASqrt * tmp) / (3 * a),
4407
+ t2 = (-b + ASqrt * (tmp + THREE_SQRT * Math.sin(theta))) / (3 * a),
4408
+ t3 = (-b + ASqrt * (tmp - THREE_SQRT * Math.sin(theta))) / (3 * a);
4409
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1), t2 >= 0 && t2 <= 1 && (roots[n++] = t2), t3 >= 0 && t3 <= 1 && (roots[n++] = t3);
4410
+ }
4411
+ }
4412
+ return n;
4413
+ }
4414
+ function cubicExtrema(p0, p1, p2, p3, extrema) {
4415
+ const b = 6 * p2 - 12 * p1 + 6 * p0,
4416
+ a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2,
4417
+ c = 3 * p1 - 3 * p0;
4418
+ let n = 0;
4419
+ if (isAroundZero(a)) {
4420
+ if (isNotAroundZero(b)) {
4421
+ const t1 = -c / b;
4422
+ t1 >= 0 && t1 <= 1 && (extrema[n++] = t1);
4423
+ }
4424
+ } else {
4425
+ const disc = b * b - 4 * a * c;
4426
+ if (isAroundZero(disc)) extrema[0] = -b / (2 * a);else if (disc > 0) {
4427
+ const discSqrt = Math.sqrt(disc),
4428
+ t1 = (-b + discSqrt) / (2 * a),
4429
+ t2 = (-b - discSqrt) / (2 * a);
4430
+ t1 >= 0 && t1 <= 1 && (extrema[n++] = t1), t2 >= 0 && t2 <= 1 && (extrema[n++] = t2);
4431
+ }
4432
+ }
4433
+ return n;
4434
+ }
4435
+ function isAroundEqual(a, b) {
4436
+ return Math.abs(a - b) < EPSILON;
4437
+ }
4438
+ const roots = [-1, -1, -1],
4439
+ extrema = [-1, -1];
4440
+ function swapExtrema() {
4441
+ const tmp = extrema[0];
4442
+ extrema[0] = extrema[1], extrema[1] = tmp;
4443
+ }
4444
+ function windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
4445
+ if (y > y0 && y > y1 && y > y2 && y > y3 || y < y0 && y < y1 && y < y2 && y < y3) return 0;
4446
+ const nRoots = cubicRootAt(y0, y1, y2, y3, y, roots);
4447
+ if (0 === nRoots) return 0;
4448
+ let w = 0,
4449
+ nExtrema = -1,
4450
+ y0_ = 0,
4451
+ y1_ = 0;
4452
+ for (let i = 0; i < nRoots; i++) {
4453
+ const t = roots[i],
4454
+ unit = 0 === t || 1 === t ? .5 : 1;
4455
+ cubicAt(x0, x1, x2, x3, t) < x || (nExtrema < 0 && (nExtrema = cubicExtrema(y0, y1, y2, y3, extrema), extrema[1] < extrema[0] && nExtrema > 1 && swapExtrema(), y0_ = cubicAt(y0, y1, y2, y3, extrema[0]), nExtrema > 1 && (y1_ = cubicAt(y0, y1, y2, y3, extrema[1]))), 2 === nExtrema ? t < extrema[0] ? w += y0_ < y0 ? unit : -unit : t < extrema[1] ? w += y1_ < y0_ ? unit : -unit : w += y3 < y1_ ? unit : -unit : t < extrema[0] ? w += y0_ < y0 ? unit : -unit : w += y3 < y0_ ? unit : -unit);
4456
+ }
4457
+ return w;
4458
+ }
4459
+ function windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
4460
+ if (y > y0 && y > y1 && y > y2 || y < y0 && y < y1 && y < y2) return 0;
4461
+ const nRoots = quadraticRootAt(y0, y1, y2, y, roots);
4462
+ if (0 === nRoots) return 0;
4463
+ const t = quadraticExtremum(y0, y1, y2);
4464
+ if (t >= 0 && t <= 1) {
4465
+ let w = 0;
4466
+ const y_ = quadraticAt(y0, y1, y2, t);
4467
+ for (let i = 0; i < nRoots; i++) {
4468
+ const unit = 0 === roots[i] || 1 === roots[i] ? .5 : 1;
4469
+ quadraticAt(x0, x1, x2, roots[i]) < x || (roots[i] < t ? w += y_ < y0 ? unit : -unit : w += y2 < y_ ? unit : -unit);
4470
+ }
4471
+ return w;
4472
+ }
4473
+ const unit = 0 === roots[0] || 1 === roots[0] ? .5 : 1;
4474
+ return quadraticAt(x0, x1, x2, roots[0]) < x ? 0 : y2 < y0 ? unit : -unit;
4475
+ }
4476
+ function windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
4477
+ if ((y -= cy) > r || y < -r) return 0;
4478
+ const tmp = Math.sqrt(r * r - y * y);
4479
+ roots[0] = -tmp, roots[1] = tmp;
4480
+ const dTheta = Math.abs(startAngle - endAngle);
4481
+ if (dTheta < 1e-4) return 0;
4482
+ if (dTheta >= pi2 - 1e-4) {
4483
+ startAngle = 0, endAngle = pi2;
4484
+ const dir = anticlockwise ? 1 : -1;
4485
+ return x >= roots[0] + cx && x <= roots[1] + cx ? dir : 0;
4486
+ }
4487
+ if (startAngle > endAngle) {
4488
+ const tmp = startAngle;
4489
+ startAngle = endAngle, endAngle = tmp;
4490
+ }
4491
+ startAngle < 0 && (startAngle += pi2, endAngle += pi2);
4492
+ let w = 0;
4493
+ for (let i = 0; i < 2; i++) {
4494
+ const x_ = roots[i];
4495
+ if (x_ + cx > x) {
4496
+ let angle = Math.atan2(y, x_),
4497
+ dir = anticlockwise ? 1 : -1;
4498
+ angle < 0 && (angle = pi2 + angle), (angle >= startAngle && angle <= endAngle || angle + pi2 >= startAngle && angle + pi2 <= endAngle) && (angle > pi / 2 && angle < 1.5 * pi && (dir = -dir), w += dir);
4499
+ }
4500
+ }
4501
+ return w;
4502
+ }
4503
+ function modpi2(radian) {
4504
+ return Math.round(radian / pi * 1e8) / 1e8 % 2 * pi;
4505
+ }
4506
+ function normalizeArcAngles(angles, anticlockwise) {
4507
+ let newStartAngle = modpi2(angles[0]);
4508
+ newStartAngle < 0 && (newStartAngle += pi2);
4509
+ const delta = newStartAngle - angles[0];
4510
+ let newEndAngle = angles[1];
4511
+ newEndAngle += delta, !anticlockwise && newEndAngle - newStartAngle >= pi2 ? newEndAngle = newStartAngle + pi2 : anticlockwise && newStartAngle - newEndAngle >= pi2 ? newEndAngle = newStartAngle - pi2 : !anticlockwise && newStartAngle > newEndAngle ? newEndAngle = newStartAngle + (pi2 - modpi2(newStartAngle - newEndAngle)) : anticlockwise && newStartAngle < newEndAngle && (newEndAngle = newStartAngle - (pi2 - modpi2(newEndAngle - newStartAngle))), angles[0] = newStartAngle, angles[1] = newEndAngle;
4512
+ }
4513
+ const tmpAngles = [0, 0];
4514
+ function containPath(commands, lineWidth, isStroke, x, y) {
4515
+ const data = commands,
4516
+ len = commands.length;
4517
+ let x1,
4518
+ y1,
4519
+ w = 0,
4520
+ xi = 0,
4521
+ yi = 0,
4522
+ x0 = 0,
4523
+ y0 = 0;
4524
+ for (let i = 0; i < len; i++) {
4525
+ const command = data[i],
4526
+ isFirst = 0 === i;
4527
+ command[0] === enumCommandMap.M && i > 1 && (isStroke || (w += isPointInLine(xi, yi, x0, y0, x, y))), isFirst && (xi = command[1], yi = command[2], x0 = xi, y0 = yi);
4528
+ const c0 = command[0],
4529
+ c1 = command[1],
4530
+ c2 = command[2],
4531
+ c3 = command[3],
4532
+ c4 = command[4],
4533
+ c5 = command[5],
4534
+ c6 = command[6];
4535
+ let startAngle = c4,
4536
+ endAngle = c5;
4537
+ tmpAngles[0] = startAngle, tmpAngles[1] = endAngle, normalizeArcAngles(tmpAngles, Boolean(command[6])), startAngle = tmpAngles[0], endAngle = tmpAngles[1];
4538
+ const theta = startAngle,
4539
+ dTheta = endAngle - startAngle,
4540
+ anticlockwise = !!(1 - (command[6] ? 0 : 1)),
4541
+ _x = (x - c1) * c3 / c3 + c1;
4542
+ switch (c0) {
4543
+ case enumCommandMap.M:
4544
+ x0 = c1, y0 = c2, xi = x0, yi = y0;
4545
+ break;
4546
+ case enumCommandMap.L:
4547
+ if (isStroke) {
4548
+ if (containLineStroke(xi, yi, c1, c2, lineWidth, x, y)) return !0;
4549
+ } else w += isPointInLine(xi, yi, c1, c2, x, y) || 0;
4550
+ xi = c1, yi = c2;
4551
+ break;
4552
+ case enumCommandMap.C:
4553
+ if (isStroke) {
4554
+ if (containCubicStroke(xi, yi, c1, c2, c3, c4, c5, c6, lineWidth, x, y)) return !0;
4555
+ } else w += windingCubic(xi, yi, c1, c2, c3, c4, c5, c6, x, y) || 0;
4556
+ xi = c5, yi = c6;
4557
+ break;
4558
+ case enumCommandMap.Q:
4559
+ if (isStroke) {
4560
+ if (containQuadStroke(xi, yi, c1, c2, c3, c4, lineWidth, x, y)) return !0;
4561
+ } else w += windingQuadratic(xi, yi, c1, c2, c3, c4, x, y) || 0;
4562
+ xi = c3, yi = c4;
4563
+ break;
4564
+ case enumCommandMap.A:
4565
+ if (x1 = Math.cos(theta) * c3 + c1, y1 = Math.sin(theta) * c3 + c2, isFirst ? (x0 = x1, y0 = y1) : w += isPointInLine(xi, yi, x1, y1, x, y), isStroke) {
4566
+ if (containArcStroke(c1, c2, c3, theta, theta + dTheta, anticlockwise, lineWidth, _x, y)) return !0;
4567
+ } else w += windingArc(c1, c2, c3, theta, theta + dTheta, anticlockwise, _x, y);
4568
+ xi = Math.cos(theta + dTheta) * c3 + c1, yi = Math.sin(theta + dTheta) * c3 + c2;
4569
+ break;
4570
+ case enumCommandMap.R:
4571
+ if (x0 = xi = c1, y0 = yi = c2, x1 = x0 + c3, y1 = y0 + c4, isStroke) {
4572
+ if (containLineStroke(x0, y0, x1, y0, lineWidth, x, y) || containLineStroke(x1, y0, x1, y1, lineWidth, x, y) || containLineStroke(x1, y1, x0, y1, lineWidth, x, y) || containLineStroke(x0, y1, x0, y0, lineWidth, x, y)) return !0;
4573
+ } else w += isPointInLine(x1, y0, x1, y1, x, y), w += isPointInLine(x0, y1, x0, y0, x, y);
4574
+ break;
4575
+ case enumCommandMap.Z:
4576
+ if (isStroke) {
4577
+ if (containLineStroke(xi, yi, x0, y0, lineWidth, x, y)) return !0;
4578
+ } else w += isPointInLine(xi, yi, x0, y0, x, y);
4579
+ xi = x0, yi = y0;
4580
+ }
4581
+ }
4582
+ return isStroke || isAroundEqual(yi, y0) || (w += isPointInLine(xi, yi, x0, y0, x, y) || 0), 0 !== w;
4583
+ }
4584
+ function contain(commands, x, y) {
4585
+ return containPath(commands, 0, !1, x, y);
4586
+ }
4587
+ function containStroke(commands, lineWidth, x, y) {
4588
+ return containPath(commands, lineWidth, !0, x, y);
4589
+ }
4757
4590
 
4758
4591
  class DefaultCanvasAllocate {
4759
4592
  constructor() {
@@ -4800,7 +4633,7 @@
4800
4633
  get length() {
4801
4634
  return this.pools.length;
4802
4635
  }
4803
- release() {
4636
+ release(...params) {
4804
4637
  this.pools = [];
4805
4638
  }
4806
4639
  }
@@ -4869,8 +4702,7 @@
4869
4702
  for (; group.parent;) if ((group = group.parent).theme) return group;
4870
4703
  return null;
4871
4704
  }
4872
- applyTheme(group, pt) {
4873
- let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
4705
+ applyTheme(group, pt, force = !1) {
4874
4706
  if (this.dirty) {
4875
4707
  const parentGroup = this.getParentWithTheme(group);
4876
4708
  if (parentGroup) {
@@ -4969,8 +4801,7 @@
4969
4801
  constructor() {
4970
4802
  super(), this._uid = Generator.GenAutoIncrementId(), this._firstChild = null, this._lastChild = null, this.parent = null, this._count = 1;
4971
4803
  }
4972
- forEachChildren(cb) {
4973
- let reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
4804
+ forEachChildren(cb, reverse = !1) {
4974
4805
  if (reverse) {
4975
4806
  let child = this._lastChild,
4976
4807
  i = 0;
@@ -4987,8 +4818,7 @@
4987
4818
  }
4988
4819
  }
4989
4820
  }
4990
- forEachChildrenAsync(cb) {
4991
- let reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
4821
+ forEachChildrenAsync(cb, reverse = !1) {
4992
4822
  return __awaiter$2(this, void 0, void 0, function* () {
4993
4823
  if (reverse) {
4994
4824
  let child = this._lastChild,
@@ -5012,13 +4842,12 @@
5012
4842
  forEach(cb) {
5013
4843
  return this.forEachChildren(cb);
5014
4844
  }
5015
- appendChild(node) {
5016
- let highPerformance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
4845
+ appendChild(node, highPerformance = !0) {
5017
4846
  if (this._uid === node._uid) return null;
5018
4847
  if (!highPerformance && node.isAncestorsOf(this)) throw new Error("【Node::appendChild】不能将父辈元素append为子元素");
5019
4848
  return node.parent && node.parent.removeChild(node), node.parent = this, this._lastChild ? (this._lastChild._next = node, node._prev = this._lastChild, this._lastChild = node) : (this._firstChild = this._lastChild = node, node._prev = node._next = null), this._idMap || (this._idMap = new Map()), this._idMap.set(node._uid, node), this.setCount(node.count), this._structEdit = !0, node;
5020
4849
  }
5021
- appendChildArrHighPerformance(nodes) {
4850
+ appendChildArrHighPerformance(nodes, replace = !1) {
5022
4851
  return nodes;
5023
4852
  }
5024
4853
  insertBefore(newNode, referenceNode) {
@@ -5086,8 +4915,7 @@
5086
4915
  replaceChild(newChild, oldChild) {
5087
4916
  throw new Error("暂不支持");
5088
4917
  }
5089
- find(callback) {
5090
- let deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
4918
+ find(callback, deep = !1) {
5091
4919
  let target = null;
5092
4920
  return this.forEachChildren((node, index) => !(node === this || !callback(node, index)) && (target = node, !0)), deep && this.forEachChildren(child => {
5093
4921
  if (child.isContainer) {
@@ -5097,8 +4925,7 @@
5097
4925
  return !1;
5098
4926
  }), target;
5099
4927
  }
5100
- findAll(callback) {
5101
- let deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
4928
+ findAll(callback, deep = !1) {
5102
4929
  let nodes = [];
5103
4930
  return this.forEachChildren((node, index) => {
5104
4931
  node !== this && callback(node, index) && nodes.push(node);
@@ -5127,8 +4954,7 @@
5127
4954
  getElementsByType(type) {
5128
4955
  return this.findAll(node => node.type === type, !0);
5129
4956
  }
5130
- getChildByName(name) {
5131
- let deep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
4957
+ getChildByName(name, deep = !1) {
5132
4958
  return this.find(node => node.name === name, deep);
5133
4959
  }
5134
4960
  getChildAt(idx) {
@@ -5247,10 +5073,7 @@
5247
5073
  removeAllListeners() {
5248
5074
  return this.removeAllEventListeners();
5249
5075
  }
5250
- dispatchEvent(event) {
5251
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
5252
- args[_key - 1] = arguments[_key];
5253
- }
5076
+ dispatchEvent(event, ...args) {
5254
5077
  return super.emit(event.type, event, ...args), !event.defaultPrevented;
5255
5078
  }
5256
5079
  emit(event, data) {
@@ -5365,530 +5188,93 @@
5365
5188
  }
5366
5189
  };
5367
5190
 
5368
- class Easing {
5369
- constructor() {}
5370
- static linear(t) {
5371
- return t;
5372
- }
5373
- static none() {
5374
- return this.linear;
5375
- }
5376
- static get(amount) {
5377
- return amount < -1 ? amount = -1 : amount > 1 && (amount = 1), function (t) {
5378
- return 0 === amount ? t : amount < 0 ? t * (t * -amount + 1 + amount) : t * ((2 - t) * amount + (1 - amount));
5379
- };
5380
- }
5381
- static getPowIn(pow) {
5382
- return function (t) {
5383
- return Math.pow(t, pow);
5384
- };
5385
- }
5386
- static getPowOut(pow) {
5387
- return function (t) {
5388
- return 1 - Math.pow(1 - t, pow);
5389
- };
5390
- }
5391
- static getPowInOut(pow) {
5392
- return function (t) {
5393
- return (t *= 2) < 1 ? .5 * Math.pow(t, pow) : 1 - .5 * Math.abs(Math.pow(2 - t, pow));
5394
- };
5395
- }
5396
- static getBackIn(amount) {
5397
- return function (t) {
5398
- return t * t * ((amount + 1) * t - amount);
5399
- };
5400
- }
5401
- static getBackOut(amount) {
5402
- return function (t) {
5403
- return --t * t * ((amount + 1) * t + amount) + 1;
5404
- };
5405
- }
5406
- static getBackInOut(amount) {
5407
- return amount *= 1.525, function (t) {
5408
- return (t *= 2) < 1 ? t * t * ((amount + 1) * t - amount) * .5 : .5 * ((t -= 2) * t * ((amount + 1) * t + amount) + 2);
5409
- };
5410
- }
5411
- static sineIn(t) {
5412
- return 1 - Math.cos(t * Math.PI / 2);
5413
- }
5414
- static sineOut(t) {
5415
- return Math.sin(t * Math.PI / 2);
5416
- }
5417
- static sineInOut(t) {
5418
- return -(Math.cos(Math.PI * t) - 1) / 2;
5419
- }
5420
- static expoIn(t) {
5421
- return 0 === t ? 0 : Math.pow(2, 10 * t - 10);
5422
- }
5423
- static expoOut(t) {
5424
- return 1 === t ? 1 : 1 - Math.pow(2, -10 * t);
5425
- }
5426
- static expoInOut(t) {
5427
- return 0 === t ? 0 : 1 === t ? 1 : t < .5 ? Math.pow(2, 20 * t - 10) / 2 : (2 - Math.pow(2, -20 * t + 10)) / 2;
5428
- }
5429
- static circIn(t) {
5430
- return -(Math.sqrt(1 - t * t) - 1);
5431
- }
5432
- static circOut(t) {
5433
- return Math.sqrt(1 - --t * t);
5191
+ class ResourceLoader {
5192
+ static GetImage(url, mark) {
5193
+ var _a;
5194
+ const data = ResourceLoader.cache.get(url);
5195
+ data ? "fail" === data.loadState ? application.global.getRequestAnimationFrame()(() => {
5196
+ mark.imageLoadFail(url);
5197
+ }) : "init" === data.loadState || "loading" === data.loadState ? null === (_a = data.waitingMark) || void 0 === _a || _a.push(mark) : mark && mark.imageLoadSuccess(url, data.data) : ResourceLoader.loadImage(url, mark);
5434
5198
  }
5435
- static circInOut(t) {
5436
- return (t *= 2) < 1 ? -.5 * (Math.sqrt(1 - t * t) - 1) : .5 * (Math.sqrt(1 - (t -= 2) * t) + 1);
5199
+ static GetSvg(svgStr, mark) {
5200
+ var _a;
5201
+ let data = ResourceLoader.cache.get(svgStr);
5202
+ data ? "fail" === data.loadState ? application.global.getRequestAnimationFrame()(() => {
5203
+ mark.imageLoadFail(svgStr);
5204
+ }) : "init" === data.loadState || "loading" === data.loadState ? null === (_a = data.waitingMark) || void 0 === _a || _a.push(mark) : mark && mark.imageLoadSuccess(svgStr, data.data) : (data = {
5205
+ type: "image",
5206
+ loadState: "init"
5207
+ }, ResourceLoader.cache.set(svgStr, data), data.dataPromise = application.global.loadSvg(svgStr), data.dataPromise ? (data.waitingMark = [mark], data.dataPromise.then(res => {
5208
+ var _a;
5209
+ data.loadState = (null == res ? void 0 : res.data) ? "success" : "fail", data.data = null == res ? void 0 : res.data, null === (_a = data.waitingMark) || void 0 === _a || _a.map((mark, index) => {
5210
+ (null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(svgStr, res.data)) : (data.loadState = "fail", mark.imageLoadFail(svgStr));
5211
+ }), data.waitingMark && (data.waitingMark = []);
5212
+ })) : (data.loadState = "fail", mark.imageLoadFail(svgStr)));
5437
5213
  }
5438
- static bounceOut(t) {
5439
- return t < 1 / 2.75 ? 7.5625 * t * t : t < 2 / 2.75 ? 7.5625 * (t -= 1.5 / 2.75) * t + .75 : t < 2.5 / 2.75 ? 7.5625 * (t -= 2.25 / 2.75) * t + .9375 : 7.5625 * (t -= 2.625 / 2.75) * t + .984375;
5214
+ static GetFile(url, type) {
5215
+ let data = ResourceLoader.cache.get(url);
5216
+ return data ? "fail" === data.loadState ? Promise.reject() : "init" === data.loadState || "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
5217
+ type: type,
5218
+ loadState: "init"
5219
+ }, ResourceLoader.cache.set(url, data), "arrayBuffer" === type ? data.dataPromise = application.global.loadArrayBuffer(url) : "blob" === type ? data.dataPromise = application.global.loadBlob(url) : "json" === type && (data.dataPromise = application.global.loadJson(url)), data.dataPromise.then(data => data.data));
5440
5220
  }
5441
- static bounceIn(t) {
5442
- return 1 - Easing.bounceOut(1 - t);
5443
- }
5444
- static bounceInOut(t) {
5445
- return t < .5 ? .5 * Easing.bounceIn(2 * t) : .5 * Easing.bounceOut(2 * t - 1) + .5;
5446
- }
5447
- static getElasticIn(amplitude, period) {
5448
- return function (t) {
5449
- if (0 === t || 1 === t) return t;
5450
- const s = period / pi2 * Math.asin(1 / amplitude);
5451
- return -amplitude * Math.pow(2, 10 * (t -= 1)) * Math.sin((t - s) * pi2 / period);
5452
- };
5453
- }
5454
- static getElasticOut(amplitude, period) {
5455
- return function (t) {
5456
- if (0 === t || 1 === t) return t;
5457
- const s = period / pi2 * Math.asin(1 / amplitude);
5458
- return amplitude * Math.pow(2, -10 * t) * Math.sin((t - s) * pi2 / period) + 1;
5459
- };
5460
- }
5461
- static getElasticInOut(amplitude, period) {
5462
- return function (t) {
5463
- const s = period / pi2 * Math.asin(1 / amplitude);
5464
- 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;
5465
- };
5466
- }
5467
- static registerFunc(name, func) {
5468
- Easing[name] = func;
5469
- }
5470
- }
5471
- function flicker(t, n) {
5472
- const step = 1 / n;
5473
- let flag = 1;
5474
- for (; t > step;) t -= step, flag *= -1;
5475
- const v = flag * t / step;
5476
- return v > 0 ? v : 1 + v;
5477
- }
5478
- 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), Easing.easeInOutQuad = t => (t /= .5) < 1 ? .5 * Math.pow(t, 2) : -.5 * ((t -= 2) * t - 2), Easing.easeOutElastic = x => {
5479
- const c4 = 2 * Math.PI / 3;
5480
- return 0 === x ? 0 : 1 === x ? 1 : Math.pow(2, -10 * x) * Math.sin((10 * x - .75) * c4) + 1;
5481
- }, Easing.easeInOutElastic = x => {
5482
- const c5 = 2 * Math.PI / 4.5;
5483
- 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;
5484
- };
5485
- for (let i = 0; i < 10; i++) Easing[`flicker${i}`] = t => flicker(t, i);
5486
- for (let i = 2; i < 10; i++) Easing[`aIn${i}`] = t => i * t * t + (1 - i) * t;
5487
-
5488
- class DefaultTimeline {
5489
- constructor() {
5490
- this.id = Generator.GenAutoIncrementId(), this.animateHead = null, this.animateTail = null, this.animateCount = 0, this.paused = !1;
5491
- }
5492
- addAnimate(animate) {
5493
- this.animateTail ? (this.animateTail.nextAnimate = animate, animate.prevAnimate = this.animateTail, this.animateTail = animate, animate.nextAnimate = null) : (this.animateHead = animate, this.animateTail = animate), this.animateCount++;
5494
- }
5495
- pause() {
5496
- this.paused = !0;
5497
- }
5498
- resume() {
5499
- this.paused = !1;
5500
- }
5501
- tick(delta) {
5502
- if (this.paused) return;
5503
- let animate = this.animateHead;
5504
- for (this.animateCount = 0; animate;) animate.status === AnimateStatus.END ? this.removeAnimate(animate) : animate.status === AnimateStatus.RUNNING || animate.status === AnimateStatus.INITIAL ? (this.animateCount++, animate.advance(delta)) : animate.status === AnimateStatus.PAUSED && this.animateCount++, animate = animate.nextAnimate;
5505
- }
5506
- clear() {
5507
- let animate = this.animateHead;
5508
- for (; animate;) animate.release(), animate = animate.nextAnimate;
5509
- this.animateHead = null, this.animateTail = null, this.animateCount = 0;
5510
- }
5511
- removeAnimate(animate) {
5512
- let release = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
5513
- animate._onRemove && animate._onRemove.forEach(cb => cb()), animate === this.animateHead ? (this.animateHead = animate.nextAnimate, animate === this.animateTail ? this.animateTail = null : this.animateHead.prevAnimate = null) : animate === this.animateTail ? (this.animateTail = animate.prevAnimate, this.animateTail.nextAnimate = null) : (animate.prevAnimate.nextAnimate = animate.nextAnimate, animate.nextAnimate.prevAnimate = animate.prevAnimate), release && animate.release();
5514
- }
5515
- }
5516
- const defaultTimeline = new DefaultTimeline();
5517
-
5518
- class ACustomAnimate {
5519
- constructor(from, to, duration, easing, params) {
5520
- this.from = from, this.to = to, this.duration = duration, this.easing = easing, this.params = params, this.updateCount = 0;
5521
- }
5522
- bind(target, subAni) {
5523
- this.target = target, this.subAnimate = subAni, this.onBind();
5524
- }
5525
- onBind() {}
5526
- onFirstRun() {}
5527
- onStart() {}
5528
- onEnd() {}
5529
- getEndProps() {
5530
- return this.to;
5531
- }
5532
- getFromProps() {
5533
- return this.from;
5534
- }
5535
- getMergedEndProps() {
5536
- var _a;
5537
- const thisEndProps = this.getEndProps();
5538
- return thisEndProps ? this._endProps === thisEndProps ? this._mergedEndProps : (this._endProps = thisEndProps, void (this._mergedEndProps = Object.assign({}, null !== (_a = this.step.prev.getLastProps()) && void 0 !== _a ? _a : {}, thisEndProps))) : this.step.prev ? this.step.prev.getLastProps() : thisEndProps;
5539
- }
5540
- update(end, ratio, out) {
5541
- if (0 === this.updateCount) {
5542
- this.onFirstRun();
5543
- const props = this.step.getLastProps();
5544
- Object.keys(props).forEach(k => {
5545
- this.subAnimate.animate.validAttr(k) && (out[k] = props[k]);
5546
- });
5547
- }
5548
- this.updateCount += 1, this.onUpdate(end, ratio, out), end && this.onEnd();
5549
- }
5550
- }
5551
- class CbAnimate extends ACustomAnimate {
5552
- constructor(cb) {
5553
- super(null, null, 0, "linear"), this.cb = cb;
5554
- }
5555
- onUpdate(end, ratio, out) {}
5556
- onStart() {
5557
- this.cb();
5558
- }
5559
- }
5560
- class Animate {
5561
- constructor() {
5562
- let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Generator.GenAutoIncrementId();
5563
- let timeline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultTimeline;
5564
- let slience = arguments.length > 2 ? arguments[2] : undefined;
5565
- this.id = id, this.timeline = timeline || defaultTimeline, 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;
5566
- }
5567
- setTimeline(timeline) {
5568
- timeline !== this.timeline && (this.timeline.removeAnimate(this, !1), timeline.addAnimate(this));
5569
- }
5570
- getStartTime() {
5571
- return this._startTime;
5572
- }
5573
- getDuration() {
5574
- return this.subAnimates.reduce((t, subAnimate) => t + subAnimate.totalDuration, 0);
5575
- }
5576
- after(animate) {
5577
- const t = animate.getDuration();
5578
- return this._startTime = t, this;
5579
- }
5580
- afterAll(list) {
5581
- let maxT = -1 / 0;
5582
- return list.forEach(a => {
5583
- maxT = max(a.getDuration(), maxT);
5584
- }), this._startTime = maxT, this;
5585
- }
5586
- parallel(animate) {
5587
- return this._startTime = animate.getStartTime(), this;
5588
- }
5589
- static AddInterpolate(name, cb) {
5590
- Animate.interpolateMap.set(name, cb);
5591
- }
5592
- play(customAnimate) {
5593
- if (this.tailAnimate.play(customAnimate), this.target) {
5594
- const stage = this.target.stage;
5595
- stage && stage.renderNextFrame();
5596
- }
5597
- return 1 === this.subAnimates.length && this.tailAnimate.totalDuration === customAnimate.duration && this.trySetAttribute(customAnimate.getFromProps(), customAnimate.mode), this;
5598
- }
5599
- trySetAttribute(attr) {
5600
- let mode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Animate.mode;
5601
- attr && mode & AnimateMode.SET_ATTR_IMMEDIATELY && this.target.setAttributes && this.target.setAttributes(attr, !1, {
5602
- type: AttributeUpdateType.ANIMATE_PLAY
5603
- });
5604
- }
5605
- runCb(cb) {
5606
- const customAnimate = new CbAnimate(() => {
5607
- cb(this, customAnimate.step.prev);
5608
- });
5609
- return this.tailAnimate.play(customAnimate), this;
5610
- }
5611
- customInterpolate(key, ratio, from, to, target, ret) {
5612
- const func = Animate.interpolateMap.get(key) || Animate.interpolateMap.get("");
5613
- return !!func && func(key, ratio, from, to, target, ret);
5614
- }
5615
- pause() {
5616
- this.status === AnimateStatus.RUNNING && (this.status = AnimateStatus.PAUSED);
5617
- }
5618
- resume() {
5619
- this.status === AnimateStatus.PAUSED && (this.status = AnimateStatus.RUNNING);
5620
- }
5621
- to(props, duration, easing, params) {
5622
- if (this.tailAnimate.to(props, duration, easing, params), this.target) {
5623
- const stage = this.target.stage;
5624
- stage && stage.renderNextFrame();
5625
- }
5626
- return this;
5627
- }
5628
- from(props, duration, easing, params) {
5629
- if (this.tailAnimate.from(props, duration, easing, params), this.target) {
5630
- const stage = this.target.stage;
5631
- stage && stage.renderNextFrame();
5632
- }
5633
- return this;
5634
- }
5635
- wait(duration) {
5636
- if (this.tailAnimate.wait(duration), this.target) {
5637
- const stage = this.target.stage;
5638
- stage && stage.renderNextFrame();
5639
- }
5640
- return this;
5641
- }
5642
- startAt(t) {
5643
- if (this.tailAnimate.startAt(t), this.target) {
5644
- const stage = this.target.stage;
5645
- stage && stage.renderNextFrame();
5646
- }
5647
- return this;
5648
- }
5649
- loop(l) {
5650
- if (this.tailAnimate.loop = l, this.target) {
5651
- const stage = this.target.stage;
5652
- stage && stage.renderNextFrame();
5653
- }
5654
- return this;
5655
- }
5656
- reversed(r) {
5657
- if (this.tailAnimate.reversed = r, this.target) {
5658
- const stage = this.target.stage;
5659
- stage && stage.renderNextFrame();
5660
- }
5661
- return this;
5662
- }
5663
- bounce(b) {
5664
- if (this.tailAnimate.bounce = b, this.target) {
5665
- const stage = this.target.stage;
5666
- stage && stage.renderNextFrame();
5667
- }
5668
- return this;
5669
- }
5670
- subAnimate() {
5671
- const sa = new SubAnimate(this, this.tailAnimate);
5672
- return this.tailAnimate = sa, this.subAnimates.push(sa), sa.bind(this.target), this;
5673
- }
5674
- getStartProps() {
5675
- return this.subAnimates[0].getStartProps();
5676
- }
5677
- getEndProps() {
5678
- return this.tailAnimate.getEndProps();
5679
- }
5680
- depreventAttr(key) {
5681
- this._preventAttrs && this._preventAttrs.delete(key);
5682
- }
5683
- preventAttr(key) {
5684
- this._preventAttrs || (this._preventAttrs = new Set()), this._preventAttrs.add(key);
5685
- }
5686
- preventAttrs(keys) {
5687
- keys.forEach(key => this.preventAttr(key));
5688
- }
5689
- validAttr(key) {
5690
- return !this._preventAttrs || !this._preventAttrs.has(key);
5691
- }
5692
- bind(target) {
5693
- return this.target = target, this.target.onAnimateBind && !this.slience && this.target.onAnimateBind(this), this.subAnimates.forEach(sa => {
5694
- sa.bind(target);
5695
- }), this;
5696
- }
5697
- advance(delta) {
5698
- if (this._duringTime < this._startTime) {
5699
- if (this._duringTime + delta * this.timeScale < this._startTime) return void (this._duringTime += delta * this.timeScale);
5700
- delta = this._duringTime + delta * this.timeScale - this._startTime, this._duringTime = this._startTime;
5701
- }
5702
- this.status === AnimateStatus.INITIAL && (this.status = AnimateStatus.RUNNING, this._onStart && this._onStart.forEach(cb => cb()));
5703
- this.setPosition(Math.max(this.rawPosition, 0) + delta * this.timeScale) && this.status === AnimateStatus.RUNNING && (this.status = AnimateStatus.END, this._onEnd && this._onEnd.forEach(cb => cb()));
5704
- }
5705
- setPosition(rawPosition) {
5706
- let sa,
5707
- d = 0;
5708
- const prevRawPos = this.rawPosition,
5709
- maxRawPos = this.subAnimates.reduce((a, b) => a + b.totalDuration, 0);
5710
- rawPosition < 0 && (rawPosition = 0);
5711
- const end = rawPosition >= maxRawPos;
5712
- if (end && (rawPosition = maxRawPos), rawPosition === prevRawPos) return end;
5713
- for (let i = 0; i < this.subAnimates.length && (sa = this.subAnimates[i], !(d + sa.totalDuration >= rawPosition)); i++) d += sa.totalDuration, sa = void 0;
5714
- return this.rawPosition = rawPosition, sa.setPosition(rawPosition - d), end;
5715
- }
5716
- onStart(cb) {
5717
- this._onStart || (this._onStart = []), this._onStart.push(cb);
5718
- }
5719
- onEnd(cb) {
5720
- this._onEnd || (this._onEnd = []), this._onEnd.push(cb);
5721
- }
5722
- onRemove(cb) {
5723
- this._onRemove || (this._onRemove = []), this._onRemove.push(cb);
5724
- }
5725
- onFrame(cb) {
5726
- this._onFrame || (this._onFrame = []), this._onFrame.push(cb);
5727
- }
5728
- release() {
5729
- this.status = AnimateStatus.END;
5730
- }
5731
- stop(nextVal) {
5732
- nextVal || this.target.onStop(), "start" === nextVal ? this.target.onStop(this.getStartProps()) : "end" === nextVal ? this.target.onStop(this.getEndProps()) : this.target.onStop(nextVal), this.release();
5733
- }
5734
- }
5735
- Animate.mode = AnimateMode.NORMAL, Animate.interpolateMap = new Map();
5736
- class SubAnimate {
5737
- get totalDuration() {
5738
- return this.calcAttr(), this._totalDuration + this._startAt;
5739
- }
5740
- constructor(animate, lastSubAnimate) {
5741
- this.rawPosition = -1, this.position = 0, this.loop = 0, this.duration = 0, this.animate = animate, this.stepHead = new Step(0, 0, lastSubAnimate ? Object.assign({}, lastSubAnimate.stepTail.props) : {}), this.stepTail = this.stepHead, this.dirty = !0, this._startAt = 0;
5742
- }
5743
- calcAttr() {
5744
- this.dirty && (this._totalDuration = this.duration * (this.loop + 1));
5745
- }
5746
- bind(target) {
5747
- return this.target = target, this;
5748
- }
5749
- play(customAnimate) {
5750
- let duration = customAnimate.duration;
5751
- (null == duration || duration < 0) && (duration = 0);
5752
- const easing = customAnimate.easing,
5753
- easingFunc = "string" == typeof easing ? Easing[easing] : easing,
5754
- step = this._addStep(duration, null, easingFunc);
5755
- return step.type = AnimateStepType.customAnimate, this._appendProps(customAnimate.getEndProps(), step, !1), this._appendCustomAnimate(customAnimate, step), this;
5756
- }
5757
- to(props, duration, easing, params) {
5758
- (null == duration || duration < 0) && (duration = 0);
5759
- const easingFunc = "string" == typeof easing ? Easing[easing] : easing,
5760
- step = this._addStep(duration, null, easingFunc);
5761
- 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 && this.target.animates.forEach(a => {
5762
- a.id !== this.animate.id && a.preventAttrs(step.propKeys);
5763
- }), this;
5764
- }
5765
- from(props, duration, easing, params) {
5766
- this.to(props, 0, easing, params);
5767
- const toProps = {};
5768
- this.stepTail.propKeys || (this.stepTail.propKeys = Object.keys(this.stepTail.props)), this.stepTail.propKeys.forEach(k => {
5769
- toProps[k] = this.getLastPropByName(k, this.stepTail);
5770
- }), this.to(toProps, duration, easing, params), this.stepTail.type = AnimateStepType.from;
5771
- }
5772
- startAt(t) {
5773
- return t < 0 && (t = 0), this._startAt = t, this;
5774
- }
5775
- getStartProps() {
5776
- var _a;
5777
- return null === (_a = this.stepHead) || void 0 === _a ? void 0 : _a.props;
5778
- }
5779
- getEndProps() {
5780
- return this.stepTail.props;
5781
- }
5782
- getLastStep() {
5783
- return this._lastStep;
5784
- }
5785
- wait(duration) {
5786
- if (duration > 0) {
5787
- const step = this._addStep(+duration, null);
5788
- step.type = AnimateStepType.wait, step.prev.customAnimate ? step.props = step.prev.customAnimate.getEndProps() : step.props = step.prev.props, this.target.onAddStep && this.target.onAddStep(step);
5789
- }
5790
- return this;
5791
- }
5792
- _addStep(duration, props, easingFunc) {
5793
- const step = new Step(this.duration, duration, props, easingFunc);
5794
- return this.duration += duration, this.stepTail.append(step), this.stepTail = step, step;
5795
- }
5796
- _appendProps(props, step, tempProps) {
5797
- step.props = tempProps ? props : Object.assign({}, props);
5798
- let lastStep = step.prev;
5799
- const _props = step.props;
5800
- for (step.propKeys || (step.propKeys = Object.keys(step.props)), step.propKeys.forEach(k => {
5801
- void 0 === step.props[k] && (step.props[k] = this.target.getDefaultAttribute(k));
5802
- }); lastStep.prev;) lastStep.props && (lastStep.propKeys || (lastStep.propKeys = Object.keys(lastStep.props)), lastStep.propKeys.forEach(key => {
5803
- void 0 === _props[key] && (_props[key] = lastStep.props[key]);
5804
- })), step.propKeys = Object.keys(step.props), lastStep = lastStep.prev;
5805
- const initProps = this.stepHead.props;
5806
- step.propKeys || (step.propKeys = Object.keys(_props)), step.propKeys.forEach(key => {
5807
- if (void 0 === initProps[key]) {
5808
- const parentAnimateInitProps = this.animate.getStartProps();
5809
- initProps[key] = parentAnimateInitProps[key] = this.target.getComputedAttribute(key);
5221
+ static loading() {
5222
+ setTimeout(() => {
5223
+ if (!ResourceLoader.isLoading && ResourceLoader.toLoadAueue.length) {
5224
+ ResourceLoader.isLoading = !0;
5225
+ const tasks = ResourceLoader.toLoadAueue.splice(0, 10),
5226
+ promises = [];
5227
+ tasks.forEach(task => {
5228
+ const {
5229
+ url: url,
5230
+ marks: marks
5231
+ } = task,
5232
+ data = {
5233
+ type: "image",
5234
+ loadState: "init"
5235
+ };
5236
+ if (ResourceLoader.cache.set(url, data), data.dataPromise = application.global.loadImage(url), data.dataPromise) {
5237
+ data.waitingMark = marks;
5238
+ const end = data.dataPromise.then(res => {
5239
+ var _a;
5240
+ data.loadState = (null == res ? void 0 : res.data) ? "success" : "fail", data.data = null == res ? void 0 : res.data, null === (_a = data.waitingMark) || void 0 === _a || _a.map((mark, index) => {
5241
+ (null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(url, res.data)) : (data.loadState = "fail", mark.imageLoadFail(url));
5242
+ }), data.waitingMark && (data.waitingMark = []);
5243
+ });
5244
+ promises.push(end);
5245
+ } else data.loadState = "fail", marks.forEach(mark => mark.imageLoadFail(url));
5246
+ }), Promise.all(promises).then(() => {
5247
+ ResourceLoader.isLoading = !1, this.onLoadSuccessCb.forEach(cb => cb()), ResourceLoader.loading();
5248
+ }).catch(error => {
5249
+ ResourceLoader.isLoading = !1, this.onLoadSuccessCb.forEach(cb => cb()), ResourceLoader.loading();
5250
+ });
5810
5251
  }
5811
- }), this.target.onAddStep && this.target.onAddStep(step);
5252
+ }, 0);
5812
5253
  }
5813
- _appendCustomAnimate(customAnimate, step) {
5814
- step.customAnimate = customAnimate, customAnimate.step = step, customAnimate.bind(this.target, this);
5254
+ static loadImage(url, mark) {
5255
+ const index = getIndex(url, ResourceLoader.toLoadAueue);
5256
+ if (-1 !== index) return ResourceLoader.toLoadAueue[index].marks.push(mark), void ResourceLoader.loading();
5257
+ ResourceLoader.toLoadAueue.push({
5258
+ url: url,
5259
+ marks: [mark]
5260
+ }), ResourceLoader.loading();
5815
5261
  }
5816
- setPosition(rawPosition) {
5817
- var _a;
5818
- const d = this.duration,
5819
- loopCount = this.loop,
5820
- prevRawPos = this.rawPosition;
5821
- let loop,
5822
- position,
5823
- end = !1;
5824
- const startAt = null !== (_a = this._startAt) && void 0 !== _a ? _a : 0;
5825
- if (rawPosition < 0 && (rawPosition = 0), rawPosition < startAt) return this.rawPosition = rawPosition, !1;
5826
- if (rawPosition -= startAt, d <= 0 && (end = !0, d < 0)) return end;
5827
- if (loop = Math.floor(rawPosition / d), position = rawPosition - loop * d, end = rawPosition >= loopCount * d + d, end && (position = d, loop = loopCount, rawPosition = position * loop + d), rawPosition === prevRawPos) return end;
5828
- const rev = !this.reversed != !(this.bounce && loop % 2);
5829
- return rev && (position = d - position), this._deltaPosition = position - this.position, this.position = position, this.rawPosition = rawPosition + startAt, this.updatePosition(end, rev), end;
5830
- }
5831
- updatePosition(end, rev) {
5832
- if (!this.stepHead) return;
5833
- let step = this.stepHead.next;
5834
- const position = this.position,
5835
- duration = this.duration;
5836
- if (this.target && step) {
5837
- let stepNext = step.next;
5838
- for (; stepNext && stepNext.position <= position;) step = stepNext, stepNext = step.next;
5839
- let ratio = end ? 0 === duration ? 1 : position / duration : (position - step.position) / step.duration;
5840
- step.easing && (ratio = step.easing(ratio)), this.tryCallCustomAnimateLifeCycle(step, this._lastStep || (rev ? this.stepTail : this.stepHead), rev), this.updateTarget(step, ratio, end), this._lastStep = step, this.animate._onFrame && this.animate._onFrame.forEach(cb => cb(step, ratio));
5841
- }
5842
- }
5843
- tryCallCustomAnimateLifeCycle(step, lastStep, rev) {
5844
- if (step !== lastStep) if (rev) {
5845
- let _step = lastStep.prev;
5846
- for (; _step && _step !== step;) _step.customAnimate && (_step.customAnimate.onStart && _step.customAnimate.onStart(), _step.customAnimate.onEnd && _step.customAnimate.onEnd()), _step = step.prev;
5847
- lastStep && lastStep.customAnimate && lastStep.customAnimate.onEnd && lastStep.customAnimate.onEnd(), step && step.customAnimate && step.customAnimate.onStart && step.customAnimate.onStart();
5848
- } else {
5849
- let _step = lastStep.next;
5850
- for (; _step && _step !== step;) _step.customAnimate && (_step.customAnimate.onStart && _step.customAnimate.onStart(), _step.customAnimate.onEnd && _step.customAnimate.onEnd()), _step = _step.next;
5851
- lastStep && lastStep.customAnimate && lastStep.customAnimate.onEnd && lastStep.customAnimate.onEnd(), step && step.customAnimate && step.customAnimate.onStart && step.customAnimate.onStart();
5852
- }
5853
- }
5854
- getLastPropByName(name, step) {
5855
- let lastStep = step.prev;
5856
- for (; lastStep;) {
5857
- if (lastStep.props && void 0 !== lastStep.props[name]) return lastStep.props[name];
5858
- if (lastStep.customAnimate) {
5859
- const val = lastStep.customAnimate.getEndProps()[name];
5860
- if (void 0 !== val) return val;
5861
- }
5862
- lastStep = lastStep.prev;
5262
+ static improveImageLoading(url) {
5263
+ const index = getIndex(url, ResourceLoader.toLoadAueue);
5264
+ if (-1 !== index) {
5265
+ const elememt = ResourceLoader.toLoadAueue.splice(index, 1);
5266
+ ResourceLoader.toLoadAueue.unshift(elememt[0]);
5863
5267
  }
5864
- return Logger.getInstance().warn("未知错误,step中找不到属性"), step.props[name];
5865
5268
  }
5866
- updateTarget(step, ratio, end) {
5867
- null == step.props && null == step.customAnimate || this.target.onStep(this, this.animate, step, ratio, end);
5269
+ static onLoadSuccess(cb) {
5270
+ this.onLoadSuccessCb.push(cb);
5868
5271
  }
5869
5272
  }
5870
- class Step {
5871
- constructor(position, duration, props, easing) {
5872
- this.duration = duration, this.position = position, this.props = props, this.easing = easing;
5873
- }
5874
- append(step) {
5875
- step.prev = this, step.next = this.next, this.next = step;
5876
- }
5877
- getLastProps() {
5878
- let step = this.prev;
5879
- for (; step;) {
5880
- if (step.props) return step.props;
5881
- if (step.customAnimate) return step.customAnimate.getMergedEndProps();
5882
- step = step.prev;
5883
- }
5884
- return null;
5885
- }
5273
+ function getIndex(url, arr) {
5274
+ for (let i = 0; i < arr.length; i++) if (arr[i].url === url) return i;
5275
+ return -1;
5886
5276
  }
5887
-
5888
- const DefaultStateAnimateConfig = {
5889
- duration: 200,
5890
- easing: "cubicOut"
5891
- };
5277
+ ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [], ResourceLoader.onLoadSuccessCb = [];
5892
5278
 
5893
5279
  var Edge;
5894
5280
  !function (Edge) {
@@ -5943,246 +5329,6 @@
5943
5329
  return isNaN(_lh) ? _lh : Math.max(fontSize, _lh);
5944
5330
  };
5945
5331
 
5946
- const normalizeRectAttributes = attribute => {
5947
- if (!attribute) return {
5948
- x: 0,
5949
- y: 0,
5950
- width: 0,
5951
- height: 0
5952
- };
5953
- let width = isNil$1(attribute.width) ? attribute.x1 - attribute.x : attribute.width,
5954
- height = isNil$1(attribute.height) ? attribute.y1 - attribute.y : attribute.height,
5955
- x = 0,
5956
- y = 0;
5957
- return width < 0 ? (x = width, width = -width) : Number.isNaN(width) && (width = 0), height < 0 ? (y = height, height = -height) : Number.isNaN(height) && (height = 0), {
5958
- x: x,
5959
- y: y,
5960
- width: width,
5961
- height: height
5962
- };
5963
- };
5964
-
5965
- var ColorType;
5966
- !function (ColorType) {
5967
- ColorType[ColorType.Color255 = 0] = "Color255", ColorType[ColorType.Color1 = 1] = "Color1";
5968
- }(ColorType || (ColorType = {}));
5969
- class ColorStore {
5970
- static Get(str) {
5971
- let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorType.Color1;
5972
- let arr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0, 1];
5973
- if (size === ColorType.Color1) {
5974
- const color = ColorStore.store1[str];
5975
- if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
5976
- const c = Color.parseColorString(str);
5977
- if (c) {
5978
- const data = [c.r / 255, c.g / 255, c.b / 255, c.opacity];
5979
- ColorStore.store1[str] = data, ColorStore.store255[str] = [c.r, c.g, c.b, c.opacity], arr[0] = data[0], arr[1] = data[1], arr[2] = data[2], arr[3] = data[3];
5980
- }
5981
- return arr;
5982
- }
5983
- const color = ColorStore.store255[str];
5984
- if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
5985
- const c = Color.parseColorString(str);
5986
- return c && (ColorStore.store1[str] = [c.r / 255, c.g / 255, c.b / 255, c.opacity], ColorStore.store255[str] = [c.r, c.g, c.b, c.opacity], arr[0] = c.r, arr[1] = c.g, arr[2] = c.b, arr[3] = c.opacity), arr;
5987
- }
5988
- static Set(str, size, arr) {
5989
- if (size === ColorType.Color1) {
5990
- if (ColorStore.store1[str]) return;
5991
- ColorStore.store1[str] = arr, ColorStore.store255[str] = [Math.floor(255 * arr[0]), Math.floor(255 * arr[1]), Math.floor(255 * arr[2]), Math.floor(255 * arr[3])];
5992
- } else {
5993
- if (ColorStore.store255[str]) return;
5994
- ColorStore.store255[str] = arr, ColorStore.store1[str] = [arr[0] / 255, arr[1] / 255, arr[2] / 255, arr[3]];
5995
- }
5996
- }
5997
- }
5998
- ColorStore.store255 = {}, ColorStore.store1 = {};
5999
-
6000
- function colorArrayToString(color) {
6001
- let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
6002
- return Array.isArray(color) && isNumber$1(color[0]) ? alphaChannel ? `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])},${color[3].toFixed(2)})` : `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])})` : color;
6003
- }
6004
- function interpolateColor(from, to, ratio, alphaChannel, cb) {
6005
- if (Array.isArray(from) && !isNumber$1(from[0]) || Array.isArray(to) && !isNumber$1(to[0])) {
6006
- return new Array(4).fill(0).map((_, index) => _interpolateColor(isArray$1(from) ? from[index] : from, isArray$1(to) ? to[index] : to, ratio, alphaChannel));
6007
- }
6008
- return _interpolateColor(from, to, ratio, alphaChannel, cb);
6009
- }
6010
- function _interpolateColor(from, to, ratio, alphaChannel, cb) {
6011
- if (!from || !to) return from && colorArrayToString(from) || to && colorArrayToString(to) || !1;
6012
- let fromArray,
6013
- toArray,
6014
- fromGradient = !1,
6015
- toGradient = !1;
6016
- if (Array.isArray(from) ? fromArray = from : "string" == typeof from ? fromArray = ColorStore.Get(from, ColorType.Color255) : fromGradient = !0, Array.isArray(to) ? toArray = to : "string" == typeof to ? toArray = ColorStore.Get(to, ColorType.Color255) : toGradient = !0, fromGradient !== toGradient) {
6017
- const gradient = fromGradient ? from : to,
6018
- pure = fromGradient ? to : from,
6019
- gradientFromPure = Object.assign(Object.assign({}, gradient), {
6020
- stops: gradient.stops.map(v => Object.assign(Object.assign({}, v), {
6021
- color: colorArrayToString(pure)
6022
- }))
6023
- });
6024
- return fromGradient ? interpolateColor(gradient, gradientFromPure, ratio, alphaChannel, cb) : interpolateColor(gradientFromPure, gradient, ratio, alphaChannel, cb);
6025
- }
6026
- if (fromGradient) {
6027
- if (from.gradient === to.gradient) {
6028
- const fc = from,
6029
- tc = to,
6030
- fromStops = fc.stops,
6031
- toStops = tc.stops;
6032
- if (fromStops.length !== toStops.length) return !1;
6033
- if ("linear" === fc.gradient) return interpolateGradientLinearColor(fc, tc, ratio);
6034
- if ("radial" === fc.gradient) return interpolateGradientRadialColor(fc, tc, ratio);
6035
- if ("conical" === fc.gradient) return interpolateGradientConicalColor(fc, tc, ratio);
6036
- }
6037
- return !1;
6038
- }
6039
- cb && cb(fromArray, toArray);
6040
- return colorArrayToString(interpolatePureColorArray(fromArray, toArray, ratio), alphaChannel);
6041
- }
6042
- function interpolateGradientLinearColor(fc, tc, ratio) {
6043
- const fStops = fc.stops,
6044
- tStops = tc.stops;
6045
- return {
6046
- gradient: "linear",
6047
- x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
6048
- x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
6049
- y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
6050
- y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
6051
- stops: new Array(fStops.length).fill(0).map((_, i) => ({
6052
- color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
6053
- offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
6054
- }))
6055
- };
6056
- }
6057
- function interpolateGradientRadialColor(fc, tc, ratio) {
6058
- const fStops = fc.stops,
6059
- tStops = tc.stops;
6060
- return {
6061
- gradient: "radial",
6062
- x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
6063
- x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
6064
- y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
6065
- y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
6066
- r0: fc.r0 + (tc.r0 - fc.r0) * ratio,
6067
- r1: fc.r1 + (tc.r1 - fc.r1) * ratio,
6068
- stops: new Array(fStops.length).fill(0).map((_, i) => ({
6069
- color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
6070
- offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
6071
- }))
6072
- };
6073
- }
6074
- function interpolateGradientConicalColor(fc, tc, ratio) {
6075
- const fStops = fc.stops,
6076
- tStops = tc.stops;
6077
- return {
6078
- gradient: "conical",
6079
- startAngle: fc.startAngle + (tc.startAngle - fc.startAngle) * ratio,
6080
- endAngle: fc.endAngle + (tc.endAngle - fc.endAngle) * ratio,
6081
- x: fc.x + (tc.x - fc.x) * ratio,
6082
- y: fc.y + (tc.y - fc.y) * ratio,
6083
- stops: new Array(fStops.length).fill(0).map((_, i) => ({
6084
- color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
6085
- offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
6086
- }))
6087
- };
6088
- }
6089
- function interpolatePureColorArray(from, to, ratio) {
6090
- return [from[0] + (to[0] - from[0]) * ratio, from[1] + (to[1] - from[1]) * ratio, from[2] + (to[2] - from[2]) * ratio, from[3] + (to[3] - from[3]) * ratio];
6091
- }
6092
- const _fromColorRGB = [0, 0, 0, 0],
6093
- _toColorRGB = [0, 0, 0, 0];
6094
- function colorStringInterpolationToStr(fromColor, toColor, ratio) {
6095
- return ColorStore.Get(fromColor, ColorType.Color255, _fromColorRGB), ColorStore.Get(toColor, ColorType.Color255, _toColorRGB), `rgba(${Math.round(_fromColorRGB[0] + (_toColorRGB[0] - _fromColorRGB[0]) * ratio)},${Math.round(_fromColorRGB[1] + (_toColorRGB[1] - _fromColorRGB[1]) * ratio)},${Math.round(_fromColorRGB[2] + (_toColorRGB[2] - _fromColorRGB[2]) * ratio)},${_fromColorRGB[3] + (_toColorRGB[3] - _fromColorRGB[3]) * ratio})`;
6096
- }
6097
-
6098
- class ResourceLoader {
6099
- static GetImage(url, mark) {
6100
- var _a;
6101
- const data = ResourceLoader.cache.get(url);
6102
- data ? "fail" === data.loadState ? application.global.getRequestAnimationFrame()(() => {
6103
- mark.imageLoadFail(url);
6104
- }) : "init" === data.loadState || "loading" === data.loadState ? null === (_a = data.waitingMark) || void 0 === _a || _a.push(mark) : mark && mark.imageLoadSuccess(url, data.data) : ResourceLoader.loadImage(url, mark);
6105
- }
6106
- static GetSvg(svgStr, mark) {
6107
- var _a;
6108
- let data = ResourceLoader.cache.get(svgStr);
6109
- data ? "fail" === data.loadState ? application.global.getRequestAnimationFrame()(() => {
6110
- mark.imageLoadFail(svgStr);
6111
- }) : "init" === data.loadState || "loading" === data.loadState ? null === (_a = data.waitingMark) || void 0 === _a || _a.push(mark) : mark && mark.imageLoadSuccess(svgStr, data.data) : (data = {
6112
- type: "image",
6113
- loadState: "init"
6114
- }, ResourceLoader.cache.set(svgStr, data), data.dataPromise = application.global.loadSvg(svgStr), data.dataPromise ? (data.waitingMark = [mark], data.dataPromise.then(res => {
6115
- var _a;
6116
- data.loadState = (null == res ? void 0 : res.data) ? "success" : "fail", data.data = null == res ? void 0 : res.data, null === (_a = data.waitingMark) || void 0 === _a || _a.map((mark, index) => {
6117
- (null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(svgStr, res.data)) : (data.loadState = "fail", mark.imageLoadFail(svgStr));
6118
- }), data.waitingMark && (data.waitingMark = []);
6119
- })) : (data.loadState = "fail", mark.imageLoadFail(svgStr)));
6120
- }
6121
- static GetFile(url, type) {
6122
- let data = ResourceLoader.cache.get(url);
6123
- return data ? "fail" === data.loadState ? Promise.reject() : "init" === data.loadState || "loading" === data.loadState ? data.dataPromise.then(data => data.data) : Promise.resolve(data.data) : (data = {
6124
- type: type,
6125
- loadState: "init"
6126
- }, ResourceLoader.cache.set(url, data), "arrayBuffer" === type ? data.dataPromise = application.global.loadArrayBuffer(url) : "blob" === type ? data.dataPromise = application.global.loadBlob(url) : "json" === type && (data.dataPromise = application.global.loadJson(url)), data.dataPromise.then(data => data.data));
6127
- }
6128
- static loading() {
6129
- setTimeout(() => {
6130
- if (!ResourceLoader.isLoading && ResourceLoader.toLoadAueue.length) {
6131
- ResourceLoader.isLoading = !0;
6132
- const tasks = ResourceLoader.toLoadAueue.splice(0, 10),
6133
- promises = [];
6134
- tasks.forEach(task => {
6135
- const {
6136
- url: url,
6137
- marks: marks
6138
- } = task,
6139
- data = {
6140
- type: "image",
6141
- loadState: "init"
6142
- };
6143
- if (ResourceLoader.cache.set(url, data), data.dataPromise = application.global.loadImage(url), data.dataPromise) {
6144
- data.waitingMark = marks;
6145
- const end = data.dataPromise.then(res => {
6146
- var _a;
6147
- data.loadState = (null == res ? void 0 : res.data) ? "success" : "fail", data.data = null == res ? void 0 : res.data, null === (_a = data.waitingMark) || void 0 === _a || _a.map((mark, index) => {
6148
- (null == res ? void 0 : res.data) ? (data.loadState = "success", data.data = res.data, mark.imageLoadSuccess(url, res.data)) : (data.loadState = "fail", mark.imageLoadFail(url));
6149
- }), data.waitingMark && (data.waitingMark = []);
6150
- });
6151
- promises.push(end);
6152
- } else data.loadState = "fail", marks.forEach(mark => mark.imageLoadFail(url));
6153
- }), Promise.all(promises).then(() => {
6154
- ResourceLoader.isLoading = !1, this.onLoadSuccessCb.forEach(cb => cb()), ResourceLoader.loading();
6155
- }).catch(error => {
6156
- ResourceLoader.isLoading = !1, this.onLoadSuccessCb.forEach(cb => cb()), ResourceLoader.loading();
6157
- });
6158
- }
6159
- }, 0);
6160
- }
6161
- static loadImage(url, mark) {
6162
- const index = getIndex(url, ResourceLoader.toLoadAueue);
6163
- if (-1 !== index) return ResourceLoader.toLoadAueue[index].marks.push(mark), void ResourceLoader.loading();
6164
- ResourceLoader.toLoadAueue.push({
6165
- url: url,
6166
- marks: [mark]
6167
- }), ResourceLoader.loading();
6168
- }
6169
- static improveImageLoading(url) {
6170
- const index = getIndex(url, ResourceLoader.toLoadAueue);
6171
- if (-1 !== index) {
6172
- const elememt = ResourceLoader.toLoadAueue.splice(index, 1);
6173
- ResourceLoader.toLoadAueue.unshift(elememt[0]);
6174
- }
6175
- }
6176
- static onLoadSuccess(cb) {
6177
- this.onLoadSuccessCb.push(cb);
6178
- }
6179
- }
6180
- function getIndex(url, arr) {
6181
- for (let i = 0; i < arr.length; i++) if (arr[i].url === url) return i;
6182
- return -1;
6183
- }
6184
- ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [], ResourceLoader.onLoadSuccessCb = [];
6185
-
6186
5332
  class BaseSymbol {
6187
5333
  bounds(size, bounds) {
6188
5334
  if (isNumber$1(size)) {
@@ -6270,8 +5416,7 @@
6270
5416
  }
6271
5417
  var square$1 = new SquareSymbol();
6272
5418
 
6273
- function trianglUpOffset(ctx, r, x, y) {
6274
- let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
5419
+ function trianglUpOffset(ctx, r, x, y, offset = 0) {
6275
5420
  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;
6276
5421
  }
6277
5422
  class TriangleUpSymbol extends BaseSymbol {
@@ -6417,8 +5562,7 @@
6417
5562
  }
6418
5563
  var triangleLeft = new TriangleLeftSymbol();
6419
5564
 
6420
- function trianglRightOffset(ctx, r, x, y) {
6421
- let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
5565
+ function trianglRightOffset(ctx, r, x, y, offset = 0) {
6422
5566
  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;
6423
5567
  }
6424
5568
  class TriangleRightSymbol extends BaseSymbol {
@@ -6434,8 +5578,7 @@
6434
5578
  }
6435
5579
  var triangleRight = new TriangleRightSymbol();
6436
5580
 
6437
- function trianglDownOffset(ctx, r, x, y) {
6438
- let offset = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
5581
+ function trianglDownOffset(ctx, r, x, y, offset = 0) {
6439
5582
  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;
6440
5583
  }
6441
5584
  class TriangleDownSymbol extends BaseSymbol {
@@ -6652,8 +5795,7 @@
6652
5795
 
6653
5796
  const tempBounds = new AABBBounds();
6654
5797
  class CustomSymbolClass {
6655
- constructor(type, path) {
6656
- let isSvg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
5798
+ constructor(type, path, isSvg = !1) {
6657
5799
  this.pathStr = "", this.type = type, isArray$1(path) ? this.svgCache = path : this.path = path, this.isSvg = isSvg;
6658
5800
  }
6659
5801
  drawOffset(ctx, size, x, y, offset, z, cb) {
@@ -6675,10 +5817,9 @@
6675
5817
  bounds(size, bounds) {
6676
5818
  if (size = this.parseSize(size), this.isSvg) {
6677
5819
  if (!this.svgCache) return;
6678
- return bounds.clear(), void this.svgCache.forEach(_ref => {
6679
- let {
6680
- path: path
6681
- } = _ref;
5820
+ return bounds.clear(), void this.svgCache.forEach(({
5821
+ path: path
5822
+ }) => {
6682
5823
  tempBounds.x1 = path.bounds.x1 * size, tempBounds.y1 = path.bounds.y1 * size, tempBounds.x2 = path.bounds.x2 * size, tempBounds.y2 = path.bounds.y2 * size, bounds.union(tempBounds);
6683
5824
  });
6684
5825
  }
@@ -6734,8 +5875,7 @@
6734
5875
  if (-1 === closingIndex) throw new Error(errMsg);
6735
5876
  return closingIndex + str.length - 1;
6736
5877
  }
6737
- function tagExpWithClosingIndex(xmlData, i) {
6738
- let closingChar = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ">";
5878
+ function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
6739
5879
  let attrBoundary,
6740
5880
  tagExp = "";
6741
5881
  for (let index = i; index < xmlData.length; index++) {
@@ -6753,8 +5893,7 @@
6753
5893
  tagExp += ch;
6754
5894
  }
6755
5895
  }
6756
- function readTagExp(xmlData, i, removeNSPrefix) {
6757
- let closingChar = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ">";
5896
+ function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
6758
5897
  const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
6759
5898
  if (!result) return;
6760
5899
  let tagExp = result.data;
@@ -6916,8 +6055,7 @@
6916
6055
  step((generator = generator.apply(thisArg, _arguments || [])).next());
6917
6056
  });
6918
6057
  };
6919
- function boundStroke(bounds, halfW, miter) {
6920
- let pad = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
6058
+ function boundStroke(bounds, halfW, miter, pad = 0) {
6921
6059
  return bounds.expand(halfW + (pad / 2 + (miter ? miterAdjustment(miter, halfW) : 0))), bounds;
6922
6060
  }
6923
6061
  function miterAdjustment(miter, strokeWidth) {
@@ -6989,7 +6127,352 @@
6989
6127
  stroke: "stroke",
6990
6128
  fill: "fill"
6991
6129
  };
6992
- const SVG_PARSE_ATTRIBUTE_MAP_KEYS = Object.keys(SVG_PARSE_ATTRIBUTE_MAP);
6130
+ const SVG_PARSE_ATTRIBUTE_MAP_KEYS = Object.keys(SVG_PARSE_ATTRIBUTE_MAP);
6131
+
6132
+ const DefaultStateAnimateConfig = {
6133
+ duration: 200,
6134
+ easing: "cubicOut"
6135
+ };
6136
+
6137
+ function identityMat4(out) {
6138
+ return out[0] = 1, out[1] = 0, out[2] = 0, out[3] = 0, out[4] = 0, out[5] = 1, out[6] = 0, out[7] = 0, out[8] = 0, out[9] = 0, out[10] = 1, out[11] = 0, out[12] = 0, out[13] = 0, out[14] = 0, out[15] = 1, out;
6139
+ }
6140
+ function rotateX(out, a, rad) {
6141
+ const s = Math.sin(rad),
6142
+ c = Math.cos(rad),
6143
+ a10 = a[4],
6144
+ a11 = a[5],
6145
+ a12 = a[6],
6146
+ a13 = a[7],
6147
+ a20 = a[8],
6148
+ a21 = a[9],
6149
+ a22 = a[10],
6150
+ a23 = a[11];
6151
+ return a !== out && (out[0] = a[0], out[1] = a[1], out[2] = a[2], out[3] = a[3], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[4] = a10 * c + a20 * s, out[5] = a11 * c + a21 * s, out[6] = a12 * c + a22 * s, out[7] = a13 * c + a23 * s, out[8] = a20 * c - a10 * s, out[9] = a21 * c - a11 * s, out[10] = a22 * c - a12 * s, out[11] = a23 * c - a13 * s, out;
6152
+ }
6153
+ function rotateY(out, a, rad) {
6154
+ const s = Math.sin(rad),
6155
+ c = Math.cos(rad),
6156
+ a00 = a[0],
6157
+ a01 = a[1],
6158
+ a02 = a[2],
6159
+ a03 = a[3],
6160
+ a20 = a[8],
6161
+ a21 = a[9],
6162
+ a22 = a[10],
6163
+ a23 = a[11];
6164
+ return a !== out && (out[4] = a[4], out[5] = a[5], out[6] = a[6], out[7] = a[7], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[0] = a00 * c - a20 * s, out[1] = a01 * c - a21 * s, out[2] = a02 * c - a22 * s, out[3] = a03 * c - a23 * s, out[8] = a00 * s + a20 * c, out[9] = a01 * s + a21 * c, out[10] = a02 * s + a22 * c, out[11] = a03 * s + a23 * c, out;
6165
+ }
6166
+ function rotateZ(out, a, rad) {
6167
+ const s = Math.sin(rad),
6168
+ c = Math.cos(rad),
6169
+ a00 = a[0],
6170
+ a01 = a[1],
6171
+ a02 = a[2],
6172
+ a03 = a[3],
6173
+ a10 = a[4],
6174
+ a11 = a[5],
6175
+ a12 = a[6],
6176
+ a13 = a[7];
6177
+ return a !== out && (out[8] = a[8], out[9] = a[9], out[10] = a[10], out[11] = a[11], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[0] = a00 * c + a10 * s, out[1] = a01 * c + a11 * s, out[2] = a02 * c + a12 * s, out[3] = a03 * c + a13 * s, out[4] = a10 * c - a00 * s, out[5] = a11 * c - a01 * s, out[6] = a12 * c - a02 * s, out[7] = a13 * c - a03 * s, out;
6178
+ }
6179
+ function translate(out, a, v) {
6180
+ const x = v[0],
6181
+ y = v[1],
6182
+ z = v[2];
6183
+ let a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23;
6184
+ return a === out ? (out[12] = a[0] * x + a[4] * y + a[8] * z + a[12], out[13] = a[1] * x + a[5] * y + a[9] * z + a[13], out[14] = a[2] * x + a[6] * y + a[10] * z + a[14], out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]) : (a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], out[0] = a00, out[1] = a01, out[2] = a02, out[3] = a03, out[4] = a10, out[5] = a11, out[6] = a12, out[7] = a13, out[8] = a20, out[9] = a21, out[10] = a22, out[11] = a23, out[12] = a00 * x + a10 * y + a20 * z + a[12], out[13] = a01 * x + a11 * y + a21 * z + a[13], out[14] = a02 * x + a12 * y + a22 * z + a[14], out[15] = a03 * x + a13 * y + a23 * z + a[15]), out;
6185
+ }
6186
+ function scaleMat4(out, a, v) {
6187
+ const x = v[0],
6188
+ y = v[1],
6189
+ z = v[2];
6190
+ return out[0] = a[0] * x, out[1] = a[1] * x, out[2] = a[2] * x, out[3] = a[3] * x, out[4] = a[4] * y, out[5] = a[5] * y, out[6] = a[6] * y, out[7] = a[7] * y, out[8] = a[8] * z, out[9] = a[9] * z, out[10] = a[10] * z, out[11] = a[11] * z, out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15], out;
6191
+ }
6192
+ function multiplyMat4Mat4(out, a, b) {
6193
+ const a00 = a[0],
6194
+ a01 = a[1],
6195
+ a02 = a[2],
6196
+ a03 = a[3],
6197
+ a10 = a[4],
6198
+ a11 = a[5],
6199
+ a12 = a[6],
6200
+ a13 = a[7],
6201
+ a20 = a[8],
6202
+ a21 = a[9],
6203
+ a22 = a[10],
6204
+ a23 = a[11],
6205
+ a30 = a[12],
6206
+ a31 = a[13],
6207
+ a32 = a[14],
6208
+ a33 = a[15];
6209
+ let b0 = b[0],
6210
+ b1 = b[1],
6211
+ b2 = b[2],
6212
+ b3 = b[3];
6213
+ return out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[4], b1 = b[5], b2 = b[6], b3 = b[7], out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[8], b1 = b[9], b2 = b[10], b3 = b[11], out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[12], b1 = b[13], b2 = b[14], b3 = b[15], out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, out;
6214
+ }
6215
+
6216
+ function createMat4() {
6217
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
6218
+ }
6219
+ class DefaultMatrixAllocate {
6220
+ constructor() {
6221
+ this.pools = [];
6222
+ }
6223
+ allocate(a, b, c, d, e, f) {
6224
+ if (!this.pools.length) return new Matrix(a, b, c, d, e, f);
6225
+ const m = this.pools.pop();
6226
+ return m.a = a, m.b = b, m.c = c, m.d = d, m.e = e, m.f = f, m;
6227
+ }
6228
+ allocateByObj(matrix) {
6229
+ if (!this.pools.length) return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
6230
+ const m = this.pools.pop();
6231
+ return m.a = matrix.a, m.b = matrix.b, m.c = matrix.c, m.d = matrix.d, m.e = matrix.e, m.f = matrix.f, m;
6232
+ }
6233
+ free(d) {
6234
+ this.pools.push(d);
6235
+ }
6236
+ get length() {
6237
+ return this.pools.length;
6238
+ }
6239
+ release(...params) {
6240
+ this.pools = [];
6241
+ }
6242
+ }
6243
+ class DefaultMat4Allocate {
6244
+ constructor() {
6245
+ this.pools = [];
6246
+ }
6247
+ static identity(out) {
6248
+ return identityMat4(out);
6249
+ }
6250
+ allocate() {
6251
+ if (!this.pools.length) return createMat4();
6252
+ const m = this.pools.pop();
6253
+ return DefaultMat4Allocate.identity(m), m;
6254
+ }
6255
+ allocateByObj(d) {
6256
+ let m;
6257
+ m = this.pools.length ? this.pools.pop() : createMat4();
6258
+ for (let i = 0; i < m.length; i++) m[i] = d[i];
6259
+ return m;
6260
+ }
6261
+ free(m) {
6262
+ m && this.pools.push(m);
6263
+ }
6264
+ get length() {
6265
+ return this.pools.length;
6266
+ }
6267
+ release(...params) {
6268
+ this.pools = [];
6269
+ }
6270
+ }
6271
+ const matrixAllocate = new DefaultMatrixAllocate();
6272
+ const mat4Allocate = new DefaultMat4Allocate();
6273
+
6274
+ var __decorate$j = undefined && undefined.__decorate || function (decorators, target, key, desc) {
6275
+ var d,
6276
+ c = arguments.length,
6277
+ r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
6278
+ if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) (d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
6279
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6280
+ },
6281
+ __metadata$f = undefined && undefined.__metadata || function (k, v) {
6282
+ if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
6283
+ };
6284
+ const initMatrix = new Matrix(1, 0, 0, 1, 0, 0),
6285
+ globalPoint = {
6286
+ x: 0,
6287
+ y: 0
6288
+ };
6289
+ let EmptyContext2d = class {
6290
+ get nativeContext() {
6291
+ return this.path;
6292
+ }
6293
+ constructor(canvas, dpr) {
6294
+ this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.path = new CustomPath2D(), this._clearMatrix = new Matrix(1, 0, 0, 1, 0, 0);
6295
+ }
6296
+ getCanvas() {
6297
+ throw new Error("不支持getCanvas");
6298
+ }
6299
+ getContext() {
6300
+ throw new Error("不支持getContext");
6301
+ }
6302
+ setTransformForCurrent(force = !1) {
6303
+ !force && this.applyedMatrix.equalToMatrix(this.matrix) || (this.applyedMatrix = this.cloneMatrix(this.matrix));
6304
+ }
6305
+ get currentMatrix() {
6306
+ return this.matrix;
6307
+ }
6308
+ cloneMatrix(m) {
6309
+ return matrixAllocate.allocateByObj(m);
6310
+ }
6311
+ clear() {
6312
+ this.save(), this.resetTransform(), this.restore();
6313
+ }
6314
+ reset() {
6315
+ this.matrix.setValue(1, 0, 0, 1, 0, 0), this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack.length = 0;
6316
+ }
6317
+ restore() {
6318
+ this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop(), this.setTransformForCurrent());
6319
+ }
6320
+ highPerformanceRestore() {
6321
+ this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop());
6322
+ }
6323
+ rotate(rad, setTransform = !0) {
6324
+ this.matrix.rotate(rad), setTransform && this.setTransformForCurrent();
6325
+ }
6326
+ save() {
6327
+ const matrix = this.cloneMatrix(this.matrix);
6328
+ this.stack.push(matrix);
6329
+ }
6330
+ highPerformanceSave() {
6331
+ const matrix = this.cloneMatrix(this.matrix);
6332
+ this.stack.push(matrix);
6333
+ }
6334
+ scale(sx, sy, setTransform = !0) {
6335
+ this.matrix.scale(sx, sy), setTransform && this.setTransformForCurrent();
6336
+ }
6337
+ setScale(sx, sy, setTransform = !0) {
6338
+ this.matrix.setScale(sx, sy), setTransform && this.setTransformForCurrent();
6339
+ }
6340
+ scalePoint(sx, sy, px, py, setTransform = !0) {
6341
+ this.translate(px, py, !1), this.scale(sx, sy, !1), this.translate(-px, -py, !1), setTransform && this.setTransformForCurrent();
6342
+ }
6343
+ setTransform(a, b, c, d, e, f, setTransform = !0, dpr = this.dpr) {
6344
+ this.matrix.setValue(dpr * a, dpr * b, dpr * c, dpr * d, dpr * e, dpr * f), setTransform && this.setTransformForCurrent();
6345
+ }
6346
+ setTransformFromMatrix(matrix, setTransform = !0, dpr = this.dpr) {
6347
+ this.matrix.setValue(matrix.a * dpr, matrix.b * dpr, matrix.c * dpr, matrix.d * dpr, matrix.e * dpr, matrix.f * dpr), setTransform && this.setTransformForCurrent();
6348
+ }
6349
+ resetTransform(setTransform = !0, dpr = this.dpr) {
6350
+ this.setTransform(dpr, 0, 0, dpr, 0, 0), setTransform && this.setTransformForCurrent();
6351
+ }
6352
+ transform(a, b, c, d, e, f, setTransform = !0) {
6353
+ this.matrix.multiply(a, b, c, d, e, f), setTransform && this.setTransformForCurrent();
6354
+ }
6355
+ transformFromMatrix(matrix, setTransform) {
6356
+ this.matrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f), setTransform && this.setTransformForCurrent();
6357
+ }
6358
+ translate(x, y, setTransform = !0) {
6359
+ this.matrix.translate(x, y), setTransform && this.setTransformForCurrent();
6360
+ }
6361
+ rotateDegrees(deg, setTransform = !0) {
6362
+ const rad = deg * Math.PI / 180;
6363
+ this.rotate(rad, setTransform);
6364
+ }
6365
+ rotateAbout(rad, x, y, setTransform = !0) {
6366
+ this.translate(x, y, !1), this.rotate(rad, !1), this.translate(-x, -y, !1), setTransform && this.setTransformForCurrent();
6367
+ }
6368
+ rotateDegreesAbout(deg, x, y, setTransform = !0) {
6369
+ this.translate(x, y, !1), this.rotateDegrees(deg, !1), this.translate(-x, -y, !1), setTransform && this.setTransformForCurrent();
6370
+ }
6371
+ beginPath() {
6372
+ this.path.clear();
6373
+ }
6374
+ clip(path, fillRule) {}
6375
+ arc(x, y, radius, startAngle, endAngle, anticlockwise) {
6376
+ this.path.arc(x, y, radius, startAngle, endAngle, anticlockwise);
6377
+ }
6378
+ arcTo(x1, y1, x2, y2, radiusX) {
6379
+ this.path.arcTo(x1, y1, x2, y2, radiusX);
6380
+ }
6381
+ bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
6382
+ this.path.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
6383
+ }
6384
+ closePath() {
6385
+ this.path.closePath();
6386
+ }
6387
+ ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {}
6388
+ lineTo(x, y) {
6389
+ this.path.lineTo(x, y);
6390
+ }
6391
+ moveTo(x, y) {
6392
+ this.path.moveTo(x, y);
6393
+ }
6394
+ quadraticCurveTo(cpx, cpy, x, y) {
6395
+ this.path.quadraticCurveTo(cpx, cpy, x, y);
6396
+ }
6397
+ rect(x, y, w, h) {
6398
+ this.path.rect(x, y, w, h);
6399
+ }
6400
+ createImageData(imageDataOrSw, sh) {
6401
+ return null;
6402
+ }
6403
+ createLinearGradient(x0, y0, x1, y1) {
6404
+ throw new Error("不支持createLinearGradient");
6405
+ }
6406
+ createPattern(image, repetition) {
6407
+ throw new Error("不支持createPattern");
6408
+ }
6409
+ createRadialGradient(x0, y0, r0, x1, y1, r1) {
6410
+ throw new Error("不支持createRadialGradient");
6411
+ }
6412
+ createConicGradient(x, y, startAngle, endAngle) {
6413
+ return null;
6414
+ }
6415
+ fill(path, fillRule) {}
6416
+ fillRect(x, y, width, height) {
6417
+ this.path.rect(x, y, width, height);
6418
+ }
6419
+ clearRect(x, y, w, h) {}
6420
+ fillText(text, x, y) {}
6421
+ getImageData(sx, sy, sw, sh) {
6422
+ return null;
6423
+ }
6424
+ getLineDash() {
6425
+ return [];
6426
+ }
6427
+ isPointInPath(x, y) {
6428
+ return this.matrix.transformPoint({
6429
+ x: x,
6430
+ y: y
6431
+ }, globalPoint), contain(this.path.commandList, globalPoint.x, globalPoint.y);
6432
+ }
6433
+ isPointInStroke(x, y) {
6434
+ if (!this.lineWidth) return !1;
6435
+ this.matrix.transformPoint({
6436
+ x: x,
6437
+ y: y
6438
+ }, globalPoint);
6439
+ const lineWidth = getScaledStroke(this, this.lineWidth, this.dpr);
6440
+ return containStroke(this.path.commandList, lineWidth, globalPoint.x, globalPoint.y);
6441
+ }
6442
+ measureText(text) {
6443
+ throw new Error("不支持measureText");
6444
+ }
6445
+ putImageData(imagedata, dx, dy) {
6446
+ throw new Error("不支持measureText");
6447
+ }
6448
+ setLineDash(segments) {}
6449
+ stroke(path) {}
6450
+ strokeRect(x, y, width, height) {
6451
+ this.path.rect(x, y, width, height);
6452
+ }
6453
+ strokeText(text, x, y) {}
6454
+ drawImage() {}
6455
+ setCommonStyle(params, attribute, offsetX, offsetY, defaultParams) {}
6456
+ _setCommonStyle(params, offsetX, offsetY, defaultParams) {}
6457
+ setStrokeStyle(params, attribute, offsetX, offsetY, defaultParams) {}
6458
+ _setStrokeStyle(params, offsetX, offsetY, defaultParams) {}
6459
+ setTextStyleWithoutAlignBaseline(params, defaultParams) {}
6460
+ setTextStyle(params, defaultParams) {}
6461
+ draw() {}
6462
+ clearMatrix(setTransform = !0, dpr = this.dpr) {
6463
+ this.setTransformFromMatrix(initMatrix, setTransform, dpr);
6464
+ }
6465
+ setClearMatrix(a, b, c, d, e, f) {
6466
+ this._clearMatrix.setValue(a, b, c, d, e, f);
6467
+ }
6468
+ onlyTranslate(dpr = this.dpr) {
6469
+ return this.matrix.a === dpr && 0 === this.matrix.b && 0 === this.matrix.c && this.matrix.d === dpr;
6470
+ }
6471
+ release(...params) {
6472
+ this.stack.forEach(m => matrixAllocate.free(m)), this.stack.length = 0;
6473
+ }
6474
+ };
6475
+ EmptyContext2d = __decorate$j([injectable(), __metadata$f("design:paramtypes", [Object, Number])], EmptyContext2d);
6993
6476
 
6994
6477
  const _tempBounds = new AABBBounds(),
6995
6478
  tempMatrix = new Matrix();
@@ -7052,11 +6535,17 @@
7052
6535
  get globalTransMatrix() {
7053
6536
  return this.tryUpdateGlobalTransMatrix(!0);
7054
6537
  }
7055
- constructor() {
7056
- let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6538
+ constructor(params = {}) {
7057
6539
  var _a;
7058
6540
  super(), this._AABBBounds = new AABBBounds(), this._updateTag = UpdateTag.INIT, this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background ? this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
7059
6541
  }
6542
+ getGraphicService() {
6543
+ var _a, _b;
6544
+ return null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.graphicService) && void 0 !== _b ? _b : application.graphicService;
6545
+ }
6546
+ getAttributes() {
6547
+ return this.attribute;
6548
+ }
7060
6549
  setMode(mode) {
7061
6550
  "3d" === mode ? this.set3dMode() : this.set2dMode();
7062
6551
  }
@@ -7066,8 +6555,7 @@
7066
6555
  set2dMode() {
7067
6556
  this.in3dMode = !1;
7068
6557
  }
7069
- getOffsetXY(attr) {
7070
- let includeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
6558
+ getOffsetXY(attr, includeScroll = !1) {
7071
6559
  var _a, _b;
7072
6560
  const {
7073
6561
  dx = attr.dx,
@@ -7086,9 +6574,9 @@
7086
6574
  const full = "imprecise" === this.attribute.boundsMode;
7087
6575
  if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
7088
6576
  if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
7089
- application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
6577
+ this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
7090
6578
  const bounds = this.doUpdateAABBBounds(full);
7091
- return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
6579
+ return this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
7092
6580
  }
7093
6581
  tryUpdateOBBBounds() {
7094
6582
  if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
@@ -7178,7 +6666,7 @@
7178
6666
  const b = this.AABBBounds;
7179
6667
  return this._globalAABBBounds ? this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2) : this._globalAABBBounds = b.clone(), this._globalAABBBounds.empty() || this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
7180
6668
  }
7181
- tryUpdateGlobalTransMatrix() {
6669
+ tryUpdateGlobalTransMatrix(clearTag = !0) {
7182
6670
  if (this._globalTransMatrix) {
7183
6671
  if (this.parent) {
7184
6672
  const m = this.parent.globalTransMatrix;
@@ -7190,12 +6678,11 @@
7190
6678
  shouldUpdateGlobalMatrix() {
7191
6679
  return !0;
7192
6680
  }
7193
- tryUpdateLocalTransMatrix() {
7194
- let clearTag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
6681
+ tryUpdateLocalTransMatrix(clearTag = !0) {
7195
6682
  return this._transMatrix || (this._transMatrix = new Matrix()), this.shouldUpdateLocalMatrix() && (this.doUpdateLocalMatrix(), clearTag && this.clearUpdateLocalPositionTag()), this._transMatrix;
7196
6683
  }
7197
6684
  shouldUpdateAABBBounds() {
7198
- return this.shadowRoot ? (!!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds()) && application.graphicService.validCheck(this.attribute, this.getGraphicTheme(), this._AABBBounds, this) : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) && application.graphicService.validCheck(this.attribute, this.getGraphicTheme(), this._AABBBounds, this);
6685
+ return this.shadowRoot ? (!!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds()) && this.getGraphicService().validCheck(this.attribute, this.getGraphicTheme(), this._AABBBounds, this) : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) && this.getGraphicService().validCheck(this.attribute, this.getGraphicTheme(), this._AABBBounds, this);
7199
6686
  }
7200
6687
  shouldSelfChangeUpdateAABBBounds() {
7201
6688
  return this.shadowRoot ? !!(this._updateTag & UpdateTag.UPDATE_BOUNDS) || this.shadowRoot.shouldUpdateAABBBounds() : !!(this._updateTag & UpdateTag.UPDATE_BOUNDS);
@@ -7231,14 +6718,17 @@
7231
6718
  setWidthHeightWithoutTransform(aabbBounds) {
7232
6719
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
7233
6720
  }
7234
- setAttributes(params) {
7235
- let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
7236
- let context = arguments.length > 2 ? arguments[2] : undefined;
6721
+ setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context) {
6722
+ this.setAttributes(params, forceUpdateTag, context), this.animates && this.animates.forEach(animate => {
6723
+ Object.keys(params).forEach(key => {
6724
+ animate.preventAttr(key);
6725
+ });
6726
+ });
6727
+ }
6728
+ setAttributes(params, forceUpdateTag = !1, context) {
7237
6729
  (params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background ? this.loadImage(params.background, !0) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context);
7238
6730
  }
7239
- _setAttributes(params) {
7240
- let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
7241
- let context = arguments.length > 2 ? arguments[2] : undefined;
6731
+ _setAttributes(params, forceUpdateTag = !1, context) {
7242
6732
  const keys = Object.keys(params);
7243
6733
  for (let i = 0; i < keys.length; i++) {
7244
6734
  const key = keys[i];
@@ -7253,16 +6743,14 @@
7253
6743
  }, this.attribute, key, context);
7254
6744
  params ? this._setAttributes(params, forceUpdateTag, context) : isNil$1(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value, this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value, "background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
7255
6745
  }
7256
- needUpdateTags(keys) {
7257
- let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GRAPHIC_UPDATE_TAG_KEY;
6746
+ needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
7258
6747
  for (let i = 0; i < k.length; i++) {
7259
6748
  const attrKey = k[i];
7260
6749
  if (-1 !== keys.indexOf(attrKey)) return !0;
7261
6750
  }
7262
6751
  return !1;
7263
6752
  }
7264
- needUpdateTag(key) {
7265
- let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : GRAPHIC_UPDATE_TAG_KEY;
6753
+ needUpdateTag(key, k = GRAPHIC_UPDATE_TAG_KEY) {
7266
6754
  for (let i = 0; i < k.length; i++) {
7267
6755
  if (key === k[i]) return !0;
7268
6756
  }
@@ -7366,25 +6854,8 @@
7366
6854
  skewTo(b, c) {
7367
6855
  return this;
7368
6856
  }
7369
- animate(params) {
7370
- var _a;
7371
- this.animates || (this.animates = new Map());
7372
- const animate = new Animate(null == params ? void 0 : params.id, null !== (_a = null == params ? void 0 : params.timeline) && void 0 !== _a ? _a : this.stage && this.stage.getTimeline(), null == params ? void 0 : params.slience);
7373
- if (animate.bind(this), params) {
7374
- const {
7375
- onStart: onStart,
7376
- onFrame: onFrame,
7377
- onEnd: onEnd,
7378
- onRemove: onRemove
7379
- } = params;
7380
- null != onStart && animate.onStart(onStart), null != onFrame && animate.onFrame(onFrame), null != onEnd && animate.onEnd(onEnd), null != onRemove && animate.onRemove(onRemove), animate.interpolateFunc = params.interpolate;
7381
- }
7382
- return this.animates.set(animate.id, animate), animate.onRemove(() => {
7383
- animate.stop(), this.animates.delete(animate.id);
7384
- }), animate;
7385
- }
7386
6857
  onAttributeUpdate(context) {
7387
- context && context.skipUpdateCallback || (application.graphicService.onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
6858
+ context && context.skipUpdateCallback || (this.getGraphicService().onAttributeUpdate(this), this._emitCustomEvent("afterAttributeUpdate", context));
7388
6859
  }
7389
6860
  update(d) {
7390
6861
  d ? (d.bounds && this.tryUpdateAABBBounds(), d.trans && this.tryUpdateLocalTransMatrix()) : (this.tryUpdateAABBBounds(), this.tryUpdateLocalTransMatrix());
@@ -7397,7 +6868,7 @@
7397
6868
  return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
7398
6869
  }
7399
6870
  applyStateAttrs(attrs, stateNames, hasAnimation, isClear) {
7400
- var _a, _b, _c, _d;
6871
+ var _a, _b;
7401
6872
  if (hasAnimation) {
7402
6873
  const keys = Object.keys(attrs),
7403
6874
  noWorkAttrs = this.getNoWorkAnimateAttr(),
@@ -7406,13 +6877,22 @@
7406
6877
  keys.forEach(key => {
7407
6878
  noWorkAttrs[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = isClear && void 0 === attrs[key] ? this.getDefaultAttribute(key) : attrs[key];
7408
6879
  });
7409
- const animate = this.animate({
7410
- slience: !0
7411
- });
7412
- animate.stateNames = stateNames, animate.to(animateAttrs, null !== (_b = null === (_a = this.stateAnimateConfig) || void 0 === _a ? void 0 : _a.duration) && void 0 !== _b ? _b : DefaultStateAnimateConfig.duration, null !== (_d = null === (_c = this.stateAnimateConfig) || void 0 === _c ? void 0 : _c.easing) && void 0 !== _d ? _d : DefaultStateAnimateConfig.easing), noAnimateAttrs && this.setAttributes(noAnimateAttrs, !1, {
6880
+ const stateAnimateConfig = null !== (_b = null !== (_a = this.context && this.context.stateAnimateConfig) && void 0 !== _a ? _a : this.stateAnimateConfig) && void 0 !== _b ? _b : DefaultStateAnimateConfig;
6881
+ this.applyAnimationState(["state"], [{
6882
+ name: "state",
6883
+ animation: {
6884
+ type: "state",
6885
+ to: animateAttrs,
6886
+ duration: stateAnimateConfig.duration,
6887
+ easing: stateAnimateConfig.easing
6888
+ }
6889
+ }]), noAnimateAttrs && this.setAttributesAndPreventAnimate(noAnimateAttrs, !1, {
7413
6890
  type: AttributeUpdateType.STATE
7414
6891
  });
7415
- } else this.stopStateAnimates(), this.setAttributes(attrs, !1, {
6892
+ } else this.stopStateAnimates(), this.setAttributesAndPreventAnimate(attrs, !1, {
6893
+ type: AttributeUpdateType.STATE
6894
+ });
6895
+ this._emitCustomEvent("afterStateUpdate", {
7416
6896
  type: AttributeUpdateType.STATE
7417
6897
  });
7418
6898
  }
@@ -7426,20 +6906,15 @@
7426
6906
  newNormalAttrs[key] = this.getNormalAttribute(key);
7427
6907
  }), this.normalAttrs = newNormalAttrs;
7428
6908
  }
7429
- stopStateAnimates() {
7430
- let type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "end";
6909
+ stopStateAnimates(type = "end") {
7431
6910
  this.animates && this.animates.forEach(animate => {
7432
6911
  animate.stateNames && (animate.stop(type), this.animates.delete(animate.id));
7433
6912
  });
7434
6913
  }
7435
6914
  getNormalAttribute(key) {
7436
- let value = this.attribute[key];
7437
- return this.animates && this.animates.forEach(animate => {
7438
- if (animate.stateNames) {
7439
- const endProps = animate.getEndProps();
7440
- has$1(endProps, key) && (value = endProps[key]);
7441
- }
7442
- }), value;
6915
+ var _a, _b;
6916
+ const value = this.attribute[key];
6917
+ return this.animates ? null === (_a = this.finalAttribute) || void 0 === _a ? void 0 : _a[key] : null != value ? value : null === (_b = this.finalAttribute) || void 0 === _b ? void 0 : _b[key];
7443
6918
  }
7444
6919
  clearStates(hasAnimation) {
7445
6920
  this.hasState() && this.normalAttrs ? (this.currentStates = [], this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, !0)) : this.currentStates = [], this.normalAttrs = null;
@@ -7573,10 +7048,10 @@
7573
7048
  if (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this.animates && this.animates.size) {
7574
7049
  const timeline = stage.getTimeline();
7575
7050
  this.animates.forEach(a => {
7576
- a.timeline === defaultTimeline && a.setTimeline(timeline);
7051
+ a.timeline.isGlobal && (a.setTimeline(timeline), timeline.addAnimate(a));
7577
7052
  });
7578
7053
  }
7579
- this._onSetStage && this._onSetStage(this, stage, layer), application.graphicService.onSetStage(this, stage);
7054
+ this._onSetStage && this._onSetStage(this, stage, layer), this.getGraphicService().onSetStage(this, stage);
7580
7055
  }
7581
7056
  }
7582
7057
  setStageToShadowRoot(stage, layer) {
@@ -7588,80 +7063,6 @@
7588
7063
  type: AttributeUpdateType.ANIMATE_END
7589
7064
  });
7590
7065
  }
7591
- onStep(subAnimate, animate, step, ratio, end) {
7592
- const nextAttributes = {};
7593
- if (step.customAnimate) step.customAnimate.update(end, ratio, nextAttributes);else {
7594
- const nextProps = step.props,
7595
- nextParsedProps = step.parsedProps,
7596
- propKeys = step.propKeys;
7597
- this.stepInterpolate(subAnimate, animate, nextAttributes, step, ratio, end, nextProps, void 0, nextParsedProps, propKeys);
7598
- }
7599
- this.setAttributes(nextAttributes, !1, {
7600
- type: AttributeUpdateType.ANIMATE_UPDATE,
7601
- animationState: {
7602
- ratio: ratio,
7603
- end: end,
7604
- step: step,
7605
- isFirstFrameOfStep: subAnimate.getLastStep() !== step
7606
- }
7607
- }), this.stage && this.stage.renderNextFrame();
7608
- }
7609
- stepInterpolate(subAnimate, animate, nextAttributes, step, ratio, end, nextProps, lastProps, nextParsedProps, propKeys) {
7610
- propKeys || (propKeys = Object.keys(nextProps), step.propKeys = propKeys), end ? step.propKeys.forEach(key => {
7611
- animate.validAttr(key) && (nextAttributes[key] = nextProps[key]);
7612
- }) : propKeys.forEach(key => {
7613
- var _a;
7614
- if (!animate.validAttr(key)) return;
7615
- const nextStepVal = nextProps[key],
7616
- lastStepVal = null !== (_a = lastProps && lastProps[key]) && void 0 !== _a ? _a : subAnimate.getLastPropByName(key, step);
7617
- if (null == nextStepVal || null == lastStepVal || nextStepVal === lastStepVal) return void (nextAttributes[key] = nextStepVal);
7618
- let match;
7619
- match = animate.interpolateFunc && animate.interpolateFunc(key, ratio, lastStepVal, nextStepVal, nextAttributes), match || (match = animate.customInterpolate(key, ratio, lastStepVal, nextStepVal, this, nextAttributes), match || this.defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio) || this._interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes));
7620
- }), step.parsedProps = nextParsedProps;
7621
- }
7622
- defaultInterpolate(nextStepVal, lastStepVal, key, nextAttributes, nextParsedProps, ratio) {
7623
- if (Number.isFinite(nextStepVal) && Number.isFinite(lastStepVal)) return nextAttributes[key] = lastStepVal + (nextStepVal - lastStepVal) * ratio, !0;
7624
- if ("fill" === key) {
7625
- nextParsedProps || (nextParsedProps = {});
7626
- const fillColorArray = nextParsedProps.fillColorArray,
7627
- color = interpolateColor(lastStepVal, null != fillColorArray ? fillColorArray : nextStepVal, ratio, !1, (fArray, tArray) => {
7628
- nextParsedProps.fillColorArray = tArray;
7629
- });
7630
- return color && (nextAttributes[key] = color), !0;
7631
- }
7632
- if ("stroke" === key) {
7633
- nextParsedProps || (nextParsedProps = {});
7634
- const strokeColorArray = nextParsedProps.strokeColorArray,
7635
- color = interpolateColor(lastStepVal, null != strokeColorArray ? strokeColorArray : nextStepVal, ratio, !1, (fArray, tArray) => {
7636
- nextParsedProps.strokeColorArray = tArray;
7637
- });
7638
- return color && (nextAttributes[key] = color), !0;
7639
- }
7640
- if ("shadowColor" === key) {
7641
- nextParsedProps || (nextParsedProps = {});
7642
- const shadowColorArray = nextParsedProps.shadowColorArray,
7643
- color = interpolateColor(lastStepVal, null != shadowColorArray ? shadowColorArray : nextStepVal, ratio, !0, (fArray, tArray) => {
7644
- nextParsedProps.shadowColorArray = tArray;
7645
- });
7646
- return color && (nextAttributes[key] = color), !0;
7647
- }
7648
- if (Array.isArray(nextStepVal) && nextStepVal.length === lastStepVal.length) {
7649
- const nextList = [];
7650
- let valid = !0;
7651
- for (let i = 0; i < nextStepVal.length; i++) {
7652
- const v = lastStepVal[i],
7653
- val = v + (nextStepVal[i] - v) * ratio;
7654
- if (!Number.isFinite(val)) {
7655
- valid = !1;
7656
- break;
7657
- }
7658
- nextList.push(val);
7659
- }
7660
- valid && (nextAttributes[key] = nextList);
7661
- }
7662
- return !1;
7663
- }
7664
- _interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {}
7665
7066
  getDefaultAttribute(name) {
7666
7067
  return this.getGraphicTheme()[name];
7667
7068
  }
@@ -7669,8 +7070,7 @@
7669
7070
  var _a;
7670
7071
  return null !== (_a = this.attribute[name]) && void 0 !== _a ? _a : this.getDefaultAttribute(name);
7671
7072
  }
7672
- onSetStage(cb) {
7673
- let immediate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
7073
+ onSetStage(cb, immediate = !1) {
7674
7074
  this._onSetStage = cb, immediate && this.stage && cb(this, this.stage);
7675
7075
  }
7676
7076
  attachShadow(shadowRoot) {
@@ -7691,8 +7091,7 @@
7691
7091
  createPathProxy(path) {
7692
7092
  return isString$1(path, !0) ? this.pathProxy = new CustomPath2D().fromString(path) : this.pathProxy = new CustomPath2D(), this.pathProxy;
7693
7093
  }
7694
- loadImage(image) {
7695
- let background = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
7094
+ loadImage(image, background = !1) {
7696
7095
  if (!image || background && backgroundNotImage(image)) return;
7697
7096
  const url = image;
7698
7097
  this.resources || (this.resources = new Map());
@@ -7722,8 +7121,7 @@
7722
7121
  animate.stop();
7723
7122
  });
7724
7123
  }
7725
- stopAnimates() {
7726
- let stopChildren = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
7124
+ stopAnimates(stopChildren = !1) {
7727
7125
  this._stopAnimates(this.animates), this.shadowRoot && this.shadowRoot.stopAnimates(!0), this.isContainer && stopChildren && this.forEachChildren(c => {
7728
7126
  c.stopAnimates(stopChildren);
7729
7127
  });
@@ -7738,6 +7136,15 @@
7738
7136
  changeEvent.bubbles = !1, changeEvent.manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager, this.dispatchEvent(changeEvent);
7739
7137
  }
7740
7138
  }
7139
+ toCustomPath() {
7140
+ var _a, _b, _c;
7141
+ const renderer = null === (_c = null === (_b = (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.renderService) || application.renderService) || void 0 === _b ? void 0 : _b.drawContribution) || void 0 === _c ? void 0 : _c.getRenderContribution(this);
7142
+ if (renderer) {
7143
+ const context = new EmptyContext2d(null, 1);
7144
+ return renderer.drawShape(this, context, 0, 0, {}, {}), context.path;
7145
+ }
7146
+ return null;
7147
+ }
7741
7148
  }
7742
7149
  function backgroundNotImage(image) {
7743
7150
  return !(!image.fill && !image.stroke);
@@ -7790,10 +7197,10 @@
7790
7197
  }
7791
7198
  tryUpdateAABBBounds() {
7792
7199
  if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
7793
- application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
7200
+ this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
7794
7201
  const selfChange = this.shouldSelfChangeUpdateAABBBounds(),
7795
7202
  bounds = this.doUpdateAABBBounds();
7796
- return this.addUpdateLayoutTag(), application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
7203
+ return this.addUpdateLayoutTag(), this.getGraphicService().afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, selfChange), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
7797
7204
  }
7798
7205
  doUpdateLocalMatrix() {
7799
7206
  const {
@@ -7854,16 +7261,15 @@
7854
7261
  }
7855
7262
  incrementalAppendChild(node) {
7856
7263
  const data = super.appendChild(node);
7857
- return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(), application.graphicService.onAddIncremental(node, this, this.stage), data;
7264
+ return this.stage && data && (data.stage = this.stage, data.layer = this.layer), this.addUpdateBoundTag(), this.getGraphicService().onAddIncremental(node, this, this.stage), data;
7858
7265
  }
7859
7266
  incrementalClearChild() {
7860
- super.removeAllChild(), this.addUpdateBoundTag(), application.graphicService.onClearIncremental(this, this.stage);
7267
+ super.removeAllChild(), this.addUpdateBoundTag(), this.getGraphicService().onClearIncremental(this, this.stage);
7861
7268
  }
7862
7269
  _updateChildToStage(child) {
7863
7270
  return this.stage && child && child.setStage(this.stage, this.layer), this.addUpdateBoundTag(), child;
7864
7271
  }
7865
- appendChild(node) {
7866
- let addStage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
7272
+ appendChild(node, addStage = !0) {
7867
7273
  const data = super.appendChild(node);
7868
7274
  return addStage && this.stage && data && data.setStage(this.stage, this.layer), this.addUpdateBoundTag(), data;
7869
7275
  }
@@ -7878,16 +7284,15 @@
7878
7284
  }
7879
7285
  removeChild(child) {
7880
7286
  const data = super.removeChild(child);
7881
- return child.stage = null, application.graphicService.onRemove(child), this.addUpdateBoundTag(), data;
7287
+ return child.stage = null, this.getGraphicService().onRemove(child), this.addUpdateBoundTag(), data;
7882
7288
  }
7883
- removeAllChild() {
7884
- let deep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
7289
+ removeAllChild(deep = !1) {
7885
7290
  this.forEachChildren(child => {
7886
- application.graphicService.onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
7291
+ this.getGraphicService().onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
7887
7292
  }), super.removeAllChild(), this.addUpdateBoundTag();
7888
7293
  }
7889
7294
  setStage(stage, layer) {
7890
- this.stage !== stage && (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), application.graphicService.onSetStage(this, stage), this.forEachChildren(item => {
7295
+ this.stage !== stage && (this.stage = stage, this.layer = layer, this.setStageToShadowRoot(stage, layer), this._onSetStage && this._onSetStage(this, stage, layer), this.getGraphicService().onSetStage(this, stage), this.forEachChildren(item => {
7891
7296
  item.setStage(stage, this.layer);
7892
7297
  }));
7893
7298
  }
@@ -7901,8 +7306,7 @@
7901
7306
  g.isContainer && g.addUpdateGlobalPositionTag();
7902
7307
  });
7903
7308
  }
7904
- tryUpdateGlobalTransMatrix() {
7905
- let clearTag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
7309
+ tryUpdateGlobalTransMatrix(clearTag = !0) {
7906
7310
  if (this.shouldUpdateGlobalMatrix()) {
7907
7311
  if (this._globalTransMatrix) {
7908
7312
  if (this.parent) {
@@ -7970,8 +7374,7 @@
7970
7374
  function textDrawOffsetX(textAlign, width) {
7971
7375
  return "end" === textAlign || "right" === textAlign ? -width : "center" === textAlign ? -width / 2 : 0;
7972
7376
  }
7973
- function textLayoutOffsetY(baseline, lineHeight, fontSize) {
7974
- let buf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
7377
+ function textLayoutOffsetY(baseline, lineHeight, fontSize, buf = 0) {
7975
7378
  return "middle" === baseline ? -lineHeight / 2 : "top" === baseline ? 0 : "bottom" === baseline ? buf - lineHeight : baseline && "alphabetic" !== baseline ? 0 : (fontSize || (fontSize = lineHeight), -(lineHeight - fontSize) / 2 - .79 * fontSize);
7976
7379
  }
7977
7380
  function textAttributesToStyle(attrs) {
@@ -7985,143 +7388,6 @@
7985
7388
  }), isValid$1(attrs.maxLineWidth) && (style["max-width"] = parsePxValue(attrs.maxLineWidth)), attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"), attrs.fill && isString$1(attrs.fill) && (style.color = attrs.fill), style;
7986
7389
  }
7987
7390
 
7988
- function identityMat4(out) {
7989
- return out[0] = 1, out[1] = 0, out[2] = 0, out[3] = 0, out[4] = 0, out[5] = 1, out[6] = 0, out[7] = 0, out[8] = 0, out[9] = 0, out[10] = 1, out[11] = 0, out[12] = 0, out[13] = 0, out[14] = 0, out[15] = 1, out;
7990
- }
7991
- function rotateX(out, a, rad) {
7992
- const s = Math.sin(rad),
7993
- c = Math.cos(rad),
7994
- a10 = a[4],
7995
- a11 = a[5],
7996
- a12 = a[6],
7997
- a13 = a[7],
7998
- a20 = a[8],
7999
- a21 = a[9],
8000
- a22 = a[10],
8001
- a23 = a[11];
8002
- return a !== out && (out[0] = a[0], out[1] = a[1], out[2] = a[2], out[3] = a[3], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[4] = a10 * c + a20 * s, out[5] = a11 * c + a21 * s, out[6] = a12 * c + a22 * s, out[7] = a13 * c + a23 * s, out[8] = a20 * c - a10 * s, out[9] = a21 * c - a11 * s, out[10] = a22 * c - a12 * s, out[11] = a23 * c - a13 * s, out;
8003
- }
8004
- function rotateY(out, a, rad) {
8005
- const s = Math.sin(rad),
8006
- c = Math.cos(rad),
8007
- a00 = a[0],
8008
- a01 = a[1],
8009
- a02 = a[2],
8010
- a03 = a[3],
8011
- a20 = a[8],
8012
- a21 = a[9],
8013
- a22 = a[10],
8014
- a23 = a[11];
8015
- return a !== out && (out[4] = a[4], out[5] = a[5], out[6] = a[6], out[7] = a[7], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[0] = a00 * c - a20 * s, out[1] = a01 * c - a21 * s, out[2] = a02 * c - a22 * s, out[3] = a03 * c - a23 * s, out[8] = a00 * s + a20 * c, out[9] = a01 * s + a21 * c, out[10] = a02 * s + a22 * c, out[11] = a03 * s + a23 * c, out;
8016
- }
8017
- function rotateZ(out, a, rad) {
8018
- const s = Math.sin(rad),
8019
- c = Math.cos(rad),
8020
- a00 = a[0],
8021
- a01 = a[1],
8022
- a02 = a[2],
8023
- a03 = a[3],
8024
- a10 = a[4],
8025
- a11 = a[5],
8026
- a12 = a[6],
8027
- a13 = a[7];
8028
- return a !== out && (out[8] = a[8], out[9] = a[9], out[10] = a[10], out[11] = a[11], out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15]), out[0] = a00 * c + a10 * s, out[1] = a01 * c + a11 * s, out[2] = a02 * c + a12 * s, out[3] = a03 * c + a13 * s, out[4] = a10 * c - a00 * s, out[5] = a11 * c - a01 * s, out[6] = a12 * c - a02 * s, out[7] = a13 * c - a03 * s, out;
8029
- }
8030
- function translate(out, a, v) {
8031
- const x = v[0],
8032
- y = v[1],
8033
- z = v[2];
8034
- let a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23;
8035
- return a === out ? (out[12] = a[0] * x + a[4] * y + a[8] * z + a[12], out[13] = a[1] * x + a[5] * y + a[9] * z + a[13], out[14] = a[2] * x + a[6] * y + a[10] * z + a[14], out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]) : (a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], out[0] = a00, out[1] = a01, out[2] = a02, out[3] = a03, out[4] = a10, out[5] = a11, out[6] = a12, out[7] = a13, out[8] = a20, out[9] = a21, out[10] = a22, out[11] = a23, out[12] = a00 * x + a10 * y + a20 * z + a[12], out[13] = a01 * x + a11 * y + a21 * z + a[13], out[14] = a02 * x + a12 * y + a22 * z + a[14], out[15] = a03 * x + a13 * y + a23 * z + a[15]), out;
8036
- }
8037
- function scaleMat4(out, a, v) {
8038
- const x = v[0],
8039
- y = v[1],
8040
- z = v[2];
8041
- return out[0] = a[0] * x, out[1] = a[1] * x, out[2] = a[2] * x, out[3] = a[3] * x, out[4] = a[4] * y, out[5] = a[5] * y, out[6] = a[6] * y, out[7] = a[7] * y, out[8] = a[8] * z, out[9] = a[9] * z, out[10] = a[10] * z, out[11] = a[11] * z, out[12] = a[12], out[13] = a[13], out[14] = a[14], out[15] = a[15], out;
8042
- }
8043
- function multiplyMat4Mat4(out, a, b) {
8044
- const a00 = a[0],
8045
- a01 = a[1],
8046
- a02 = a[2],
8047
- a03 = a[3],
8048
- a10 = a[4],
8049
- a11 = a[5],
8050
- a12 = a[6],
8051
- a13 = a[7],
8052
- a20 = a[8],
8053
- a21 = a[9],
8054
- a22 = a[10],
8055
- a23 = a[11],
8056
- a30 = a[12],
8057
- a31 = a[13],
8058
- a32 = a[14],
8059
- a33 = a[15];
8060
- let b0 = b[0],
8061
- b1 = b[1],
8062
- b2 = b[2],
8063
- b3 = b[3];
8064
- return out[0] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[1] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[2] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[3] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[4], b1 = b[5], b2 = b[6], b3 = b[7], out[4] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[5] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[6] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[7] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[8], b1 = b[9], b2 = b[10], b3 = b[11], out[8] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[9] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[10] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[11] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, b0 = b[12], b1 = b[13], b2 = b[14], b3 = b[15], out[12] = b0 * a00 + b1 * a10 + b2 * a20 + b3 * a30, out[13] = b0 * a01 + b1 * a11 + b2 * a21 + b3 * a31, out[14] = b0 * a02 + b1 * a12 + b2 * a22 + b3 * a32, out[15] = b0 * a03 + b1 * a13 + b2 * a23 + b3 * a33, out;
8065
- }
8066
-
8067
- function createMat4() {
8068
- return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
8069
- }
8070
- class DefaultMatrixAllocate {
8071
- constructor() {
8072
- this.pools = [];
8073
- }
8074
- allocate(a, b, c, d, e, f) {
8075
- if (!this.pools.length) return new Matrix(a, b, c, d, e, f);
8076
- const m = this.pools.pop();
8077
- return m.a = a, m.b = b, m.c = c, m.d = d, m.e = e, m.f = f, m;
8078
- }
8079
- allocateByObj(matrix) {
8080
- if (!this.pools.length) return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
8081
- const m = this.pools.pop();
8082
- return m.a = matrix.a, m.b = matrix.b, m.c = matrix.c, m.d = matrix.d, m.e = matrix.e, m.f = matrix.f, m;
8083
- }
8084
- free(d) {
8085
- this.pools.push(d);
8086
- }
8087
- get length() {
8088
- return this.pools.length;
8089
- }
8090
- release() {
8091
- this.pools = [];
8092
- }
8093
- }
8094
- class DefaultMat4Allocate {
8095
- constructor() {
8096
- this.pools = [];
8097
- }
8098
- static identity(out) {
8099
- return identityMat4(out);
8100
- }
8101
- allocate() {
8102
- if (!this.pools.length) return createMat4();
8103
- const m = this.pools.pop();
8104
- return DefaultMat4Allocate.identity(m), m;
8105
- }
8106
- allocateByObj(d) {
8107
- let m;
8108
- m = this.pools.length ? this.pools.pop() : createMat4();
8109
- for (let i = 0; i < m.length; i++) m[i] = d[i];
8110
- return m;
8111
- }
8112
- free(m) {
8113
- m && this.pools.push(m);
8114
- }
8115
- get length() {
8116
- return this.pools.length;
8117
- }
8118
- release() {
8119
- this.pools = [];
8120
- }
8121
- }
8122
- const matrixAllocate = new DefaultMatrixAllocate();
8123
- const mat4Allocate = new DefaultMat4Allocate();
8124
-
8125
7391
  var __decorate$i = undefined && undefined.__decorate || function (decorators, target, key, desc) {
8126
7392
  var d,
8127
7393
  c = arguments.length,
@@ -8301,7 +7567,7 @@
8301
7567
  const {
8302
7568
  visible = theme.visible
8303
7569
  } = attribute;
8304
- return !(!graphic.valid || !visible) || (aabbBounds.empty() || (graphic.parent && aabbBounds.transformWithMatrix(graphic.parent.globalTransMatrix), application.graphicService.clearAABBBounds(graphic, graphic.stage, aabbBounds), aabbBounds.clear()), !1);
7570
+ return !(!graphic.valid || !visible) || (aabbBounds.empty() || (graphic.parent && aabbBounds.transformWithMatrix(graphic.parent.globalTransMatrix), this.clearAABBBounds(graphic, graphic.stage, aabbBounds), aabbBounds.clear()), !1);
8305
7571
  }
8306
7572
  updateTempAABBBounds(aabbBounds) {
8307
7573
  const tb1 = this.tempAABBBounds1,
@@ -8345,10 +7611,7 @@
8345
7611
  } else bbox.yOffset = -bbox.height;
8346
7612
  return bbox;
8347
7613
  }
8348
- GetLayoutByLines(lines, textAlign, textBaseline, lineHeight) {
8349
- let suffix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : "";
8350
- let wordBreak = arguments.length > 5 ? arguments[5] : undefined;
8351
- let params = arguments.length > 6 ? arguments[6] : undefined;
7614
+ GetLayoutByLines(lines, textAlign, textBaseline, lineHeight, suffix = "", wordBreak, params) {
8352
7615
  const {
8353
7616
  lineWidth: lineWidth,
8354
7617
  suffixPosition = "end",
@@ -8471,11 +7734,10 @@
8471
7734
  get isMultiLine() {
8472
7735
  return Array.isArray(this.attribute.text) || "normal" === this.attribute.whiteSpace;
8473
7736
  }
8474
- constructor() {
8475
- let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
8476
- text: "",
8477
- fontSize: 16
8478
- };
7737
+ constructor(params = {
7738
+ text: "",
7739
+ fontSize: 16
7740
+ }) {
8479
7741
  super(params), this.type = "text", this.numberType = TEXT_NUMBER_TYPE, this.cache = {};
8480
7742
  }
8481
7743
  isValid() {
@@ -8807,12 +8069,10 @@
8807
8069
  var _a;
8808
8070
  return null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
8809
8071
  }
8810
- needUpdateTags(keys) {
8811
- let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
8072
+ needUpdateTags(keys, k = TEXT_UPDATE_TAG_KEY) {
8812
8073
  return super.needUpdateTags(keys, k);
8813
8074
  }
8814
- needUpdateTag(key) {
8815
- let k = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : TEXT_UPDATE_TAG_KEY;
8075
+ needUpdateTag(key, k = TEXT_UPDATE_TAG_KEY) {
8816
8076
  return super.needUpdateTag(key, k);
8817
8077
  }
8818
8078
  _interpolate(key, ratio, lastStepVal, nextStepVal, nextAttributes) {
@@ -9015,19 +8275,15 @@
9015
8275
 
9016
8276
  const SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size", ...GRAPHIC_UPDATE_TAG_KEY];
9017
8277
  let Symbol$2 = class Symbol extends Graphic {
9018
- constructor() {
9019
- let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
9020
- symbolType: "circle"
9021
- };
8278
+ constructor(params = {
8279
+ symbolType: "circle"
8280
+ }) {
9022
8281
  super(params), this.type = "symbol", this.numberType = SYMBOL_NUMBER_TYPE;
9023
8282
  }
9024
8283
  getParsedPath() {
9025
8284
  return this.shouldUpdateShape() && (this._parsedPath = this.doUpdateParsedPath(), this.clearUpdateShapeTag()), this._parsedPath;
9026
8285
  }
9027
- getParsedPath2D() {
9028
- let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
9029
- let y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
9030
- let size = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
8286
+ getParsedPath2D(x = 0, y = 0, size = 1) {
9031
8287
  let path = null;
9032
8288
  try {
9033
8289
  path = new Path2D();
@@ -9110,6 +8366,25 @@
9110
8366
  return new Symbol$2(attributes);
9111
8367
  }
9112
8368
 
8369
+ const normalizeRectAttributes = attribute => {
8370
+ if (!attribute) return {
8371
+ x: 0,
8372
+ y: 0,
8373
+ width: 0,
8374
+ height: 0
8375
+ };
8376
+ let width = isNil$1(attribute.width) ? attribute.x1 - attribute.x : attribute.width,
8377
+ height = isNil$1(attribute.height) ? attribute.y1 - attribute.y : attribute.height,
8378
+ x = 0,
8379
+ y = 0;
8380
+ return width < 0 ? (x = width, width = -width) : Number.isNaN(width) && (width = 0), height < 0 ? (y = height, height = -height) : Number.isNaN(height) && (height = 0), {
8381
+ x: x,
8382
+ y: y,
8383
+ width: width,
8384
+ height: height
8385
+ };
8386
+ };
8387
+
9113
8388
  const RECT_UPDATE_TAG_KEY = ["width", "x1", "y1", "height", "cornerRadius", ...GRAPHIC_UPDATE_TAG_KEY];
9114
8389
  let Rect$1 = class Rect extends Graphic {
9115
8390
  constructor(params) {
@@ -9151,15 +8426,16 @@
9151
8426
  return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
9152
8427
  }
9153
8428
  toCustomPath() {
8429
+ let path = super.toCustomPath();
8430
+ if (path) return path;
9154
8431
  const attribute = this.attribute,
9155
8432
  {
9156
8433
  x: x,
9157
8434
  y: y,
9158
8435
  width: width,
9159
8436
  height: height
9160
- } = normalizeRectAttributes(attribute),
9161
- path = new CustomPath2D();
9162
- return path.moveTo(x, y), path.rect(x, y, width, height), path;
8437
+ } = normalizeRectAttributes(attribute);
8438
+ return path = new CustomPath2D(), path.moveTo(x, y), path.rect(x, y, width, height), path;
9163
8439
  }
9164
8440
  clone() {
9165
8441
  return new Rect(Object.assign({}, this.attribute));
@@ -9410,7 +8686,7 @@
9410
8686
  const {
9411
8687
  lineWidth = 1
9412
8688
  } = this.character;
9413
- if (this.character.stroke && lineWidth && ctx.strokeText(text, left, baseline + this.dy), this.character.fill && ctx.fillText(text, left, baseline + this.dy), this.character.fill) if (this.character.lineThrough || this.character.underline) {
8689
+ if (this.character.stroke && lineWidth && ctx.strokeText(text, left + this.dx, baseline + this.dy), this.character.fill && ctx.fillText(text, left + this.dx, baseline + this.dy), this.character.fill) if (this.character.lineThrough || this.character.underline) {
9414
8690
  if (this.character.underline) {
9415
8691
  const top = 1 + baseline,
9416
8692
  lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
@@ -9740,8 +9016,7 @@
9740
9016
  line = new Line$1(this.frame.left, this[this.directionKey.width], this.y + maxAscent, maxAscent, maxDescent, this.lineBuffer, this.direction, "horizontal" === this.direction ? this.frame.isWidthMax : this.frame.isHeightMax);
9741
9017
  this.frame.lines.push(line), this.frame.actualHeight += line.height, this.y += line.height, this.lineBuffer.length = 0, this.lineWidth = this.maxAscent = this.maxDescent = this.maxAscentForBlank = this.maxDescentForBlank = 0;
9742
9018
  }
9743
- deal(paragraph) {
9744
- let singleLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
9019
+ deal(paragraph, singleLine = !1) {
9745
9020
  paragraph instanceof RichTextIcon ? "horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : 0 === this.lineBuffer.length ? (this.store(paragraph), this.send()) : (this.send(), this.deal(paragraph)) : "number" != typeof this.width || this.width < 0 || (paragraph.newLine && this.send(), (0 !== paragraph.text.length || this.newLine) && ("horizontal" === this.direction && 0 === this.width || "vertical" === this.direction && 0 === this.height || this.lineWidth + paragraph[this.directionKey.width] <= this[this.directionKey.width] ? this.store(paragraph) : this.lineWidth === this[this.directionKey.width] ? (this.send(), this.deal(paragraph)) : this.cut(paragraph, singleLine)));
9746
9021
  }
9747
9022
  cut(paragraph, singleLine) {
@@ -10278,6 +9553,8 @@
10278
9553
  }
10279
9554
  toCustomPath() {
10280
9555
  var _a, _b, _c, _d;
9556
+ let path = super.toCustomPath();
9557
+ if (path) return path;
10281
9558
  const attribute = this.attribute,
10282
9559
  {
10283
9560
  startAngle: startAngle,
@@ -10291,8 +9568,7 @@
10291
9568
  const temp = outerRadius;
10292
9569
  outerRadius = innerRadius, innerRadius = temp;
10293
9570
  }
10294
- const path = new CustomPath2D();
10295
- if (outerRadius <= epsilon) path.moveTo(0, 0);else if (deltaAngle >= pi2 - epsilon) path.moveTo(0 + outerRadius * cos(startAngle), 0 + outerRadius * sin(startAngle)), path.arc(0, 0, outerRadius, startAngle, endAngle, !clockwise), innerRadius > epsilon && (path.moveTo(0 + innerRadius * cos(endAngle), 0 + innerRadius * sin(endAngle)), path.arc(0, 0, innerRadius, endAngle, startAngle, clockwise));else {
9571
+ if (path = new CustomPath2D(), outerRadius <= epsilon) path.moveTo(0, 0);else if (deltaAngle >= pi2 - epsilon) path.moveTo(0 + outerRadius * cos(startAngle), 0 + outerRadius * sin(startAngle)), path.arc(0, 0, outerRadius, startAngle, endAngle, !clockwise), innerRadius > epsilon && (path.moveTo(0 + innerRadius * cos(endAngle), 0 + innerRadius * sin(endAngle)), path.arc(0, 0, innerRadius, endAngle, startAngle, clockwise));else {
10296
9572
  const xors = outerRadius * cos(startAngle),
10297
9573
  yors = outerRadius * sin(startAngle),
10298
9574
  xire = innerRadius * cos(endAngle),
@@ -10685,9 +9961,7 @@
10685
9961
  const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
10686
9962
 
10687
9963
  const halfPi = pi / 2;
10688
- function createRectPath(path, x, y, width, height, rectCornerRadius) {
10689
- let roundCorner = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
10690
- let edgeCb = arguments.length > 7 ? arguments[7] : undefined;
9964
+ function createRectPath(path, x, y, width, height, rectCornerRadius, roundCorner = !0, edgeCb) {
10691
9965
  let cornerRadius;
10692
9966
  if (Array.isArray(roundCorner) && (edgeCb = roundCorner, roundCorner = !0), width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$1(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
10693
9967
  const cornerRadiusArr = rectCornerRadius;
@@ -11008,8 +10282,7 @@
11008
10282
  doStroke: doStroke
11009
10283
  };
11010
10284
  }
11011
- transform(graphic, graphicAttribute, context) {
11012
- let use3dMatrixIn3dMode = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !1;
10285
+ transform(graphic, graphicAttribute, context, use3dMatrixIn3dMode = !1) {
11013
10286
  const {
11014
10287
  x = graphicAttribute.x,
11015
10288
  y = graphicAttribute.y,
@@ -11077,7 +10350,7 @@
11077
10350
  const p = context.project(x, y, z);
11078
10351
  context.translate(p.x, p.y, !1), context.scale(scaleX, scaleY, !1), context.rotate(angle, !1), context.translate(-p.x, -p.y, !1), context.setTransformForCurrent();
11079
10352
  }
11080
- _draw(graphic, defaultAttr, computed3dMatrix, drawContext, params) {
10353
+ _draw(graphic, defaultAttr, computed3dMatrix, drawContext, params, themeAttribute) {
11081
10354
  const {
11082
10355
  context: context
11083
10356
  } = drawContext;
@@ -11094,7 +10367,7 @@
11094
10367
  z: z,
11095
10368
  lastModelMatrix: lastModelMatrix
11096
10369
  } = data;
11097
- this.z = z, this.drawPathProxy(graphic, context, x, y, drawContext, params) || (this.drawShape(graphic, context, x, y, drawContext, params), this.z = 0, context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix), context.highPerformanceRestore();
10370
+ this.z = z, this.drawPathProxy(graphic, context, x, y, drawContext, params) || (this.drawShape(graphic, context, x, y, drawContext, params, null, null, themeAttribute), this.z = 0, context.modelMatrix !== lastModelMatrix && mat4Allocate.free(context.modelMatrix), context.modelMatrix = lastModelMatrix), context.highPerformanceRestore();
11098
10371
  }
11099
10372
  }
11100
10373
 
@@ -11117,26 +10390,25 @@
11117
10390
  constructor(graphicRenderContributions) {
11118
10391
  super(), this.graphicRenderContributions = graphicRenderContributions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(graphicRenderContributions);
11119
10392
  }
11120
- drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
11121
- var _a;
11122
- const rectAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : getTheme(rect, null == params ? void 0 : params.theme).rect,
11123
- {
11124
- fill = rectAttribute.fill,
11125
- background: background,
11126
- stroke = rectAttribute.stroke,
11127
- cornerRadius = rectAttribute.cornerRadius,
11128
- cornerType = rectAttribute.cornerType,
11129
- opacity = rectAttribute.opacity,
11130
- fillOpacity = rectAttribute.fillOpacity,
11131
- lineWidth = rectAttribute.lineWidth,
11132
- strokeOpacity = rectAttribute.strokeOpacity,
11133
- visible = rectAttribute.visible,
11134
- x1: x1,
11135
- y1: y1,
11136
- x: originX = rectAttribute.x,
11137
- y: originY = rectAttribute.y,
11138
- fillStrokeOrder = rectAttribute.fillStrokeOrder
11139
- } = rect.attribute;
10393
+ drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb, rectAttribute) {
10394
+ rectAttribute = null != rectAttribute ? rectAttribute : getTheme(rect, null == params ? void 0 : params.theme).rect;
10395
+ const {
10396
+ fill = rectAttribute.fill,
10397
+ background: background,
10398
+ stroke = rectAttribute.stroke,
10399
+ cornerRadius = rectAttribute.cornerRadius,
10400
+ cornerType = rectAttribute.cornerType,
10401
+ opacity = rectAttribute.opacity,
10402
+ fillOpacity = rectAttribute.fillOpacity,
10403
+ lineWidth = rectAttribute.lineWidth,
10404
+ strokeOpacity = rectAttribute.strokeOpacity,
10405
+ visible = rectAttribute.visible,
10406
+ x1: x1,
10407
+ y1: y1,
10408
+ x: originX = rectAttribute.x,
10409
+ y: originY = rectAttribute.y,
10410
+ fillStrokeOrder = rectAttribute.fillStrokeOrder
10411
+ } = rect.attribute;
11140
10412
  let {
11141
10413
  width: width,
11142
10414
  height: height
@@ -11154,18 +10426,17 @@
11154
10426
  doFill: doFill,
11155
10427
  doStroke: doStroke
11156
10428
  };
11157
- context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
11158
- const _runFill = () => {
11159
- doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill()));
11160
- },
11161
- _runStroke = () => {
11162
- doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke()));
11163
- };
11164
- fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
10429
+ context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke), fillStrokeOrder ? (this._runStroke(rect, context, x, y, rectAttribute, doFillOrStroke, sVisible, originX, originY, strokeCb), this._runFill(rect, context, x, y, rectAttribute, doFillOrStroke, fVisible, originX, originY, fillCb)) : (this._runFill(rect, context, x, y, rectAttribute, doFillOrStroke, fVisible, originX, originY, fillCb), this._runStroke(rect, context, x, y, rectAttribute, doFillOrStroke, sVisible, originX, originY, strokeCb)), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
10430
+ }
10431
+ _runFill(rect, context, x, y, rectAttribute, doFillOrStroke, fVisible, originX, originY, fillCb) {
10432
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill()));
10433
+ }
10434
+ _runStroke(rect, context, x, y, rectAttribute, doFillOrStroke, sVisible, originX, originY, strokeCb) {
10435
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke()));
11165
10436
  }
11166
10437
  draw(rect, renderService, drawContext, params) {
11167
10438
  const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect;
11168
- this.tempTheme = rectAttribute, this._draw(rect, rectAttribute, !1, drawContext, params), this.tempTheme = null;
10439
+ this._draw(rect, rectAttribute, !1, drawContext, params, rectAttribute);
11169
10440
  }
11170
10441
  };
11171
10442
  DefaultCanvasRectRender = __decorate$f([injectable(), __param$a(0, inject(ContributionProvider)), __param$a(0, named(RectRenderContribution)), __metadata$c("design:paramtypes", [Object])], DefaultCanvasRectRender);
@@ -11189,10 +10460,10 @@
11189
10460
  constructor(graphicRenderContributions) {
11190
10461
  super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
11191
10462
  }
11192
- drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb) {
10463
+ drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb, symbolAttribute) {
11193
10464
  var _a;
11194
- const symbolAttribute = getTheme(symbol, null == params ? void 0 : params.theme).symbol,
11195
- {
10465
+ symbolAttribute = null != symbolAttribute ? symbolAttribute : getTheme(symbol, null == params ? void 0 : params.theme).symbol;
10466
+ const {
11196
10467
  size = symbolAttribute.size,
11197
10468
  x: originX = symbolAttribute.x,
11198
10469
  y: originY = symbolAttribute.y,
@@ -11237,14 +10508,13 @@
11237
10508
  a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && clipRange >= 1 && (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
11238
10509
  };
11239
10510
  fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
11240
- }) && context.closePath(), context.camera = camera, context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
11241
- const _runFill = () => {
11242
- doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill()));
11243
- },
11244
- _runStroke = () => {
11245
- doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && clipRange >= 1 && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
11246
- };
11247
- fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
10511
+ }) && context.closePath(), context.camera = camera, context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb), fillStrokeOrder ? (this._runStroke(symbol, context, x, y, symbolAttribute, doStroke, sVisible, originX, originY, parsedPath, clipRange, scaleX, scaleY, strokeCb), this._runFill(symbol, context, x, y, symbolAttribute, doFill, fVisible, originX, originY, parsedPath, fillCb)) : (this._runFill(symbol, context, x, y, symbolAttribute, doFill, fVisible, originX, originY, parsedPath, fillCb), this._runStroke(symbol, context, x, y, symbolAttribute, doStroke, sVisible, originX, originY, parsedPath, clipRange, scaleX, scaleY, strokeCb)), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
10512
+ }
10513
+ _runFill(symbol, context, x, y, symbolAttribute, doFill, fVisible, originX, originY, parsedPath, fillCb) {
10514
+ doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill()));
10515
+ }
10516
+ _runStroke(symbol, context, x, y, symbolAttribute, doStroke, sVisible, originX, originY, parsedPath, clipRange, scaleX, scaleY, strokeCb) {
10517
+ doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && clipRange >= 1 && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
11248
10518
  }
11249
10519
  draw(symbol, renderService, drawContext, params) {
11250
10520
  const symbolAttribute = getTheme(symbol, null == params ? void 0 : params.theme).symbol;
@@ -11274,7 +10544,7 @@
11274
10544
  get length() {
11275
10545
  return this.pools.length;
11276
10546
  }
11277
- release() {
10547
+ release(...params) {
11278
10548
  this.pools = [];
11279
10549
  }
11280
10550
  }
@@ -11630,7 +10900,7 @@
11630
10900
  });
11631
10901
  };
11632
10902
  let BaseEnvContribution = class {
11633
- configure(service) {
10903
+ configure(service, ...p) {
11634
10904
  service.env === this.type && service.setActiveEnvContribution(this);
11635
10905
  }
11636
10906
  getNativeAABBBounds(dom) {
@@ -11846,7 +11116,7 @@
11846
11116
  });
11847
11117
  }
11848
11118
  deactivate(context) {
11849
- context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => item.name !== this.key), application.graphicService.hooks.onRemove.unTap(this.key), application.graphicService.hooks.onRelease.unTap(this.key), this.release();
11119
+ context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(item => item.name !== this.key), this.release();
11850
11120
  }
11851
11121
  getWrapContainer(stage, userContainer, domParams) {
11852
11122
  let nativeContainer;
@@ -12241,8 +11511,7 @@
12241
11511
  this.dom = dom;
12242
11512
  }
12243
11513
  }
12244
- function createImageElement(src) {
12245
- let isSvg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
11514
+ function createImageElement(src, isSvg = !1) {
12246
11515
  const img = document.createElement("img");
12247
11516
  if (application.global.isImageAnonymous && (img.crossOrigin = "anonymous"), isSvg) {
12248
11517
  const data = new Blob([src], {
@@ -12389,7 +11658,7 @@
12389
11658
  getDocument() {
12390
11659
  return document;
12391
11660
  }
12392
- release() {}
11661
+ release(...params) {}
12393
11662
  getElementTop(element, baseWindow) {
12394
11663
  let actualTop = element.offsetTop,
12395
11664
  current = element.offsetParent;
@@ -12923,8 +12192,7 @@
12923
12192
  [StateValue.hoverReverse]: {}
12924
12193
  });
12925
12194
 
12926
- function measureTextSize(text, textSpec) {
12927
- let defaultTextTheme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
12195
+ function measureTextSize(text, textSpec, defaultTextTheme = {}) {
12928
12196
  if (!text) return {
12929
12197
  width: 0,
12930
12198
  height: 0
@@ -12945,12 +12213,10 @@
12945
12213
  height: bounds.height()
12946
12214
  };
12947
12215
  }
12948
- function isRichText(attributes) {
12949
- let typeKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "type";
12216
+ function isRichText(attributes, typeKey = "type") {
12950
12217
  return "rich" === getTextType(attributes, typeKey);
12951
12218
  }
12952
- function getTextType(attributes) {
12953
- let typeKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "type";
12219
+ function getTextType(attributes, typeKey = "type") {
12954
12220
  var _a, _b;
12955
12221
  return isObject$1(attributes.text) && "type" in attributes.text ? null !== (_a = attributes.text.type) && void 0 !== _a ? _a : "text" : typeKey in attributes && null !== (_b = attributes[typeKey]) && void 0 !== _b ? _b : "text";
12956
12222
  }
@@ -20509,7 +19775,7 @@
20509
19775
  const Checkbox = React.forwardRef(CheckboxComponent);
20510
19776
  Checkbox.displayName = 'Checkbox';
20511
19777
 
20512
- const version = "1.18.4";
19778
+ const version = "1.19.0-alpha.0";
20513
19779
 
20514
19780
  Object.defineProperty(exports, 'register', {
20515
19781
  enumerable: true,