@visactor/vrender-components 1.0.0-alpha.5 → 1.0.0-alpha.6

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.
Files changed (138) hide show
  1. package/cjs/animation/axis-animate.js +4 -4
  2. package/cjs/animation/axis-animate.js.map +1 -1
  3. package/cjs/axis/util.js +5 -5
  4. package/cjs/axis/util.js.map +1 -1
  5. package/cjs/brush/brush.d.ts +16 -10
  6. package/cjs/brush/brush.js +81 -93
  7. package/cjs/brush/brush.js.map +1 -1
  8. package/cjs/brush/config.d.ts +5 -5
  9. package/cjs/brush/config.js +5 -5
  10. package/cjs/brush/config.js.map +1 -1
  11. package/cjs/brush/type.d.ts +1 -0
  12. package/cjs/brush/type.js +1 -1
  13. package/cjs/brush/type.js.map +1 -1
  14. package/cjs/data-zoom/data-zoom.d.ts +3 -0
  15. package/cjs/data-zoom/data-zoom.js +36 -19
  16. package/cjs/data-zoom/data-zoom.js.map +1 -1
  17. package/cjs/index.d.ts +1 -1
  18. package/cjs/index.js +1 -1
  19. package/cjs/index.js.map +1 -1
  20. package/cjs/label/base.js +17 -3
  21. package/cjs/label/base.js.map +1 -1
  22. package/cjs/marker/animate/animate.d.ts +3 -3
  23. package/cjs/marker/animate/animate.js.map +1 -1
  24. package/cjs/marker/animate/clip-in.d.ts +1 -1
  25. package/cjs/marker/animate/clip-in.js +6 -3
  26. package/cjs/marker/animate/clip-in.js.map +1 -1
  27. package/cjs/marker/animate/fade-in.d.ts +3 -3
  28. package/cjs/marker/animate/fade-in.js +10 -4
  29. package/cjs/marker/animate/fade-in.js.map +1 -1
  30. package/cjs/marker/animate/fade-out.d.ts +3 -3
  31. package/cjs/marker/animate/fade-out.js +10 -4
  32. package/cjs/marker/animate/fade-out.js.map +1 -1
  33. package/cjs/marker/arc-area.d.ts +8 -5
  34. package/cjs/marker/arc-area.js +18 -39
  35. package/cjs/marker/arc-area.js.map +1 -1
  36. package/cjs/marker/arc-line.d.ts +6 -4
  37. package/cjs/marker/arc-line.js +12 -9
  38. package/cjs/marker/arc-line.js.map +1 -1
  39. package/cjs/marker/area.d.ts +6 -4
  40. package/cjs/marker/area.js +14 -32
  41. package/cjs/marker/area.js.map +1 -1
  42. package/cjs/marker/base.d.ts +2 -3
  43. package/cjs/marker/base.js.map +1 -1
  44. package/cjs/marker/common-line.d.ts +11 -7
  45. package/cjs/marker/common-line.js +11 -31
  46. package/cjs/marker/common-line.js.map +1 -1
  47. package/cjs/marker/config.d.ts +2 -0
  48. package/cjs/marker/config.js +2 -0
  49. package/cjs/marker/config.js.map +1 -1
  50. package/cjs/marker/line.d.ts +6 -4
  51. package/cjs/marker/line.js +10 -4
  52. package/cjs/marker/line.js.map +1 -1
  53. package/cjs/marker/mixin/label.d.ts +16 -0
  54. package/cjs/marker/mixin/label.js +57 -0
  55. package/cjs/marker/mixin/label.js.map +1 -0
  56. package/cjs/marker/type.d.ts +19 -16
  57. package/cjs/marker/type.js.map +1 -1
  58. package/cjs/scrollbar/scrollbar.d.ts +1 -0
  59. package/cjs/scrollbar/scrollbar.js +21 -12
  60. package/cjs/scrollbar/scrollbar.js.map +1 -1
  61. package/cjs/slider/slider.d.ts +3 -0
  62. package/cjs/slider/slider.js +48 -27
  63. package/cjs/slider/slider.js.map +1 -1
  64. package/cjs/switch/switch.js +2 -2
  65. package/cjs/switch/switch.js.map +1 -1
  66. package/cjs/util/event.d.ts +1 -0
  67. package/cjs/util/event.js +14 -0
  68. package/cjs/util/event.js.map +1 -0
  69. package/dist/index.es.js +1580 -916
  70. package/es/animation/axis-animate.js +4 -4
  71. package/es/animation/axis-animate.js.map +1 -1
  72. package/es/axis/util.js +5 -6
  73. package/es/axis/util.js.map +1 -1
  74. package/es/brush/brush.d.ts +16 -10
  75. package/es/brush/brush.js +83 -95
  76. package/es/brush/brush.js.map +1 -1
  77. package/es/brush/config.d.ts +5 -5
  78. package/es/brush/config.js +5 -5
  79. package/es/brush/config.js.map +1 -1
  80. package/es/brush/type.d.ts +1 -0
  81. package/es/brush/type.js +1 -1
  82. package/es/brush/type.js.map +1 -1
  83. package/es/data-zoom/data-zoom.d.ts +3 -0
  84. package/es/data-zoom/data-zoom.js +35 -16
  85. package/es/data-zoom/data-zoom.js.map +1 -1
  86. package/es/index.d.ts +1 -1
  87. package/es/index.js +1 -1
  88. package/es/index.js.map +1 -1
  89. package/es/label/base.js +17 -3
  90. package/es/label/base.js.map +1 -1
  91. package/es/marker/animate/animate.d.ts +3 -3
  92. package/es/marker/animate/animate.js.map +1 -1
  93. package/es/marker/animate/clip-in.d.ts +1 -1
  94. package/es/marker/animate/clip-in.js +6 -2
  95. package/es/marker/animate/clip-in.js.map +1 -1
  96. package/es/marker/animate/fade-in.d.ts +3 -3
  97. package/es/marker/animate/fade-in.js +11 -3
  98. package/es/marker/animate/fade-in.js.map +1 -1
  99. package/es/marker/animate/fade-out.d.ts +3 -3
  100. package/es/marker/animate/fade-out.js +11 -3
  101. package/es/marker/animate/fade-out.js.map +1 -1
  102. package/es/marker/arc-area.d.ts +8 -5
  103. package/es/marker/arc-area.js +19 -41
  104. package/es/marker/arc-area.js.map +1 -1
  105. package/es/marker/arc-line.d.ts +6 -4
  106. package/es/marker/arc-line.js +12 -9
  107. package/es/marker/arc-line.js.map +1 -1
  108. package/es/marker/area.d.ts +6 -4
  109. package/es/marker/area.js +15 -34
  110. package/es/marker/area.js.map +1 -1
  111. package/es/marker/base.d.ts +2 -3
  112. package/es/marker/base.js.map +1 -1
  113. package/es/marker/common-line.d.ts +11 -7
  114. package/es/marker/common-line.js +14 -34
  115. package/es/marker/common-line.js.map +1 -1
  116. package/es/marker/config.d.ts +2 -0
  117. package/es/marker/config.js +2 -0
  118. package/es/marker/config.js.map +1 -1
  119. package/es/marker/line.d.ts +6 -4
  120. package/es/marker/line.js +10 -4
  121. package/es/marker/line.js.map +1 -1
  122. package/es/marker/mixin/label.d.ts +16 -0
  123. package/es/marker/mixin/label.js +45 -0
  124. package/es/marker/mixin/label.js.map +1 -0
  125. package/es/marker/type.d.ts +19 -16
  126. package/es/marker/type.js.map +1 -1
  127. package/es/scrollbar/scrollbar.d.ts +1 -0
  128. package/es/scrollbar/scrollbar.js +22 -11
  129. package/es/scrollbar/scrollbar.js.map +1 -1
  130. package/es/slider/slider.d.ts +3 -0
  131. package/es/slider/slider.js +49 -26
  132. package/es/slider/slider.js.map +1 -1
  133. package/es/switch/switch.js +2 -2
  134. package/es/switch/switch.js.map +1 -1
  135. package/es/util/event.d.ts +1 -0
  136. package/es/util/event.js +6 -0
  137. package/es/util/event.js.map +1 -0
  138. package/package.json +6 -6
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, isArray, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, cos, sin, isString, pointAt, isNumber, sqrt, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, acos, Color, transformBoundsWithMatrix, getContextFont, rotatePoint, clampAngleByRadian, asin, arrayEqual, Bounds, getRectIntersect, isRectIntersect, isEqual, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, cloneDeep, get, last, mixin, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
1
+ import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, pi, isArray, isPointInLine, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, cos, sin, isString, pointAt, isNumber, sqrt, Color, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, acos, transformBoundsWithMatrix, getContextFont, rotatePoint, clampAngleByRadian, asin, arrayEqual, Bounds, getRectIntersect, isRectIntersect, isEqual, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, array, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, normalizeAngle, isValidNumber, flattenArray, isRotateAABBIntersect, isLess, isGreater, aabbSeparation, obbSeparation, cloneDeep, get, last, mixin, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, pointInRect, calculateAnchorOfBounds, computeQuadrant, polygonContainPoint } from '@visactor/vutils';
2
2
  import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
3
3
 
4
4
  class Generator {
@@ -596,14 +596,14 @@ class PerformanceRAF {
596
596
  }
597
597
  }
598
598
 
599
- var __decorate$P = undefined && undefined.__decorate || function (decorators, target, key, desc) {
599
+ var __decorate$Q = undefined && undefined.__decorate || function (decorators, target, key, desc) {
600
600
  var d,
601
601
  c = arguments.length,
602
602
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
603
603
  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);
604
604
  return c > 3 && r && Object.defineProperty(target, key, r), r;
605
605
  },
606
- __metadata$F = undefined && undefined.__metadata || function (k, v) {
606
+ __metadata$G = undefined && undefined.__metadata || function (k, v) {
607
607
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
608
608
  },
609
609
  __param$A = undefined && undefined.__param || function (paramIndex, decorator) {
@@ -818,7 +818,7 @@ let DefaultGlobal = class {
818
818
  return this._env || this.setEnv("browser"), this.envContribution.copyToClipBoard(text);
819
819
  }
820
820
  };
821
- DefaultGlobal = __decorate$P([injectable(), __param$A(0, inject(ContributionProvider)), __param$A(0, named(EnvContribution)), __metadata$F("design:paramtypes", [Object])], DefaultGlobal);
821
+ DefaultGlobal = __decorate$Q([injectable(), __param$A(0, inject(ContributionProvider)), __param$A(0, named(EnvContribution)), __metadata$G("design:paramtypes", [Object])], DefaultGlobal);
822
822
 
823
823
  var MeasureModeEnum;
824
824
  !function (MeasureModeEnum) {
@@ -1063,15 +1063,19 @@ function drawArc(context, x, y, coords) {
1063
1063
  context.bezierCurveTo(bez[0], bez[1], bez[2], bez[3], bez[4], bez[5]);
1064
1064
  }
1065
1065
  }
1066
- const addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry) => {
1067
- const delta = Math.abs(endAngle - startAngle),
1068
- count = delta > .5 * Math.PI ? Math.ceil(2 * delta / Math.PI) : 1,
1069
- stepAngle = (endAngle - startAngle) / count;
1066
+ const addArcToBezierPath = function (bezierPath, startAngle, endAngle, cx, cy, rx, ry) {
1067
+ let counterclockwise = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : !1;
1068
+ const PI2 = 2 * Math.PI,
1069
+ sAngle = (startAngle % PI2 + PI2) % PI2;
1070
+ let deltaAngle,
1071
+ eAngle = (endAngle % PI2 + PI2) % PI2;
1072
+ counterclockwise ? (eAngle >= sAngle && (eAngle -= PI2), deltaAngle = eAngle - sAngle) : (eAngle <= sAngle && (eAngle += PI2), deltaAngle = eAngle - sAngle);
1073
+ const count = Math.ceil(Math.abs(deltaAngle) / (.5 * Math.PI)),
1074
+ stepAngle = deltaAngle / count;
1070
1075
  for (let i = 0; i < count; i++) {
1071
- const sa = startAngle + stepAngle * i,
1072
- ea = startAngle + stepAngle * (i + 1),
1073
- len = 4 * Math.tan(Math.abs(stepAngle) / 4) / 3,
1074
- dir = ea < sa ? -1 : 1,
1076
+ const sa = sAngle + stepAngle * i,
1077
+ ea = sAngle + stepAngle * (i + 1),
1078
+ len = 4 / 3 * Math.tan(Math.abs(stepAngle) / 4),
1075
1079
  c1 = Math.cos(sa),
1076
1080
  s1 = Math.sin(sa),
1077
1081
  c2 = Math.cos(ea),
@@ -1080,8 +1084,9 @@ const addArcToBezierPath = (bezierPath, startAngle, endAngle, cx, cy, rx, ry) =>
1080
1084
  y1 = s1 * ry + cy,
1081
1085
  x4 = c2 * rx + cx,
1082
1086
  y4 = s2 * ry + cy,
1083
- hx = rx * len * dir,
1084
- hy = ry * len * dir;
1087
+ sign = counterclockwise ? -1 : 1,
1088
+ hx = rx * len * sign,
1089
+ hy = ry * len * sign;
1085
1090
  bezierPath.push(x1 - hx * s1, y1 + hy * c1, x4 + hx * s2, y4 - hy * c2, x4, y4);
1086
1091
  }
1087
1092
  };
@@ -1642,6 +1647,11 @@ let Step$1 = class Step {
1642
1647
  return this.context.tryUpdateLength();
1643
1648
  }
1644
1649
  };
1650
+ class StepClosed extends Step$1 {
1651
+ lineEnd() {
1652
+ this.context.closePath();
1653
+ }
1654
+ }
1645
1655
  function genStepSegments(points, t) {
1646
1656
  let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1647
1657
  const {
@@ -1655,6 +1665,16 @@ function genStepSegments(points, t) {
1655
1665
  function genStepTypeSegments(path, points) {
1656
1666
  return genCurveSegments(path, points);
1657
1667
  }
1668
+ function genStepClosedSegments(points, t) {
1669
+ let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1670
+ const {
1671
+ direction: direction,
1672
+ startPoint: startPoint
1673
+ } = params;
1674
+ if (points.length < 2 - Number(!!startPoint)) return null;
1675
+ 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);
1676
+ return genStepTypeSegments(new StepClosed(segContext, t, startPoint), points), segContext;
1677
+ }
1658
1678
 
1659
1679
  class LinearClosed extends Linear {
1660
1680
  lineEnd() {
@@ -1884,6 +1904,8 @@ function calcLineCache(points, curveType, params) {
1884
1904
  return genMonotoneYSegments(points, params);
1885
1905
  case "step":
1886
1906
  return genStepSegments(points, .5, params);
1907
+ case "stepClosed":
1908
+ return genStepClosedSegments(points, .5, params);
1887
1909
  case "stepBefore":
1888
1910
  return genStepSegments(points, 0, params);
1889
1911
  case "stepAfter":
@@ -1954,8 +1976,14 @@ class CustomPath2D extends CurvePath {
1954
1976
  if (!this.toStringCbList) {
1955
1977
  const list = [];
1956
1978
  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 => {
1957
- const bezierPathList = [];
1958
- addArcToBezierPath(bezierPathList, cmd[4], cmd[5], cmd[1], cmd[2], cmd[3], cmd[3]);
1979
+ const bezierPathList = [],
1980
+ x = cmd[1],
1981
+ y = cmd[2],
1982
+ radius = cmd[3],
1983
+ startAngle = cmd[4],
1984
+ endAngle = cmd[5],
1985
+ counterclockwise = cmd[6];
1986
+ addArcToBezierPath(bezierPathList, startAngle, endAngle, x, y, radius, radius, counterclockwise);
1959
1987
  let path = "";
1960
1988
  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]}`;
1961
1989
  return path;
@@ -2318,7 +2346,8 @@ const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
2318
2346
  filter: "",
2319
2347
  cursor: null,
2320
2348
  html: null,
2321
- react: null
2349
+ react: null,
2350
+ vue: null
2322
2351
  }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout), DefaultPickStyle);
2323
2352
  const DefaultConnectAttribute = {
2324
2353
  connectedType: "none",
@@ -2353,7 +2382,8 @@ const DefaultAttribute = Object.assign(Object.assign(Object.assign({
2353
2382
  overflow: "hidden",
2354
2383
  shadowPickMode: "graphic",
2355
2384
  keepStrokeScale: !1,
2356
- clipConfig: null
2385
+ clipConfig: null,
2386
+ roughStyle: null
2357
2387
  }, DefaultDebugAttribute), DefaultStyle), DefaultTransform);
2358
2388
  const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
2359
2389
  startAngle: 0,
@@ -2426,6 +2456,12 @@ const DefaultPolygonAttribute = Object.assign(Object.assign({}, DefaultAttribute
2426
2456
  cornerRadius: 0,
2427
2457
  closePath: !0
2428
2458
  });
2459
+ const DefaultStarAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
2460
+ width: 100,
2461
+ height: 100,
2462
+ spikes: 5,
2463
+ thickness: .5
2464
+ });
2429
2465
  const DefaultRectAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
2430
2466
  width: 0,
2431
2467
  height: 0,
@@ -2751,6 +2787,7 @@ function getScaledStroke(context, width, dpr) {
2751
2787
  function createColor(context, c, params) {
2752
2788
  let offsetX = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
2753
2789
  let offsetY = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
2790
+ var _a, _b, _c, _d;
2754
2791
  if (!c || !0 === c) return "black";
2755
2792
  let result, color;
2756
2793
  if (isArray(c)) for (let i = 0; i < c.length && (color = c[i], !color); i++);else color = c;
@@ -2764,9 +2801,10 @@ function createColor(context, c, params) {
2764
2801
  if (params.attribute) {
2765
2802
  const {
2766
2803
  scaleX = 1,
2767
- scaleY = 1
2804
+ scaleY = 1,
2805
+ angle = 0
2768
2806
  } = params.attribute;
2769
- w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY;
2807
+ w /= scaleX, h /= scaleY, x /= scaleX, y /= scaleY, (angle || 1 !== scaleX || 1 !== scaleY) && (x = null !== (_a = params.x1WithoutTransform) && void 0 !== _a ? _a : 0, y = null !== (_b = params.y1WithoutTransform) && void 0 !== _b ? _b : 0, w = null !== (_c = params.widthWithoutTransform) && void 0 !== _c ? _c : w, h = null !== (_d = params.heightWithoutTransform) && void 0 !== _d ? _d : h);
2770
2808
  }
2771
2809
  "linear" === color.gradient ? result = createLinearGradient(context, color, x, y, w, h) : "conical" === color.gradient ? result = createConicGradient(context, color, x, y, w, h) : "radial" === color.gradient && (result = createRadialGradient(context, color, x, y, w, h));
2772
2810
  }
@@ -2791,7 +2829,7 @@ function createConicGradient(context, color, x, y, w, h) {
2791
2829
  const canvasGradient = context.createConicGradient(x + (null !== (_a = color.x) && void 0 !== _a ? _a : 0) * w, y + (null !== (_b = color.y) && void 0 !== _b ? _b : 0) * h, color.startAngle, color.endAngle);
2792
2830
  return color.stops.forEach(stop => {
2793
2831
  canvasGradient.addColorStop(stop.offset, stop.color);
2794
- }), canvasGradient.GetPattern(w + x, h + y, undefined);
2832
+ }), canvasGradient.GetPattern ? canvasGradient.GetPattern(w + x, h + y, undefined) : canvasGradient;
2795
2833
  }
2796
2834
 
2797
2835
  const DIRECTION_KEY = {
@@ -2921,7 +2959,7 @@ function measureTextCanvas(text, character) {
2921
2959
  return result.width += space, result;
2922
2960
  }
2923
2961
 
2924
- var __decorate$O = undefined && undefined.__decorate || function (decorators, target, key, desc) {
2962
+ var __decorate$P = undefined && undefined.__decorate || function (decorators, target, key, desc) {
2925
2963
  var d,
2926
2964
  c = arguments.length,
2927
2965
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
@@ -3313,9 +3351,9 @@ let ATextMeasure = class {
3313
3351
  return data.str = data.result, data.width += suffixWidth, data;
3314
3352
  }
3315
3353
  };
3316
- ATextMeasure = __decorate$O([injectable()], ATextMeasure);
3354
+ ATextMeasure = __decorate$P([injectable()], ATextMeasure);
3317
3355
 
3318
- var __decorate$N = undefined && undefined.__decorate || function (decorators, target, key, desc) {
3356
+ var __decorate$O = undefined && undefined.__decorate || function (decorators, target, key, desc) {
3319
3357
  var d,
3320
3358
  c = arguments.length,
3321
3359
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
@@ -3324,7 +3362,7 @@ var __decorate$N = undefined && undefined.__decorate || function (decorators, ta
3324
3362
  };
3325
3363
  const TextMeasureContribution = Symbol.for("TextMeasureContribution");
3326
3364
  let DefaultTextMeasureContribution = class extends ATextMeasure {};
3327
- DefaultTextMeasureContribution = __decorate$N([injectable()], DefaultTextMeasureContribution);
3365
+ DefaultTextMeasureContribution = __decorate$O([injectable()], DefaultTextMeasureContribution);
3328
3366
 
3329
3367
  const container = new Container();
3330
3368
 
@@ -3333,6 +3371,355 @@ const CanvasFactory = Symbol.for("CanvasFactory");
3333
3371
  function wrapCanvas(params) {
3334
3372
  return container.getNamed(CanvasFactory, application.global.env)(params);
3335
3373
  }
3374
+ const EPSILON_NUMERIC = 1e-4,
3375
+ THREE_SQRT = Math.sqrt(3),
3376
+ ONE_THIRD = 1 / 3;
3377
+ function isAroundZero(val) {
3378
+ return val > -EPSILON && val < EPSILON;
3379
+ }
3380
+ function isNotAroundZero(val) {
3381
+ return val > EPSILON || val < -EPSILON;
3382
+ }
3383
+ const _v0 = [0, 0],
3384
+ _v1 = [0, 0],
3385
+ _v2 = [0, 0];
3386
+ function distanceSquare(v1, v2) {
3387
+ return (v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1]);
3388
+ }
3389
+ function quadraticAt(p0, p1, p2, t) {
3390
+ const onet = 1 - t;
3391
+ return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
3392
+ }
3393
+ function cubicAt(p0, p1, p2, p3, t) {
3394
+ const onet = 1 - t;
3395
+ return onet * onet * (onet * p0 + 3 * t * p1) + t * t * (t * p3 + 3 * onet * p2);
3396
+ }
3397
+ function quadraticRootAt(p0, p1, p2, val, roots) {
3398
+ const a = p0 - 2 * p1 + p2,
3399
+ b = 2 * (p1 - p0),
3400
+ c = p0 - val;
3401
+ let n = 0;
3402
+ if (isAroundZero(a)) {
3403
+ if (isNotAroundZero(b)) {
3404
+ const t1 = -c / b;
3405
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
3406
+ }
3407
+ } else {
3408
+ const disc = b * b - 4 * a * c;
3409
+ if (isAroundZero(disc)) {
3410
+ const t1 = -b / (2 * a);
3411
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
3412
+ } else if (disc > 0) {
3413
+ const discSqrt = Math.sqrt(disc),
3414
+ t1 = (-b + discSqrt) / (2 * a),
3415
+ t2 = (-b - discSqrt) / (2 * a);
3416
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1), t2 >= 0 && t2 <= 1 && (roots[n++] = t2);
3417
+ }
3418
+ }
3419
+ return n;
3420
+ }
3421
+ function quadraticExtremum(p0, p1, p2) {
3422
+ const divider = p0 + p2 - 2 * p1;
3423
+ return 0 === divider ? .5 : (p0 - p1) / divider;
3424
+ }
3425
+ function quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
3426
+ let t = 0,
3427
+ interval = .005,
3428
+ d = 1 / 0;
3429
+ _v0[0] = x, _v0[1] = y;
3430
+ for (let _t = 0; _t < 1; _t += .05) {
3431
+ _v1[0] = quadraticAt(x0, x1, x2, _t), _v1[1] = quadraticAt(y0, y1, y2, _t);
3432
+ const d1 = distanceSquare(_v0, _v1);
3433
+ d1 < d && (t = _t, d = d1);
3434
+ }
3435
+ d = 1 / 0;
3436
+ for (let i = 0; i < 32 && !(interval < EPSILON_NUMERIC); i++) {
3437
+ const prev = t - interval,
3438
+ next = t + interval;
3439
+ _v1[0] = quadraticAt(x0, x1, x2, prev), _v1[1] = quadraticAt(y0, y1, y2, prev);
3440
+ const d1 = distanceSquare(_v1, _v0);
3441
+ if (prev >= 0 && d1 < d) t = prev, d = d1;else {
3442
+ _v2[0] = quadraticAt(x0, x1, x2, next), _v2[1] = quadraticAt(y0, y1, y2, next);
3443
+ const d2 = distanceSquare(_v2, _v0);
3444
+ next <= 1 && d2 < d ? (t = next, d = d2) : interval *= .5;
3445
+ }
3446
+ }
3447
+ return out && (out[0] = quadraticAt(x0, x1, x2, t), out[1] = quadraticAt(y0, y1, y2, t)), Math.sqrt(d);
3448
+ }
3449
+ function cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
3450
+ let prev,
3451
+ next,
3452
+ d1,
3453
+ d2,
3454
+ t = 0,
3455
+ interval = .005,
3456
+ d = 1 / 0;
3457
+ _v0[0] = x, _v0[1] = y;
3458
+ 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);
3459
+ d = 1 / 0;
3460
+ 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);
3461
+ return out && (out[0] = cubicAt(x0, x1, x2, x3, t), out[1] = cubicAt(y0, y1, y2, y3, t)), Math.sqrt(d);
3462
+ }
3463
+ function normalizeRadian(angle) {
3464
+ return (angle %= pi2) < 0 && (angle += pi2), angle;
3465
+ }
3466
+ function containQuadStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
3467
+ if (0 === lineWidth) return !1;
3468
+ const _l = lineWidth;
3469
+ 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;
3470
+ return quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, null) <= _l / 2;
3471
+ }
3472
+ function containCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
3473
+ if (0 === lineWidth) return !1;
3474
+ const _l = lineWidth;
3475
+ 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;
3476
+ return cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, null) <= _l / 2;
3477
+ }
3478
+ function containArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
3479
+ if (0 === lineWidth) return !1;
3480
+ const _l = lineWidth;
3481
+ x -= cx, y -= cy;
3482
+ const d = Math.sqrt(x * x + y * y);
3483
+ if (d - _l > r || d + _l < r) return !1;
3484
+ if (Math.abs(startAngle - endAngle) % pi2 < 1e-4) return !0;
3485
+ if (anticlockwise) {
3486
+ const tmp = startAngle;
3487
+ startAngle = normalizeRadian(endAngle), endAngle = normalizeRadian(tmp);
3488
+ } else startAngle = normalizeRadian(startAngle), endAngle = normalizeRadian(endAngle);
3489
+ startAngle > endAngle && (endAngle += pi2);
3490
+ let angle = Math.atan2(y, x);
3491
+ return angle < 0 && (angle += pi2), angle >= startAngle && angle <= endAngle || angle + pi2 >= startAngle && angle + pi2 <= endAngle;
3492
+ }
3493
+ function containLineStroke(x0, y0, x1, y1, lineWidth, x, y) {
3494
+ if (0 === lineWidth) return !1;
3495
+ const _l = lineWidth,
3496
+ _halfL = lineWidth / 2;
3497
+ let _a = 0,
3498
+ _b = x0;
3499
+ 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;
3500
+ if (x0 === x1) return Math.abs(x - x0) <= _l / 2;
3501
+ _a = (y0 - y1) / (x0 - x1), _b = (x0 * y1 - x1 * y0) / (x0 - x1);
3502
+ const tmp = _a * x - y + _b;
3503
+ return tmp * tmp / (_a * _a + 1) <= _l / 2 * _l / 2;
3504
+ }
3505
+ const EPSILON = 1e-4;
3506
+ function cubicRootAt(p0, p1, p2, p3, val, roots) {
3507
+ const a = p3 + 3 * (p1 - p2) - p0,
3508
+ b = 3 * (p2 - 2 * p1 + p0),
3509
+ c = 3 * (p1 - p0),
3510
+ d = p0 - val,
3511
+ A = b * b - 3 * a * c,
3512
+ B = b * c - 9 * a * d,
3513
+ C = c * c - 3 * b * d;
3514
+ let n = 0;
3515
+ if (isAroundZero(A) && isAroundZero(B)) {
3516
+ if (isAroundZero(b)) roots[0] = 0;else {
3517
+ const t1 = -c / b;
3518
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
3519
+ }
3520
+ } else {
3521
+ const disc = B * B - 4 * A * C;
3522
+ if (isAroundZero(disc)) {
3523
+ const K = B / A,
3524
+ t1 = -b / a + K,
3525
+ t2 = -K / 2;
3526
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1), t2 >= 0 && t2 <= 1 && (roots[n++] = t2);
3527
+ } else if (disc > 0) {
3528
+ const discSqrt = Math.sqrt(disc);
3529
+ let Y1 = A * b + 1.5 * a * (-B + discSqrt),
3530
+ Y2 = A * b + 1.5 * a * (-B - discSqrt);
3531
+ 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);
3532
+ const t1 = (-b - (Y1 + Y2)) / (3 * a);
3533
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1);
3534
+ } else {
3535
+ const T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A)),
3536
+ theta = Math.acos(T) / 3,
3537
+ ASqrt = Math.sqrt(A),
3538
+ tmp = Math.cos(theta),
3539
+ t1 = (-b - 2 * ASqrt * tmp) / (3 * a),
3540
+ t2 = (-b + ASqrt * (tmp + THREE_SQRT * Math.sin(theta))) / (3 * a),
3541
+ t3 = (-b + ASqrt * (tmp - THREE_SQRT * Math.sin(theta))) / (3 * a);
3542
+ t1 >= 0 && t1 <= 1 && (roots[n++] = t1), t2 >= 0 && t2 <= 1 && (roots[n++] = t2), t3 >= 0 && t3 <= 1 && (roots[n++] = t3);
3543
+ }
3544
+ }
3545
+ return n;
3546
+ }
3547
+ function cubicExtrema(p0, p1, p2, p3, extrema) {
3548
+ const b = 6 * p2 - 12 * p1 + 6 * p0,
3549
+ a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2,
3550
+ c = 3 * p1 - 3 * p0;
3551
+ let n = 0;
3552
+ if (isAroundZero(a)) {
3553
+ if (isNotAroundZero(b)) {
3554
+ const t1 = -c / b;
3555
+ t1 >= 0 && t1 <= 1 && (extrema[n++] = t1);
3556
+ }
3557
+ } else {
3558
+ const disc = b * b - 4 * a * c;
3559
+ if (isAroundZero(disc)) extrema[0] = -b / (2 * a);else if (disc > 0) {
3560
+ const discSqrt = Math.sqrt(disc),
3561
+ t1 = (-b + discSqrt) / (2 * a),
3562
+ t2 = (-b - discSqrt) / (2 * a);
3563
+ t1 >= 0 && t1 <= 1 && (extrema[n++] = t1), t2 >= 0 && t2 <= 1 && (extrema[n++] = t2);
3564
+ }
3565
+ }
3566
+ return n;
3567
+ }
3568
+ function isAroundEqual(a, b) {
3569
+ return Math.abs(a - b) < EPSILON;
3570
+ }
3571
+ const roots = [-1, -1, -1],
3572
+ extrema = [-1, -1];
3573
+ function swapExtrema() {
3574
+ const tmp = extrema[0];
3575
+ extrema[0] = extrema[1], extrema[1] = tmp;
3576
+ }
3577
+ function windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
3578
+ if (y > y0 && y > y1 && y > y2 && y > y3 || y < y0 && y < y1 && y < y2 && y < y3) return 0;
3579
+ const nRoots = cubicRootAt(y0, y1, y2, y3, y, roots);
3580
+ if (0 === nRoots) return 0;
3581
+ let w = 0,
3582
+ nExtrema = -1,
3583
+ y0_ = 0,
3584
+ y1_ = 0;
3585
+ for (let i = 0; i < nRoots; i++) {
3586
+ const t = roots[i],
3587
+ unit = 0 === t || 1 === t ? .5 : 1;
3588
+ 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);
3589
+ }
3590
+ return w;
3591
+ }
3592
+ function windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
3593
+ if (y > y0 && y > y1 && y > y2 || y < y0 && y < y1 && y < y2) return 0;
3594
+ const nRoots = quadraticRootAt(y0, y1, y2, y, roots);
3595
+ if (0 === nRoots) return 0;
3596
+ const t = quadraticExtremum(y0, y1, y2);
3597
+ if (t >= 0 && t <= 1) {
3598
+ let w = 0;
3599
+ const y_ = quadraticAt(y0, y1, y2, t);
3600
+ for (let i = 0; i < nRoots; i++) {
3601
+ const unit = 0 === roots[i] || 1 === roots[i] ? .5 : 1;
3602
+ quadraticAt(x0, x1, x2, roots[i]) < x || (roots[i] < t ? w += y_ < y0 ? unit : -unit : w += y2 < y_ ? unit : -unit);
3603
+ }
3604
+ return w;
3605
+ }
3606
+ const unit = 0 === roots[0] || 1 === roots[0] ? .5 : 1;
3607
+ return quadraticAt(x0, x1, x2, roots[0]) < x ? 0 : y2 < y0 ? unit : -unit;
3608
+ }
3609
+ function windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
3610
+ if ((y -= cy) > r || y < -r) return 0;
3611
+ const tmp = Math.sqrt(r * r - y * y);
3612
+ roots[0] = -tmp, roots[1] = tmp;
3613
+ const dTheta = Math.abs(startAngle - endAngle);
3614
+ if (dTheta < 1e-4) return 0;
3615
+ if (dTheta >= pi2 - 1e-4) {
3616
+ startAngle = 0, endAngle = pi2;
3617
+ const dir = anticlockwise ? 1 : -1;
3618
+ return x >= roots[0] + cx && x <= roots[1] + cx ? dir : 0;
3619
+ }
3620
+ if (startAngle > endAngle) {
3621
+ const tmp = startAngle;
3622
+ startAngle = endAngle, endAngle = tmp;
3623
+ }
3624
+ startAngle < 0 && (startAngle += pi2, endAngle += pi2);
3625
+ let w = 0;
3626
+ for (let i = 0; i < 2; i++) {
3627
+ const x_ = roots[i];
3628
+ if (x_ + cx > x) {
3629
+ let angle = Math.atan2(y, x_),
3630
+ dir = anticlockwise ? 1 : -1;
3631
+ 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);
3632
+ }
3633
+ }
3634
+ return w;
3635
+ }
3636
+ function modpi2(radian) {
3637
+ return Math.round(radian / pi * 1e8) / 1e8 % 2 * pi;
3638
+ }
3639
+ function normalizeArcAngles(angles, anticlockwise) {
3640
+ let newStartAngle = modpi2(angles[0]);
3641
+ newStartAngle < 0 && (newStartAngle += pi2);
3642
+ const delta = newStartAngle - angles[0];
3643
+ let newEndAngle = angles[1];
3644
+ 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;
3645
+ }
3646
+ const tmpAngles = [0, 0];
3647
+ function containPath(commands, lineWidth, isStroke, x, y) {
3648
+ const data = commands,
3649
+ len = commands.length;
3650
+ let x1,
3651
+ y1,
3652
+ w = 0,
3653
+ xi = 0,
3654
+ yi = 0,
3655
+ x0 = 0,
3656
+ y0 = 0;
3657
+ for (let i = 0; i < len; i++) {
3658
+ const command = data[i],
3659
+ isFirst = 0 === i;
3660
+ 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);
3661
+ const c0 = command[0],
3662
+ c1 = command[1],
3663
+ c2 = command[2],
3664
+ c3 = command[3],
3665
+ c4 = command[4],
3666
+ c5 = command[5],
3667
+ c6 = command[6];
3668
+ let startAngle = c4,
3669
+ endAngle = c5;
3670
+ tmpAngles[0] = startAngle, tmpAngles[1] = endAngle, normalizeArcAngles(tmpAngles, Boolean(command[6])), startAngle = tmpAngles[0], endAngle = tmpAngles[1];
3671
+ const theta = startAngle,
3672
+ dTheta = endAngle - startAngle,
3673
+ anticlockwise = !!(1 - (command[6] ? 0 : 1)),
3674
+ _x = (x - c1) * c3 / c3 + c1;
3675
+ switch (c0) {
3676
+ case enumCommandMap.M:
3677
+ x0 = c1, y0 = c2, xi = x0, yi = y0;
3678
+ break;
3679
+ case enumCommandMap.L:
3680
+ if (isStroke) {
3681
+ if (containLineStroke(xi, yi, c1, c2, lineWidth, x, y)) return !0;
3682
+ } else w += isPointInLine(xi, yi, c1, c2, x, y) || 0;
3683
+ xi = c1, yi = c2;
3684
+ break;
3685
+ case enumCommandMap.C:
3686
+ if (isStroke) {
3687
+ if (containCubicStroke(xi, yi, c1, c2, c3, c4, c5, c6, lineWidth, x, y)) return !0;
3688
+ } else w += windingCubic(xi, yi, c1, c2, c3, c4, c5, c6, x, y) || 0;
3689
+ xi = c5, yi = c6;
3690
+ break;
3691
+ case enumCommandMap.Q:
3692
+ if (isStroke) {
3693
+ if (containQuadStroke(xi, yi, c1, c2, c3, c4, lineWidth, x, y)) return !0;
3694
+ } else w += windingQuadratic(xi, yi, c1, c2, c3, c4, x, y) || 0;
3695
+ xi = c3, yi = c4;
3696
+ break;
3697
+ case enumCommandMap.A:
3698
+ 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) {
3699
+ if (containArcStroke(c1, c2, c3, theta, theta + dTheta, anticlockwise, lineWidth, _x, y)) return !0;
3700
+ } else w += windingArc(c1, c2, c3, theta, theta + dTheta, anticlockwise, _x, y);
3701
+ xi = Math.cos(theta + dTheta) * c3 + c1, yi = Math.sin(theta + dTheta) * c3 + c2;
3702
+ break;
3703
+ case enumCommandMap.R:
3704
+ if (x0 = xi = c1, y0 = yi = c2, x1 = x0 + c3, y1 = y0 + c4, isStroke) {
3705
+ 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;
3706
+ } else w += isPointInLine(x1, y0, x1, y1, x, y), w += isPointInLine(x0, y1, x0, y0, x, y);
3707
+ break;
3708
+ case enumCommandMap.Z:
3709
+ if (isStroke) {
3710
+ if (containLineStroke(xi, yi, x0, y0, lineWidth, x, y)) return !0;
3711
+ } else w += isPointInLine(xi, yi, x0, y0, x, y);
3712
+ xi = x0, yi = y0;
3713
+ }
3714
+ }
3715
+ return isStroke || isAroundEqual(yi, y0) || (w += isPointInLine(xi, yi, x0, y0, x, y) || 0), 0 !== w;
3716
+ }
3717
+ function contain(commands, x, y) {
3718
+ return containPath(commands, 0, !1, x, y);
3719
+ }
3720
+ function containStroke(commands, lineWidth, x, y) {
3721
+ return containPath(commands, lineWidth, !0, x, y);
3722
+ }
3336
3723
 
3337
3724
  class DefaultCanvasAllocate {
3338
3725
  constructor() {
@@ -3385,14 +3772,14 @@ class DefaultCanvasAllocate {
3385
3772
  }
3386
3773
  const canvasAllocate = new DefaultCanvasAllocate();
3387
3774
 
3388
- var __decorate$M = undefined && undefined.__decorate || function (decorators, target, key, desc) {
3775
+ var __decorate$N = undefined && undefined.__decorate || function (decorators, target, key, desc) {
3389
3776
  var d,
3390
3777
  c = arguments.length,
3391
3778
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
3392
3779
  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);
3393
3780
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3394
3781
  },
3395
- __metadata$E = undefined && undefined.__metadata || function (k, v) {
3782
+ __metadata$F = undefined && undefined.__metadata || function (k, v) {
3396
3783
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
3397
3784
  };
3398
3785
  const VWindow = Symbol.for("VWindow");
@@ -3529,16 +3916,16 @@ let DefaultWindow = class {
3529
3916
  return this._handler.getTopLeft(baseWindow);
3530
3917
  }
3531
3918
  };
3532
- DefaultWindow = __decorate$M([injectable(), __metadata$E("design:paramtypes", [])], DefaultWindow);
3919
+ DefaultWindow = __decorate$N([injectable(), __metadata$F("design:paramtypes", [])], DefaultWindow);
3533
3920
 
3534
- var __decorate$L = undefined && undefined.__decorate || function (decorators, target, key, desc) {
3921
+ var __decorate$M = undefined && undefined.__decorate || function (decorators, target, key, desc) {
3535
3922
  var d,
3536
3923
  c = arguments.length,
3537
3924
  r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
3538
3925
  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);
3539
3926
  return c > 3 && r && Object.defineProperty(target, key, r), r;
3540
3927
  },
3541
- __metadata$D = undefined && undefined.__metadata || function (k, v) {
3928
+ __metadata$E = undefined && undefined.__metadata || function (k, v) {
3542
3929
  if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
3543
3930
  },
3544
3931
  __param$z = undefined && undefined.__param || function (paramIndex, decorator) {
@@ -3636,7 +4023,7 @@ let DefaultGraphicUtil = class {
3636
4023
  return c.nativeCanvas ? c.nativeCanvas : null;
3637
4024
  }
3638
4025
  };
3639
- DefaultGraphicUtil = __decorate$L([injectable(), __param$z(0, inject(ContributionProvider)), __param$z(0, named(TextMeasureContribution)), __metadata$D("design:paramtypes", [Object])], DefaultGraphicUtil);
4026
+ DefaultGraphicUtil = __decorate$M([injectable(), __param$z(0, inject(ContributionProvider)), __param$z(0, named(TextMeasureContribution)), __metadata$E("design:paramtypes", [Object])], DefaultGraphicUtil);
3640
4027
  var TransformMode;
3641
4028
  !function (TransformMode) {
3642
4029
  TransformMode[TransformMode.transform = 0] = "transform", TransformMode[TransformMode.matrix = 1] = "matrix";
@@ -3694,7 +4081,7 @@ let DefaultTransformUtil = class {
3694
4081
  return this;
3695
4082
  }
3696
4083
  };
3697
- DefaultTransformUtil = __decorate$L([injectable(), __metadata$D("design:paramtypes", [])], DefaultTransformUtil);
4084
+ DefaultTransformUtil = __decorate$M([injectable(), __metadata$E("design:paramtypes", [])], DefaultTransformUtil);
3698
4085
 
3699
4086
  const defaultThemeObj = {
3700
4087
  arc: DefaultArcAttribute,
@@ -3706,6 +4093,7 @@ const defaultThemeObj = {
3706
4093
  text: DefaultTextAttribute,
3707
4094
  rect: DefaultRectAttribute,
3708
4095
  polygon: DefaultPolygonAttribute,
4096
+ star: DefaultStarAttribute,
3709
4097
  richtext: DefaultRichTextAttribute,
3710
4098
  richtextIcon: DefaultRichTextIconAttribute,
3711
4099
  image: DefaultImageAttribute,
@@ -3724,6 +4112,7 @@ function newThemeObj() {
3724
4112
  text: Object.assign({}, defaultThemeObj.text),
3725
4113
  rect: Object.assign({}, defaultThemeObj.rect),
3726
4114
  polygon: Object.assign({}, defaultThemeObj.polygon),
4115
+ star: Object.assign({}, defaultThemeObj.star),
3727
4116
  richtext: Object.assign({}, defaultThemeObj.richtext),
3728
4117
  richtextIcon: Object.assign({}, defaultThemeObj.richtextIcon),
3729
4118
  image: Object.assign({}, defaultThemeObj.image),
@@ -4913,7 +5302,7 @@ class RectSymbol extends BaseSymbol {
4913
5302
  }
4914
5303
  var rect = new RectSymbol();
4915
5304
 
4916
- const tempBounds$1 = new AABBBounds();
5305
+ const tempBounds = new AABBBounds();
4917
5306
  class CustomSymbolClass {
4918
5307
  constructor(type, path) {
4919
5308
  let isSvg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
@@ -4942,7 +5331,7 @@ class CustomSymbolClass {
4942
5331
  let {
4943
5332
  path: path
4944
5333
  } = _ref;
4945
- tempBounds$1.x1 = path.bounds.x1 * size, tempBounds$1.y1 = path.bounds.y1 * size, tempBounds$1.x2 = path.bounds.x2 * size, tempBounds$1.y2 = path.bounds.y2 * size, bounds.union(tempBounds$1);
5334
+ 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);
4946
5335
  });
4947
5336
  }
4948
5337
  this.path.bounds && (bounds.x1 = this.path.bounds.x1 * size, bounds.y1 = this.path.bounds.y1 * size, bounds.x2 = this.path.bounds.x2 * size, bounds.y2 = this.path.bounds.y2 * size);
@@ -5237,6 +5626,7 @@ genNumberType();
5237
5626
  const RECT_NUMBER_TYPE = genNumberType();
5238
5627
  genNumberType();
5239
5628
  const RICHTEXT_NUMBER_TYPE = genNumberType();
5629
+ genNumberType();
5240
5630
  const SYMBOL_NUMBER_TYPE = genNumberType();
5241
5631
  const TEXT_NUMBER_TYPE = genNumberType();
5242
5632
  const GraphicService = Symbol.for("GraphicService");
@@ -5259,109 +5649,630 @@ const DefaultStateAnimateConfig = {
5259
5649
  easing: "cubicOut"
5260
5650
  };
5261
5651
 
5262
- const _tempBounds = new AABBBounds(),
5263
- tempMatrix = new Matrix(),
5264
- tempBounds = new AABBBounds();
5265
- const GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible"];
5266
- const tempConstantXYKey = ["x", "y"],
5267
- tempConstantScaleXYKey = ["scaleX", "scaleY"],
5268
- tempConstantAngleKey = ["angle"],
5269
- point = new Point();
5270
- const NOWORK_ANIMATE_ATTR = {
5271
- strokeSeg: 1,
5272
- boundsPadding: 2,
5273
- pickMode: 1,
5274
- boundsMode: 1,
5275
- customPickShape: 1,
5276
- pickable: 1,
5277
- childrenPickable: 1,
5278
- visible: 1,
5279
- zIndex: 1,
5280
- layout: 1,
5281
- keepDirIn3d: 1,
5282
- globalZIndex: 1,
5283
- outerBorder: 1,
5284
- innerBorder: 1,
5285
- lineDash: 1,
5286
- lineCap: 1,
5287
- lineJoin: 1,
5288
- miterLimit: 2,
5289
- strokeBoundsBuffer: 2,
5290
- scaleCenter: 1,
5291
- anchor: 1,
5292
- anchor3d: 1,
5293
- postMatrix: 1,
5294
- backgroundMode: 2,
5295
- background: 1,
5296
- texture: 1,
5297
- cursor: 1,
5298
- html: 1
5299
- };
5300
- class Graphic extends Node {
5301
- static mixin(source) {
5302
- const keys = Object.keys(source);
5303
- for (let i = 0; i < keys.length; ++i) {
5304
- const propertyName = keys[i];
5305
- Object.defineProperty(Graphic.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
5306
- }
5652
+ function identityMat4(out) {
5653
+ 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;
5654
+ }
5655
+ function rotateX(out, a, rad) {
5656
+ const s = Math.sin(rad),
5657
+ c = Math.cos(rad),
5658
+ a10 = a[4],
5659
+ a11 = a[5],
5660
+ a12 = a[6],
5661
+ a13 = a[7],
5662
+ a20 = a[8],
5663
+ a21 = a[9],
5664
+ a22 = a[10],
5665
+ a23 = a[11];
5666
+ 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;
5667
+ }
5668
+ function rotateY(out, a, rad) {
5669
+ const s = Math.sin(rad),
5670
+ c = Math.cos(rad),
5671
+ a00 = a[0],
5672
+ a01 = a[1],
5673
+ a02 = a[2],
5674
+ a03 = a[3],
5675
+ a20 = a[8],
5676
+ a21 = a[9],
5677
+ a22 = a[10],
5678
+ a23 = a[11];
5679
+ 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;
5680
+ }
5681
+ function rotateZ(out, a, rad) {
5682
+ const s = Math.sin(rad),
5683
+ c = Math.cos(rad),
5684
+ a00 = a[0],
5685
+ a01 = a[1],
5686
+ a02 = a[2],
5687
+ a03 = a[3],
5688
+ a10 = a[4],
5689
+ a11 = a[5],
5690
+ a12 = a[6],
5691
+ a13 = a[7];
5692
+ 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;
5693
+ }
5694
+ function translate(out, a, v) {
5695
+ const x = v[0],
5696
+ y = v[1],
5697
+ z = v[2];
5698
+ let a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23;
5699
+ 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;
5700
+ }
5701
+ function mat3Tomat4(out, b) {
5702
+ out[0] = b.a, out[1] = b.b, out[2] = 0, out[3] = 0, out[4] = b.c, out[5] = b.d, out[6] = 0, out[7] = 0, out[8] = 0, out[9] = 0, out[10] = 1, out[11] = 0, out[12] = b.e, out[13] = b.f, out[14] = 0, out[15] = 1;
5703
+ }
5704
+ function scaleMat4(out, a, v) {
5705
+ const x = v[0],
5706
+ y = v[1],
5707
+ z = v[2];
5708
+ 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;
5709
+ }
5710
+ function multiplyMat4Mat4(out, a, b) {
5711
+ const a00 = a[0],
5712
+ a01 = a[1],
5713
+ a02 = a[2],
5714
+ a03 = a[3],
5715
+ a10 = a[4],
5716
+ a11 = a[5],
5717
+ a12 = a[6],
5718
+ a13 = a[7],
5719
+ a20 = a[8],
5720
+ a21 = a[9],
5721
+ a22 = a[10],
5722
+ a23 = a[11],
5723
+ a30 = a[12],
5724
+ a31 = a[13],
5725
+ a32 = a[14],
5726
+ a33 = a[15];
5727
+ let b0 = b[0],
5728
+ b1 = b[1],
5729
+ b2 = b[2],
5730
+ b3 = b[3];
5731
+ 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;
5732
+ }
5733
+
5734
+ function createMat4() {
5735
+ return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
5736
+ }
5737
+ class DefaultMatrixAllocate {
5738
+ constructor() {
5739
+ this.pools = [];
5307
5740
  }
5308
- get AABBBounds() {
5309
- return this.tryUpdateAABBBounds();
5741
+ allocate(a, b, c, d, e, f) {
5742
+ if (!this.pools.length) return new Matrix(a, b, c, d, e, f);
5743
+ const m = this.pools.pop();
5744
+ return m.a = a, m.b = b, m.c = c, m.d = d, m.e = e, m.f = f, m;
5310
5745
  }
5311
- get OBBBounds() {
5312
- return this.tryUpdateOBBBounds();
5746
+ allocateByObj(matrix) {
5747
+ if (!this.pools.length) return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
5748
+ const m = this.pools.pop();
5749
+ 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;
5313
5750
  }
5314
- get globalAABBBounds() {
5315
- return this.tryUpdateGlobalAABBBounds();
5751
+ free(d) {
5752
+ this.pools.push(d);
5316
5753
  }
5317
- get transMatrix() {
5318
- return this.tryUpdateLocalTransMatrix(!0);
5754
+ get length() {
5755
+ return this.pools.length;
5319
5756
  }
5320
- get globalTransMatrix() {
5321
- return this.tryUpdateGlobalTransMatrix(!0);
5757
+ release() {
5758
+ this.pools = [];
5322
5759
  }
5760
+ }
5761
+ class DefaultMat4Allocate {
5323
5762
  constructor() {
5324
- let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5325
- var _a;
5326
- 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);
5327
- }
5328
- getAttributes() {
5329
- return this.attribute;
5763
+ this.pools = [];
5330
5764
  }
5331
- setMode(mode) {
5332
- "3d" === mode ? this.set3dMode() : this.set2dMode();
5765
+ static identity(out) {
5766
+ return identityMat4(out);
5333
5767
  }
5334
- set3dMode() {
5335
- this.in3dMode = !0;
5768
+ allocate() {
5769
+ if (!this.pools.length) return createMat4();
5770
+ const m = this.pools.pop();
5771
+ return DefaultMat4Allocate.identity(m), m;
5336
5772
  }
5337
- set2dMode() {
5338
- this.in3dMode = !1;
5773
+ allocateByObj(d) {
5774
+ let m;
5775
+ m = this.pools.length ? this.pools.pop() : createMat4();
5776
+ for (let i = 0; i < m.length; i++) m[i] = d[i];
5777
+ return m;
5339
5778
  }
5340
- getOffsetXY(attr) {
5341
- let includeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
5342
- var _a, _b;
5343
- const {
5344
- dx = attr.dx,
5345
- dy = attr.dy
5346
- } = this.attribute;
5347
- if (includeScroll && this.parent) {
5348
- const attribute = this.parent.attribute;
5349
- point.x = dx + (null !== (_a = attribute.scrollX) && void 0 !== _a ? _a : 0), point.y = dy + (null !== (_b = attribute.scrollY) && void 0 !== _b ? _b : 0);
5350
- } else point.x = dx, point.y = dy;
5351
- return point;
5779
+ free(m) {
5780
+ m && this.pools.push(m);
5352
5781
  }
5353
- onAnimateBind(animate) {
5354
- this._emitCustomEvent("animate-bind", animate);
5782
+ get length() {
5783
+ return this.pools.length;
5355
5784
  }
5356
- tryUpdateAABBBounds() {
5357
- const full = "imprecise" === this.attribute.boundsMode;
5358
- if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
5359
- if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
5360
- application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
5361
- const bounds = this.doUpdateAABBBounds(full);
5362
- return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
5785
+ release() {
5786
+ this.pools = [];
5363
5787
  }
5364
- tryUpdateOBBBounds() {
5788
+ }
5789
+ const matrixAllocate = new DefaultMatrixAllocate();
5790
+ const mat4Allocate = new DefaultMat4Allocate();
5791
+
5792
+ var __decorate$L = undefined && undefined.__decorate || function (decorators, target, key, desc) {
5793
+ var d,
5794
+ c = arguments.length,
5795
+ r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
5796
+ 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);
5797
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
5798
+ },
5799
+ __metadata$D = undefined && undefined.__metadata || function (k, v) {
5800
+ if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
5801
+ };
5802
+ const initMatrix = new Matrix(1, 0, 0, 1, 0, 0),
5803
+ globalPoint = {
5804
+ x: 0,
5805
+ y: 0
5806
+ };
5807
+ let EmptyContext2d = class {
5808
+ get nativeContext() {
5809
+ return this.path;
5810
+ }
5811
+ constructor(canvas, dpr) {
5812
+ 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);
5813
+ }
5814
+ getCanvas() {
5815
+ throw new Error("不支持getCanvas");
5816
+ }
5817
+ getContext() {
5818
+ throw new Error("不支持getContext");
5819
+ }
5820
+ setTransformForCurrent() {
5821
+ let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
5822
+ !force && this.applyedMatrix.equalToMatrix(this.matrix) || (this.applyedMatrix = this.cloneMatrix(this.matrix));
5823
+ }
5824
+ get currentMatrix() {
5825
+ return this.matrix;
5826
+ }
5827
+ cloneMatrix(m) {
5828
+ return matrixAllocate.allocateByObj(m);
5829
+ }
5830
+ clear() {
5831
+ this.save(), this.resetTransform(), this.restore();
5832
+ }
5833
+ reset() {
5834
+ this.matrix.setValue(1, 0, 0, 1, 0, 0), this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack.length = 0;
5835
+ }
5836
+ restore() {
5837
+ this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop(), this.setTransformForCurrent());
5838
+ }
5839
+ highPerformanceRestore() {
5840
+ this.stack.length > 0 && (matrixAllocate.free(this.matrix), this.matrix = this.stack.pop());
5841
+ }
5842
+ rotate(rad) {
5843
+ let setTransform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
5844
+ this.matrix.rotate(rad), setTransform && this.setTransformForCurrent();
5845
+ }
5846
+ save() {
5847
+ const matrix = this.cloneMatrix(this.matrix);
5848
+ this.stack.push(matrix);
5849
+ }
5850
+ highPerformanceSave() {
5851
+ const matrix = this.cloneMatrix(this.matrix);
5852
+ this.stack.push(matrix);
5853
+ }
5854
+ scale(sx, sy) {
5855
+ let setTransform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
5856
+ this.matrix.scale(sx, sy), setTransform && this.setTransformForCurrent();
5857
+ }
5858
+ setScale(sx, sy) {
5859
+ let setTransform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
5860
+ this.matrix.setScale(sx, sy), setTransform && this.setTransformForCurrent();
5861
+ }
5862
+ scalePoint(sx, sy, px, py) {
5863
+ let setTransform = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !0;
5864
+ this.translate(px, py, !1), this.scale(sx, sy, !1), this.translate(-px, -py, !1), setTransform && this.setTransformForCurrent();
5865
+ }
5866
+ setTransform(a, b, c, d, e, f) {
5867
+ let setTransform = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
5868
+ let dpr = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : this.dpr;
5869
+ this.matrix.setValue(dpr * a, dpr * b, dpr * c, dpr * d, dpr * e, dpr * f), setTransform && this.setTransformForCurrent();
5870
+ }
5871
+ setTransformFromMatrix(matrix) {
5872
+ let setTransform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
5873
+ let dpr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.dpr;
5874
+ this.matrix.setValue(matrix.a * dpr, matrix.b * dpr, matrix.c * dpr, matrix.d * dpr, matrix.e * dpr, matrix.f * dpr), setTransform && this.setTransformForCurrent();
5875
+ }
5876
+ resetTransform() {
5877
+ let setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
5878
+ let dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
5879
+ this.setTransform(dpr, 0, 0, dpr, 0, 0), setTransform && this.setTransformForCurrent();
5880
+ }
5881
+ transform(a, b, c, d, e, f) {
5882
+ let setTransform = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
5883
+ this.matrix.multiply(a, b, c, d, e, f), setTransform && this.setTransformForCurrent();
5884
+ }
5885
+ transformFromMatrix(matrix, setTransform) {
5886
+ this.matrix.multiply(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f), setTransform && this.setTransformForCurrent();
5887
+ }
5888
+ translate(x, y) {
5889
+ let setTransform = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
5890
+ this.matrix.translate(x, y), setTransform && this.setTransformForCurrent();
5891
+ }
5892
+ rotateDegrees(deg) {
5893
+ let setTransform = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;
5894
+ const rad = deg * Math.PI / 180;
5895
+ this.rotate(rad, setTransform);
5896
+ }
5897
+ rotateAbout(rad, x, y) {
5898
+ let setTransform = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !0;
5899
+ this.translate(x, y, !1), this.rotate(rad, !1), this.translate(-x, -y, !1), setTransform && this.setTransformForCurrent();
5900
+ }
5901
+ rotateDegreesAbout(deg, x, y) {
5902
+ let setTransform = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : !0;
5903
+ this.translate(x, y, !1), this.rotateDegrees(deg, !1), this.translate(-x, -y, !1), setTransform && this.setTransformForCurrent();
5904
+ }
5905
+ beginPath() {
5906
+ this.path.clear();
5907
+ }
5908
+ clip(path, fillRule) {}
5909
+ arc(x, y, radius, startAngle, endAngle, anticlockwise) {
5910
+ this.path.arc(x, y, radius, startAngle, endAngle, anticlockwise);
5911
+ }
5912
+ arcTo(x1, y1, x2, y2, radiusX) {
5913
+ this.path.arcTo(x1, y1, x2, y2, radiusX);
5914
+ }
5915
+ bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
5916
+ this.path.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
5917
+ }
5918
+ closePath() {
5919
+ this.path.closePath();
5920
+ }
5921
+ ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {}
5922
+ lineTo(x, y) {
5923
+ this.path.lineTo(x, y);
5924
+ }
5925
+ moveTo(x, y) {
5926
+ this.path.moveTo(x, y);
5927
+ }
5928
+ quadraticCurveTo(cpx, cpy, x, y) {
5929
+ this.path.quadraticCurveTo(cpx, cpy, x, y);
5930
+ }
5931
+ rect(x, y, w, h) {
5932
+ this.path.rect(x, y, w, h);
5933
+ }
5934
+ createImageData(imageDataOrSw, sh) {
5935
+ return null;
5936
+ }
5937
+ createLinearGradient(x0, y0, x1, y1) {
5938
+ throw new Error("不支持createLinearGradient");
5939
+ }
5940
+ createPattern(image, repetition) {
5941
+ throw new Error("不支持createPattern");
5942
+ }
5943
+ createRadialGradient(x0, y0, r0, x1, y1, r1) {
5944
+ throw new Error("不支持createRadialGradient");
5945
+ }
5946
+ createConicGradient(x, y, startAngle, endAngle) {
5947
+ return null;
5948
+ }
5949
+ fill(path, fillRule) {}
5950
+ fillRect(x, y, width, height) {
5951
+ this.path.rect(x, y, width, height);
5952
+ }
5953
+ clearRect(x, y, w, h) {}
5954
+ fillText(text, x, y) {}
5955
+ getImageData(sx, sy, sw, sh) {
5956
+ return null;
5957
+ }
5958
+ getLineDash() {
5959
+ return [];
5960
+ }
5961
+ isPointInPath(x, y) {
5962
+ return this.matrix.transformPoint({
5963
+ x: x,
5964
+ y: y
5965
+ }, globalPoint), contain(this.path.commandList, globalPoint.x, globalPoint.y);
5966
+ }
5967
+ isPointInStroke(x, y) {
5968
+ if (!this.lineWidth) return !1;
5969
+ this.matrix.transformPoint({
5970
+ x: x,
5971
+ y: y
5972
+ }, globalPoint);
5973
+ const lineWidth = getScaledStroke(this, this.lineWidth, this.dpr);
5974
+ return containStroke(this.path.commandList, lineWidth, globalPoint.x, globalPoint.y);
5975
+ }
5976
+ measureText(text) {
5977
+ throw new Error("不支持measureText");
5978
+ }
5979
+ putImageData(imagedata, dx, dy) {
5980
+ throw new Error("不支持measureText");
5981
+ }
5982
+ setLineDash(segments) {}
5983
+ stroke(path) {}
5984
+ strokeRect(x, y, width, height) {
5985
+ this.path.rect(x, y, width, height);
5986
+ }
5987
+ strokeText(text, x, y) {}
5988
+ drawImage() {}
5989
+ setCommonStyle(params, attribute, offsetX, offsetY, defaultParams) {}
5990
+ _setCommonStyle(params, offsetX, offsetY, defaultParams) {}
5991
+ setStrokeStyle(params, attribute, offsetX, offsetY, defaultParams) {}
5992
+ _setStrokeStyle(params, offsetX, offsetY, defaultParams) {}
5993
+ setTextStyleWithoutAlignBaseline(params, defaultParams) {}
5994
+ setTextStyle(params, defaultParams) {}
5995
+ draw() {}
5996
+ clearMatrix() {
5997
+ let setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
5998
+ let dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
5999
+ this.setTransformFromMatrix(initMatrix, setTransform, dpr);
6000
+ }
6001
+ setClearMatrix(a, b, c, d, e, f) {
6002
+ this._clearMatrix.setValue(a, b, c, d, e, f);
6003
+ }
6004
+ onlyTranslate() {
6005
+ let dpr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.dpr;
6006
+ return this.matrix.a === dpr && 0 === this.matrix.b && 0 === this.matrix.c && this.matrix.d === dpr;
6007
+ }
6008
+ release() {
6009
+ this.stack.forEach(m => matrixAllocate.free(m)), this.stack.length = 0;
6010
+ }
6011
+ };
6012
+ EmptyContext2d = __decorate$L([injectable(), __metadata$D("design:paramtypes", [Object, Number])], EmptyContext2d);
6013
+
6014
+ var ColorType;
6015
+ !function (ColorType) {
6016
+ ColorType[ColorType.Color255 = 0] = "Color255", ColorType[ColorType.Color1 = 1] = "Color1";
6017
+ }(ColorType || (ColorType = {}));
6018
+ class ColorStore {
6019
+ static Get(str) {
6020
+ let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorType.Color1;
6021
+ let arr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0, 1];
6022
+ if (size === ColorType.Color1) {
6023
+ const color = ColorStore.store1[str];
6024
+ if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
6025
+ const c = Color.parseColorString(str);
6026
+ if (c) {
6027
+ const data = [c.r / 255, c.g / 255, c.b / 255, c.opacity];
6028
+ 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];
6029
+ }
6030
+ return arr;
6031
+ }
6032
+ const color = ColorStore.store255[str];
6033
+ if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
6034
+ const c = Color.parseColorString(str);
6035
+ 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;
6036
+ }
6037
+ static Set(str, size, arr) {
6038
+ if (size === ColorType.Color1) {
6039
+ if (ColorStore.store1[str]) return;
6040
+ 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])];
6041
+ } else {
6042
+ if (ColorStore.store255[str]) return;
6043
+ ColorStore.store255[str] = arr, ColorStore.store1[str] = [arr[0] / 255, arr[1] / 255, arr[2] / 255, arr[3]];
6044
+ }
6045
+ }
6046
+ }
6047
+ ColorStore.store255 = {}, ColorStore.store1 = {};
6048
+
6049
+ function colorArrayToString(color) {
6050
+ let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
6051
+ return Array.isArray(color) && isNumber(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;
6052
+ }
6053
+ function interpolateColor(from, to, ratio, alphaChannel, cb) {
6054
+ if (Array.isArray(from) && !isNumber(from[0]) || Array.isArray(to) && !isNumber(to[0])) {
6055
+ return new Array(4).fill(0).map((_, index) => {
6056
+ var _a, _b;
6057
+ return _interpolateColor(isArray(from) ? null !== (_a = from[index]) && void 0 !== _a ? _a : from[0] : from, isArray(to) ? null !== (_b = to[index]) && void 0 !== _b ? _b : to[0] : to, ratio, alphaChannel);
6058
+ });
6059
+ }
6060
+ return _interpolateColor(from, to, ratio, alphaChannel, cb);
6061
+ }
6062
+ function _interpolateColor(from, to, ratio, alphaChannel, cb) {
6063
+ if (!from || !to) return from && colorArrayToString(from) || to && colorArrayToString(to) || !1;
6064
+ let fromArray,
6065
+ toArray,
6066
+ fromGradient = !1,
6067
+ toGradient = !1;
6068
+ 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) {
6069
+ const gradient = fromGradient ? from : to,
6070
+ pure = fromGradient ? to : from,
6071
+ gradientFromPure = Object.assign(Object.assign({}, gradient), {
6072
+ stops: gradient.stops.map(v => Object.assign(Object.assign({}, v), {
6073
+ color: colorArrayToString(pure)
6074
+ }))
6075
+ });
6076
+ return fromGradient ? interpolateColor(gradient, gradientFromPure, ratio, alphaChannel, cb) : interpolateColor(gradientFromPure, gradient, ratio, alphaChannel, cb);
6077
+ }
6078
+ if (fromGradient) {
6079
+ if (from.gradient === to.gradient) {
6080
+ const fc = from,
6081
+ tc = to,
6082
+ fromStops = fc.stops,
6083
+ toStops = tc.stops;
6084
+ if (fromStops.length !== toStops.length) return !1;
6085
+ if ("linear" === fc.gradient) return interpolateGradientLinearColor(fc, tc, ratio);
6086
+ if ("radial" === fc.gradient) return interpolateGradientRadialColor(fc, tc, ratio);
6087
+ if ("conical" === fc.gradient) return interpolateGradientConicalColor(fc, tc, ratio);
6088
+ }
6089
+ return !1;
6090
+ }
6091
+ cb && cb(fromArray, toArray);
6092
+ return colorArrayToString(interpolatePureColorArray(fromArray, toArray, ratio), alphaChannel);
6093
+ }
6094
+ function interpolateGradientLinearColor(fc, tc, ratio) {
6095
+ const fStops = fc.stops,
6096
+ tStops = tc.stops;
6097
+ return {
6098
+ gradient: "linear",
6099
+ x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
6100
+ x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
6101
+ y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
6102
+ y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
6103
+ stops: new Array(fStops.length).fill(0).map((_, i) => ({
6104
+ color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
6105
+ offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
6106
+ }))
6107
+ };
6108
+ }
6109
+ function interpolateGradientRadialColor(fc, tc, ratio) {
6110
+ const fStops = fc.stops,
6111
+ tStops = tc.stops;
6112
+ return {
6113
+ gradient: "radial",
6114
+ x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
6115
+ x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
6116
+ y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
6117
+ y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
6118
+ r0: fc.r0 + (tc.r0 - fc.r0) * ratio,
6119
+ r1: fc.r1 + (tc.r1 - fc.r1) * ratio,
6120
+ stops: new Array(fStops.length).fill(0).map((_, i) => ({
6121
+ color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
6122
+ offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
6123
+ }))
6124
+ };
6125
+ }
6126
+ function interpolateGradientConicalColor(fc, tc, ratio) {
6127
+ const fStops = fc.stops,
6128
+ tStops = tc.stops;
6129
+ return {
6130
+ gradient: "conical",
6131
+ startAngle: fc.startAngle + (tc.startAngle - fc.startAngle) * ratio,
6132
+ endAngle: fc.endAngle + (tc.endAngle - fc.endAngle) * ratio,
6133
+ x: fc.x + (tc.x - fc.x) * ratio,
6134
+ y: fc.y + (tc.y - fc.y) * ratio,
6135
+ stops: new Array(fStops.length).fill(0).map((_, i) => ({
6136
+ color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
6137
+ offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
6138
+ }))
6139
+ };
6140
+ }
6141
+ function interpolatePureColorArray(from, to, ratio) {
6142
+ 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];
6143
+ }
6144
+ function interpolatePureColorArrayToStr(from, to, ratio) {
6145
+ return `rgba(${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})`;
6146
+ }
6147
+ const _fromColorRGB = [0, 0, 0, 0],
6148
+ _toColorRGB = [0, 0, 0, 0];
6149
+ function colorStringInterpolationToStr(fromColor, toColor, ratio) {
6150
+ 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})`;
6151
+ }
6152
+
6153
+ function getConicGradientAt(x, y, angle, color) {
6154
+ const {
6155
+ stops: stops,
6156
+ startAngle: startAngle,
6157
+ endAngle: endAngle
6158
+ } = color;
6159
+ for (; angle < 0;) angle += pi2;
6160
+ for (; angle > pi2;) angle -= pi2;
6161
+ if (angle < startAngle) return stops[0].color;
6162
+ if (angle > endAngle) return stops[0].color;
6163
+ let startStop,
6164
+ endStop,
6165
+ percent = (angle - startAngle) / (endAngle - startAngle);
6166
+ for (let i = 0; i < stops.length; i++) if (stops[i].offset >= percent) {
6167
+ startStop = stops[i - 1], endStop = stops[i];
6168
+ break;
6169
+ }
6170
+ return percent = (percent - startStop.offset) / (endStop.offset - startStop.offset), interpolateColor(startStop.color, endStop.color, percent, !1);
6171
+ }
6172
+
6173
+ const _tempBounds = new AABBBounds(),
6174
+ tempMatrix = new Matrix();
6175
+ new AABBBounds();
6176
+ const GRAPHIC_UPDATE_TAG_KEY = ["lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible"];
6177
+ const tempConstantXYKey = ["x", "y"],
6178
+ tempConstantScaleXYKey = ["scaleX", "scaleY"],
6179
+ tempConstantAngleKey = ["angle"],
6180
+ point = new Point();
6181
+ const NOWORK_ANIMATE_ATTR = {
6182
+ strokeSeg: 1,
6183
+ boundsPadding: 2,
6184
+ pickMode: 1,
6185
+ boundsMode: 1,
6186
+ customPickShape: 1,
6187
+ pickable: 1,
6188
+ childrenPickable: 1,
6189
+ visible: 1,
6190
+ zIndex: 1,
6191
+ layout: 1,
6192
+ keepDirIn3d: 1,
6193
+ globalZIndex: 1,
6194
+ outerBorder: 1,
6195
+ innerBorder: 1,
6196
+ lineDash: 1,
6197
+ lineCap: 1,
6198
+ lineJoin: 1,
6199
+ miterLimit: 2,
6200
+ strokeBoundsBuffer: 2,
6201
+ scaleCenter: 1,
6202
+ anchor: 1,
6203
+ anchor3d: 1,
6204
+ postMatrix: 1,
6205
+ backgroundMode: 2,
6206
+ background: 1,
6207
+ texture: 1,
6208
+ cursor: 1,
6209
+ html: 1
6210
+ };
6211
+ class Graphic extends Node {
6212
+ static mixin(source) {
6213
+ const keys = Object.keys(source);
6214
+ for (let i = 0; i < keys.length; ++i) {
6215
+ const propertyName = keys[i];
6216
+ Object.defineProperty(Graphic.prototype, propertyName, Object.getOwnPropertyDescriptor(source, propertyName));
6217
+ }
6218
+ }
6219
+ get AABBBounds() {
6220
+ return this.tryUpdateAABBBounds();
6221
+ }
6222
+ get OBBBounds() {
6223
+ return this.tryUpdateOBBBounds();
6224
+ }
6225
+ get globalAABBBounds() {
6226
+ return this.tryUpdateGlobalAABBBounds();
6227
+ }
6228
+ get transMatrix() {
6229
+ return this.tryUpdateLocalTransMatrix(!0);
6230
+ }
6231
+ get globalTransMatrix() {
6232
+ return this.tryUpdateGlobalTransMatrix(!0);
6233
+ }
6234
+ constructor() {
6235
+ let params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6236
+ var _a;
6237
+ 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);
6238
+ }
6239
+ getAttributes() {
6240
+ return this.attribute;
6241
+ }
6242
+ setMode(mode) {
6243
+ "3d" === mode ? this.set3dMode() : this.set2dMode();
6244
+ }
6245
+ set3dMode() {
6246
+ this.in3dMode = !0;
6247
+ }
6248
+ set2dMode() {
6249
+ this.in3dMode = !1;
6250
+ }
6251
+ getOffsetXY(attr) {
6252
+ let includeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
6253
+ var _a, _b;
6254
+ const {
6255
+ dx = attr.dx,
6256
+ dy = attr.dy
6257
+ } = this.attribute;
6258
+ if (includeScroll && this.parent) {
6259
+ const attribute = this.parent.attribute;
6260
+ point.x = dx + (null !== (_a = attribute.scrollX) && void 0 !== _a ? _a : 0), point.y = dy + (null !== (_b = attribute.scrollY) && void 0 !== _b ? _b : 0);
6261
+ } else point.x = dx, point.y = dy;
6262
+ return point;
6263
+ }
6264
+ onAnimateBind(animate) {
6265
+ this._emitCustomEvent("animate-bind", animate);
6266
+ }
6267
+ tryUpdateAABBBounds() {
6268
+ const full = "imprecise" === this.attribute.boundsMode;
6269
+ if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
6270
+ if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
6271
+ application.graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
6272
+ const bounds = this.doUpdateAABBBounds(full);
6273
+ return application.graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0), "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
6274
+ }
6275
+ tryUpdateOBBBounds() {
5365
6276
  if (this._OBBBounds || (this._OBBBounds = new OBBBounds()), this.tryUpdateAABBBounds(), this.updateOBBBoundsStamp === this.updateAABBBoundsStamp) return this._OBBBounds;
5366
6277
  if (this.updateOBBBoundsStamp = this.updateAABBBoundsStamp, !this.valid) return this._OBBBounds.clear(), this._OBBBounds;
5367
6278
  return this.doUpdateOBBBounds();
@@ -5499,6 +6410,9 @@ class Graphic extends Node {
5499
6410
  y: y
5500
6411
  });
5501
6412
  }
6413
+ setWidthHeightWithoutTransform(aabbBounds) {
6414
+ this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
6415
+ }
5502
6416
  setAttributesAndPreventAnimate(params) {
5503
6417
  let forceUpdateTag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
5504
6418
  let context = arguments.length > 2 ? arguments[2] : undefined;
@@ -5666,7 +6580,7 @@ class Graphic extends Node {
5666
6580
  keys.forEach(key => {
5667
6581
  noWorkAttrs[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = isClear && void 0 === attrs[key] ? this.getDefaultAttribute(key) : attrs[key];
5668
6582
  });
5669
- const stateAnimateConfig = null !== (_b = null !== (_a = this.context.stateAnimateConfig) && void 0 !== _a ? _a : this.stateAnimateConfig) && void 0 !== _b ? _b : DefaultStateAnimateConfig;
6583
+ const stateAnimateConfig = null !== (_b = null !== (_a = this.context && this.context.stateAnimateConfig) && void 0 !== _a ? _a : this.stateAnimateConfig) && void 0 !== _b ? _b : DefaultStateAnimateConfig;
5670
6584
  this.applyAnimationState(["state"], [{
5671
6585
  name: "state",
5672
6586
  animation: {
@@ -5774,24 +6688,12 @@ class Graphic extends Node {
5774
6688
  needUpdateLayout() {
5775
6689
  return !!(this._updateTag & UpdateTag.UPDATE_LAYOUT);
5776
6690
  }
5777
- getAnchor(anchor, params) {
6691
+ getAnchor(anchor, params, resetScale) {
5778
6692
  const _anchor = [0, 0],
5779
6693
  getBounds = () => {
5780
6694
  if (params.b) return params.b;
5781
- const {
5782
- scaleX: scaleX,
5783
- scaleY: scaleY,
5784
- angle: angle
5785
- } = this.attribute;
5786
- return tempBounds.copy(this._AABBBounds), this.setAttributes({
5787
- scaleX: 1,
5788
- scaleY: 1,
5789
- angle: 0
5790
- }), params.b = this.AABBBounds.clone(), this._AABBBounds.copy(tempBounds), this.setAttributes({
5791
- scaleX: scaleX,
5792
- scaleY: scaleY,
5793
- angle: angle
5794
- }), params.b;
6695
+ const graphic = this.clone();
6696
+ return graphic.attribute.angle = 0, graphic.attribute.scaleCenter = null, resetScale && (graphic.attribute.scaleX = 1, graphic.attribute.scaleY = 1), params.b = graphic.AABBBounds, params.b;
5795
6697
  };
5796
6698
  if ("string" == typeof anchor[0]) {
5797
6699
  const ratio = parseFloat(anchor[0]) / 100,
@@ -5818,9 +6720,9 @@ class Graphic extends Node {
5818
6720
  } = this.attribute;
5819
6721
  let _anchor = [0, 0];
5820
6722
  const params = {};
5821
- if (anchor && (_anchor = this.getAnchor(anchor, params)), !scaleCenter || 1 === scaleX && 1 === scaleY) normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);else {
6723
+ if (anchor && angle && (_anchor = this.getAnchor(anchor, params)), !scaleCenter || 1 === scaleX && 1 === scaleY) normalTransform(this._transMatrix, this._transMatrix.reset(), x, y, scaleX, scaleY, angle, anchor && _anchor);else {
5822
6724
  const m = this._transMatrix;
5823
- m.reset(), m.translate(_anchor[0], _anchor[1]), m.rotate(angle), m.translate(-_anchor[0], -_anchor[1]), m.translate(x, y), _anchor = this.getAnchor(scaleCenter, params), application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, {
6725
+ m.reset(), m.translate(_anchor[0], _anchor[1]), m.rotate(angle), m.translate(-_anchor[0], -_anchor[1]), m.translate(x, y), _anchor = this.getAnchor(scaleCenter, params, !0), application.transformUtil.fromMatrix(m, m).scale(scaleX, scaleY, {
5824
6726
  x: _anchor[0],
5825
6727
  y: _anchor[1]
5826
6728
  });
@@ -5938,6 +6840,15 @@ class Graphic extends Node {
5938
6840
  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);
5939
6841
  }
5940
6842
  }
6843
+ toCustomPath() {
6844
+ var _a, _b, _c;
6845
+ 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);
6846
+ if (renderer) {
6847
+ const context = new EmptyContext2d(null, 1);
6848
+ return renderer.drawShape(this, context, 0, 0, {}, {}), context.path;
6849
+ }
6850
+ return null;
6851
+ }
5941
6852
  }
5942
6853
  function backgroundNotImage(image) {
5943
6854
  return !(!image.fill && !image.stroke);
@@ -6429,246 +7340,90 @@ function calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerR
6429
7340
  by = yore - oc[1],
6430
7341
  kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
6431
7342
  lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
6432
- limitedIcr = min(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1)), limitedOcr = min(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));
6433
- }
6434
- }
6435
- return {
6436
- outerDeltaAngle: outerDeltaAngle,
6437
- xors: xors,
6438
- yors: yors,
6439
- xirs: xirs,
6440
- yirs: yirs,
6441
- xore: xore,
6442
- yore: yore,
6443
- xire: xire,
6444
- yire: yire,
6445
- limitedOcr: limitedOcr,
6446
- limitedIcr: limitedIcr,
6447
- outerCornerRadiusStart: outerCornerRadiusStart,
6448
- outerCornerRadiusEnd: outerCornerRadiusEnd,
6449
- maxOuterCornerRadius: maxOuterCornerRadius,
6450
- maxInnerCornerRadius: maxInnerCornerRadius,
6451
- outerStartAngle: outerStartAngle,
6452
- outerEndAngle: outerEndAngle,
6453
- innerDeltaAngle: innerDeltaAngle,
6454
- innerEndAngle: innerEndAngle,
6455
- innerStartAngle: innerStartAngle,
6456
- innerCornerRadiusStart: innerCornerRadiusStart,
6457
- innerCornerRadiusEnd: innerCornerRadiusEnd
6458
- };
6459
- }
6460
- function drawArcPath(arc, context, cx, cy, outerRadius, innerRadius, partStroke) {
6461
- const {
6462
- startAngle: startAngle,
6463
- endAngle: endAngle
6464
- } = arc.getParsedAngle(),
6465
- deltaAngle = abs(endAngle - startAngle),
6466
- clockwise = endAngle > startAngle;
6467
- let collapsedToLine = !1;
6468
- if (outerRadius < innerRadius) {
6469
- const temp = outerRadius;
6470
- outerRadius = innerRadius, innerRadius = temp;
6471
- }
6472
- if (outerRadius <= epsilon) context.moveTo(cx, cy);else if (deltaAngle >= pi2 - epsilon) context.moveTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)), context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise), innerRadius > epsilon && (context.moveTo(cx + innerRadius * cos(endAngle), cy + innerRadius * sin(endAngle)), context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise));else {
6473
- const {
6474
- outerDeltaAngle: outerDeltaAngle,
6475
- xors: xors,
6476
- yors: yors,
6477
- xirs: xirs,
6478
- yirs: yirs,
6479
- limitedOcr: limitedOcr,
6480
- outerCornerRadiusStart: outerCornerRadiusStart,
6481
- outerCornerRadiusEnd: outerCornerRadiusEnd,
6482
- maxOuterCornerRadius: maxOuterCornerRadius,
6483
- xore: xore,
6484
- yore: yore,
6485
- xire: xire,
6486
- yire: yire,
6487
- outerStartAngle: outerStartAngle,
6488
- outerEndAngle: outerEndAngle,
6489
- limitedIcr: limitedIcr,
6490
- innerDeltaAngle: innerDeltaAngle,
6491
- innerEndAngle: innerEndAngle,
6492
- innerStartAngle: innerStartAngle,
6493
- innerCornerRadiusStart: innerCornerRadiusStart,
6494
- innerCornerRadiusEnd: innerCornerRadiusEnd,
6495
- maxInnerCornerRadius: maxInnerCornerRadius
6496
- } = calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerRadius);
6497
- if (outerDeltaAngle < .001) partStroke && (partStroke[3] || partStroke[1]) && context.moveTo(cx + xors, cy + yors), collapsedToLine = !0;else if (limitedOcr > epsilon) {
6498
- const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr),
6499
- cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr),
6500
- t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise)),
6501
- t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));
6502
- limitedOcr < maxOuterCornerRadius && cornerRadiusStart === cornerRadiusEnd ? !partStroke || partStroke[0] ? (context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !clockwise)) : context.moveTo(cx + t0.cx + limitedOcr * cos(atan2(t1.y01, t1.x01)), cy + t0.cy + limitedOcr * sin(atan2(t1.y01, t1.x01))) : !partStroke || partStroke[0] ? (context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), cornerRadiusStart > 0 && context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusStart, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise), context.arc(cx, cy, outerRadius, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !clockwise), cornerRadiusEnd > 0 && context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusEnd, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise)) : cornerRadiusEnd > 0 ? context.moveTo(cx + t1.cx + cornerRadiusEnd * cos(atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusEnd * sin(atan2(t1.y01, t1.x01))) : context.moveTo(cx + xore, cy + outerRadius * sin(outerEndAngle));
6503
- } else !partStroke || partStroke[0] ? (context.moveTo(cx + xors, cy + yors), context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise)) : context.moveTo(cx + outerRadius * cos(outerEndAngle), cy + outerRadius * sin(outerEndAngle));
6504
- if (!(innerRadius > epsilon) || innerDeltaAngle < .001) !partStroke || partStroke[1] ? context.lineTo(cx + xire, cy + yire) : context.moveTo(cx + xire, cy + yire), collapsedToLine = !0;else if (limitedIcr > epsilon) {
6505
- const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr),
6506
- cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr),
6507
- t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise)),
6508
- t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));
6509
- if (!partStroke || partStroke[1] ? context.lineTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01) : context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), limitedIcr < maxInnerCornerRadius && cornerRadiusStart === cornerRadiusEnd) {
6510
- const arcEndAngle = atan2(t1.y01, t1.x01);
6511
- !partStroke || partStroke[2] ? context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, atan2(t0.y01, t0.x01), arcEndAngle, !clockwise) : context.moveTo(cx + t0.cx + cos(arcEndAngle), cy + t0.cy + sin(arcEndAngle));
6512
- } else !partStroke || partStroke[2] ? (cornerRadiusEnd > 0 && context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusEnd, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise), context.arc(cx, cy, innerRadius, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), clockwise), cornerRadiusStart > 0 && context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusStart, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise)) : cornerRadiusStart > 0 ? context.moveTo(cx + t1.cx + cornerRadiusStart * cos(atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusStart * sin(atan2(t1.y01, t1.x01))) : context.moveTo(cx + xirs, cy + yirs);
6513
- } else !partStroke || partStroke[1] ? context.lineTo(cx + xire, cy + yire) : context.moveTo(cx + xire, cy + yire), !partStroke || partStroke[2] ? context.arc(cx, cy, innerRadius, innerEndAngle, innerStartAngle, clockwise) : context.moveTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));
6514
- }
6515
- return partStroke ? partStroke[3] && context.lineTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)) : context.closePath(), collapsedToLine;
6516
- }
6517
-
6518
- var ColorType;
6519
- !function (ColorType) {
6520
- ColorType[ColorType.Color255 = 0] = "Color255", ColorType[ColorType.Color1 = 1] = "Color1";
6521
- }(ColorType || (ColorType = {}));
6522
- class ColorStore {
6523
- static Get(str) {
6524
- let size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ColorType.Color1;
6525
- let arr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [0, 0, 0, 1];
6526
- if (size === ColorType.Color1) {
6527
- const color = ColorStore.store1[str];
6528
- if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
6529
- const c = Color.parseColorString(str);
6530
- if (c) {
6531
- const data = [c.r / 255, c.g / 255, c.b / 255, c.opacity];
6532
- 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];
6533
- }
6534
- return arr;
6535
- }
6536
- const color = ColorStore.store255[str];
6537
- if (color) return arr[0] = color[0], arr[1] = color[1], arr[2] = color[2], arr[3] = color[3], arr;
6538
- const c = Color.parseColorString(str);
6539
- 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;
6540
- }
6541
- static Set(str, size, arr) {
6542
- if (size === ColorType.Color1) {
6543
- if (ColorStore.store1[str]) return;
6544
- 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])];
6545
- } else {
6546
- if (ColorStore.store255[str]) return;
6547
- ColorStore.store255[str] = arr, ColorStore.store1[str] = [arr[0] / 255, arr[1] / 255, arr[2] / 255, arr[3]];
6548
- }
6549
- }
6550
- }
6551
- ColorStore.store255 = {}, ColorStore.store1 = {};
6552
-
6553
- function colorArrayToString(color) {
6554
- let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
6555
- return Array.isArray(color) && isNumber(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;
6556
- }
6557
- function interpolateColor(from, to, ratio, alphaChannel, cb) {
6558
- if (Array.isArray(from) && !isNumber(from[0]) || Array.isArray(to) && !isNumber(to[0])) {
6559
- return new Array(4).fill(0).map((_, index) => _interpolateColor(isArray(from) ? from[index] : from, isArray(to) ? to[index] : to, ratio, alphaChannel));
6560
- }
6561
- return _interpolateColor(from, to, ratio, alphaChannel, cb);
6562
- }
6563
- function _interpolateColor(from, to, ratio, alphaChannel, cb) {
6564
- if (!from || !to) return from && colorArrayToString(from) || to && colorArrayToString(to) || !1;
6565
- let fromArray,
6566
- toArray,
6567
- fromGradient = !1,
6568
- toGradient = !1;
6569
- 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) {
6570
- const gradient = fromGradient ? from : to,
6571
- pure = fromGradient ? to : from,
6572
- gradientFromPure = Object.assign(Object.assign({}, gradient), {
6573
- stops: gradient.stops.map(v => Object.assign(Object.assign({}, v), {
6574
- color: colorArrayToString(pure)
6575
- }))
6576
- });
6577
- return fromGradient ? interpolateColor(gradient, gradientFromPure, ratio, alphaChannel, cb) : interpolateColor(gradientFromPure, gradient, ratio, alphaChannel, cb);
6578
- }
6579
- if (fromGradient) {
6580
- if (from.gradient === to.gradient) {
6581
- const fc = from,
6582
- tc = to,
6583
- fromStops = fc.stops,
6584
- toStops = tc.stops;
6585
- if (fromStops.length !== toStops.length) return !1;
6586
- if ("linear" === fc.gradient) return interpolateGradientLinearColor(fc, tc, ratio);
6587
- if ("radial" === fc.gradient) return interpolateGradientRadialColor(fc, tc, ratio);
6588
- if ("conical" === fc.gradient) return interpolateGradientConicalColor(fc, tc, ratio);
6589
- }
6590
- return !1;
6591
- }
6592
- cb && cb(fromArray, toArray);
6593
- return colorArrayToString(interpolatePureColorArray(fromArray, toArray, ratio), alphaChannel);
6594
- }
6595
- function interpolateGradientLinearColor(fc, tc, ratio) {
6596
- const fStops = fc.stops,
6597
- tStops = tc.stops;
6598
- return {
6599
- gradient: "linear",
6600
- x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
6601
- x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
6602
- y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
6603
- y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
6604
- stops: new Array(fStops.length).fill(0).map((_, i) => ({
6605
- color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
6606
- offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
6607
- }))
6608
- };
6609
- }
6610
- function interpolateGradientRadialColor(fc, tc, ratio) {
6611
- const fStops = fc.stops,
6612
- tStops = tc.stops;
6613
- return {
6614
- gradient: "radial",
6615
- x0: fc.x0 + (tc.x0 - fc.x0) * ratio,
6616
- x1: fc.x1 + (tc.x1 - fc.x1) * ratio,
6617
- y0: fc.y0 + (tc.y0 - fc.y0) * ratio,
6618
- y1: fc.y1 + (tc.y1 - fc.y1) * ratio,
6619
- r0: fc.r0 + (tc.r0 - fc.r0) * ratio,
6620
- r1: fc.r1 + (tc.r1 - fc.r1) * ratio,
6621
- stops: new Array(fStops.length).fill(0).map((_, i) => ({
6622
- color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
6623
- offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
6624
- }))
6625
- };
6626
- }
6627
- function interpolateGradientConicalColor(fc, tc, ratio) {
6628
- const fStops = fc.stops,
6629
- tStops = tc.stops;
6630
- return {
6631
- gradient: "conical",
6632
- startAngle: fc.startAngle + (tc.startAngle - fc.startAngle) * ratio,
6633
- endAngle: fc.endAngle + (tc.endAngle - fc.endAngle) * ratio,
6634
- x: fc.x + (tc.x - fc.x) * ratio,
6635
- y: fc.y + (tc.y - fc.y) * ratio,
6636
- stops: new Array(fStops.length).fill(0).map((_, i) => ({
6637
- color: colorStringInterpolationToStr(fStops[i].color, tStops[i].color, ratio),
6638
- offset: fStops[i].offset + (tStops[i].offset - fStops[i].offset) * ratio
6639
- }))
7343
+ limitedIcr = min(maxInnerCornerRadius, (innerRadius - lc) / (kc - 1)), limitedOcr = min(maxOuterCornerRadius, (outerRadius - lc) / (kc + 1));
7344
+ }
7345
+ }
7346
+ return {
7347
+ outerDeltaAngle: outerDeltaAngle,
7348
+ xors: xors,
7349
+ yors: yors,
7350
+ xirs: xirs,
7351
+ yirs: yirs,
7352
+ xore: xore,
7353
+ yore: yore,
7354
+ xire: xire,
7355
+ yire: yire,
7356
+ limitedOcr: limitedOcr,
7357
+ limitedIcr: limitedIcr,
7358
+ outerCornerRadiusStart: outerCornerRadiusStart,
7359
+ outerCornerRadiusEnd: outerCornerRadiusEnd,
7360
+ maxOuterCornerRadius: maxOuterCornerRadius,
7361
+ maxInnerCornerRadius: maxInnerCornerRadius,
7362
+ outerStartAngle: outerStartAngle,
7363
+ outerEndAngle: outerEndAngle,
7364
+ innerDeltaAngle: innerDeltaAngle,
7365
+ innerEndAngle: innerEndAngle,
7366
+ innerStartAngle: innerStartAngle,
7367
+ innerCornerRadiusStart: innerCornerRadiusStart,
7368
+ innerCornerRadiusEnd: innerCornerRadiusEnd
6640
7369
  };
6641
7370
  }
6642
- function interpolatePureColorArray(from, to, ratio) {
6643
- 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];
6644
- }
6645
- function interpolatePureColorArrayToStr(from, to, ratio) {
6646
- return `rgba(${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})`;
6647
- }
6648
- const _fromColorRGB = [0, 0, 0, 0],
6649
- _toColorRGB = [0, 0, 0, 0];
6650
- function colorStringInterpolationToStr(fromColor, toColor, ratio) {
6651
- 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})`;
6652
- }
6653
-
6654
- function getConicGradientAt(x, y, angle, color) {
7371
+ function drawArcPath(arc, context, cx, cy, outerRadius, innerRadius, partStroke) {
6655
7372
  const {
6656
- stops: stops,
6657
- startAngle: startAngle,
6658
- endAngle: endAngle
6659
- } = color;
6660
- for (; angle < 0;) angle += pi2;
6661
- for (; angle > pi2;) angle -= pi2;
6662
- if (angle < startAngle) return stops[0].color;
6663
- if (angle > endAngle) return stops[0].color;
6664
- let startStop,
6665
- endStop,
6666
- percent = (angle - startAngle) / (endAngle - startAngle);
6667
- for (let i = 0; i < stops.length; i++) if (stops[i].offset >= percent) {
6668
- startStop = stops[i - 1], endStop = stops[i];
6669
- break;
7373
+ startAngle: startAngle,
7374
+ endAngle: endAngle
7375
+ } = arc.getParsedAngle(),
7376
+ deltaAngle = abs(endAngle - startAngle),
7377
+ clockwise = endAngle > startAngle;
7378
+ let collapsedToLine = !1;
7379
+ if (outerRadius < innerRadius) {
7380
+ const temp = outerRadius;
7381
+ outerRadius = innerRadius, innerRadius = temp;
6670
7382
  }
6671
- return percent = (percent - startStop.offset) / (endStop.offset - startStop.offset), interpolateColor(startStop.color, endStop.color, percent, !1);
7383
+ if (outerRadius <= epsilon) context.moveTo(cx, cy);else if (deltaAngle >= pi2 - epsilon) context.moveTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)), context.arc(cx, cy, outerRadius, startAngle, endAngle, !clockwise), innerRadius > epsilon && (context.moveTo(cx + innerRadius * cos(endAngle), cy + innerRadius * sin(endAngle)), context.arc(cx, cy, innerRadius, endAngle, startAngle, clockwise));else {
7384
+ const {
7385
+ outerDeltaAngle: outerDeltaAngle,
7386
+ xors: xors,
7387
+ yors: yors,
7388
+ xirs: xirs,
7389
+ yirs: yirs,
7390
+ limitedOcr: limitedOcr,
7391
+ outerCornerRadiusStart: outerCornerRadiusStart,
7392
+ outerCornerRadiusEnd: outerCornerRadiusEnd,
7393
+ maxOuterCornerRadius: maxOuterCornerRadius,
7394
+ xore: xore,
7395
+ yore: yore,
7396
+ xire: xire,
7397
+ yire: yire,
7398
+ outerStartAngle: outerStartAngle,
7399
+ outerEndAngle: outerEndAngle,
7400
+ limitedIcr: limitedIcr,
7401
+ innerDeltaAngle: innerDeltaAngle,
7402
+ innerEndAngle: innerEndAngle,
7403
+ innerStartAngle: innerStartAngle,
7404
+ innerCornerRadiusStart: innerCornerRadiusStart,
7405
+ innerCornerRadiusEnd: innerCornerRadiusEnd,
7406
+ maxInnerCornerRadius: maxInnerCornerRadius
7407
+ } = calculateArcCornerRadius(arc, startAngle, endAngle, innerRadius, outerRadius);
7408
+ if (outerDeltaAngle < .001) partStroke && (partStroke[3] || partStroke[1]) && context.moveTo(cx + xors, cy + yors), collapsedToLine = !0;else if (limitedOcr > epsilon) {
7409
+ const cornerRadiusStart = min(outerCornerRadiusStart, limitedOcr),
7410
+ cornerRadiusEnd = min(outerCornerRadiusEnd, limitedOcr),
7411
+ t0 = cornerTangents(xirs, yirs, xors, yors, outerRadius, cornerRadiusStart, Number(clockwise)),
7412
+ t1 = cornerTangents(xore, yore, xire, yire, outerRadius, cornerRadiusEnd, Number(clockwise));
7413
+ limitedOcr < maxOuterCornerRadius && cornerRadiusStart === cornerRadiusEnd ? !partStroke || partStroke[0] ? (context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), context.arc(cx + t0.cx, cy + t0.cy, limitedOcr, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !clockwise)) : context.moveTo(cx + t0.cx + limitedOcr * cos(atan2(t1.y01, t1.x01)), cy + t0.cy + limitedOcr * sin(atan2(t1.y01, t1.x01))) : !partStroke || partStroke[0] ? (context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), cornerRadiusStart > 0 && context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusStart, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise), context.arc(cx, cy, outerRadius, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !clockwise), cornerRadiusEnd > 0 && context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusEnd, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise)) : cornerRadiusEnd > 0 ? context.moveTo(cx + t1.cx + cornerRadiusEnd * cos(atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusEnd * sin(atan2(t1.y01, t1.x01))) : context.moveTo(cx + xore, cy + outerRadius * sin(outerEndAngle));
7414
+ } else !partStroke || partStroke[0] ? (context.moveTo(cx + xors, cy + yors), context.arc(cx, cy, outerRadius, outerStartAngle, outerEndAngle, !clockwise)) : context.moveTo(cx + outerRadius * cos(outerEndAngle), cy + outerRadius * sin(outerEndAngle));
7415
+ if (!(innerRadius > epsilon) || innerDeltaAngle < .001) !partStroke || partStroke[1] ? context.lineTo(cx + xire, cy + yire) : context.moveTo(cx + xire, cy + yire), collapsedToLine = !0;else if (limitedIcr > epsilon) {
7416
+ const cornerRadiusStart = min(innerCornerRadiusStart, limitedIcr),
7417
+ cornerRadiusEnd = min(innerCornerRadiusEnd, limitedIcr),
7418
+ t0 = cornerTangents(xire, yire, xore, yore, innerRadius, -cornerRadiusEnd, Number(clockwise)),
7419
+ t1 = cornerTangents(xors, yors, xirs, yirs, innerRadius, -cornerRadiusStart, Number(clockwise));
7420
+ if (!partStroke || partStroke[1] ? context.lineTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01) : context.moveTo(cx + t0.cx + t0.x01, cy + t0.cy + t0.y01), limitedIcr < maxInnerCornerRadius && cornerRadiusStart === cornerRadiusEnd) {
7421
+ const arcEndAngle = atan2(t1.y01, t1.x01);
7422
+ !partStroke || partStroke[2] ? context.arc(cx + t0.cx, cy + t0.cy, limitedIcr, atan2(t0.y01, t0.x01), arcEndAngle, !clockwise) : context.moveTo(cx + t0.cx + cos(arcEndAngle), cy + t0.cy + sin(arcEndAngle));
7423
+ } else !partStroke || partStroke[2] ? (cornerRadiusEnd > 0 && context.arc(cx + t0.cx, cy + t0.cy, cornerRadiusEnd, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !clockwise), context.arc(cx, cy, innerRadius, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), clockwise), cornerRadiusStart > 0 && context.arc(cx + t1.cx, cy + t1.cy, cornerRadiusStart, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !clockwise)) : cornerRadiusStart > 0 ? context.moveTo(cx + t1.cx + cornerRadiusStart * cos(atan2(t1.y01, t1.x01)), cy + t1.cy + cornerRadiusStart * sin(atan2(t1.y01, t1.x01))) : context.moveTo(cx + xirs, cy + yirs);
7424
+ } else !partStroke || partStroke[1] ? context.lineTo(cx + xire, cy + yire) : context.moveTo(cx + xire, cy + yire), !partStroke || partStroke[2] ? context.arc(cx, cy, innerRadius, innerEndAngle, innerStartAngle, clockwise) : context.moveTo(cx + innerRadius * cos(innerStartAngle), cy + innerRadius * sin(innerStartAngle));
7425
+ }
7426
+ return partStroke ? partStroke[3] && context.lineTo(cx + outerRadius * cos(startAngle), cy + outerRadius * sin(startAngle)) : context.closePath(), collapsedToLine;
6672
7427
  }
6673
7428
 
6674
7429
  const ArcRenderContribution = Symbol.for("ArcRenderContribution");
@@ -6691,146 +7446,6 @@ function textLayoutOffsetY(baseline, lineHeight, fontSize) {
6691
7446
  return "middle" === baseline ? -lineHeight / 2 : "top" === baseline ? 0 : "bottom" === baseline ? buf - lineHeight : baseline && "alphabetic" !== baseline ? 0 : (fontSize || (fontSize = lineHeight), -(lineHeight - fontSize) / 2 - .79 * fontSize);
6692
7447
  }
6693
7448
 
6694
- function identityMat4(out) {
6695
- 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;
6696
- }
6697
- function rotateX(out, a, rad) {
6698
- const s = Math.sin(rad),
6699
- c = Math.cos(rad),
6700
- a10 = a[4],
6701
- a11 = a[5],
6702
- a12 = a[6],
6703
- a13 = a[7],
6704
- a20 = a[8],
6705
- a21 = a[9],
6706
- a22 = a[10],
6707
- a23 = a[11];
6708
- 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;
6709
- }
6710
- function rotateY(out, a, rad) {
6711
- const s = Math.sin(rad),
6712
- c = Math.cos(rad),
6713
- a00 = a[0],
6714
- a01 = a[1],
6715
- a02 = a[2],
6716
- a03 = a[3],
6717
- a20 = a[8],
6718
- a21 = a[9],
6719
- a22 = a[10],
6720
- a23 = a[11];
6721
- 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;
6722
- }
6723
- function rotateZ(out, a, rad) {
6724
- const s = Math.sin(rad),
6725
- c = Math.cos(rad),
6726
- a00 = a[0],
6727
- a01 = a[1],
6728
- a02 = a[2],
6729
- a03 = a[3],
6730
- a10 = a[4],
6731
- a11 = a[5],
6732
- a12 = a[6],
6733
- a13 = a[7];
6734
- 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;
6735
- }
6736
- function translate(out, a, v) {
6737
- const x = v[0],
6738
- y = v[1],
6739
- z = v[2];
6740
- let a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23;
6741
- 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;
6742
- }
6743
- function mat3Tomat4(out, b) {
6744
- out[0] = b.a, out[1] = b.b, out[2] = 0, out[3] = 0, out[4] = b.c, out[5] = b.d, out[6] = 0, out[7] = 0, out[8] = 0, out[9] = 0, out[10] = 1, out[11] = 0, out[12] = b.e, out[13] = b.f, out[14] = 0, out[15] = 1;
6745
- }
6746
- function scaleMat4(out, a, v) {
6747
- const x = v[0],
6748
- y = v[1],
6749
- z = v[2];
6750
- 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;
6751
- }
6752
- function multiplyMat4Mat4(out, a, b) {
6753
- const a00 = a[0],
6754
- a01 = a[1],
6755
- a02 = a[2],
6756
- a03 = a[3],
6757
- a10 = a[4],
6758
- a11 = a[5],
6759
- a12 = a[6],
6760
- a13 = a[7],
6761
- a20 = a[8],
6762
- a21 = a[9],
6763
- a22 = a[10],
6764
- a23 = a[11],
6765
- a30 = a[12],
6766
- a31 = a[13],
6767
- a32 = a[14],
6768
- a33 = a[15];
6769
- let b0 = b[0],
6770
- b1 = b[1],
6771
- b2 = b[2],
6772
- b3 = b[3];
6773
- 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;
6774
- }
6775
-
6776
- function createMat4() {
6777
- return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
6778
- }
6779
- class DefaultMatrixAllocate {
6780
- constructor() {
6781
- this.pools = [];
6782
- }
6783
- allocate(a, b, c, d, e, f) {
6784
- if (!this.pools.length) return new Matrix(a, b, c, d, e, f);
6785
- const m = this.pools.pop();
6786
- return m.a = a, m.b = b, m.c = c, m.d = d, m.e = e, m.f = f, m;
6787
- }
6788
- allocateByObj(matrix) {
6789
- if (!this.pools.length) return new Matrix(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f);
6790
- const m = this.pools.pop();
6791
- 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;
6792
- }
6793
- free(d) {
6794
- this.pools.push(d);
6795
- }
6796
- get length() {
6797
- return this.pools.length;
6798
- }
6799
- release() {
6800
- this.pools = [];
6801
- }
6802
- }
6803
- class DefaultMat4Allocate {
6804
- constructor() {
6805
- this.pools = [];
6806
- }
6807
- static identity(out) {
6808
- return identityMat4(out);
6809
- }
6810
- allocate() {
6811
- if (!this.pools.length) return createMat4();
6812
- const m = this.pools.pop();
6813
- return DefaultMat4Allocate.identity(m), m;
6814
- }
6815
- allocateByObj(d) {
6816
- let m;
6817
- m = this.pools.length ? this.pools.pop() : createMat4();
6818
- for (let i = 0; i < m.length; i++) m[i] = d[i];
6819
- return m;
6820
- }
6821
- free(m) {
6822
- m && this.pools.push(m);
6823
- }
6824
- get length() {
6825
- return this.pools.length;
6826
- }
6827
- release() {
6828
- this.pools = [];
6829
- }
6830
- }
6831
- const matrixAllocate = new DefaultMatrixAllocate();
6832
- const mat4Allocate = new DefaultMat4Allocate();
6833
-
6834
7449
  var __decorate$J = undefined && undefined.__decorate || function (decorators, target, key, desc) {
6835
7450
  var d,
6836
7451
  c = arguments.length,
@@ -7067,7 +7682,7 @@ class Circle extends Graphic {
7067
7682
  tb1: tb1,
7068
7683
  tb2: tb2
7069
7684
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
7070
- return updateBoundsOfCommonOuterBorder(attribute, circleTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), application.graphicService.transformAABBBounds(attribute, aabbBounds, circleTheme, !1, this), aabbBounds;
7685
+ return updateBoundsOfCommonOuterBorder(attribute, circleTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, circleTheme, !1, this), aabbBounds;
7071
7686
  }
7072
7687
  updateCircleAABBBoundsImprecise(attribute, circleTheme, aabbBounds) {
7073
7688
  const {
@@ -7091,12 +7706,13 @@ class Circle extends Graphic {
7091
7706
  }
7092
7707
  toCustomPath() {
7093
7708
  var _a, _b, _c;
7709
+ let path = super.toCustomPath();
7710
+ if (path) return path;
7094
7711
  const attribute = this.attribute,
7095
7712
  radius = null !== (_a = attribute.radius) && void 0 !== _a ? _a : this.getDefaultAttribute("radius"),
7096
7713
  startAngle = null !== (_b = attribute.startAngle) && void 0 !== _b ? _b : this.getDefaultAttribute("startAngle"),
7097
- endAngle = null !== (_c = attribute.endAngle) && void 0 !== _c ? _c : this.getDefaultAttribute("endAngle"),
7098
- path = new CustomPath2D();
7099
- return path.arc(0, 0, radius, startAngle, endAngle), path;
7714
+ endAngle = null !== (_c = attribute.endAngle) && void 0 !== _c ? _c : this.getDefaultAttribute("endAngle");
7715
+ return path = new CustomPath2D(), path.arc(0, 0, radius, startAngle, endAngle), path;
7100
7716
  }
7101
7717
  clone() {
7102
7718
  return new Circle(Object.assign({}, this.attribute));
@@ -7317,7 +7933,7 @@ class Text extends Graphic {
7317
7933
  const shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);
7318
7934
  boundStroke(tb1, shadowBlurHalfWidth, !0, strokeBoundsBuffer), aabbBounds.union(tb1);
7319
7935
  }
7320
- return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
7936
+ return application.graphicService.combindShadowAABBBounds(aabbBounds, this), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, transformBoundsWithMatrix(aabbBounds, aabbBounds, this.transMatrix), aabbBounds;
7321
7937
  }
7322
7938
  updateSingallineAABBBounds(text) {
7323
7939
  this.updateMultilineAABBBounds([text]);
@@ -7842,7 +8458,7 @@ let Symbol$1 = class Symbol extends Graphic {
7842
8458
  tb1: tb1,
7843
8459
  tb2: tb2
7844
8460
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
7845
- updateBoundsOfSymbolOuterBorder(attribute, symbolTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
8461
+ updateBoundsOfSymbolOuterBorder(attribute, symbolTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, this.x1WithoutTransform = aabbBounds.x1, this.y1WithoutTransform = aabbBounds.y1;
7846
8462
  const {
7847
8463
  lineJoin = symbolTheme.lineJoin
7848
8464
  } = attribute;
@@ -7914,7 +8530,7 @@ let Line$1 = class Line extends Graphic {
7914
8530
  return getTheme(this).line;
7915
8531
  }
7916
8532
  updateAABBBounds(attribute, lineTheme, aabbBounds) {
7917
- this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
8533
+ this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds) : this.updateLineAABBBoundsByPoints(attribute, lineTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
7918
8534
  const {
7919
8535
  lineJoin = lineTheme.lineJoin
7920
8536
  } = attribute;
@@ -7949,9 +8565,11 @@ let Line$1 = class Line extends Graphic {
7949
8565
  return super.needUpdateTag(key, LINE_UPDATE_TAG_KEY);
7950
8566
  }
7951
8567
  toCustomPath() {
7952
- const attribute = this.attribute,
7953
- path = new CustomPath2D(),
7954
- segments = attribute.segments,
8568
+ let path = super.toCustomPath();
8569
+ if (path) return path;
8570
+ const attribute = this.attribute;
8571
+ path = new CustomPath2D();
8572
+ const segments = attribute.segments,
7955
8573
  parsePoints = points => {
7956
8574
  if (points && points.length) {
7957
8575
  let isFirst = !0;
@@ -8030,7 +8648,7 @@ class Rect extends Graphic {
8030
8648
  tb1: tb1,
8031
8649
  tb2: tb2
8032
8650
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
8033
- return updateBoundsOfCommonOuterBorder(attribute, rectTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), application.graphicService.transformAABBBounds(attribute, aabbBounds, rectTheme, !1, this), aabbBounds;
8651
+ return updateBoundsOfCommonOuterBorder(attribute, rectTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, rectTheme, !1, this), aabbBounds;
8034
8652
  }
8035
8653
  needUpdateTags(keys) {
8036
8654
  return super.needUpdateTags(keys, RECT_UPDATE_TAG_KEY);
@@ -8039,15 +8657,16 @@ class Rect extends Graphic {
8039
8657
  return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
8040
8658
  }
8041
8659
  toCustomPath() {
8660
+ let path = super.toCustomPath();
8661
+ if (path) return path;
8042
8662
  const attribute = this.attribute,
8043
8663
  {
8044
8664
  x: x,
8045
8665
  y: y,
8046
8666
  width: width,
8047
8667
  height: height
8048
- } = normalizeRectAttributes(attribute),
8049
- path = new CustomPath2D();
8050
- return path.moveTo(x, y), path.rect(x, y, width, height), path;
8668
+ } = normalizeRectAttributes(attribute);
8669
+ return path = new CustomPath2D(), path.moveTo(x, y), path.rect(x, y, width, height), path;
8051
8670
  }
8052
8671
  clone() {
8053
8672
  return new Rect(Object.assign({}, this.attribute));
@@ -8427,7 +9046,7 @@ class Image extends Graphic {
8427
9046
  tb1: tb1,
8428
9047
  tb2: tb2
8429
9048
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
8430
- return updateBoundsOfCommonOuterBorder(attribute, imageTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), application.graphicService.transformAABBBounds(attribute, aabbBounds, imageTheme, !1, this), aabbBounds;
9049
+ return updateBoundsOfCommonOuterBorder(attribute, imageTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, imageTheme, !1, this), aabbBounds;
8431
9050
  }
8432
9051
  getDefaultAttribute(name) {
8433
9052
  return DefaultImageAttribute[name];
@@ -8770,7 +9389,7 @@ class RichText extends Graphic {
8770
9389
  maxWidth = richtextTheme.maxWidth,
8771
9390
  maxHeight = richtextTheme.maxHeight,
8772
9391
  textAlign = richtextTheme.textAlign,
8773
- verticalDirection = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : richtextTheme.verticalDirection,
9392
+ textBaseline = null !== (_b = null !== (_a = attribute.textBaseline) && void 0 !== _a ? _a : richtextTheme.textBaseline) && void 0 !== _b ? _b : "top",
8774
9393
  editOptions: editOptions
8775
9394
  } = attribute;
8776
9395
  if (width > 0 && height > 0) aabbBounds.set(0, 0, width, height);else {
@@ -8785,7 +9404,7 @@ class RichText extends Graphic {
8785
9404
  }
8786
9405
  editOptions && editOptions.keepHeightWhileEmpty && !aabbBounds.height() && !(null === (_c = attribute.textConfig) || void 0 === _c ? void 0 : _c.length) && (aabbBounds.y2 = aabbBounds.y1 + (null !== (_d = attribute.fontSize) && void 0 !== _d ? _d : 12), aabbBounds.x2 = aabbBounds.x1 + 2);
8787
9406
  let deltaY = 0;
8788
- switch (verticalDirection) {
9407
+ switch (textBaseline) {
8789
9408
  case "top":
8790
9409
  deltaY = 0;
8791
9410
  break;
@@ -8806,7 +9425,7 @@ class RichText extends Graphic {
8806
9425
  case "right":
8807
9426
  deltaX = -aabbBounds.width();
8808
9427
  }
8809
- return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
9428
+ return aabbBounds.translate(deltaX, deltaY), application.graphicService.updateTempAABBBounds(aabbBounds), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || application.graphicService.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1, application.graphicService.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, this), 0 === aabbBounds.width() && 0 === aabbBounds.height() && aabbBounds.clear(), aabbBounds;
8810
9429
  }
8811
9430
  needUpdateTags(keys) {
8812
9431
  return super.needUpdateTags(keys, RICHTEXT_UPDATE_TAG_KEY);
@@ -9024,7 +9643,7 @@ class Path extends Graphic {
9024
9643
  tb1: tb1,
9025
9644
  tb2: tb2
9026
9645
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
9027
- updateBoundsOfCommonOuterBorder(attribute, pathTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
9646
+ updateBoundsOfCommonOuterBorder(attribute, pathTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
9028
9647
  const {
9029
9648
  lineJoin = pathTheme.lineJoin
9030
9649
  } = attribute;
@@ -9081,7 +9700,7 @@ class Area extends Graphic {
9081
9700
  return getTheme(this).area;
9082
9701
  }
9083
9702
  updateAABBBounds(attribute, areaTheme, aabbBounds) {
9084
- this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds);
9703
+ this.updatePathProxyAABBBounds(aabbBounds) || (attribute.segments ? this.updateAreaAABBBoundsBySegments(attribute, areaTheme, aabbBounds) : this.updateAreaAABBBoundsByPoints(attribute, areaTheme, aabbBounds)), application.graphicService.updateTempAABBBounds(aabbBounds), this.setWidthHeightWithoutTransform(aabbBounds);
9085
9704
  const {
9086
9705
  lineJoin = areaTheme.lineJoin
9087
9706
  } = attribute;
@@ -9119,8 +9738,10 @@ class Area extends Graphic {
9119
9738
  return super.needUpdateTag(key, AREA_UPDATE_TAG_KEY);
9120
9739
  }
9121
9740
  toCustomPath() {
9122
- const path = new CustomPath2D(),
9123
- attribute = this.attribute,
9741
+ let path = super.toCustomPath();
9742
+ if (path) return path;
9743
+ path = new CustomPath2D();
9744
+ const attribute = this.attribute,
9124
9745
  segments = attribute.segments,
9125
9746
  parsePoints = points => {
9126
9747
  if (points && points.length) {
@@ -9286,7 +9907,7 @@ class Arc extends Graphic {
9286
9907
  tb1: tb1,
9287
9908
  tb2: tb2
9288
9909
  } = application.graphicService.updateTempAABBBounds(aabbBounds);
9289
- updateBoundsOfCommonOuterBorder(attribute, arcTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
9910
+ updateBoundsOfCommonOuterBorder(attribute, arcTheme, tb1), aabbBounds.union(tb1), tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2), this.setWidthHeightWithoutTransform(aabbBounds);
9290
9911
  const {
9291
9912
  lineJoin = arcTheme.lineJoin
9292
9913
  } = attribute;
@@ -9334,6 +9955,8 @@ class Arc extends Graphic {
9334
9955
  }
9335
9956
  toCustomPath() {
9336
9957
  var _a, _b, _c, _d;
9958
+ let path = super.toCustomPath();
9959
+ if (path) return path;
9337
9960
  const attribute = this.attribute,
9338
9961
  {
9339
9962
  startAngle: startAngle,
@@ -9347,8 +9970,7 @@ class Arc extends Graphic {
9347
9970
  const temp = outerRadius;
9348
9971
  outerRadius = innerRadius, innerRadius = temp;
9349
9972
  }
9350
- const path = new CustomPath2D();
9351
- 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 {
9973
+ 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 {
9352
9974
  const xors = outerRadius * cos(startAngle),
9353
9975
  yors = outerRadius * sin(startAngle),
9354
9976
  xire = innerRadius * cos(endAngle),
@@ -9389,7 +10011,7 @@ class Polygon extends Graphic {
9389
10011
  return getTheme(this).polygon;
9390
10012
  }
9391
10013
  updateAABBBounds(attribute, polygonTheme, aabbBounds) {
9392
- this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds);
10014
+ this.updatePathProxyAABBBounds(aabbBounds) || this.updatePolygonAABBBoundsImprecise(attribute, polygonTheme, aabbBounds), application.graphicService.updateTempAABBBounds(aabbBounds), this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
9393
10015
  const {
9394
10016
  lineJoin = polygonTheme.lineJoin
9395
10017
  } = attribute;
@@ -10735,7 +11357,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
10735
11357
  if (!cache) return;
10736
11358
  context.beginPath();
10737
11359
  const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
10738
- drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
11360
+ drawSegments(context, cache, clipRange, clipRangeByDimension, {
10739
11361
  offsetX: offsetX,
10740
11362
  offsetY: offsetY,
10741
11363
  offsetZ: z
@@ -11138,7 +11760,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11138
11760
  } else startP = points[0], endP = points[points.length - 1];
11139
11761
  const xTotalLength = abs(endP.x - startP.x),
11140
11762
  yTotalLength = abs(endP.y - startP.y);
11141
- direction = null == endP.x1 ? Direction.ROW : null == endP.y1 ? Direction.COLUMN : Number.isFinite(xTotalLength + yTotalLength) ? xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN : Direction.ROW, drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {
11763
+ direction = null == endP.x1 ? Direction.ROW : null == endP.y1 ? Direction.COLUMN : Number.isFinite(xTotalLength + yTotalLength) ? xTotalLength > yTotalLength ? Direction.ROW : Direction.COLUMN : Direction.ROW, drawAreaSegments(context, cache, clipRange, {
11142
11764
  offsetX: offsetX,
11143
11765
  offsetY: offsetY,
11144
11766
  offsetZ: offsetZ,
@@ -11157,7 +11779,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
11157
11779
  const {
11158
11780
  stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
11159
11781
  } = attribute;
11160
- isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction.ROW ? "x" : "y", {
11782
+ isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1] && (context.beginPath(), drawSegments(context, stroke[0] ? cache.top : cache.bottom, clipRange, direction === Direction.ROW ? "x" : "y", {
11161
11783
  offsetX: offsetX,
11162
11784
  offsetY: offsetY,
11163
11785
  offsetZ: offsetZ
@@ -13070,6 +13692,8 @@ const transformUtil = container.get(TransformUtil);
13070
13692
  application.transformUtil = transformUtil;
13071
13693
  const graphicService = container.get(GraphicService);
13072
13694
  application.graphicService = graphicService;
13695
+ const renderService = container.get(RenderService);
13696
+ application.renderService = renderService;
13073
13697
  const layerService = container.get(LayerService);
13074
13698
  application.layerService = layerService;
13075
13699
 
@@ -14323,6 +14947,13 @@ const SCROLLBAR_START_EVENT = 'scrollDown';
14323
14947
  const SCROLLBAR_EVENT = 'scrollDrag';
14324
14948
  const SCROLLBAR_END_EVENT = 'scrollUp';
14325
14949
 
14950
+ function getEndTriggersOfDrag() {
14951
+ if (vglobal.env === 'browser') {
14952
+ return ['pointerup', 'pointerleave', 'pointercancel'];
14953
+ }
14954
+ return ['pointerup', 'pointerleave', 'pointerupoutside'];
14955
+ }
14956
+
14326
14957
  const delayMap$2 = {
14327
14958
  debounce: debounce,
14328
14959
  throttle: throttle
@@ -14356,6 +14987,7 @@ class ScrollBar extends AbstractComponent {
14356
14987
  }
14357
14988
  };
14358
14989
  this._onSliderPointerDown = (e) => {
14990
+ this._clearDragEvents();
14359
14991
  const { stopSliderDownPropagation = true } = this.attribute;
14360
14992
  if (stopSliderDownPropagation) {
14361
14993
  e.stopPropagation();
@@ -14367,15 +14999,12 @@ class ScrollBar extends AbstractComponent {
14367
14999
  pos: this._prePos,
14368
15000
  event: e
14369
15001
  });
14370
- if (vglobal.env === 'browser') {
14371
- vglobal.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
14372
- vglobal.addEventListener('pointerup', this._onSliderPointerUp);
14373
- }
14374
- else {
14375
- this.stage.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
14376
- this.stage.addEventListener('pointerup', this._onSliderPointerUp);
14377
- this.stage.addEventListener('pointerupoutside', this._onSliderPointerUp);
14378
- }
15002
+ const triggers = getEndTriggersOfDrag();
15003
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
15004
+ obj.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: true });
15005
+ triggers.forEach((trigger) => {
15006
+ obj.addEventListener(trigger, this._onSliderPointerUp);
15007
+ });
14379
15008
  };
14380
15009
  this._computeScrollValue = (e) => {
14381
15010
  const { direction } = this.attribute;
@@ -14397,6 +15026,7 @@ class ScrollBar extends AbstractComponent {
14397
15026
  return [currentPos, currentScrollValue];
14398
15027
  };
14399
15028
  this._onSliderPointerMove = (e) => {
15029
+ e.preventDefault();
14400
15030
  const { stopSliderMovePropagation = true } = this.attribute;
14401
15031
  if (stopSliderMovePropagation) {
14402
15032
  e.stopPropagation();
@@ -14410,7 +15040,6 @@ class ScrollBar extends AbstractComponent {
14410
15040
  ? this._onSliderPointerMove
14411
15041
  : delayMap$2[this.attribute.delayType](this._onSliderPointerMove, this.attribute.delayTime);
14412
15042
  this._onSliderPointerUp = (e) => {
14413
- e.preventDefault();
14414
15043
  const { range: preRange, limitRange = [0, 1] } = this.attribute;
14415
15044
  const preScrollRange = this.getScrollRange();
14416
15045
  const [currentPos, currentScrollValue] = this._computeScrollValue(e);
@@ -14419,15 +15048,7 @@ class ScrollBar extends AbstractComponent {
14419
15048
  pre: preRange,
14420
15049
  value: clampRange(range, limitRange[0], limitRange[1])
14421
15050
  });
14422
- if (vglobal.env === 'browser') {
14423
- vglobal.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
14424
- vglobal.removeEventListener('pointerup', this._onSliderPointerUp);
14425
- }
14426
- else {
14427
- this.stage.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
14428
- this.stage.removeEventListener('pointerup', this._onSliderPointerUp);
14429
- this.stage.removeEventListener('pointerupoutside', this._onSliderPointerUp);
14430
- }
15051
+ this._clearDragEvents();
14431
15052
  };
14432
15053
  }
14433
15054
  setScrollRange(range, render = true) {
@@ -14560,6 +15181,14 @@ class ScrollBar extends AbstractComponent {
14560
15181
  ? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)
14561
15182
  : clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);
14562
15183
  }
15184
+ _clearDragEvents() {
15185
+ const triggers = getEndTriggersOfDrag();
15186
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
15187
+ obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true, passive: false });
15188
+ triggers.forEach((trigger) => {
15189
+ obj.removeEventListener(trigger, this._onSliderPointerUp);
15190
+ });
15191
+ }
14563
15192
  _reset() {
14564
15193
  this._sliderRenderBounds = null;
14565
15194
  this._sliderLimitRange = null;
@@ -16861,24 +17490,17 @@ function getPolygonPath(points, closed) {
16861
17490
  }
16862
17491
  function textIntersect(textA, textB, sep) {
16863
17492
  var _a;
16864
- let a;
16865
- let b;
16866
17493
  const angle = (_a = textA.attribute) === null || _a === void 0 ? void 0 : _a.angle;
16867
17494
  const isHorizontal = isAngleHorizontal(angle, Number.EPSILON);
16868
- const isAABBIntersects = (textA, textB, sep) => {
16869
- a = textA.AABBBounds;
16870
- b = textB.AABBBounds;
16871
- return sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2);
16872
- };
16873
17495
  if (isHorizontal) {
16874
- return isAABBIntersects(textA, textB, sep);
17496
+ return sep > aabbSeparation(textA.AABBBounds, textB.AABBBounds);
16875
17497
  }
16876
- a = textA.OBBBounds;
16877
- b = textB.OBBBounds;
17498
+ const a = textA.OBBBounds;
17499
+ const b = textB.OBBBounds;
16878
17500
  if (!a || !b || a.empty() || b.empty()) {
16879
- return isAABBIntersects(textA, textB, sep);
17501
+ return sep > aabbSeparation(textA.AABBBounds, textB.AABBBounds);
16880
17502
  }
16881
- return a.intersects(b);
17503
+ return a.intersects(b) || sep > obbSeparation(a, b);
16882
17504
  }
16883
17505
  function hasOverlap(items, pad) {
16884
17506
  for (let i = 1, n = items.length, a = items[0], b; i < n; a = b, ++i) {
@@ -18416,7 +19038,7 @@ class Animate {
18416
19038
  stop(type) {
18417
19039
  let step = this._firstStep;
18418
19040
  for (; step;) step.stop(), step = step.next;
18419
- this.status = AnimateStatus.END, this.onEnd(), this.target && ("start" === type ? this.target.setAttributes(this._startProps) : "end" === type ? this.target.setAttributes(this._endProps) : type && this.target.setAttributes(type));
19041
+ this.status !== AnimateStatus.END && this.onEnd(), this.status = AnimateStatus.END, this.target && ("start" === type ? this.target.setAttributes(this._startProps) : "end" === type ? this.target.setAttributes(this._endProps) : type && this.target.setAttributes(type));
18420
19042
  }
18421
19043
  release() {
18422
19044
  this.status = AnimateStatus.END, this._onRemove && this._onRemove.forEach(cb => cb()), this._onStart = [], this._onFrame = [], this._onEnd = [], this._onRemove = [];
@@ -18523,19 +19145,25 @@ class AnimateExecutor {
18523
19145
  var _a, _b;
18524
19146
  const totalTime = this.resolveValue(params.totalTime, void 0, void 0),
18525
19147
  startTime = this.resolveValue(params.startTime, void 0, 0),
18526
- parsedParams = cloneDeep(params);
19148
+ parsedParams = Object.assign({}, params);
18527
19149
  parsedParams.oneByOneDelay = 0, parsedParams.startTime = startTime, parsedParams.totalTime = totalTime;
18528
19150
  const oneByOne = this.resolveValue(params.oneByOne, child, !1);
18529
19151
  if (isTimeline) {
18530
19152
  const timeSlices = parsedParams.timeSlices;
18531
19153
  isArray(timeSlices) || (parsedParams.timeSlices = [timeSlices]);
18532
19154
  let sliceTime = 0;
18533
- parsedParams.timeSlices.forEach(slice => {
18534
- slice.delay = this.resolveValue(slice.delay, child, 0), slice.delayAfter = this.resolveValue(slice.delayAfter, child, 0), slice.duration = this.resolveValue(slice.duration, child, 300), sliceTime += slice.delay + slice.duration + slice.delayAfter;
19155
+ parsedParams.timeSlices = parsedParams.timeSlices.map(slice => {
19156
+ const delay = this.resolveValue(slice.delay, child, 0),
19157
+ delayAfter = this.resolveValue(slice.delayAfter, child, 0),
19158
+ duration = this.resolveValue(slice.duration, child, 300);
19159
+ return sliceTime += delay + duration + delayAfter, Object.assign(Object.assign({}, slice), {
19160
+ delay: delay,
19161
+ delayAfter: delayAfter,
19162
+ duration: duration
19163
+ });
18535
19164
  });
18536
- let oneByOneDelay = 0,
18537
- oneByOneTime = 0;
18538
- oneByOne && (oneByOneTime = Number(oneByOne), oneByOneDelay = oneByOneTime), parsedParams.oneByOne = oneByOneTime, parsedParams.oneByOneDelay = oneByOneDelay;
19165
+ let oneByOneDelay = 0;
19166
+ oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? sliceTime : 0), parsedParams.oneByOneDelay = oneByOneDelay;
18539
19167
  let scale = 1;
18540
19168
  if (totalTime) {
18541
19169
  const _totalTime = sliceTime + oneByOneDelay * (this._target.count - 2);
@@ -18557,19 +19185,18 @@ class AnimateExecutor {
18557
19185
  });
18558
19186
  })
18559
19187
  });
18560
- }), parsedParams.oneByOne = oneByOneTime * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime * scale;
19188
+ }), parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime * scale;
18561
19189
  } else {
18562
19190
  const delay = this.resolveValue(params.delay, child, 0),
18563
19191
  delayAfter = this.resolveValue(params.delayAfter, child, 0),
18564
19192
  duration = this.resolveValue(params.duration, child, 300);
18565
- let oneByOneDelay = 0,
18566
- oneByOneTime = 0;
18567
- oneByOne && (oneByOneTime = Number(oneByOne), oneByOneDelay = duration + oneByOneTime), parsedParams.oneByOne = oneByOneTime, parsedParams.oneByOneDelay = oneByOneDelay, parsedParams.custom = null !== (_a = params.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = params.type) && void 0 !== _b ? _b : "fromTo"];
19193
+ let oneByOneDelay = 0;
19194
+ oneByOne && (oneByOneDelay = "number" == typeof oneByOne ? oneByOne : oneByOne ? delay + delayAfter + duration : 0), parsedParams.oneByOneDelay = oneByOneDelay, parsedParams.custom = null !== (_a = params.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[null !== (_b = params.type) && void 0 !== _b ? _b : "fromTo"];
18568
19195
  const customType = parsedParams.custom && isFunction(parsedParams.custom) ? /^class\s/.test(Function.prototype.toString.call(parsedParams.custom)) ? 1 : 2 : 0;
18569
19196
  if (parsedParams.customType = customType, totalTime) {
18570
19197
  const _totalTime = delay + delayAfter + duration + oneByOneDelay * (this._target.count - 2),
18571
19198
  scale = totalTime ? totalTime / _totalTime : 1;
18572
- parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.oneByOne = oneByOneTime * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime;
19199
+ parsedParams.delay = delay * scale, parsedParams.delayAfter = delayAfter * scale, parsedParams.duration = duration * scale, parsedParams.oneByOneDelay = oneByOneDelay * scale, parsedParams.startTime = startTime;
18573
19200
  }
18574
19201
  }
18575
19202
  return parsedParams;
@@ -18661,10 +19288,10 @@ class AnimateExecutor {
18661
19288
  const animate = graphic.animate();
18662
19289
  animate.priority = priority, animate.startAt(startTime), animate.wait(index * oneByOneDelay), loop && loop > 0 && animate.loop(loop), bounce && animate.bounce(!0);
18663
19290
  return (Array.isArray(timeSlices) ? timeSlices : [timeSlices]).forEach(slice => {
18664
- this.applyTimeSliceToAnimate(slice, animate, graphic);
19291
+ this.applyTimeSliceToAnimate(slice, animate, graphic, controlOptions);
18665
19292
  }), oneByOneDelay && animate.wait(oneByOneDelay * (count - index - 1)), animate;
18666
19293
  }
18667
- applyTimeSliceToAnimate(slice, animate, graphic) {
19294
+ applyTimeSliceToAnimate(slice, animate, graphic, controlOptions) {
18668
19295
  var _a, _b, _c, _d;
18669
19296
  const {
18670
19297
  effects: effects,
@@ -18690,7 +19317,7 @@ class AnimateExecutor {
18690
19317
  props || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), props = parsedFromProps.props), from || (parsedFromProps || (parsedFromProps = this.createPropsFromChannel(channel, graphic)), from = parsedFromProps.from);
18691
19318
  const custom = null !== (_a = effect.custom) && void 0 !== _a ? _a : AnimateExecutor.builtInAnimateMap[type],
18692
19319
  customType = effect.customType;
18693
- this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, null, options, type, graphic);
19320
+ this._handleRunAnimate(animate, custom, customType, from, props, duration, easing, customParameters, controlOptions, options, type, graphic);
18694
19321
  }), delayAfterValue > 0 && animate.wait(delayAfterValue);
18695
19322
  }
18696
19323
  createCustomInterpolatorAnimation(animate, interpolator, props, duration, easing, customParams) {
@@ -18834,9 +19461,9 @@ class AxisEnter extends AComponentAnimate {
18834
19461
  const easing = this.easing;
18835
19462
  const { config, lastScale, getTickCoord } = this.params;
18836
19463
  let ratio = 1;
18837
- if (lastScale && getTickCoord) {
19464
+ const currData = this.target.data;
19465
+ if (lastScale && getTickCoord && currData) {
18838
19466
  ratio = 0.7;
18839
- const currData = this.target.data;
18840
19467
  const oldValue = lastScale.scale(currData.rawValue);
18841
19468
  const point = getTickCoord(oldValue);
18842
19469
  const newX = this.target.attribute.x;
@@ -18860,14 +19487,13 @@ class AxisEnter extends AComponentAnimate {
18860
19487
  }
18861
19488
  class AxisUpdate extends AComponentAnimate {
18862
19489
  onBind() {
18863
- var _a;
18864
19490
  const animator = createComponentAnimator(this.target);
18865
19491
  this._animator = animator;
18866
19492
  const duration = this.duration;
18867
19493
  const easing = this.easing;
18868
19494
  const { config, diffAttrs } = this.params;
18869
19495
  animator.animate(this.target, {
18870
- type: (_a = config.type) !== null && _a !== void 0 ? _a : 'to',
19496
+ type: 'to',
18871
19497
  to: Object.assign({}, diffAttrs),
18872
19498
  duration,
18873
19499
  easing,
@@ -21324,6 +21950,13 @@ class LabelBase extends AnimateComponent {
21324
21950
  if (isNil(this._idToGraphic) || (this._isCollectionBase && isNil(this._idToPoint))) {
21325
21951
  return;
21326
21952
  }
21953
+ const markAttributeList = [];
21954
+ if (this._enableAnimation !== false) {
21955
+ this._baseMarks.forEach(mark => {
21956
+ markAttributeList.push(mark.attribute);
21957
+ mark.initAttributes(mark.getAttributes(true));
21958
+ });
21959
+ }
21327
21960
  const { overlap, smartInvert, dataFilter, customLayoutFunc, customOverlapFunc } = this.attribute;
21328
21961
  let data = this.attribute.data;
21329
21962
  if (isFunction(dataFilter)) {
@@ -21361,6 +21994,11 @@ class LabelBase extends AnimateComponent {
21361
21994
  this._smartInvert(labels);
21362
21995
  }
21363
21996
  this._renderLabels(labels);
21997
+ if (this._enableAnimation !== false) {
21998
+ this._baseMarks.forEach((mark, index) => {
21999
+ mark.initAttributes(markAttributeList[index]);
22000
+ });
22001
+ }
21364
22002
  }
21365
22003
  _bindEvent(target) {
21366
22004
  if (this.attribute.disableTriggerEvent) {
@@ -21703,8 +22341,14 @@ class LabelBase extends AnimateComponent {
21703
22341
  return this.getRootNode().find(node => node.name === baseMarkGroupName, true);
21704
22342
  }
21705
22343
  getGraphicBounds(graphic, point = {}, position) {
22344
+ var _a;
21706
22345
  if (graphic) {
21707
22346
  if (graphic.attribute.visible !== false) {
22347
+ if ((_a = graphic.context) === null || _a === void 0 ? void 0 : _a.animationState) {
22348
+ const clonedGraphic = graphic.clone();
22349
+ Object.assign(clonedGraphic.attribute, graphic.getAttributes(true));
22350
+ return clonedGraphic.AABBBounds;
22351
+ }
21708
22352
  return graphic.AABBBounds;
21709
22353
  }
21710
22354
  const { x, y } = graphic.attribute;
@@ -21770,7 +22414,7 @@ class LabelBase extends AnimateComponent {
21770
22414
  animation: Object.assign(Object.assign({}, enter), { type: 'labelEnter', selfOnly: true, customParameters: {
21771
22415
  relatedGraphic,
21772
22416
  relatedGraphics: this._idToGraphic,
21773
- config: Object.assign(Object.assign({}, enter), { type: item === text ? enter.type : 'clipIn' })
22417
+ config: Object.assign(Object.assign({}, enter), { type: item === text ? enter.type : 'fadeIn' })
21774
22418
  } })
21775
22419
  }
21776
22420
  ]));
@@ -23533,8 +24177,13 @@ class DataZoom extends AbstractComponent {
23533
24177
  end: 1
23534
24178
  };
23535
24179
  this._statePointToData = state => state;
24180
+ this._handleTouchMove = (e) => {
24181
+ if (this._activeState) {
24182
+ e.preventDefault();
24183
+ }
24184
+ };
23536
24185
  this._onHandlerPointerDown = (e, tag) => {
23537
- e.stopPropagation();
24186
+ this._clearDragEvents();
23538
24187
  if (tag === 'start') {
23539
24188
  this._activeTag = DataZoomActiveTag.startHandler;
23540
24189
  this._activeItem = this._startHandlerMask;
@@ -23558,14 +24207,16 @@ class DataZoom extends AbstractComponent {
23558
24207
  this._activeState = true;
23559
24208
  this._activeCache.startPos = this.eventPosToStagePos(e);
23560
24209
  this._activeCache.lastPos = this.eventPosToStagePos(e);
23561
- if (vglobal.env === 'browser') {
23562
- vglobal.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23563
- vglobal.addEventListener('pointerup', this._onHandlerPointerUp);
23564
- }
24210
+ const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
24211
+ const triggers = getEndTriggersOfDrag();
24212
+ evtTarget.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23565
24213
  this.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
24214
+ triggers.forEach((trigger) => {
24215
+ evtTarget.addEventListener(trigger, this._onHandlerPointerUp);
24216
+ });
23566
24217
  };
23567
24218
  this._pointerMove = (e) => {
23568
- e.stopPropagation();
24219
+ e.preventDefault();
23569
24220
  const { start: startAttr, end: endAttr, brushSelect, realTime = true } = this.attribute;
23570
24221
  const pos = this.eventPosToStagePos(e);
23571
24222
  const { attPos, max } = this._layoutCache;
@@ -23615,7 +24266,6 @@ class DataZoom extends AbstractComponent {
23615
24266
  ? this._pointerMove
23616
24267
  : delayMap$1[this.attribute.delayType](this._pointerMove, this.attribute.delayTime);
23617
24268
  this._onHandlerPointerUp = (e) => {
23618
- e.preventDefault();
23619
24269
  const { start, end, brushSelect, realTime = true } = this.attribute;
23620
24270
  if (this._activeState) {
23621
24271
  if (this._activeTag === DataZoomActiveTag.background) {
@@ -23630,12 +24280,7 @@ class DataZoom extends AbstractComponent {
23630
24280
  end: this.state.end,
23631
24281
  tag: this._activeTag
23632
24282
  });
23633
- if (vglobal.env === 'browser') {
23634
- vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23635
- vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
23636
- }
23637
- this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
23638
- this.removeEventListener('pointerup', this._onHandlerPointerUp);
24283
+ this._clearDragEvents();
23639
24284
  };
23640
24285
  const { position, showDetail } = attributes;
23641
24286
  this._activeCache.startPos = position;
@@ -23683,12 +24328,13 @@ class DataZoom extends AbstractComponent {
23683
24328
  if (this._selectedPreviewGroup) {
23684
24329
  this._selectedPreviewGroup.addEventListener('pointerdown', (e) => this._onHandlerPointerDown(e, selectedTag));
23685
24330
  }
23686
- this.addEventListener('pointerup', this._onHandlerPointerUp);
23687
- this.addEventListener('pointerupoutside', this._onHandlerPointerUp);
23688
24331
  if (showDetail === 'auto') {
23689
24332
  this.addEventListener('pointerenter', this._onHandlerPointerEnter);
23690
24333
  this.addEventListener('pointerleave', this._onHandlerPointerLeave);
23691
24334
  }
24335
+ (vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
24336
+ passive: false
24337
+ });
23692
24338
  }
23693
24339
  dragMaskSize() {
23694
24340
  const { position } = this.attribute;
@@ -23716,13 +24362,20 @@ class DataZoom extends AbstractComponent {
23716
24362
  var _a, _b;
23717
24363
  return (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventPointTransform(e)) !== null && _b !== void 0 ? _b : { x: 0, y: 0 };
23718
24364
  }
24365
+ _clearDragEvents() {
24366
+ const evtTarget = vglobal.env === 'browser' ? vglobal : this.stage;
24367
+ const triggers = getEndTriggersOfDrag();
24368
+ evtTarget.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
24369
+ triggers.forEach((trigger) => {
24370
+ evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
24371
+ });
24372
+ this.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
24373
+ }
23719
24374
  _onHandlerPointerEnter(e) {
23720
- e.stopPropagation();
23721
24375
  this._showText = true;
23722
24376
  this.renderText();
23723
24377
  }
23724
24378
  _onHandlerPointerLeave(e) {
23725
- e.stopPropagation();
23726
24379
  this._showText = false;
23727
24380
  this.renderText();
23728
24381
  }
@@ -24232,6 +24885,13 @@ class DataZoom extends AbstractComponent {
24232
24885
  setStatePointToData(callback) {
24233
24886
  isFunction(callback) && (this._statePointToData = callback);
24234
24887
  }
24888
+ release(all) {
24889
+ super.release(all);
24890
+ (vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
24891
+ passive: false
24892
+ });
24893
+ this._clearDragEvents();
24894
+ }
24235
24895
  }
24236
24896
  DataZoom.defaultAttributes = DEFAULT_DATA_ZOOM_ATTRIBUTES;
24237
24897
 
@@ -24521,21 +25181,30 @@ function commonLineClipIn(line, label, duration, delay, easing) {
24521
25181
  .to({ clipRange: 1 }, stepDuration, easing);
24522
25182
  });
24523
25183
  graphicFadeIn(line.endSymbol, delay + startSymbolDuration + lineDuration, endSymbolDuration, easing);
24524
- graphicFadeIn(label.getTextShape(), delay + startSymbolDuration + lineDuration + endSymbolDuration, labelDuration, easing);
24525
- graphicFadeIn(label.getBgRect(), delay + startSymbolDuration + lineDuration + endSymbolDuration, labelDuration, easing);
25184
+ array(label).forEach(labelNode => {
25185
+ const delayTime = delay + startSymbolDuration + lineDuration + endSymbolDuration;
25186
+ graphicFadeIn(labelNode.getTextShape(), delayTime, labelDuration, easing);
25187
+ graphicFadeIn(labelNode.getBgRect(), delayTime, labelDuration, easing);
25188
+ });
24526
25189
  }
24527
25190
 
24528
25191
  function commonLineFadeIn(line, label, duration, delay, easing) {
24529
25192
  segmentFadeIn(line, delay, duration, easing);
24530
- tagFadeIn(label, delay, duration, easing);
25193
+ array(label).forEach(labelNode => {
25194
+ tagFadeIn(labelNode, delay, duration, easing);
25195
+ });
24531
25196
  }
24532
25197
  function areaFadeIn(area, label, duration, delay, easing) {
24533
25198
  graphicFadeIn(area, delay, duration, easing);
24534
- tagFadeIn(label, delay, duration, easing);
25199
+ array(label).forEach(labelNode => {
25200
+ tagFadeIn(labelNode, delay, duration, easing);
25201
+ });
24535
25202
  }
24536
25203
  function arcAreaFadeIn(area, label, duration, delay, easing) {
24537
25204
  graphicFadeIn(area, delay, duration, easing);
24538
- tagFadeIn(label, delay, duration, easing);
25205
+ array(label).forEach(labelNode => {
25206
+ tagFadeIn(labelNode, delay, duration, easing);
25207
+ });
24539
25208
  }
24540
25209
  function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
24541
25210
  var _a;
@@ -24551,15 +25220,21 @@ function pointFadeIn(itemLine, decorativeLine, item, duration, delay, easing) {
24551
25220
 
24552
25221
  function commonLineFadeOut(line, label, duration, delay, easing) {
24553
25222
  segmentFadeOut(line, delay, duration, easing);
24554
- tagFadeOut(label, delay, duration, easing);
25223
+ array(label).forEach(labelNode => {
25224
+ tagFadeOut(labelNode, delay, duration, easing);
25225
+ });
24555
25226
  }
24556
25227
  function areaFadeOut(area, label, duration, delay, easing) {
24557
25228
  graphicFadeOut(area, delay, duration, easing);
24558
- tagFadeOut(label, delay, duration, easing);
25229
+ array(label).forEach(labelNode => {
25230
+ tagFadeOut(labelNode, delay, duration, easing);
25231
+ });
24559
25232
  }
24560
25233
  function arcAreaFadeOut(area, label, duration, delay, easing) {
24561
25234
  graphicFadeOut(area, delay, duration, easing);
24562
- tagFadeOut(label, delay, duration, easing);
25235
+ array(label).forEach(labelNode => {
25236
+ tagFadeOut(labelNode, delay, duration, easing);
25237
+ });
24563
25238
  }
24564
25239
  function pointFadeOut(itemLine, decorativeLine, item, duration, delay, easing) {
24565
25240
  var _a;
@@ -24713,6 +25388,48 @@ const DefaultExitMarkerAnimation = {
24713
25388
  delay: 0
24714
25389
  };
24715
25390
 
25391
+ class MarkLabelMixin {
25392
+ getLabel() {
25393
+ return this._label;
25394
+ }
25395
+ _addMarkLabels(container, labelName, defaultLabelAttrs) {
25396
+ const { label, state } = this.attribute;
25397
+ const labelStates = array(state === null || state === void 0 ? void 0 : state.label);
25398
+ const labelBackgroundStates = array(state === null || state === void 0 ? void 0 : state.labelBackground);
25399
+ const labelShapes = array(label).map((labelAttrs, index) => {
25400
+ var _a, _b;
25401
+ const finalLabelAttrs = merge({}, defaultLabelAttrs, labelAttrs);
25402
+ const markLabel = new Tag(Object.assign(Object.assign({}, finalLabelAttrs), { state: {
25403
+ panel: merge({}, DEFAULT_STATES$2, (_a = labelBackgroundStates[index]) !== null && _a !== void 0 ? _a : last(labelBackgroundStates)),
25404
+ text: merge({}, DEFAULT_STATES$2, (_b = labelStates[index]) !== null && _b !== void 0 ? _b : last(labelStates))
25405
+ } }));
25406
+ markLabel.name = labelName;
25407
+ container.add(markLabel);
25408
+ this.setLabelPos(markLabel, finalLabelAttrs);
25409
+ return markLabel;
25410
+ });
25411
+ this._label = array(labelShapes).length === 1 ? labelShapes[0] : labelShapes;
25412
+ }
25413
+ _updateMarkLabels(defaultLabelAttrs) {
25414
+ const { label, state } = this.attribute;
25415
+ const labelShapes = array(this._label);
25416
+ const labelStates = array(state === null || state === void 0 ? void 0 : state.label);
25417
+ const labelBackgroundStates = array(state === null || state === void 0 ? void 0 : state.labelBackground);
25418
+ if (labelShapes.length) {
25419
+ const labels = array(label);
25420
+ labelShapes.forEach((labelItem, index) => {
25421
+ var _a, _b;
25422
+ const finalLabelAttrs = merge({}, defaultLabelAttrs, labels[index]);
25423
+ labelItem.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, finalLabelAttrs), { state: {
25424
+ panel: merge({}, DEFAULT_STATES$2, (_a = labelBackgroundStates[index]) !== null && _a !== void 0 ? _a : last(labelBackgroundStates)),
25425
+ text: merge({}, DEFAULT_STATES$2, (_b = labelStates[index]) !== null && _b !== void 0 ? _b : last(labelStates))
25426
+ } }));
25427
+ this.setLabelPos(labelItem, finalLabelAttrs);
25428
+ });
25429
+ }
25430
+ }
25431
+ }
25432
+
24716
25433
  class MarkCommonLine extends Marker {
24717
25434
  constructor() {
24718
25435
  super(...arguments);
@@ -24723,20 +25440,17 @@ class MarkCommonLine extends Marker {
24723
25440
  getLine() {
24724
25441
  return this._line;
24725
25442
  }
24726
- getLabel() {
24727
- return this._label;
24728
- }
24729
- setLabelPos() {
24730
- const { label = {}, limitRect } = this.attribute;
24731
- const { position, confine, autoRotate } = label;
24732
- const labelPoint = this.getPointAttrByPosition(position);
25443
+ setLabelPos(labelNode, labelAttrs) {
25444
+ const { limitRect } = this.attribute;
25445
+ const { position, confine, autoRotate } = labelAttrs;
25446
+ const labelPoint = this.getPointAttrByPosition(position, labelAttrs);
24733
25447
  const labelAngle = position.toString().toLocaleLowerCase().includes('start')
24734
25448
  ? this._line.getStartAngle() || 0
24735
25449
  : this._line.getEndAngle() || 0;
24736
- this._label.setAttributes(Object.assign(Object.assign({}, labelPoint.position), { angle: autoRotate ? this.getRotateByAngle(labelPoint.angle) : 0, textStyle: Object.assign(Object.assign({}, this.getTextStyle(position, labelAngle, autoRotate)), label.textStyle) }));
25450
+ labelNode.setAttributes(Object.assign(Object.assign({}, labelPoint.position), { angle: autoRotate ? this.getRotateByAngle(labelPoint.angle, labelAttrs) : 0, textStyle: Object.assign(Object.assign({}, this.getTextStyle(position, labelAngle, autoRotate)), labelAttrs.textStyle) }));
24737
25451
  if (limitRect && confine) {
24738
25452
  const { x, y, width, height } = limitRect;
24739
- limitShapeInBounds(this._label, {
25453
+ limitShapeInBounds(labelNode, {
24740
25454
  x1: x,
24741
25455
  y1: y,
24742
25456
  x2: x + width,
@@ -24745,32 +25459,18 @@ class MarkCommonLine extends Marker {
24745
25459
  }
24746
25460
  }
24747
25461
  initMarker(container) {
24748
- const { label, state } = this.attribute;
24749
25462
  const line = this.createSegment();
24750
25463
  line.name = 'mark-common-line-line';
24751
25464
  this._line = line;
24752
25465
  container.add(line);
24753
- const markLabel = new Tag(Object.assign(Object.assign({}, label), { state: {
24754
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
24755
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
24756
- } }));
24757
- markLabel.name = 'mark-common-line-label';
24758
- this._label = markLabel;
24759
- container.add(markLabel);
24760
- this.setLabelPos();
25466
+ this.addMarkLineLabels(container);
24761
25467
  }
24762
25468
  updateMarker() {
24763
- const { label, state } = this.attribute;
24764
25469
  this.setLineAttributes();
24765
- if (this._label) {
24766
- this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
24767
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
24768
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
24769
- } }));
24770
- this.setLabelPos();
24771
- }
25470
+ this.updateMarkLineLabels();
24772
25471
  }
24773
25472
  }
25473
+ mixin(MarkCommonLine, MarkLabelMixin);
24774
25474
 
24775
25475
  const FUZZY_EQUAL_DELTA = 0.001;
24776
25476
  const DEFAULT_MARK_LINE_THEME = {
@@ -24959,6 +25659,7 @@ const DEFAULT_MARK_ARC_LINE_THEME = {
24959
25659
  lineWidth: 0
24960
25660
  },
24961
25661
  label: {
25662
+ autoRotate: true,
24962
25663
  position: IMarkCommonArcLabelPosition.arcOuterMiddle,
24963
25664
  refX: 0,
24964
25665
  refY: 0,
@@ -25013,6 +25714,7 @@ const DEFAULT_MARK_AREA_THEME = {
25013
25714
  const DEFAULT_MARK_ARC_AREA_THEME = {
25014
25715
  interactive: true,
25015
25716
  label: {
25717
+ autoRotate: true,
25016
25718
  position: IMarkCommonArcLabelPosition.arcOuterMiddle,
25017
25719
  textStyle: {
25018
25720
  fill: '#fff',
@@ -25271,10 +25973,9 @@ class MarkLine extends MarkCommonLine {
25271
25973
  super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkLine.defaultAttributes, attributes));
25272
25974
  this.name = 'markLine';
25273
25975
  }
25274
- getPointAttrByPosition(position) {
25976
+ getPointAttrByPosition(position, labelAttrs) {
25275
25977
  var _a;
25276
- const { label = {} } = this.attribute;
25277
- const { refX = 0, refY = 0 } = label;
25978
+ const { refX = 0, refY = 0 } = labelAttrs;
25278
25979
  const points = this._line.getMainSegmentPoints();
25279
25980
  const lineEndAngle = (_a = this._line.getEndAngle()) !== null && _a !== void 0 ? _a : 0;
25280
25981
  const labelAngle = isPostiveXAxis(lineEndAngle) ? lineEndAngle : lineEndAngle;
@@ -25306,10 +26007,10 @@ class MarkLine extends MarkCommonLine {
25306
26007
  angle: labelAngle
25307
26008
  };
25308
26009
  }
25309
- getRotateByAngle(angle) {
26010
+ getRotateByAngle(angle, labelAttrs) {
25310
26011
  var _a;
25311
26012
  const itemAngle = isPostiveXAxis(angle) ? angle : angle - Math.PI;
25312
- return itemAngle + ((_a = this.attribute.label.refAngle) !== null && _a !== void 0 ? _a : 0);
26013
+ return itemAngle + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0);
25313
26014
  }
25314
26015
  getTextStyle(position, labelAngle, autoRotate) {
25315
26016
  if (fuzzyEqualNumber(Math.abs(labelAngle), Math.PI / 2, FUZZY_EQUAL_DELTA) ||
@@ -25380,6 +26081,12 @@ class MarkLine extends MarkCommonLine {
25380
26081
  });
25381
26082
  return validFlag;
25382
26083
  }
26084
+ addMarkLineLabels(container) {
26085
+ this._addMarkLabels(container, 'mark-common-line-label', MarkLine.defaultAttributes.label);
26086
+ }
26087
+ updateMarkLineLabels() {
26088
+ this._updateMarkLabels(MarkLine.defaultAttributes.label);
26089
+ }
25383
26090
  }
25384
26091
  MarkLine.defaultAttributes = DEFAULT_MARK_LINE_THEME;
25385
26092
 
@@ -25396,9 +26103,6 @@ class MarkArea extends Marker {
25396
26103
  getArea() {
25397
26104
  return this._area;
25398
26105
  }
25399
- getLabel() {
25400
- return this._label;
25401
- }
25402
26106
  constructor(attributes, options) {
25403
26107
  super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArea.defaultAttributes, attributes));
25404
26108
  this.name = 'markArea';
@@ -25425,16 +26129,15 @@ class MarkArea extends Marker {
25425
26129
  }
25426
26130
  return result;
25427
26131
  }
25428
- setLabelPos() {
26132
+ setLabelPos(labelNode, labelAttrs) {
25429
26133
  var _a;
25430
- if (this._label && this._area) {
25431
- const { label = {} } = this.attribute;
25432
- const labelPosition = (_a = label.position) !== null && _a !== void 0 ? _a : 'middle';
26134
+ if (this._area) {
26135
+ const labelPosition = (_a = labelAttrs.position) !== null && _a !== void 0 ? _a : 'middle';
25433
26136
  const labelPoint = this.getPointAttrByPosition(labelPosition);
25434
- this._label.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), label.textStyle) }));
25435
- if (this.attribute.limitRect && label.confine) {
26137
+ labelNode.setAttributes(Object.assign(Object.assign({}, labelPoint), { textStyle: Object.assign(Object.assign({}, DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP[labelPosition]), labelAttrs.textStyle) }));
26138
+ if (this.attribute.limitRect && labelAttrs.confine) {
25436
26139
  const { x, y, width, height } = this.attribute.limitRect;
25437
- limitShapeInBounds(this._label, {
26140
+ limitShapeInBounds(labelNode, {
25438
26141
  x1: x,
25439
26142
  y1: y,
25440
26143
  x2: x + width,
@@ -25444,34 +26147,21 @@ class MarkArea extends Marker {
25444
26147
  }
25445
26148
  }
25446
26149
  initMarker(container) {
25447
- const { points, label, areaStyle, state } = this.attribute;
26150
+ const { points, areaStyle, state } = this.attribute;
25448
26151
  const area = graphicCreator.polygon(Object.assign({ points: points }, areaStyle));
25449
26152
  area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
25450
26153
  area.name = 'mark-area-polygon';
25451
26154
  this._area = area;
25452
26155
  container.add(area);
25453
- const markLabel = new Tag(Object.assign(Object.assign({}, label), { state: {
25454
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
25455
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
25456
- } }));
25457
- markLabel.name = 'mark-area-label';
25458
- this._label = markLabel;
25459
- container.add(markLabel);
25460
- this.setLabelPos();
26156
+ this._addMarkLabels(container, 'mark-area-label', MarkArea.defaultAttributes.label);
25461
26157
  }
25462
26158
  updateMarker() {
25463
- const { points, label, areaStyle, state } = this.attribute;
26159
+ const { points, areaStyle, state } = this.attribute;
25464
26160
  if (this._area) {
25465
26161
  this._area.setAttributes(Object.assign({ points: points }, areaStyle));
25466
26162
  this._area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
25467
26163
  }
25468
- if (this._label) {
25469
- this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
25470
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
25471
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
25472
- } }));
25473
- }
25474
- this.setLabelPos();
26164
+ this._updateMarkLabels(MarkArea.defaultAttributes.label);
25475
26165
  }
25476
26166
  isValidPoints() {
25477
26167
  const { points } = this.attribute;
@@ -25489,6 +26179,7 @@ class MarkArea extends Marker {
25489
26179
  }
25490
26180
  }
25491
26181
  MarkArea.defaultAttributes = DEFAULT_MARK_AREA_THEME;
26182
+ mixin(MarkArea, MarkLabelMixin);
25492
26183
 
25493
26184
  loadMarkArcLineComponent();
25494
26185
  function registerMarkArcLineAnimate() {
@@ -25501,14 +26192,12 @@ class MarkArcLine extends MarkCommonLine {
25501
26192
  }
25502
26193
  }
25503
26194
  constructor(attributes, options) {
25504
- super((options === null || options === void 0 ? void 0 : options.skipDefault)
25505
- ? attributes
25506
- : merge({}, MarkArcLine.defaultAttributes, attributes, { label: { autoRotate: true } }));
26195
+ super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArcLine.defaultAttributes, attributes));
25507
26196
  this.name = 'markArcLine';
25508
26197
  }
25509
- getPointAttrByPosition(direction) {
25510
- const { center, radius, startAngle, endAngle, label } = this.attribute;
25511
- const { refX = 0, refY = 0 } = label;
26198
+ getPointAttrByPosition(direction, labelAttrs) {
26199
+ const { center, radius, startAngle, endAngle } = this.attribute;
26200
+ const { refX = 0, refY = 0 } = labelAttrs;
25512
26201
  let angle;
25513
26202
  switch (direction) {
25514
26203
  case IMarkCommonArcLabelPosition.arcInnerStart:
@@ -25540,9 +26229,9 @@ class MarkArcLine extends MarkCommonLine {
25540
26229
  getTextStyle(position) {
25541
26230
  return DEFAULT_POLAR_MARKER_TEXT_STYLE_MAP[position];
25542
26231
  }
25543
- getRotateByAngle(angle) {
26232
+ getRotateByAngle(angle, labelAttrs) {
25544
26233
  var _a;
25545
- return angle - Math.PI / 2 + ((_a = this.attribute.label.refAngle) !== null && _a !== void 0 ? _a : 0);
26234
+ return angle - Math.PI / 2 + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0);
25546
26235
  }
25547
26236
  createSegment() {
25548
26237
  const { center, radius, startAngle, endAngle, startSymbol, endSymbol, lineStyle, state } = this
@@ -25585,6 +26274,12 @@ class MarkArcLine extends MarkCommonLine {
25585
26274
  isValidPoints() {
25586
26275
  return true;
25587
26276
  }
26277
+ addMarkLineLabels(container) {
26278
+ this._addMarkLabels(container, 'mark-common-line-label', MarkArcLine.defaultAttributes.label);
26279
+ }
26280
+ updateMarkLineLabels() {
26281
+ this._updateMarkLabels(MarkArcLine.defaultAttributes.label);
26282
+ }
25588
26283
  }
25589
26284
  MarkArcLine.defaultAttributes = DEFAULT_MARK_ARC_LINE_THEME;
25590
26285
 
@@ -25601,20 +26296,15 @@ class MarkArcArea extends Marker {
25601
26296
  getArea() {
25602
26297
  return this._area;
25603
26298
  }
25604
- getLabel() {
25605
- return this._label;
25606
- }
25607
26299
  constructor(attributes, options) {
25608
- super((options === null || options === void 0 ? void 0 : options.skipDefault)
25609
- ? attributes
25610
- : merge({}, MarkArcArea.defaultAttributes, attributes, { label: { autoRotate: true } }));
26300
+ super((options === null || options === void 0 ? void 0 : options.skipDefault) ? attributes : merge({}, MarkArcArea.defaultAttributes, attributes));
25611
26301
  this.name = 'markArcArea';
25612
26302
  this.defaultUpdateAnimation = DefaultUpdateMarkAreaAnimation;
25613
26303
  this.defaultExitAnimation = DefaultExitMarkerAnimation;
25614
26304
  }
25615
- getPointAttrByPosition(position) {
25616
- const { center, innerRadius, outerRadius, startAngle, endAngle, label } = this.attribute;
25617
- const { refX = 0, refY = 0 } = label;
26305
+ getPointAttrByPosition(position, labelAttrs) {
26306
+ const { center, innerRadius, outerRadius, startAngle, endAngle } = this.attribute;
26307
+ const { refX = 0, refY = 0 } = labelAttrs;
25618
26308
  let radius;
25619
26309
  let angle;
25620
26310
  switch (position) {
@@ -25658,16 +26348,15 @@ class MarkArcArea extends Marker {
25658
26348
  angle
25659
26349
  };
25660
26350
  }
25661
- setLabelPos() {
26351
+ setLabelPos(labelNode, labelAttrs) {
25662
26352
  var _a;
25663
- if (this._label && this._area) {
25664
- const { label = {} } = this.attribute;
25665
- const { position: labelPosition = 'arcInnerMiddle', autoRotate } = label;
25666
- const labelAttr = this.getPointAttrByPosition(labelPosition);
25667
- this._label.setAttributes(Object.assign(Object.assign({}, labelAttr.position), { angle: autoRotate ? labelAttr.angle - Math.PI / 2 + ((_a = label.refAngle) !== null && _a !== void 0 ? _a : 0) : 0, textStyle: Object.assign(Object.assign({}, DEFAULT_POLAR_MARKER_TEXT_STYLE_MAP[labelPosition]), label.textStyle) }));
25668
- if (this.attribute.limitRect && label.confine) {
26353
+ if (this._area) {
26354
+ const { position: labelPosition = 'arcInnerMiddle', autoRotate } = labelAttrs;
26355
+ const labelAttr = this.getPointAttrByPosition(labelPosition, labelAttrs);
26356
+ labelNode.setAttributes(Object.assign(Object.assign({}, labelAttr.position), { angle: autoRotate ? labelAttr.angle - Math.PI / 2 + ((_a = labelAttrs.refAngle) !== null && _a !== void 0 ? _a : 0) : 0, textStyle: Object.assign(Object.assign({}, DEFAULT_POLAR_MARKER_TEXT_STYLE_MAP[labelPosition]), labelAttrs.textStyle) }));
26357
+ if (this.attribute.limitRect && labelAttrs.confine) {
25669
26358
  const { x, y, width, height } = this.attribute.limitRect;
25670
- limitShapeInBounds(this._label, {
26359
+ limitShapeInBounds(labelNode, {
25671
26360
  x1: x,
25672
26361
  y1: y,
25673
26362
  x2: x + width,
@@ -25677,7 +26366,7 @@ class MarkArcArea extends Marker {
25677
26366
  }
25678
26367
  }
25679
26368
  initMarker(container) {
25680
- const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this
26369
+ const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, state } = this
25681
26370
  .attribute;
25682
26371
  const area = graphicCreator.arc(Object.assign({ x: center.x, y: center.y, innerRadius,
25683
26372
  outerRadius,
@@ -25687,14 +26376,7 @@ class MarkArcArea extends Marker {
25687
26376
  area.name = 'polar-mark-area-area';
25688
26377
  this._area = area;
25689
26378
  container.add(area);
25690
- const markLabel = new Tag(Object.assign(Object.assign({}, label), { state: {
25691
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
25692
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
25693
- } }));
25694
- markLabel.name = 'mark-area-label';
25695
- this._label = markLabel;
25696
- container.add(markLabel);
25697
- this.setLabelPos();
26379
+ this._addMarkLabels(container, 'mark-area-label', MarkArcArea.defaultAttributes.label);
25698
26380
  }
25699
26381
  updateMarker() {
25700
26382
  const { center, innerRadius, outerRadius, startAngle, endAngle, areaStyle, label, state } = this
@@ -25706,19 +26388,14 @@ class MarkArcArea extends Marker {
25706
26388
  endAngle }, areaStyle));
25707
26389
  this._area.states = merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.area);
25708
26390
  }
25709
- if (this._label) {
25710
- this._label.setAttributes(Object.assign(Object.assign({ dx: 0, dy: 0 }, label), { state: {
25711
- panel: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.labelBackground),
25712
- text: merge({}, DEFAULT_STATES$2, state === null || state === void 0 ? void 0 : state.label)
25713
- } }));
25714
- this.setLabelPos();
25715
- }
26391
+ this._updateMarkLabels(MarkArcArea.defaultAttributes.label);
25716
26392
  }
25717
26393
  isValidPoints() {
25718
26394
  return true;
25719
26395
  }
25720
26396
  }
25721
26397
  MarkArcArea.defaultAttributes = DEFAULT_MARK_ARC_AREA_THEME;
26398
+ mixin(MarkArcArea, MarkLabelMixin);
25722
26399
 
25723
26400
  loadMarkPointComponent();
25724
26401
  function registerMarkPointAnimate() {
@@ -27739,28 +28416,21 @@ class Slider extends AbstractComponent {
27739
28416
  this._dispatchTooltipEvent('sliderTooltipHide');
27740
28417
  };
27741
28418
  this._onHandlerPointerdown = (e) => {
27742
- e.stopPropagation();
28419
+ this._clearAllDragEvents();
27743
28420
  this._isChanging = true;
27744
28421
  const { x, y } = this.stage.eventPointTransform(e);
27745
28422
  this._currentHandler = e.target;
27746
28423
  this._prePos = this._isHorizontal ? x : y;
27747
- if (vglobal.env === 'browser') {
27748
- vglobal.addEventListener('pointermove', this._onHandlerPointerMove, {
27749
- capture: true
27750
- });
27751
- vglobal.addEventListener('pointerup', this._onHandlerPointerUp);
27752
- }
27753
- else {
27754
- this.stage.addEventListener('pointermove', this._onHandlerPointerMove, {
27755
- capture: true
27756
- });
27757
- this.stage.addEventListener('pointerup', this._onHandlerPointerUp);
27758
- this.stage.addEventListener('pointerupoutside', this._onHandlerPointerUp);
27759
- }
28424
+ const triggers = getEndTriggersOfDrag();
28425
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
28426
+ obj.addEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
28427
+ triggers.forEach((trigger) => {
28428
+ obj.addEventListener(trigger, this._onHandlerPointerUp);
28429
+ });
27760
28430
  };
27761
28431
  this._onHandlerPointerMove = (e) => {
27762
28432
  var _a, _b;
27763
- e.stopPropagation();
28433
+ e.preventDefault();
27764
28434
  this._isChanging = true;
27765
28435
  const { railWidth, railHeight, min, max } = this.attribute;
27766
28436
  if (max === min) {
@@ -27796,44 +28466,29 @@ class Slider extends AbstractComponent {
27796
28466
  this._dispatchChangeEvent();
27797
28467
  };
27798
28468
  this._onHandlerPointerUp = (e) => {
27799
- e.preventDefault();
27800
28469
  this._isChanging = false;
27801
28470
  this._currentHandler = null;
27802
- if (vglobal.env === 'browser') {
27803
- vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, {
27804
- capture: true
27805
- });
27806
- vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
27807
- }
27808
- else {
27809
- this.stage.removeEventListener('pointermove', this._onHandlerPointerMove, {
27810
- capture: true
27811
- });
27812
- this.stage.removeEventListener('pointerup', this._onHandlerPointerUp);
27813
- this.stage.removeEventListener('pointerupoutside', this._onHandlerPointerUp);
28471
+ this._clearAllDragEvents();
28472
+ };
28473
+ this._handleTouchMove = (e) => {
28474
+ if (this._isChanging) {
28475
+ e.preventDefault();
27814
28476
  }
27815
28477
  };
27816
28478
  this._onTrackPointerdown = (e) => {
27817
- e.stopPropagation();
28479
+ this._clearAllDragEvents();
27818
28480
  this._isChanging = true;
27819
28481
  const { x, y } = this.stage.eventPointTransform(e);
27820
28482
  this._prePos = this._isHorizontal ? x : y;
27821
- if (vglobal.env === 'browser') {
27822
- vglobal.addEventListener('pointermove', this._onTrackPointerMove, {
27823
- capture: true
27824
- });
27825
- vglobal.addEventListener('pointerup', this._onTrackPointerUp);
27826
- }
27827
- else {
27828
- this.stage.addEventListener('pointermove', this._onTrackPointerMove, {
27829
- capture: true
27830
- });
27831
- this.stage.addEventListener('pointerup', this._onTrackPointerUp);
27832
- this.stage.addEventListener('pointerupoutside', this._onTrackPointerUp);
27833
- }
28483
+ const triggers = getEndTriggersOfDrag();
28484
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
28485
+ obj.addEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
28486
+ triggers.forEach((trigger) => {
28487
+ obj.addEventListener(trigger, this._onTrackPointerUp);
28488
+ });
27834
28489
  };
27835
28490
  this._onTrackPointerMove = (e) => {
27836
- e.stopPropagation();
28491
+ e.preventDefault();
27837
28492
  this._isChanging = true;
27838
28493
  const { railWidth, railHeight, min, max, inverse } = this.attribute;
27839
28494
  if (max === min) {
@@ -27885,24 +28540,11 @@ class Slider extends AbstractComponent {
27885
28540
  this._dispatchChangeEvent();
27886
28541
  };
27887
28542
  this._onTrackPointerUp = (e) => {
27888
- e.preventDefault();
27889
28543
  this._isChanging = false;
27890
- if (vglobal.env === 'browser') {
27891
- vglobal.removeEventListener('pointermove', this._onTrackPointerMove, {
27892
- capture: true
27893
- });
27894
- vglobal.removeEventListener('pointerup', this._onTrackPointerUp);
27895
- }
27896
- else {
27897
- this.stage.removeEventListener('pointermove', this._onTrackPointerMove, {
27898
- capture: true
27899
- });
27900
- this.stage.removeEventListener('pointerup', this._onTrackPointerUp);
27901
- this.stage.removeEventListener('pointerupoutside', this._onTrackPointerUp);
27902
- }
28544
+ this._clearAllDragEvents();
27903
28545
  };
27904
28546
  this._onRailPointerDown = (e) => {
27905
- e.stopPropagation();
28547
+ this._clearAllDragEvents();
27906
28548
  this._isChanging = true;
27907
28549
  const { railWidth, railHeight, min, max } = this.attribute;
27908
28550
  if (max === min) {
@@ -28280,6 +28922,9 @@ class Slider extends AbstractComponent {
28280
28922
  this._track.addEventListener('pointerdown', this._onTrackPointerdown);
28281
28923
  }
28282
28924
  this._railContainer.addEventListener('pointerdown', this._onRailPointerDown);
28925
+ (vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
28926
+ passive: false
28927
+ });
28283
28928
  }
28284
28929
  }
28285
28930
  _bindTooltipEvents() {
@@ -28290,6 +28935,18 @@ class Slider extends AbstractComponent {
28290
28935
  this._mainContainer.addEventListener('pointermove', this._onTooltipUpdate);
28291
28936
  this._mainContainer.addEventListener('pointerleave', this._onTooltipHide);
28292
28937
  }
28938
+ _clearAllDragEvents() {
28939
+ const triggers = getEndTriggersOfDrag();
28940
+ const obj = vglobal.env === 'browser' ? vglobal : this.stage;
28941
+ obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true, passive: false });
28942
+ triggers.forEach((trigger) => {
28943
+ obj.removeEventListener(trigger, this._onHandlerPointerUp);
28944
+ });
28945
+ obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true, passive: false });
28946
+ triggers.forEach((trigger) => {
28947
+ obj.removeEventListener(trigger, this._onTrackPointerUp);
28948
+ });
28949
+ }
28293
28950
  _updateTrack() {
28294
28951
  const { inverse, railWidth, railHeight } = this.attribute;
28295
28952
  const startHandler = this._startHandler;
@@ -28430,6 +29087,13 @@ class Slider extends AbstractComponent {
28430
29087
  endHandler
28431
29088
  };
28432
29089
  }
29090
+ release(all) {
29091
+ super.release(all);
29092
+ (vglobal.env === 'browser' ? vglobal : this.stage).addEventListener('touchmove', this._handleTouchMove, {
29093
+ passive: false
29094
+ });
29095
+ this._clearAllDragEvents();
29096
+ }
28433
29097
  }
28434
29098
  Slider.defaultAttributes = {
28435
29099
  slidable: true,
@@ -30123,13 +30787,14 @@ var IOperateType;
30123
30787
  IOperateType["moving"] = "moving";
30124
30788
  IOperateType["moveStart"] = "moveStart";
30125
30789
  IOperateType["moveEnd"] = "moveEnd";
30790
+ IOperateType["brushActive"] = "brushActive";
30126
30791
  IOperateType["brushClear"] = "brushClear";
30127
30792
  })(IOperateType || (IOperateType = {}));
30128
30793
 
30129
30794
  const DEFAULT_BRUSH_ATTRIBUTES = {
30130
30795
  trigger: 'pointerdown',
30131
30796
  updateTrigger: 'pointermove',
30132
- endTrigger: 'pointerup',
30797
+ endTrigger: ['pointerup', 'pointerleave'],
30133
30798
  resetTrigger: 'pointerupoutside',
30134
30799
  hasMask: true,
30135
30800
  brushMode: 'single',
@@ -30145,10 +30810,10 @@ const DEFAULT_BRUSH_ATTRIBUTES = {
30145
30810
  delayType: 'throttle',
30146
30811
  delayTime: 10,
30147
30812
  interactiveRange: {
30148
- y1: -Infinity,
30149
- y2: Infinity,
30150
- x1: -Infinity,
30151
- x2: Infinity
30813
+ minY: -Infinity,
30814
+ maxY: Infinity,
30815
+ minX: -Infinity,
30816
+ maxX: Infinity
30152
30817
  }
30153
30818
  };
30154
30819
  const DEFAULT_SIZE_THRESHOLD = 5;
@@ -30169,145 +30834,87 @@ class Brush extends AbstractComponent {
30169
30834
  this.name = 'brush';
30170
30835
  this._activeDrawState = false;
30171
30836
  this._cacheDrawPoints = [];
30172
- this._isDrawedBeforeEnd = false;
30173
- this._isDownBeforeUpOutside = false;
30174
30837
  this._activeMoveState = false;
30175
30838
  this._operatingMaskMoveDx = 0;
30176
30839
  this._operatingMaskMoveDy = 0;
30177
30840
  this._operatingMaskMoveRangeX = [-Infinity, Infinity];
30178
30841
  this._operatingMaskMoveRangeY = [-Infinity, Infinity];
30179
30842
  this._brushMaskAABBBoundsDict = {};
30843
+ this._firstUpdate = true;
30180
30844
  this._onBrushStart = (e) => {
30181
- var _a;
30182
30845
  if (this._outOfInteractiveRange(e)) {
30183
- this._isDownBeforeUpOutside = true;
30846
+ if (!this._isEmptyMask()) {
30847
+ this._clearMask();
30848
+ this._dispatchBrushEvent(IOperateType.brushClear, e);
30849
+ }
30184
30850
  return;
30185
30851
  }
30852
+ const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, brushMoved = true } = this.attribute;
30853
+ array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay));
30854
+ array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd));
30186
30855
  e.stopPropagation();
30187
- const brushMoved = (_a = this.attribute.brushMoved) !== null && _a !== void 0 ? _a : true;
30856
+ this._firstUpdate = true;
30188
30857
  this._activeMoveState = brushMoved && this._isPosInBrushMask(e);
30189
30858
  this._activeDrawState = !this._activeMoveState;
30190
- this._activeDrawState && this._initDraw(e);
30191
- this._activeMoveState && this._initMove(e);
30859
+ this._startPos = this.eventPosToStagePos(e);
30860
+ this._cacheDrawPoints = [this._startPos];
30192
30861
  };
30193
30862
  this._onBrushing = (e) => {
30194
30863
  if (this._outOfInteractiveRange(e)) {
30195
30864
  return;
30196
30865
  }
30197
- if (this._activeDrawState || this._activeMoveState) {
30198
- e.stopPropagation();
30866
+ e.stopPropagation();
30867
+ if (this._firstUpdate) {
30868
+ this._activeDrawState && this._initDraw(e);
30869
+ this._activeMoveState && this._initMove(e);
30870
+ this._firstUpdate = false;
30871
+ }
30872
+ else {
30873
+ this._activeDrawState && this._drawing(e);
30874
+ this._activeMoveState && this._moving(e);
30199
30875
  }
30200
- this._activeDrawState && this._drawing(e);
30201
- this._activeMoveState && this._moving(e);
30202
30876
  };
30203
30877
  this._onBrushingWithDelay = this.attribute.delayTime === 0
30204
30878
  ? this._onBrushing
30205
30879
  : delayMap[this.attribute.delayType](this._onBrushing, this.attribute.delayTime);
30206
30880
  this._onBrushEnd = (e) => {
30207
- var _a;
30208
- if (!this._activeDrawState && !this._activeMoveState) {
30209
- return;
30210
- }
30881
+ this._releaseBrushUpdateEvents();
30211
30882
  e.preventDefault();
30212
- const { removeOnClick = true } = this.attribute;
30213
- if (this._activeDrawState && !this._isDrawedBeforeEnd && removeOnClick) {
30214
- if ((_a = this._operatingMask) === null || _a === void 0 ? void 0 : _a._AABBBounds.empty()) {
30215
- this._dispatchEvent(IOperateType.brushClear, {
30216
- operateMask: this._operatingMask,
30217
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
30218
- event: e
30219
- });
30220
- }
30221
- this._container.incrementalClearChild();
30222
- this._brushMaskAABBBoundsDict = {};
30223
- }
30224
- else {
30225
- if (this._activeDrawState) {
30226
- this._dispatchEvent(IOperateType.drawEnd, {
30227
- operateMask: this._operatingMask,
30228
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
30229
- event: e
30230
- });
30231
- }
30232
- if (this._activeMoveState) {
30233
- this._dispatchEvent(IOperateType.moveEnd, {
30234
- operateMask: this._operatingMask,
30235
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
30236
- event: e
30237
- });
30238
- }
30239
- }
30883
+ this._activeDrawState && this._drawEnd(e);
30884
+ this._activeMoveState && this._moveEnd(e);
30240
30885
  this._activeDrawState = false;
30241
30886
  this._activeMoveState = false;
30242
- this._isDrawedBeforeEnd = false;
30243
- if (this._operatingMask) {
30244
- this._operatingMask.setAttribute('pickable', false);
30245
- }
30246
30887
  };
30247
30888
  this._onBrushClear = (e) => {
30248
30889
  e.preventDefault();
30249
- const { removeOnClick = true } = this.attribute;
30250
- if (this._isDownBeforeUpOutside && removeOnClick) {
30251
- this._dispatchEvent(IOperateType.brushClear, {
30252
- operateMask: this._operatingMask,
30253
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
30254
- event: e
30255
- });
30256
- this._container.incrementalClearChild();
30257
- this._brushMaskAABBBoundsDict = {};
30890
+ if (!this._isEmptyMask()) {
30891
+ this._clearMask();
30892
+ this._dispatchBrushEvent(IOperateType.brushClear, e);
30258
30893
  }
30259
30894
  this._activeDrawState = false;
30260
30895
  this._activeMoveState = false;
30261
- this._isDrawedBeforeEnd = false;
30262
- this._isDownBeforeUpOutside = false;
30263
- if (this._operatingMask) {
30264
- this._operatingMask.setAttribute('pickable', false);
30265
- }
30266
30896
  };
30267
30897
  }
30268
30898
  _bindBrushEvents() {
30899
+ this.releaseBrushEvents();
30269
30900
  if (this.attribute.disableTriggerEvent) {
30270
30901
  return;
30271
30902
  }
30272
- const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
30273
- array(trigger).forEach(t => vglobal.addEventListener(t, this._onBrushStart));
30274
- array(updateTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushingWithDelay));
30275
- array(endTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushEnd));
30903
+ const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this
30904
+ .attribute;
30905
+ array(trigger).forEach(t => this.stage.addEventListener(t, this._onBrushStart));
30276
30906
  array(resetTrigger).forEach(t => this.stage.addEventListener(t, this._onBrushClear));
30277
30907
  }
30278
- _isPosInBrushMask(e) {
30279
- const pos = this.eventPosToStagePos(e);
30280
- const brushMasks = this._container.getChildren();
30281
- for (let i = 0; i < brushMasks.length; i++) {
30282
- const { points = [], dx = 0, dy = 0 } = brushMasks[i].attribute;
30283
- const pointsConsiderOffset = points.map((point) => {
30284
- return {
30285
- x: point.x + dx,
30286
- y: point.y + dy
30287
- };
30288
- });
30289
- if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {
30290
- this._operatingMask = brushMasks[i];
30291
- return true;
30292
- }
30293
- }
30294
- return false;
30295
- }
30296
30908
  _initDraw(e) {
30297
30909
  const { brushMode } = this.attribute;
30298
30910
  const pos = this.eventPosToStagePos(e);
30299
- this._cacheDrawPoints = [pos];
30300
- this._isDrawedBeforeEnd = false;
30301
- if (brushMode === 'single') {
30302
- this._brushMaskAABBBoundsDict = {};
30303
- this._container.incrementalClearChild();
30304
- }
30911
+ this._cacheDrawPoints.push(pos);
30912
+ brushMode === 'single' && this._clearMask();
30305
30913
  this._addBrushMask();
30306
- this._dispatchEvent(IOperateType.drawStart, {
30307
- operateMask: this._operatingMask,
30308
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
30309
- event: e
30310
- });
30914
+ this._dispatchBrushEvent(IOperateType.drawStart, e);
30915
+ if (Object.keys(this._brushMaskAABBBoundsDict).length === 1) {
30916
+ this._dispatchBrushEvent(IOperateType.brushActive, e);
30917
+ }
30311
30918
  }
30312
30919
  _initMove(e) {
30313
30920
  var _a, _b;
@@ -30324,16 +30931,12 @@ class Brush extends AbstractComponent {
30324
30931
  this._operatingMaskMoveRangeX = [minMoveStepX, maxMoveStepX];
30325
30932
  this._operatingMaskMoveRangeY = [minMoveStepY, maxMoveStepY];
30326
30933
  this._operatingMask.setAttribute('pickable', true);
30327
- this._dispatchEvent(IOperateType.moveStart, {
30328
- operateMask: this._operatingMask,
30329
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
30330
- event: e
30331
- });
30934
+ this._dispatchBrushEvent(IOperateType.moveStart, e);
30332
30935
  }
30333
30936
  _drawing(e) {
30334
- var _a, _b;
30937
+ var _a;
30335
30938
  const pos = this.eventPosToStagePos(e);
30336
- const { sizeThreshold = DEFAULT_SIZE_THRESHOLD, brushType } = this.attribute;
30939
+ const { brushType } = this.attribute;
30337
30940
  const cacheLength = this._cacheDrawPoints.length;
30338
30941
  if (cacheLength > 0) {
30339
30942
  const lastPos = (_a = this._cacheDrawPoints[this._cacheDrawPoints.length - 1]) !== null && _a !== void 0 ? _a : {};
@@ -30349,18 +30952,7 @@ class Brush extends AbstractComponent {
30349
30952
  }
30350
30953
  const maskPoints = this._computeMaskPoints();
30351
30954
  this._operatingMask.setAttribute('points', maskPoints);
30352
- const { x1 = 0, x2 = 0, y1 = 0, y2 = 0 } = (_b = this._operatingMask) === null || _b === void 0 ? void 0 : _b._AABBBounds;
30353
- this._isDrawedBeforeEnd =
30354
- !this._operatingMask._AABBBounds.empty() &&
30355
- !!(Math.abs(x2 - x1) > sizeThreshold || Math.abs(y1 - y2) > sizeThreshold);
30356
- if (this._isDrawedBeforeEnd) {
30357
- this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
30358
- this._dispatchEvent(IOperateType.drawing, {
30359
- operateMask: this._operatingMask,
30360
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
30361
- event: e
30362
- });
30363
- }
30955
+ this._dispatchBrushEvent(IOperateType.drawing, e);
30364
30956
  }
30365
30957
  _moving(e) {
30366
30958
  const startPos = this._cacheMovePoint;
@@ -30379,11 +30971,61 @@ class Brush extends AbstractComponent {
30379
30971
  dy: moveY
30380
30972
  });
30381
30973
  this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
30382
- this._dispatchEvent(IOperateType.moving, {
30383
- operateMask: this._operatingMask,
30384
- operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
30385
- event: e
30386
- });
30974
+ this._dispatchBrushEvent(IOperateType.moving, e);
30975
+ }
30976
+ _drawEnd(e) {
30977
+ const { removeOnClick = true, sizeThreshold = DEFAULT_SIZE_THRESHOLD } = this.attribute;
30978
+ if (this._outOfInteractiveRange(e)) {
30979
+ if (!this._isEmptyMask()) {
30980
+ this._clearMask();
30981
+ this._dispatchBrushEvent(IOperateType.brushClear, e);
30982
+ }
30983
+ }
30984
+ else {
30985
+ const { x: x1, y: y1 } = this._startPos;
30986
+ const { x: x2, y: y2 } = this.eventPosToStagePos(e);
30987
+ if (Math.abs(x2 - x1) <= 1 && Math.abs(y2 - y1) <= 1 && removeOnClick) {
30988
+ if (!this._isEmptyMask()) {
30989
+ this._clearMask();
30990
+ this._dispatchBrushEvent(IOperateType.brushClear, e);
30991
+ }
30992
+ }
30993
+ else if (Math.abs(x2 - x1) < sizeThreshold && Math.abs(y1 - y2) < sizeThreshold) {
30994
+ delete this._brushMaskAABBBoundsDict[this._operatingMask.name];
30995
+ this._container.setAttributes({});
30996
+ this._container.removeChild(this._operatingMask);
30997
+ if (this._isEmptyMask()) {
30998
+ this._dispatchBrushEvent(IOperateType.brushClear, e);
30999
+ }
31000
+ }
31001
+ else {
31002
+ this._brushMaskAABBBoundsDict[this._operatingMask.name] = this._operatingMask.AABBBounds;
31003
+ this._dispatchBrushEvent(IOperateType.drawEnd, e);
31004
+ }
31005
+ }
31006
+ }
31007
+ _moveEnd(e) {
31008
+ if (this._operatingMask) {
31009
+ this._operatingMask.setAttribute('pickable', false);
31010
+ }
31011
+ this._dispatchBrushEvent(IOperateType.moveEnd, e);
31012
+ }
31013
+ render() {
31014
+ this._bindBrushEvents();
31015
+ const group = this.createOrUpdateChild('brush-container', {}, 'group');
31016
+ this._container = group;
31017
+ }
31018
+ releaseBrushEvents() {
31019
+ const { trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this
31020
+ .attribute;
31021
+ array(trigger).forEach(t => this.stage.removeEventListener(t, this._onBrushStart));
31022
+ array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear));
31023
+ this._releaseBrushUpdateEvents();
31024
+ }
31025
+ _releaseBrushUpdateEvents() {
31026
+ const { updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger } = this.attribute;
31027
+ array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay));
31028
+ array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd));
30387
31029
  }
30388
31030
  _computeMaskPoints() {
30389
31031
  const { brushType, xRange = [0, 0], yRange = [0, 0] } = this.attribute;
@@ -30452,12 +31094,30 @@ class Brush extends AbstractComponent {
30452
31094
  _addBrushMask() {
30453
31095
  var _a;
30454
31096
  const { brushStyle, hasMask } = this.attribute;
30455
- const brushMask = graphicCreator.polygon(Object.assign(Object.assign({ points: cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle), { opacity: hasMask ? (_a = brushStyle.opacity) !== null && _a !== void 0 ? _a : 1 : 0 }));
31097
+ const brushMask = graphicCreator.polygon(Object.assign(Object.assign({ points: cloneDeep(this._cacheDrawPoints), cursor: 'move', pickable: false }, brushStyle), { opacity: hasMask ? ((_a = brushStyle.opacity) !== null && _a !== void 0 ? _a : 1) : 0 }));
30456
31098
  brushMask.name = `brush-${Date.now()}`;
30457
31099
  this._operatingMask = brushMask;
30458
31100
  this._container.add(brushMask);
30459
31101
  this._brushMaskAABBBoundsDict[brushMask.name] = brushMask.AABBBounds;
30460
31102
  }
31103
+ _isPosInBrushMask(e) {
31104
+ const pos = this.eventPosToStagePos(e);
31105
+ const brushMasks = this._container.getChildren();
31106
+ for (let i = 0; i < brushMasks.length; i++) {
31107
+ const { points = [], dx = 0, dy = 0 } = brushMasks[i].attribute;
31108
+ const pointsConsiderOffset = points.map((point) => {
31109
+ return {
31110
+ x: point.x + dx,
31111
+ y: point.y + dy
31112
+ };
31113
+ });
31114
+ if (polygonContainPoint(pointsConsiderOffset, pos.x, pos.y)) {
31115
+ this._operatingMask = brushMasks[i];
31116
+ return true;
31117
+ }
31118
+ }
31119
+ return false;
31120
+ }
30461
31121
  _outOfInteractiveRange(e) {
30462
31122
  const { interactiveRange } = this.attribute;
30463
31123
  const { minY = -Infinity, maxY = Infinity, minX = -Infinity, maxX = Infinity } = interactiveRange;
@@ -30470,17 +31130,21 @@ class Brush extends AbstractComponent {
30470
31130
  eventPosToStagePos(e) {
30471
31131
  return this.stage.eventPointTransform(e);
30472
31132
  }
30473
- render() {
30474
- this._bindBrushEvents();
30475
- const group = this.createOrUpdateChild('brush-container', {}, 'group');
30476
- this._container = group;
31133
+ _dispatchBrushEvent(operateType, e) {
31134
+ this._dispatchEvent(operateType, {
31135
+ operateMask: this._operatingMask,
31136
+ operatedMaskAABBBounds: this._brushMaskAABBBoundsDict,
31137
+ event: e
31138
+ });
30477
31139
  }
30478
- releaseBrushEvents() {
30479
- const { delayType = 'throttle', delayTime = 0, trigger = DEFAULT_BRUSH_ATTRIBUTES.trigger, updateTrigger = DEFAULT_BRUSH_ATTRIBUTES.updateTrigger, endTrigger = DEFAULT_BRUSH_ATTRIBUTES.endTrigger, resetTrigger = DEFAULT_BRUSH_ATTRIBUTES.resetTrigger } = this.attribute;
30480
- array(trigger).forEach(t => vglobal.removeEventListener(t, this._onBrushStart));
30481
- array(updateTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushingWithDelay));
30482
- array(endTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushEnd));
30483
- array(resetTrigger).forEach(t => this.stage.removeEventListener(t, this._onBrushClear));
31140
+ _clearMask() {
31141
+ this._brushMaskAABBBoundsDict = {};
31142
+ this._container.incrementalClearChild();
31143
+ this._operatingMask = null;
31144
+ }
31145
+ _isEmptyMask() {
31146
+ return (isEmpty(this._brushMaskAABBBoundsDict) ||
31147
+ Object.keys(this._brushMaskAABBBoundsDict).every(key => this._brushMaskAABBBoundsDict[key].empty()));
30484
31148
  }
30485
31149
  }
30486
31150
  Brush.defaultAttributes = DEFAULT_BRUSH_ATTRIBUTES;
@@ -31782,10 +32446,10 @@ class Switch extends AbstractComponent {
31782
32446
  });
31783
32447
  this._circle.setAttributes({
31784
32448
  y: circleY,
31785
- x: this.attribute.checked ? circleX : maxWidth - circleX
32449
+ x: !this.attribute.checked ? circleX : maxWidth - circleX
31786
32450
  });
31787
32451
  this._text.setAttributes({
31788
- x: this.attribute.checked ? textX : maxWidth - textX - textWidth,
32452
+ x: !this.attribute.checked ? textX : maxWidth - textX - textWidth,
31789
32453
  y: textY
31790
32454
  });
31791
32455
  }
@@ -31932,6 +32596,6 @@ StoryLabelItem.defaultAttributes = {
31932
32596
  theme: 'default'
31933
32597
  };
31934
32598
 
31935
- const version = "1.0.0-alpha.5";
32599
+ const version = "1.0.0-alpha.6";
31936
32600
 
31937
32601
  export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };