@visactor/vchart 1.12.9-alpha.0 → 1.12.9-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/build/es5/index.js +1 -1
  2. package/build/index.js +371 -137
  3. package/build/index.min.js +1 -1
  4. package/build/tsconfig.tsbuildinfo +1 -1
  5. package/cjs/component/label/util.d.ts +4 -4
  6. package/cjs/component/tooltip/interface/spec.d.ts +3 -1
  7. package/cjs/component/tooltip/interface/spec.js.map +1 -1
  8. package/cjs/component/tooltip/processor/mark-tooltip.js +29 -3
  9. package/cjs/component/tooltip/processor/mark-tooltip.js.map +1 -1
  10. package/cjs/component/tooltip/tooltip.d.ts +1 -0
  11. package/cjs/component/tooltip/tooltip.js +13 -7
  12. package/cjs/component/tooltip/tooltip.js.map +1 -1
  13. package/cjs/core/index.d.ts +1 -1
  14. package/cjs/core/index.js +1 -1
  15. package/cjs/core/index.js.map +1 -1
  16. package/cjs/core/vchart.js +2 -1
  17. package/cjs/data/register.js +1 -2
  18. package/cjs/plugin/components/tooltip-handler/base.d.ts +0 -3
  19. package/cjs/plugin/components/tooltip-handler/base.js +3 -10
  20. package/cjs/plugin/components/tooltip-handler/base.js.map +1 -1
  21. package/esm/component/label/util.d.ts +4 -4
  22. package/esm/component/tooltip/interface/spec.d.ts +3 -1
  23. package/esm/component/tooltip/interface/spec.js.map +1 -1
  24. package/esm/component/tooltip/processor/mark-tooltip.js +30 -2
  25. package/esm/component/tooltip/processor/mark-tooltip.js.map +1 -1
  26. package/esm/component/tooltip/tooltip.d.ts +1 -0
  27. package/esm/component/tooltip/tooltip.js +13 -8
  28. package/esm/component/tooltip/tooltip.js.map +1 -1
  29. package/esm/core/index.d.ts +1 -1
  30. package/esm/core/index.js +1 -1
  31. package/esm/core/index.js.map +1 -1
  32. package/esm/core/vchart.js +2 -1
  33. package/esm/data/register.js +1 -2
  34. package/esm/plugin/components/tooltip-handler/base.d.ts +0 -3
  35. package/esm/plugin/components/tooltip-handler/base.js +4 -11
  36. package/esm/plugin/components/tooltip-handler/base.js.map +1 -1
  37. package/package.json +15 -15
package/build/index.js CHANGED
@@ -7979,11 +7979,12 @@
7979
7979
  for (let i = 0, len = paths.length; i < len; i++) if (currPath = paths[i], coordsStr = currPath.slice(1), commandChar = currPath[0], currCommandData = [commandChar], coordsStrArr = coordsStr.match(rePathCommand), null !== coordsStrArr) {
7980
7980
  for (let i = 0, len = coordsStrArr.length; i < len; i++) coordStr = coordsStrArr[i], coordNumber = parseFloat(coordStr), Number.isNaN(coordNumber) || currCommandData.push(coordNumber);
7981
7981
  if (standardCommandLen = commandLengths[commandChar], currCommandData.length - 1 > standardCommandLen) {
7982
- let subCommand;
7982
+ let subCommand,
7983
+ bestCommandChar = commandChar;
7983
7984
  for (let i = 1, len = currCommandData.length; i < len; i += standardCommandLen) {
7984
- subCommand = [commandChar];
7985
+ subCommand = [bestCommandChar];
7985
7986
  for (let j = i, subLen = i + standardCommandLen; j < subLen; j++) subCommand.push(currCommandData[j]);
7986
- result.push(subCommand);
7987
+ result.push(subCommand), "m" === bestCommandChar ? bestCommandChar = "l" : "M" === bestCommandChar && (bestCommandChar = "L");
7987
7988
  }
7988
7989
  } else result.push(currCommandData);
7989
7990
  } else result.push(currCommandData);
@@ -9194,6 +9195,7 @@
9194
9195
  zIndex: 0,
9195
9196
  layout: null,
9196
9197
  boundsPadding: 0,
9198
+ fillStrokeOrder: 0,
9197
9199
  renderStyle: "default",
9198
9200
  pickMode: "accurate",
9199
9201
  customPickShape: null,
@@ -9264,6 +9266,7 @@
9264
9266
  });
9265
9267
  const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
9266
9268
  path: new CustomPath2D(),
9269
+ fillStrokeOrder: 1,
9267
9270
  customPath: () => {
9268
9271
  Logger.getInstance().warn("空函数");
9269
9272
  }
@@ -10286,7 +10289,7 @@
10286
10289
  }
10287
10290
  hasSubView() {
10288
10291
  const viewBox = this._handler.getViewBox();
10289
- return !(0 === viewBox.x1 && 0 === viewBox.y1 && this.width === viewBox.width() && this.height === viewBox.height());
10292
+ return !(0 === viewBox.x1 && 0 === viewBox.y1 && isNumberClose(this.width, viewBox.width()) && isNumberClose(this.height, viewBox.height()));
10290
10293
  }
10291
10294
  isVisible(bbox) {
10292
10295
  return this._handler.isVisible(bbox);
@@ -17037,7 +17040,8 @@
17037
17040
  fill = arcAttribute.fill,
17038
17041
  stroke = arcAttribute.stroke,
17039
17042
  x: originX = arcAttribute.x,
17040
- y: originY = arcAttribute.y
17043
+ y: originY = arcAttribute.y,
17044
+ fillStrokeOrder = arcAttribute.fillStrokeOrder
17041
17045
  } = arc.attribute,
17042
17046
  data = this.valid(arc, arcAttribute, fillCb, strokeCb);
17043
17047
  if (!data) return;
@@ -17073,7 +17077,17 @@
17073
17077
  isFullStroke: isFullStroke,
17074
17078
  stroke: arrayStroke
17075
17079
  } = parseStroke(stroke);
17076
- if ((doFill || isFullStroke) && (context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius, innerRadius), beforeRenderContribitionsRuned = !0, context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill())), doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()))), !isFullStroke && doStroke) {
17080
+ if (doFill || isFullStroke) {
17081
+ context.beginPath(), drawArcPath$1(arc, context, x, y, outerRadius, innerRadius), beforeRenderContribitionsRuned = !0, context.setShadowBlendStyle && context.setShadowBlendStyle(arc, arc.attribute, arcAttribute), this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
17082
+ const _runFill = () => {
17083
+ doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
17084
+ },
17085
+ _runStroke = () => {
17086
+ doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()));
17087
+ };
17088
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
17089
+ }
17090
+ if (!isFullStroke && doStroke) {
17077
17091
  context.beginPath();
17078
17092
  drawArcPath$1(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
17079
17093
  beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke());
@@ -17091,14 +17105,20 @@
17091
17105
  fill = arcAttribute.fill
17092
17106
  } = arc.attribute,
17093
17107
  startAngle = endAngle;
17094
- if (this.drawArcTailCapPath(arc, context, x, y, outerRadius, innerRadius, startAngle, startAngle + capAngle), beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), doFill) {
17095
- const color = fill;
17096
- if ("conical" === color.gradient) {
17097
- const lastColor = getConicGradientAt(0, 0, endAngle, color);
17098
- fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
17099
- }
17100
- }
17101
- doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
17108
+ this.drawArcTailCapPath(arc, context, x, y, outerRadius, innerRadius, startAngle, startAngle + capAngle), beforeRenderContribitionsRuned || this.beforeRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb);
17109
+ const _runFill = () => {
17110
+ if (doFill) {
17111
+ const color = fill;
17112
+ if ("conical" === color.gradient) {
17113
+ const lastColor = getConicGradientAt(0, 0, endAngle, color);
17114
+ fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
17115
+ }
17116
+ }
17117
+ },
17118
+ _runStroke = () => {
17119
+ doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
17120
+ };
17121
+ _runFill(), _runStroke();
17102
17122
  }
17103
17123
  }
17104
17124
  this.afterRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), tempChangeConicalColor && (fill.startAngle += conicalOffset, fill.endAngle += conicalOffset);
@@ -17136,7 +17156,8 @@
17136
17156
  startAngle = circleAttribute.startAngle,
17137
17157
  endAngle = circleAttribute.endAngle,
17138
17158
  x: originX = circleAttribute.x,
17139
- y: originY = circleAttribute.y
17159
+ y: originY = circleAttribute.y,
17160
+ fillStrokeOrder = circleAttribute.fillStrokeOrder
17140
17161
  } = circle.attribute,
17141
17162
  data = this.valid(circle, circleAttribute, fillCb, strokeCb);
17142
17163
  if (!data) return;
@@ -17146,7 +17167,14 @@
17146
17167
  doFill: doFill,
17147
17168
  doStroke: doStroke
17148
17169
  } = data;
17149
- context.beginPath(), context.arc(x, y, radius, startAngle, endAngle), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute), this.beforeRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb), doFill && (fillCb ? fillCb(context, circle.attribute, circleAttribute) : fVisible && (context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.fill())), doStroke && (strokeCb ? strokeCb(context, circle.attribute, circleAttribute) : sVisible && (context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.stroke())), this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
17170
+ context.beginPath(), context.arc(x, y, radius, startAngle, endAngle), context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(circle, circle.attribute, circleAttribute), this.beforeRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
17171
+ const _runFill = () => {
17172
+ doFill && (fillCb ? fillCb(context, circle.attribute, circleAttribute) : fVisible && (context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.fill()));
17173
+ },
17174
+ _runStroke = () => {
17175
+ doStroke && (strokeCb ? strokeCb(context, circle.attribute, circleAttribute) : sVisible && (context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.stroke()));
17176
+ };
17177
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
17150
17178
  }
17151
17179
  draw(circle, renderService, drawContext, params) {
17152
17180
  const circleAttribute = getTheme$1(circle, null == params ? void 0 : params.theme).circle;
@@ -17587,7 +17615,7 @@
17587
17615
  super(), this.areaRenderContribitions = areaRenderContribitions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(areaRenderContribitions);
17588
17616
  }
17589
17617
  drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
17590
- var _a, _b, _c, _d, _e;
17618
+ var _a, _b, _c;
17591
17619
  const {
17592
17620
  points: points
17593
17621
  } = area.attribute;
@@ -17611,28 +17639,31 @@
17611
17639
  x: originX = 0,
17612
17640
  x: originY = 0
17613
17641
  } = area.attribute;
17614
- if (!1 !== fill && (fillCb ? fillCb(context, area.attribute, areaAttribute) : fillOpacity && (context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, areaAttribute, drawContext, fillCb, null, {
17642
+ !1 !== fill && (fillCb ? fillCb(context, area.attribute, areaAttribute) : fillOpacity && (context.setCommonStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, areaAttribute, drawContext, fillCb, null, {
17615
17643
  attribute: area.attribute
17616
- }), stroke) {
17617
- const {
17618
- stroke = areaAttribute && areaAttribute.stroke
17619
- } = area.attribute;
17620
- if (isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
17621
- context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
17622
- for (let i = 1; i < points.length; i++) {
17623
- const p = points[i];
17624
- context.lineTo(p.x + offsetX, p.y + offsetY, z);
17625
- }
17626
- } else if (stroke[2]) {
17627
- const endP = points[points.length - 1];
17628
- context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
17629
- for (let i = points.length - 2; i >= 0; i--) {
17630
- const p = points[i];
17631
- context.lineTo((null !== (_d = p.x1) && void 0 !== _d ? _d : p.x) + offsetX, (null !== (_e = p.y1) && void 0 !== _e ? _e : p.y) + offsetY, z);
17644
+ }), (() => {
17645
+ var _a, _b;
17646
+ if (stroke) {
17647
+ const {
17648
+ stroke = areaAttribute && areaAttribute.stroke
17649
+ } = area.attribute;
17650
+ if (isArray$1(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
17651
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
17652
+ for (let i = 1; i < points.length; i++) {
17653
+ const p = points[i];
17654
+ context.lineTo(p.x + offsetX, p.y + offsetY, z);
17655
+ }
17656
+ } else if (stroke[2]) {
17657
+ const endP = points[points.length - 1];
17658
+ context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
17659
+ for (let i = points.length - 2; i >= 0; i--) {
17660
+ const p = points[i];
17661
+ context.lineTo((null !== (_a = p.x1) && void 0 !== _a ? _a : p.x) + offsetX, (null !== (_b = p.y1) && void 0 !== _b ? _b : p.y) + offsetY, z);
17662
+ }
17632
17663
  }
17664
+ strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
17633
17665
  }
17634
- strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
17635
- }
17666
+ })();
17636
17667
  }
17637
17668
  drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
17638
17669
  var _a, _b, _c, _d, _e, _f;
@@ -17797,23 +17828,24 @@
17797
17828
  x: originX = 0,
17798
17829
  x: originY = 0
17799
17830
  } = attribute;
17800
- if (!1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
17831
+ return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
17801
17832
  attribute: attribute
17802
- }), !1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
17803
- const {
17804
- stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
17805
- } = attribute;
17806
- isArray$1(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$1.ROW ? "x" : "y", {
17807
- offsetX: offsetX,
17808
- offsetY: offsetY,
17809
- offsetZ: offsetZ,
17810
- drawConnect: connect,
17811
- mode: connectedType,
17812
- zeroX: connectedX,
17813
- zeroY: connectedY
17814
- })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
17815
- }
17816
- return !1;
17833
+ }), (() => {
17834
+ if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
17835
+ const {
17836
+ stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
17837
+ } = attribute;
17838
+ isArray$1(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$1.ROW ? "x" : "y", {
17839
+ offsetX: offsetX,
17840
+ offsetY: offsetY,
17841
+ offsetZ: offsetZ,
17842
+ drawConnect: connect,
17843
+ mode: connectedType,
17844
+ zeroX: connectedX,
17845
+ zeroY: connectedY
17846
+ })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
17847
+ }
17848
+ })(), !1;
17817
17849
  }
17818
17850
  };
17819
17851
  DefaultCanvasAreaRender = __decorate$1o([injectable(), __param$I(0, inject(ContributionProvider)), __param$I(0, named(AreaRenderContribution)), __metadata$13("design:paramtypes", [Object])], DefaultCanvasAreaRender);
@@ -17845,7 +17877,8 @@
17845
17877
  const pathAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : getTheme$1(path, null == params ? void 0 : params.theme).path,
17846
17878
  {
17847
17879
  x: originX = pathAttribute.x,
17848
- y: originY = pathAttribute.y
17880
+ y: originY = pathAttribute.y,
17881
+ fillStrokeOrder = pathAttribute.fillStrokeOrder
17849
17882
  } = path.attribute,
17850
17883
  z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
17851
17884
  data = this.valid(path, pathAttribute, fillCb, strokeCb);
@@ -17860,7 +17893,14 @@
17860
17893
  const path2D = null !== (_c = path.attribute.path) && void 0 !== _c ? _c : pathAttribute.path;
17861
17894
  renderCommandList(path2D.commandList, context, x, y, 1, 1, z);
17862
17895
  }
17863
- context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute), this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb), doStroke && (strokeCb ? strokeCb(context, path.attribute, pathAttribute) : sVisible && (context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.stroke())), doFill && (fillCb ? fillCb(context, path.attribute, pathAttribute) : fVisible && (context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.fill())), this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
17896
+ context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute), this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
17897
+ const _runStroke = () => {
17898
+ doStroke && (strokeCb ? strokeCb(context, path.attribute, pathAttribute) : sVisible && (context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.stroke()));
17899
+ },
17900
+ _runFill = () => {
17901
+ doFill && (fillCb ? fillCb(context, path.attribute, pathAttribute) : fVisible && (context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.fill()));
17902
+ };
17903
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
17864
17904
  }
17865
17905
  draw(path, renderService, drawContext, params) {
17866
17906
  const pathAttribute = getTheme$1(path, null == params ? void 0 : params.theme).path;
@@ -17904,7 +17944,8 @@
17904
17944
  x1: x1,
17905
17945
  y1: y1,
17906
17946
  x: originX = rectAttribute.x,
17907
- y: originY = rectAttribute.y
17947
+ y: originY = rectAttribute.y,
17948
+ fillStrokeOrder = rectAttribute.fillStrokeOrder
17908
17949
  } = rect.attribute;
17909
17950
  let {
17910
17951
  width: width,
@@ -17923,7 +17964,14 @@
17923
17964
  doFill: doFill,
17924
17965
  doStroke: doStroke
17925
17966
  };
17926
- context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke), doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill())), doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke())), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
17967
+ context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
17968
+ const _runFill = () => {
17969
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill()));
17970
+ },
17971
+ _runStroke = () => {
17972
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke()));
17973
+ };
17974
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
17927
17975
  }
17928
17976
  draw(rect, renderService, drawContext, params) {
17929
17977
  const rectAttribute = getTheme$1(rect, null == params ? void 0 : params.theme).rect;
@@ -17959,7 +18007,8 @@
17959
18007
  x: originX = symbolAttribute.x,
17960
18008
  y: originY = symbolAttribute.y,
17961
18009
  scaleX = symbolAttribute.scaleX,
17962
- scaleY = symbolAttribute.scaleY
18010
+ scaleY = symbolAttribute.scaleY,
18011
+ fillStrokeOrder = symbolAttribute.fillStrokeOrder
17963
18012
  } = symbol.attribute,
17964
18013
  data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);
17965
18014
  if (!data) return;
@@ -17982,14 +18031,27 @@
17982
18031
  const obj = Object.assign({}, a);
17983
18032
  obj.fill = null !== (_a = a.fill) && void 0 !== _a ? _a : symbol.attribute.fill, obj.opacity = null !== (_b = a.opacity) && void 0 !== _b ? _b : symbol.attribute.opacity, obj.fillOpacity = symbol.attribute.fillOpacity, obj.stroke = null !== (_c = a.stroke) && void 0 !== _c ? _c : symbol.attribute.stroke, a = obj;
17984
18033
  }
17985
- a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill())), a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
18034
+ const _runFill = () => {
18035
+ a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill()));
18036
+ },
18037
+ _runStroke = () => {
18038
+ a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
18039
+ };
18040
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
17986
18041
  };
17987
18042
  if (keepDirIn3d && context.camera && context.project) {
17988
18043
  const p = context.project(x, y, z),
17989
18044
  camera = context.camera;
17990
18045
  context.camera = null, !1 === parsedPath.draw(context, isArray$1(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX, p.x, p.y, void 0, callback) && context.closePath(), context.camera = camera;
17991
18046
  } else !1 === parsedPath.draw(context, size, x, y, z, callback) && context.closePath();
17992
- context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb), doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill())), doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke())), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
18047
+ context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
18048
+ const _runFill = () => {
18049
+ doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill()));
18050
+ },
18051
+ _runStroke = () => {
18052
+ doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
18053
+ };
18054
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
17993
18055
  }
17994
18056
  draw(symbol, renderService, drawContext, params) {
17995
18057
  const symbolAttribute = getTheme$1(symbol, null == params ? void 0 : params.theme).symbol;
@@ -18366,7 +18428,8 @@
18366
18428
  cornerRadius = polygonAttribute.cornerRadius,
18367
18429
  x: originX = polygonAttribute.x,
18368
18430
  y: originY = polygonAttribute.y,
18369
- closePath = polygonAttribute.closePath
18431
+ closePath = polygonAttribute.closePath,
18432
+ fillStrokeOrder = polygonAttribute.fillStrokeOrder
18370
18433
  } = polygon.attribute,
18371
18434
  data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);
18372
18435
  if (!data) return;
@@ -18376,7 +18439,14 @@
18376
18439
  doFill: doFill,
18377
18440
  doStroke: doStroke
18378
18441
  } = data;
18379
- context.beginPath(), cornerRadius <= 0 || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? drawPolygon(context.camera ? context : context.nativeContext, points, x, y) : drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath), closePath && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute), this.beforeRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb), doFill && (fillCb ? fillCb(context, polygon.attribute, polygonAttribute) : fVisible && (context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.fill())), doStroke && (strokeCb ? strokeCb(context, polygon.attribute, polygonAttribute) : sVisible && (context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.stroke())), this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
18442
+ context.beginPath(), cornerRadius <= 0 || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) ? drawPolygon(context.camera ? context : context.nativeContext, points, x, y) : drawRoundedPolygon(context.camera ? context : context.nativeContext, points, x, y, cornerRadius, closePath), closePath && context.closePath(), context.setShadowBlendStyle && context.setShadowBlendStyle(polygon, polygon.attribute, polygonAttribute), this.beforeRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
18443
+ const _runFill = () => {
18444
+ doFill && (fillCb ? fillCb(context, polygon.attribute, polygonAttribute) : fVisible && (context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.fill()));
18445
+ },
18446
+ _runStroke = () => {
18447
+ doStroke && (strokeCb ? strokeCb(context, polygon.attribute, polygonAttribute) : sVisible && (context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.stroke()));
18448
+ };
18449
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
18380
18450
  }
18381
18451
  draw(polygon, renderService, drawContext, params) {
18382
18452
  const polygonAttribute = getTheme$1(polygon, null == params ? void 0 : params.theme).polygon;
@@ -18419,7 +18489,8 @@
18419
18489
  cornerRadius = groupAttribute.cornerRadius,
18420
18490
  path = groupAttribute.path,
18421
18491
  lineWidth = groupAttribute.lineWidth,
18422
- visible = groupAttribute.visible
18492
+ visible = groupAttribute.visible,
18493
+ fillStrokeOrder = groupAttribute.fillStrokeOrder
18423
18494
  } = group.attribute,
18424
18495
  fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
18425
18496
  sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
@@ -18445,7 +18516,14 @@
18445
18516
  };
18446
18517
  this._groupRenderContribitions.forEach(c => {
18447
18518
  c.time === BaseRenderContributionTime.beforeFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
18448
- }), clip && context.clip(), context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute), doFillOrStroke.doFill && (fillCb ? fillCb(context, group.attribute, groupAttribute) : fVisible && (context.setCommonStyle(group, group.attribute, x, y, groupAttribute), context.fill())), doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, group.attribute, groupAttribute) : sVisible && (context.setStrokeStyle(group, group.attribute, x, y, groupAttribute), context.stroke())), this._groupRenderContribitions.forEach(c => {
18519
+ }), clip && context.clip(), context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);
18520
+ const _runFill = () => {
18521
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, group.attribute, groupAttribute) : fVisible && (context.setCommonStyle(group, group.attribute, x, y, groupAttribute), context.fill()));
18522
+ },
18523
+ _runStroke = () => {
18524
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, group.attribute, groupAttribute) : sVisible && (context.setStrokeStyle(group, group.attribute, x, y, groupAttribute), context.stroke()));
18525
+ };
18526
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this._groupRenderContribitions.forEach(c => {
18449
18527
  c.time === BaseRenderContributionTime.afterFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb);
18450
18528
  });
18451
18529
  }
@@ -18511,6 +18589,7 @@
18511
18589
  x: originX = imageAttribute.x,
18512
18590
  y: originY = imageAttribute.y,
18513
18591
  cornerRadius = imageAttribute.cornerRadius,
18592
+ fillStrokeOrder = imageAttribute.fillStrokeOrder,
18514
18593
  image: url
18515
18594
  } = image.attribute,
18516
18595
  data = this.valid(image, imageAttribute, fillCb);
@@ -18521,20 +18600,26 @@
18521
18600
  doFill: doFill,
18522
18601
  doStroke: doStroke
18523
18602
  } = data;
18524
- if (context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb), doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
18525
- if (!url || !image.resources) return;
18526
- const res = image.resources.get(url);
18527
- if ("success" !== res.state) return;
18528
- let needRestore = !1;
18529
- 0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) || (context.beginPath(), createRectPath(context, x, y, width, height, cornerRadius), context.save(), context.clip(), needRestore = !0), context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
18530
- let repeat = 0;
18531
- if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
18532
- const pattern = context.createPattern(res.data, repeatStr[repeat]);
18533
- context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
18534
- } else context.drawImage(res.data, x, y, width, height);
18535
- needRestore && context.restore();
18536
- }
18537
- doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke())), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
18603
+ context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
18604
+ const _runFill = () => {
18605
+ if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
18606
+ if (!url || !image.resources) return;
18607
+ const res = image.resources.get(url);
18608
+ if ("success" !== res.state) return;
18609
+ let needRestore = !1;
18610
+ 0 === cornerRadius || isArray$1(cornerRadius) && cornerRadius.every(num => 0 === num) || (context.beginPath(), createRectPath(context, x, y, width, height, cornerRadius), context.save(), context.clip(), needRestore = !0), context.setCommonStyle(image, image.attribute, x, y, imageAttribute);
18611
+ let repeat = 0;
18612
+ if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
18613
+ const pattern = context.createPattern(res.data, repeatStr[repeat]);
18614
+ context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
18615
+ } else context.drawImage(res.data, x, y, width, height);
18616
+ needRestore && context.restore();
18617
+ }
18618
+ },
18619
+ _runStroke = () => {
18620
+ doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
18621
+ };
18622
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
18538
18623
  }
18539
18624
  draw(image, renderService, drawContext) {
18540
18625
  const {
@@ -31535,27 +31620,27 @@
31535
31620
  scale = _ => ~~(_ / ratio);
31536
31621
  return scale.bitmap = () => bitmap(w, h), scale.x = _ => ~~((_ + left) / ratio), scale.y = _ => ~~((_ + top) / ratio), scale.ratio = ratio, scale.padding = padding, scale.width = width, scale.height = height, scale;
31537
31622
  }
31623
+ function clampRangeByBitmap($, range) {
31624
+ const {
31625
+ x1: x1,
31626
+ x2: x2,
31627
+ y1: y1,
31628
+ y2: y2
31629
+ } = range,
31630
+ _x1 = clamp$1(x1, 0, $.width),
31631
+ _x2 = clamp$1(x2, 0, $.width),
31632
+ _y1 = clamp$1(y1, 0, $.height),
31633
+ _y2 = clamp$1(y2, 0, $.height);
31634
+ return {
31635
+ x1: $.x(_x1),
31636
+ x2: $.x(_x2),
31637
+ y1: $.y(_y1),
31638
+ y2: $.y(_y2)
31639
+ };
31640
+ }
31538
31641
  function boundToRange($, bound) {
31539
31642
  let clamp = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !1;
31540
- if (clamp) {
31541
- const {
31542
- x1: x1,
31543
- x2: x2,
31544
- y1: y1,
31545
- y2: y2
31546
- } = bound,
31547
- _x1 = clamp$1(x1, 0, $.width),
31548
- _x2 = clamp$1(x2, 0, $.width),
31549
- _y1 = clamp$1(y1, 0, $.height),
31550
- _y2 = clamp$1(y2, 0, $.height);
31551
- return {
31552
- x1: $.x(_x1),
31553
- x2: $.x(_x2),
31554
- y1: $.y(_y1),
31555
- y2: $.y(_y2)
31556
- };
31557
- }
31558
- return {
31643
+ return clamp ? clampRangeByBitmap($, bound) : {
31559
31644
  x1: $.x(bound.x1),
31560
31645
  x2: $.x(bound.x2),
31561
31646
  y1: $.y(bound.y1),
@@ -31573,7 +31658,8 @@
31573
31658
  y1: bound.y1 - pad,
31574
31659
  y2: bound.y2 + pad
31575
31660
  }), range = boundToRange($, range);
31576
- return !(checkBound && bitmap.outOfBounds(range)) && !bitmap.getRange(range);
31661
+ const outOfBounds = bitmap.outOfBounds(range);
31662
+ return (!checkBound || !outOfBounds) && (outOfBounds && (range = clampRangeByBitmap($, range)), !bitmap.getRange(range));
31577
31663
  }
31578
31664
  function placeToCandidates($, bitmap, text) {
31579
31665
  let candidates = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
@@ -31926,6 +32012,73 @@
31926
32012
  registerGroup(), registerText(), registerRichtext(), registerLine();
31927
32013
  }
31928
32014
 
32015
+ function shiftY(texts) {
32016
+ let option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
32017
+ const {
32018
+ maxIterations = 10,
32019
+ maxError = .1,
32020
+ padding = 1,
32021
+ maxY = Number.MAX_VALUE
32022
+ } = option,
32023
+ n = texts.length;
32024
+ if (n <= 1) return texts;
32025
+ const isIntersect = (_ref, _ref2) => {
32026
+ let [a, b] = _ref;
32027
+ let [c, d] = _ref2;
32028
+ return d > a && b > c;
32029
+ },
32030
+ textInformation = new Map(),
32031
+ getY0 = text => textInformation.get(text).y0,
32032
+ getY = text => textInformation.get(text).y,
32033
+ getHeight = text => textInformation.get(text).height,
32034
+ getX1 = text => textInformation.get(text).x1,
32035
+ getX2 = text => textInformation.get(text).x2,
32036
+ setY = (text, y) => {
32037
+ textInformation.get(text).y = y;
32038
+ };
32039
+ for (const text of texts) {
32040
+ const {
32041
+ y1: y1,
32042
+ y2: y2,
32043
+ x1: x1,
32044
+ x2: x2
32045
+ } = text.AABBBounds;
32046
+ textInformation.set(text, {
32047
+ y0: y1,
32048
+ y: y1,
32049
+ height: y2 - y1,
32050
+ x1: x1,
32051
+ x2: x2
32052
+ });
32053
+ }
32054
+ for (let iter = 0; iter < maxIterations; iter++) {
32055
+ texts.sort((a, b) => getY(a) - getY(b));
32056
+ let error = 0;
32057
+ for (let i = 0; i < n - 1; i++) {
32058
+ const curText = texts[i];
32059
+ let nextText,
32060
+ j = i + 1;
32061
+ for (; (nextText = texts[j]) && !isIntersect([getX1(curText), getX2(curText)], [getX1(nextText), getX2(nextText)]);) j += 1;
32062
+ if (nextText) {
32063
+ const y0 = getY(curText),
32064
+ h0 = getHeight(curText),
32065
+ y1 = getY(nextText),
32066
+ delta = y1 - (y0 + h0);
32067
+ if (delta < padding) {
32068
+ const newDelta = (padding - delta) / 2;
32069
+ error = Math.max(error, newDelta), y1 + newDelta + getHeight(nextText) > maxY ? setY(curText, y0 - (padding - delta)) : y0 - newDelta < 0 ? setY(nextText, y1 + (padding - delta)) : (setY(curText, y0 - newDelta), setY(nextText, y1 + newDelta));
32070
+ }
32071
+ }
32072
+ }
32073
+ if (error < maxError) break;
32074
+ }
32075
+ for (const text of texts) {
32076
+ const finalY = text.attribute.y + getY(text) - getY0(text);
32077
+ text.setAttribute("y", finalY);
32078
+ }
32079
+ return texts;
32080
+ }
32081
+
31929
32082
  var __rest$b = undefined && undefined.__rest || function (s, e) {
31930
32083
  var t = {};
31931
32084
  for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
@@ -32132,16 +32285,57 @@
32132
32285
  return texts;
32133
32286
  }
32134
32287
  _overlapping(labels) {
32135
- var _a, _b, _c, _d;
32288
+ var _a, _b, _c;
32136
32289
  if (0 === labels.length) return [];
32137
32290
  const option = isObject$2(this.attribute.overlap) ? this.attribute.overlap : {},
32138
- result = [],
32139
32291
  baseMarkGroup = this.getBaseMarkGroup(),
32140
32292
  size = null !== (_a = option.size) && void 0 !== _a ? _a : {
32141
32293
  width: null !== (_b = null == baseMarkGroup ? void 0 : baseMarkGroup.AABBBounds.width()) && void 0 !== _b ? _b : 0,
32142
32294
  height: null !== (_c = null == baseMarkGroup ? void 0 : baseMarkGroup.AABBBounds.height()) && void 0 !== _c ? _c : 0
32143
32295
  };
32144
32296
  if (0 === size.width || 0 === size.height) return labels;
32297
+ const {
32298
+ strategy: strategy,
32299
+ priority: priority
32300
+ } = option,
32301
+ bmpTool = this._bmpTool || bitmapTool(size.width, size.height),
32302
+ bitmap = this._bitmap || bmpTool.bitmap();
32303
+ return priority && (labels = labels.sort((a, b) => priority(b.attribute.data) - priority(a.attribute.data))), "shiftY" === (null == strategy ? void 0 : strategy.type) ? this._overlapGlobal(labels, option, bmpTool, bitmap) : this._overlapByStrategy(labels, option, bmpTool, bitmap);
32304
+ }
32305
+ _overlapGlobal(labels, option, bmpTool, bitmap) {
32306
+ let result = labels.filter(label => label.attribute.visible && 0 !== label.attribute.opacity);
32307
+ const {
32308
+ clampForce = !0,
32309
+ hideOnHit = !0,
32310
+ overlapPadding: overlapPadding,
32311
+ strategy: strategy
32312
+ } = option;
32313
+ if (clampForce) for (let i = 0; i < result.length; i++) {
32314
+ const text = labels[i],
32315
+ {
32316
+ dx = 0,
32317
+ dy = 0
32318
+ } = clampText(text, bmpTool.width, bmpTool.height);
32319
+ 0 === dx && 0 === dy || text.setAttributes({
32320
+ x: text.attribute.x + dx,
32321
+ y: text.attribute.y + dy
32322
+ });
32323
+ }
32324
+ result = shiftY(result, Object.assign({
32325
+ maxY: bmpTool.height
32326
+ }, strategy));
32327
+ for (let i = 0; i < result.length; i++) {
32328
+ const text = result[i],
32329
+ bounds = text.AABBBounds,
32330
+ range = boundToRange(bmpTool, bounds, !0);
32331
+ canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding) ? bitmap.setRange(range) : hideOnHit ? text.setAttributes({
32332
+ visible: !1
32333
+ }) : bitmap.setRange(range);
32334
+ }
32335
+ return result;
32336
+ }
32337
+ _overlapByStrategy(labels, option, bmpTool, bitmap) {
32338
+ var _a;
32145
32339
  const {
32146
32340
  avoidBaseMark: avoidBaseMark,
32147
32341
  strategy = [],
@@ -32150,10 +32344,9 @@
32150
32344
  avoidMarks = [],
32151
32345
  overlapPadding: overlapPadding
32152
32346
  } = option,
32153
- bmpTool = this._bmpTool || bitmapTool(size.width, size.height),
32154
- bitmap = this._bitmap || bmpTool.bitmap(),
32347
+ result = [],
32155
32348
  checkBounds = strategy.some(s => "bound" === s.type);
32156
- avoidBaseMark && (null === (_d = this._baseMarks) || void 0 === _d || _d.forEach(mark => {
32349
+ avoidBaseMark && (null === (_a = this._baseMarks) || void 0 === _a || _a.forEach(mark => {
32157
32350
  mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, !0));
32158
32351
  })), avoidMarks.length > 0 && avoidMarks.forEach(avoid => {
32159
32352
  isString$1(avoid) ? getNoneGroupMarksByName(this.getRootNode(), avoid).forEach(avoidMark => {
@@ -32161,7 +32354,7 @@
32161
32354
  }) : avoid.AABBBounds && bitmap.setRange(boundToRange(bmpTool, avoid.AABBBounds, !0));
32162
32355
  });
32163
32356
  for (let i = 0; i < labels.length; i++) {
32164
- if (!1 === labels[i].visible) continue;
32357
+ if (!1 === labels[i].attribute.visible) continue;
32165
32358
  const text = labels[i],
32166
32359
  baseMark = this.getRelatedGraphic(text.attribute);
32167
32360
  if (text.update(), !isRectIntersect(baseMark.AABBBounds, {
@@ -34042,12 +34235,15 @@
34042
34235
  do {
34043
34236
  items = reduce(items, sep);
34044
34237
  } while (items.length >= 3 && hasOverlap$1(items, sep));
34045
- const shouldCheck = (length, visibility) => length < 3 || visibility,
34046
- checkFirst = shouldCheck(items.length, config.firstVisible);
34238
+ const shouldCheck = function (length, visibility) {
34239
+ let checkLength = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
34240
+ return checkLength && length < 3 || visibility;
34241
+ },
34242
+ checkFirst = shouldCheck(items.length, config.firstVisible, !1);
34047
34243
  let checkLast = shouldCheck(items.length, config.lastVisible);
34048
34244
  const firstSourceItem = source[0],
34049
34245
  lastSourceItem = last(source);
34050
- textIntersect(firstSourceItem, lastSourceItem, sep) && (lastSourceItem.setAttribute("opacity", 0), checkLast = !1), forceItemVisible$1(firstSourceItem, items, checkFirst, item => textIntersect(item, firstSourceItem, sep)), forceItemVisible$1(lastSourceItem, items, checkLast, item => textIntersect(item, lastSourceItem, sep) || !(!checkFirst || item === firstSourceItem) && textIntersect(item, firstSourceItem, sep), !0);
34246
+ textIntersect(firstSourceItem, lastSourceItem, sep) && checkFirst && checkLast && (lastSourceItem.setAttribute("opacity", 0), checkLast = !1), forceItemVisible$1(firstSourceItem, items, checkFirst, item => textIntersect(item, firstSourceItem, sep)), forceItemVisible$1(lastSourceItem, items, checkLast, item => textIntersect(item, lastSourceItem, sep) || !(!checkFirst || item === firstSourceItem) && textIntersect(item, firstSourceItem, sep), !0);
34051
34247
  }
34052
34248
  source.forEach(item => {
34053
34249
  item.setAttribute("visible", !!item.attribute.opacity);
@@ -36271,10 +36467,9 @@
36271
36467
  lastSourceItem = last(source),
36272
36468
  samplingMethod = breakData && breakData() ? methods$1.greedy : methods$1.parity;
36273
36469
  for (; items.length >= 3 && hasOverlap$1(items, labelGap);) items = samplingMethod(items, labelGap);
36274
- const shouldCheck = (length, visibility) => length < 3 || visibility,
36275
- checkFirst = shouldCheck(items.length, op.labelFirstVisible);
36276
- let checkLast = shouldCheck(items.length, op.labelLastVisible);
36277
- textIntersect(firstSourceItem, lastSourceItem, labelGap) && items.includes(lastSourceItem) && items.length > 1 && (items.splice(items.indexOf(lastSourceItem), 1), checkLast = !1), forceItemVisible(firstSourceItem, items, checkFirst, item => textIntersect(item, firstSourceItem, labelGap)), forceItemVisible(lastSourceItem, items, checkLast, item => textIntersect(item, lastSourceItem, labelGap) || !(!checkFirst || item === firstSourceItem) && textIntersect(item, firstSourceItem, labelGap), !0);
36470
+ const checkFirst = op.labelFirstVisible;
36471
+ let checkLast = op.labelLastVisible;
36472
+ textIntersect(firstSourceItem, lastSourceItem, labelGap) && items.includes(lastSourceItem) && items.length > 1 && checkFirst && checkLast && (items.splice(items.indexOf(lastSourceItem), 1), checkLast = !1), forceItemVisible(firstSourceItem, items, checkFirst, item => textIntersect(item, firstSourceItem, labelGap)), forceItemVisible(lastSourceItem, items, checkLast, item => textIntersect(item, lastSourceItem, labelGap) || !(!checkFirst || item === firstSourceItem) && textIntersect(item, firstSourceItem, labelGap), !0);
36278
36473
  const ticks = items.map(item => item.value);
36279
36474
  ticks.length < 3 && labelFlush && (ticks.length > 1 && ticks.pop(), last(ticks) !== last(scaleTicks) && ticks.push(last(scaleTicks))), scaleTicks = ticks;
36280
36475
  }
@@ -47310,7 +47505,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
47310
47505
  Object.keys(nextGraphicAttributes).forEach(channel => {
47311
47506
  prevGraphicAttributes[channel] = this.getGraphicAttribute(channel), finalGraphicAttributes[channel] = nextGraphicAttributes[channel];
47312
47507
  }), this.setNextGraphicAttributes(nextGraphicAttributes), this.setPrevGraphicAttributes(prevGraphicAttributes), this.setFinalGraphicAttributes(finalGraphicAttributes);
47313
- const animateGraphicAttributes = ((null === (_c = this.mark.animate) || void 0 === _c ? void 0 : _c.getElementAnimators(this)) || []).reduce((attributes, animator) => Object.assign(attributes, animator.getEndAttributes()), {}),
47508
+ const currentAnimators = null === (_c = this.mark.animate) || void 0 === _c ? void 0 : _c.getElementAnimators(this).filter(animator => {
47509
+ var _a;
47510
+ return !(null === (_a = animator.animationOptions.timeline.controlOptions) || void 0 === _a ? void 0 : _a.ignoreLoopFinalAttributes) || !animator.animationOptions.timeline.loop;
47511
+ }),
47512
+ animateGraphicAttributes = (currentAnimators || []).reduce((attributes, animator) => Object.assign(attributes, animator.getEndAttributes()), {}),
47314
47513
  currentGraphicAttributes = Object.assign({}, animateGraphicAttributes, finalGraphicAttributes);
47315
47514
  this.graphicItem.setAttributes(currentGraphicAttributes);
47316
47515
  } else this.graphicItem.setAttributes(graphicAttributes);
@@ -61446,7 +61645,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
61446
61645
  };
61447
61646
  registerVChartCore();
61448
61647
 
61449
- const version = "1.12.9-alpha.0";
61648
+ const version = "1.12.9-alpha.2";
61450
61649
 
61451
61650
  const addVChartProperty = (data, op) => {
61452
61651
  const context = op.beforeCall();
@@ -90318,9 +90517,44 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90318
90517
  this.activeType = 'mark';
90319
90518
  }
90320
90519
  showTooltip(info, params, changePositionOnly) {
90520
+ var _a, _b, _c;
90321
90521
  const { datum, series } = info;
90522
+ const tooltipSpec = this.component.getSpec();
90322
90523
  const tooltipData = [{ datum: [datum], series }];
90524
+ const helper = series.tooltipHelper;
90525
+ const seriesSpec = (_a = series.getSpec()) === null || _a === void 0 ? void 0 : _a.tooltip;
90526
+ const seriesCheckOverlap = (_b = seriesSpec === null || seriesSpec === void 0 ? void 0 : seriesSpec.mark) === null || _b === void 0 ? void 0 : _b.checkOverlap;
90527
+ let checkOverlap = false;
90528
+ if (seriesCheckOverlap === true || (((_c = tooltipSpec.mark) === null || _c === void 0 ? void 0 : _c.checkOverlap) === true && seriesCheckOverlap !== false)) {
90529
+ const activeTriggers = helper === null || helper === void 0 ? void 0 : helper.activeTriggerSet.mark;
90530
+ if (activeTriggers) {
90531
+ checkOverlap = true;
90532
+ const chart = this.component.getChart();
90533
+ const layer = chart.getCompiler().getStage().getLayer(undefined);
90534
+ const point = { x: params.event.viewX, y: params.event.viewY };
90535
+ layer.globalTransMatrix.transformPoint({ x: params.event.viewX, y: params.event.viewY }, point);
90536
+ activeTriggers.forEach(mark => {
90537
+ mark.getProductElements().forEach(el => {
90538
+ const graphic = el.getGraphicItem();
90539
+ if (el !== params.item &&
90540
+ graphic &&
90541
+ graphic.containsPoint(point.x, point.y, IContainPointMode.GLOBAL, graphic.stage.getPickerService())) {
90542
+ tooltipData[0].datum.push(el.getDatum());
90543
+ }
90544
+ });
90545
+ });
90546
+ }
90547
+ }
90323
90548
  const newParams = Object.assign(Object.assign({}, params), { changePositionOnly, tooltip: this.component });
90549
+ if (changePositionOnly && checkOverlap) {
90550
+ const cacheData = this._cacheActiveSpec && this._cacheActiveSpec.data;
90551
+ if (!cacheData ||
90552
+ cacheData[0].series !== tooltipData[0].series ||
90553
+ cacheData[0].datum.length !== tooltipData[0].datum.length ||
90554
+ cacheData[0].datum.some((d, index) => d !== tooltipData[0].datum[index])) {
90555
+ newParams.changePositionOnly = false;
90556
+ }
90557
+ }
90324
90558
  return this._showTooltipByHandler(tooltipData, newParams);
90325
90559
  }
90326
90560
  getMouseEventData(params) {
@@ -90487,6 +90721,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90487
90721
  this._handleChartMouseOut(params);
90488
90722
  }, (_d = this._spec.showDelay) !== null && _d !== void 0 ? _d : DEFAULT_SHOW_DELAY);
90489
90723
  }
90724
+ else {
90725
+ this._handleChartMouseOut(params);
90726
+ }
90490
90727
  };
90491
90728
  this._handleChartMouseOut = (params) => {
90492
90729
  if (this._alwaysShow) {
@@ -90729,7 +90966,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90729
90966
  const container = (_b = (_a = this.tooltipHandler).getTooltipContainer) === null || _b === void 0 ? void 0 : _b.call(_a);
90730
90967
  const element = container === null || container === void 0 ? void 0 : container.firstChild;
90731
90968
  if (element) {
90732
- element.addEventListener('mouseenter', () => {
90969
+ element.addEventListener('pointerenter', () => {
90733
90970
  var _a;
90734
90971
  const rect = (_a = element.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(element);
90735
90972
  if (rect) {
@@ -90744,7 +90981,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90744
90981
  this._showTimer = null;
90745
90982
  }
90746
90983
  });
90747
- element.addEventListener('mouseleave', () => {
90984
+ element.addEventListener('pointerleave', () => {
90748
90985
  var _a, _b;
90749
90986
  if (this._cacheEnterableRect) {
90750
90987
  const newRect = (_a = element.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(element);
@@ -90779,12 +91016,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90779
91016
  const trigger = array((_a = this._spec.trigger) !== null && _a !== void 0 ? _a : 'hover');
90780
91017
  const mode = this._option.mode;
90781
91018
  if (trigger.includes('hover')) {
90782
- this._mountEvent('pointermove', { source: 'chart' }, this._getMouseMoveHandler(false));
91019
+ this._mountEvent('pointermove', { source: 'chart' }, this._throttle(this._getMouseMoveHandler(false)));
90783
91020
  if (isMobileLikeMode(mode) || isMiniAppLikeMode(mode)) {
90784
91021
  this._mountEvent('pointerdown', { source: 'chart' }, this._getMouseMoveHandler(false));
90785
91022
  this._mountEvent('pointerup', { source: 'window' }, this._getMouseOutHandler(true));
90786
91023
  }
90787
- this._mountEvent('pointerleave', { source: 'canvas' }, this._getMouseOutHandler(false));
91024
+ this._mountEvent('pointerout', { source: 'chart' }, this._getMouseOutHandler(false));
90788
91025
  }
90789
91026
  if (trigger.includes('click')) {
90790
91027
  this._mountEvent('pointertap', { source: 'chart' }, this._getMouseMoveHandler(true));
@@ -90794,6 +91031,21 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
90794
91031
  this._mountEvent('pointertap', { source: 'chart' }, this._handleClickToLock);
90795
91032
  }
90796
91033
  }
91034
+ _throttle(callback) {
91035
+ let wait;
91036
+ if (isNumber$1(this._spec.throttleInterval)) {
91037
+ wait = this._spec.throttleInterval;
91038
+ }
91039
+ else {
91040
+ if (this._spec.renderMode !== 'html' || !this._spec.transitionDuration) {
91041
+ wait = 10;
91042
+ }
91043
+ else {
91044
+ wait = 50;
91045
+ }
91046
+ }
91047
+ return throttle(callback, wait);
91048
+ }
90797
91049
  reInit(spec) {
90798
91050
  var _a, _b;
90799
91051
  super.reInit(spec);
@@ -98829,7 +99081,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98829
99081
  }
98830
99082
  return this.changeTooltip(true, params, data);
98831
99083
  };
98832
- this._changeTooltip = (visible, params, data) => {
99084
+ this.changeTooltip = (visible, params, data) => {
98833
99085
  if (this._isReleased) {
98834
99086
  return 1;
98835
99087
  }
@@ -98837,9 +99089,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
98837
99089
  this._updateTooltip(false, params);
98838
99090
  return 0;
98839
99091
  }
98840
- return this._changeTooltipPosition(params, data);
99092
+ return this.changeTooltipPosition(params, data);
98841
99093
  };
98842
- this._changeTooltipPosition = (params, data) => {
99094
+ this.changeTooltipPosition = (params, data) => {
98843
99095
  var _a, _b, _c, _d, _e;
98844
99096
  if (this._isReleased) {
98845
99097
  return 1;
@@ -99094,22 +99346,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
99094
99346
  this._removeTooltip();
99095
99347
  this._isReleased = true;
99096
99348
  }
99097
- _throttle(callback) {
99098
- const tooltipSpec = this._component.getSpec();
99099
- let wait;
99100
- if (isNumber$1(tooltipSpec.throttleInterval)) {
99101
- wait = tooltipSpec.throttleInterval;
99102
- }
99103
- else {
99104
- if (tooltipSpec.renderMode !== 'html' || !tooltipSpec.transitionDuration) {
99105
- wait = 10;
99106
- }
99107
- else {
99108
- wait = 50;
99109
- }
99110
- }
99111
- return throttle(callback, wait);
99112
- }
99113
99349
  _getDefaultOption() {
99114
99350
  var _a, _b;
99115
99351
  const { offset } = this._component.getSpec();
@@ -99136,8 +99372,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
99136
99372
  }
99137
99373
  _initFromSpec() {
99138
99374
  this._option = this._getDefaultOption();
99139
- this.changeTooltip = this._throttle(this._changeTooltip);
99140
- this.changeTooltipPosition = this._throttle(this._changeTooltipPosition);
99141
99375
  }
99142
99376
  reInit() {
99143
99377
  this._initFromSpec();