@visactor/vrender-components 0.20.21 → 0.20.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1452,7 +1452,7 @@ let Step$1 = class Step {
1452
1452
  default:
1453
1453
  if (this._t <= 0) this.context.lineTo(this._x, y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x, y, !1 !== this._lastDefined && !1 !== p.defined, p);else {
1454
1454
  const x1 = this._x * (1 - this._t) + x * this._t;
1455
- this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
1455
+ .5 === this._t ? this.context.lineTo(x1, this._y, !1 !== this._lastDefined, this.lastPoint) : this.context.lineTo(x1, this._y, !1 !== this._lastDefined && !1 !== p.defined, this.lastPoint), this.context.lineTo(x1, y, !1 !== this._lastDefined && !1 !== p.defined, p);
1456
1456
  }
1457
1457
  }
1458
1458
  this._lastDefined = p.defined, this._x = x, this._y = y, this.lastPoint = p;
@@ -7793,7 +7793,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
7793
7793
  this._draw(line, lineAttribute, !1, drawContext, params);
7794
7794
  }
7795
7795
  drawSegmentItem(context, cache, fill, stroke, fillOpacity, strokeOpacity, attribute, defaultAttribute, clipRange, clipRangeByDimension, offsetX, offsetY, line, fillCb, strokeCb) {
7796
- var _a, _b, _c, _d, _e;
7796
+ var _a;
7797
7797
  if (!cache) return;
7798
7798
  context.beginPath();
7799
7799
  const z = null !== (_a = this.z) && void 0 !== _a ? _a : 0;
@@ -7806,27 +7806,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
7806
7806
  x: originX = 0,
7807
7807
  x: originY = 0
7808
7808
  } = attribute;
7809
- !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke()));
7810
- let {
7811
- connectedType: connectedType,
7812
- connectedX: connectedX,
7813
- connectedY: connectedY,
7814
- connectedStyle: connectedStyle
7815
- } = attribute;
7816
- if (isArray(defaultAttribute) ? (connectedType = null !== (_b = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _b ? _b : defaultAttribute[1].connectedType, connectedX = null !== (_c = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _c ? _c : defaultAttribute[1].connectedX, connectedY = null !== (_d = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _d ? _d : defaultAttribute[1].connectedY, connectedStyle = null !== (_e = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _e ? _e : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), "none" !== connectedType) {
7817
- context.beginPath(), drawSegments(context.camera ? context : context.nativeContext, cache, clipRange, clipRangeByDimension, {
7818
- offsetX: offsetX,
7819
- offsetY: offsetY,
7820
- offsetZ: z,
7821
- drawConnect: !0,
7822
- mode: connectedType,
7823
- zeroX: connectedX,
7824
- zeroY: connectedY
7825
- });
7826
- const da = [];
7827
- isArray(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute), !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, connectedStyle, originX - offsetX, originY - offsetY, da), context.stroke()));
7828
- }
7829
- return !1;
7809
+ return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), !1 !== stroke && (strokeCb ? strokeCb(context, attribute, defaultAttribute) : strokeOpacity && (context.setStrokeStyle(line, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke())), !1;
7830
7810
  }
7831
7811
  drawLinearLineHighPerformance(line, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, lineAttribute, drawContext, params, fillCb, strokeCb) {
7832
7812
  var _a;
@@ -7858,7 +7838,8 @@ let DefaultCanvasLineRender = class extends BaseRender {
7858
7838
  segments: segments,
7859
7839
  points: points,
7860
7840
  closePath: closePath,
7861
- curveTension = lineAttribute.curveTension
7841
+ curveTension = lineAttribute.curveTension,
7842
+ connectedType = lineAttribute.connectedType
7862
7843
  } = line.attribute;
7863
7844
  if (!this.valid(line, lineAttribute, fillCb, strokeCb)) return;
7864
7845
  let {
@@ -7870,6 +7851,9 @@ let DefaultCanvasLineRender = class extends BaseRender {
7870
7851
  clipRangeByDimension = lineAttribute.clipRangeByDimension
7871
7852
  } = line.attribute;
7872
7853
  if (1 === clipRange && !segments && !points.some(p => !1 === p.defined) && "linear" === curveType) return this.drawLinearLineHighPerformance(line, context, !!fill, !!stroke, fillOpacity, strokeOpacity, x, y, lineAttribute, drawContext, params, fillCb, strokeCb);
7854
+ function parsePoint(points, connectedType) {
7855
+ return "none" === connectedType ? points : points.filter(p => !1 !== p.defined);
7856
+ }
7873
7857
  if (line.shouldUpdateShape()) {
7874
7858
  const {
7875
7859
  points: points,
@@ -7891,7 +7875,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
7891
7875
  y: lastSeg.endY,
7892
7876
  defined: lastSeg.curves[lastSeg.curves.length - 1].defined
7893
7877
  } : index > 1 && (startPoint.x = lastSeg.endX, startPoint.y = lastSeg.endY, startPoint.defined = lastSeg.curves[lastSeg.curves.length - 1].defined);
7894
- const data = calcLineCache(seg.points, curveType, {
7878
+ const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
7895
7879
  startPoint: startPoint,
7896
7880
  curveTension: curveTension
7897
7881
  });
@@ -7910,7 +7894,7 @@ let DefaultCanvasLineRender = class extends BaseRender {
7910
7894
  }
7911
7895
  } else {
7912
7896
  if (!points || !points.length) return line.cache = null, void line.clearUpdateShapeTag();
7913
- line.cache = calcLineCache(_points, curveType, {
7897
+ line.cache = calcLineCache(parsePoint(_points, connectedType), curveType, {
7914
7898
  curveTension: curveTension
7915
7899
  });
7916
7900
  }
@@ -7942,11 +7926,6 @@ DefaultCanvasLineRender = __decorate$E([injectable()], DefaultCanvasLineRender);
7942
7926
 
7943
7927
  function drawAreaSegments(path, segPath, percent, params) {
7944
7928
  var _a;
7945
- const {
7946
- drawConnect = !1,
7947
- mode = "none"
7948
- } = params || {};
7949
- if (drawConnect && "none" === mode) return;
7950
7929
  const {
7951
7930
  top: top,
7952
7931
  bottom: bottom
@@ -7956,34 +7935,11 @@ function drawAreaSegments(path, segPath, percent, params) {
7956
7935
  const topList = [],
7957
7936
  bottomList = [];
7958
7937
  let lastDefined = !0;
7959
- if (drawConnect) {
7960
- let lastCurve,
7961
- lastBottomCurve,
7962
- defined0 = !0;
7963
- const n = top.curves.length;
7964
- top.curves.forEach((curve, i) => {
7965
- const bototmCurve = bottom.curves[n - i - 1];
7966
- let currentTopCurve = curve,
7967
- currentBottomCurve = bototmCurve;
7968
- if (curve.originP1 === curve.originP2) return lastCurve = curve, void (lastBottomCurve = bototmCurve);
7969
- if (lastCurve && lastCurve.originP1 === lastCurve.originP2 && (currentTopCurve = lastCurve, currentBottomCurve = lastBottomCurve), curve.defined) defined0 || (topList.push(currentTopCurve), bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0, defined0 = !defined0);else {
7970
- const {
7971
- originP1: originP1,
7972
- originP2: originP2
7973
- } = curve;
7974
- let validTopCurve, validBottomCurve;
7975
- originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = curve, validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0, topList.push(validTopCurve || curve), bottomList.push(validBottomCurve || bototmCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
7976
- }
7977
- lastCurve = curve;
7978
- }), drawAreaConnectBlock(path, topList, bottomList, params);
7979
- } else {
7980
- for (let i = 0, n = top.curves.length; i < n; i++) {
7981
- const topCurve = top.curves[i];
7982
- lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])), lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
7983
- }
7984
- drawAreaBlock(path, topList, bottomList, params);
7938
+ for (let i = 0, n = top.curves.length; i < n; i++) {
7939
+ const topCurve = top.curves[i];
7940
+ lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1])), lastDefined = !lastDefined) : lastDefined && (topList.push(topCurve), bottomList.push(bottom.curves[n - i - 1]));
7985
7941
  }
7986
- return;
7942
+ return void drawAreaBlock(path, topList, bottomList, params);
7987
7943
  }
7988
7944
  if (percent <= 0) return;
7989
7945
  let {
@@ -8001,51 +7957,17 @@ function drawAreaSegments(path, segPath, percent, params) {
8001
7957
  lastDefined = !0;
8002
7958
  const topList = [],
8003
7959
  bottomList = [];
8004
- let lastTopCurve,
8005
- lastBottomCurve,
8006
- defined0 = !0;
8007
7960
  for (let i = 0, n = top.curves.length; i < n; i++) {
8008
7961
  const topCurve = top.curves[i],
8009
7962
  curCurveLength = topCurve.getLength(direction),
8010
7963
  percent = (totalDrawLength - drawedLengthUntilLast) / curCurveLength;
8011
7964
  if (percent < 0) break;
8012
- if (drawedLengthUntilLast += curCurveLength, drawConnect) {
8013
- const bototmCurve = bottom.curves[n - i - 1];
8014
- let currentTopCurve = topCurve,
8015
- currentBottomCurve = bototmCurve;
8016
- if (topCurve.originP1 === topCurve.originP2) {
8017
- lastTopCurve = topCurve, lastBottomCurve = bototmCurve;
8018
- continue;
8019
- }
8020
- if (lastTopCurve && lastTopCurve.originP1 === lastTopCurve.originP2 && (currentTopCurve = lastTopCurve, currentBottomCurve = lastBottomCurve), topCurve.defined) defined0 || (topList.push(currentTopCurve), bottomList.push(currentBottomCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0, defined0 = !defined0);else {
8021
- const {
8022
- originP1: originP1,
8023
- originP2: originP2
8024
- } = topCurve;
8025
- let validTopCurve, validBottomCurve;
8026
- originP1 && !1 !== originP1.defined ? (validTopCurve = currentTopCurve, validBottomCurve = currentBottomCurve) : originP1 && !1 !== originP2.defined && (validTopCurve = topCurve, validBottomCurve = bototmCurve), defined0 ? (defined0 = !defined0, topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve)) : validTopCurve && (defined0 = !defined0, topList.push(validTopCurve || topCurve), bottomList.push(validBottomCurve || bototmCurve), drawAreaConnectBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0);
8027
- }
8028
- lastTopCurve = topCurve;
8029
- } else {
8030
- let tc = null,
8031
- bc = null;
8032
- lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]), lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]), tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? divideCubic(tc, percent)[0] : divideLinear(tc, percent)[0], bc = bc.p2 && bc.p3 ? divideCubic(bc, 1 - percent)[1] : divideLinear(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined, topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
8033
- }
7965
+ drawedLengthUntilLast += curCurveLength;
7966
+ let tc = null,
7967
+ bc = null;
7968
+ lastDefined !== topCurve.defined ? (lastDefined ? (drawAreaBlock(path, topList, bottomList, params), topList.length = 0, bottomList.length = 0) : (tc = topCurve, bc = bottom.curves[n - i - 1]), lastDefined = !lastDefined) : lastDefined && (tc = topCurve, bc = bottom.curves[n - i - 1]), tc && bc && (percent < 1 && (tc = tc.p2 && tc.p3 ? divideCubic(tc, percent)[0] : divideLinear(tc, percent)[0], bc = bc.p2 && bc.p3 ? divideCubic(bc, 1 - percent)[1] : divideLinear(bc, 1 - percent)[1]), tc.defined = lastDefined, bc.defined = lastDefined, topList.push(tc), bottomList.push(bc)), tc = null, bc = null;
8034
7969
  }
8035
- drawConnect ? drawAreaConnectBlock(path, topList, bottomList, params) : drawAreaBlock(path, topList, bottomList, params);
8036
- }
8037
- function drawAreaConnectBlock(path, topList, bottomList, params) {
8038
- if (topList.length < 2) return;
8039
- const {
8040
- offsetX = 0,
8041
- offsetY = 0,
8042
- offsetZ = 0,
8043
- mode: mode
8044
- } = params || {};
8045
- let curve = topList[0];
8046
- path.moveTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = topList[topList.length - 1];
8047
- let end = curve.p3 || curve.p1;
8048
- path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), curve = bottomList[bottomList.length - 1], path.lineTo(curve.p0.x + offsetX, curve.p0.y + offsetY, offsetZ), curve = bottomList[0], end = curve.p3 || curve.p1, path.lineTo(end.x + offsetX, end.y + offsetY, offsetZ), path.closePath();
7970
+ drawAreaBlock(path, topList, bottomList, params);
8049
7971
  }
8050
7972
  function drawAreaBlock(path, topList, bottomList, params) {
8051
7973
  const {
@@ -8146,7 +8068,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8146
8068
  fillOpacity = areaAttribute.fillOpacity,
8147
8069
  z = areaAttribute.z,
8148
8070
  strokeOpacity = areaAttribute.strokeOpacity,
8149
- curveTension = areaAttribute.curveTension
8071
+ curveTension = areaAttribute.curveTension,
8072
+ connectedType = areaAttribute.connectedType
8150
8073
  } = area.attribute,
8151
8074
  data = this.valid(area, areaAttribute, fillCb, strokeCb);
8152
8075
  if (!data) return;
@@ -8163,6 +8086,9 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8163
8086
  let {
8164
8087
  curveType = areaAttribute.curveType
8165
8088
  } = area.attribute;
8089
+ function parsePoint(points, connectedType) {
8090
+ return "connect" !== connectedType ? points : points.filter(p => !1 !== p.defined);
8091
+ }
8166
8092
  if (closePath && "linear" === curveType && (curveType = "linearClosed"), 1 === clipRange && !segments && !points.some(p => !1 === p.defined) && "linear" === curveType) return this.drawLinearAreaHighPerformance(area, context, !!fill, doStroke, fillOpacity, strokeOpacity, x, y, areaAttribute, drawContext, params, fillCb, strokeCb);
8167
8093
  if (area.shouldUpdateShape()) {
8168
8094
  if (segments && segments.length) {
@@ -8176,7 +8102,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8176
8102
  x: lastTopSeg.endX,
8177
8103
  y: lastTopSeg.endY
8178
8104
  } : index > 1 && (startPoint.x = lastTopSeg.endX, startPoint.y = lastTopSeg.endY);
8179
- const data = calcLineCache(seg.points, curveType, {
8105
+ const data = calcLineCache(parsePoint(seg.points, connectedType), curveType, {
8180
8106
  startPoint: startPoint,
8181
8107
  curveTension: curveTension
8182
8108
  });
@@ -8199,7 +8125,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8199
8125
  y: null !== (_d = endPoint.y1) && void 0 !== _d ? _d : endPoint.y
8200
8126
  });
8201
8127
  }
8202
- bottomPoints.length > 1 && (lastBottomSeg = calcLineCache(bottomPoints, "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType, {
8128
+ bottomPoints.length > 1 && (lastBottomSeg = calcLineCache(parsePoint(bottomPoints, connectedType), "stepBefore" === curveType ? "stepAfter" : "stepAfter" === curveType ? "stepBefore" : curveType, {
8203
8129
  curveTension: curveTension
8204
8130
  }), bottomCaches.unshift(lastBottomSeg));
8205
8131
  }
@@ -8210,11 +8136,11 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8210
8136
  } else {
8211
8137
  if (!points || !points.length) return area.cacheArea = null, void area.clearUpdateShapeTag();
8212
8138
  {
8213
- const topPoints = points,
8139
+ const topPoints = parsePoint(points, connectedType),
8214
8140
  bottomPoints = [];
8215
- for (let i = points.length - 1; i >= 0; i--) bottomPoints.push({
8216
- x: null !== (_e = points[i].x1) && void 0 !== _e ? _e : points[i].x,
8217
- y: null !== (_f = points[i].y1) && void 0 !== _f ? _f : points[i].y
8141
+ for (let i = topPoints.length - 1; i >= 0; i--) bottomPoints.push({
8142
+ x: null !== (_e = points[i].x1) && void 0 !== _e ? _e : topPoints[i].x,
8143
+ y: null !== (_f = points[i].y1) && void 0 !== _f ? _f : topPoints[i].y
8218
8144
  });
8219
8145
  const topCache = calcLineCache(topPoints, curveType, {
8220
8146
  curveTension: curveTension
@@ -8256,20 +8182,10 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8256
8182
  this._draw(area, areaAttribute, !1, drawContext, params);
8257
8183
  }
8258
8184
  drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
8259
- let ret = !1;
8260
- return ret = ret || this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, !1, fillCb, strokeCb), ret = ret || this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, !0, fillCb, strokeCb), ret;
8185
+ return this._drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb);
8261
8186
  }
8262
- _drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, connect, fillCb, strokeCb) {
8263
- var _a, _b, _c, _d;
8187
+ _drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, fillCb, strokeCb) {
8264
8188
  if (!(cache && cache.top && cache.bottom && cache.top.curves && cache.top.curves.length && cache.bottom.curves && cache.bottom.curves.length)) return;
8265
- let {
8266
- connectedType: connectedType,
8267
- connectedX: connectedX,
8268
- connectedY: connectedY,
8269
- connectedStyle: connectedStyle
8270
- } = attribute;
8271
- const da = [];
8272
- if (connect && (isArray(defaultAttribute) ? (connectedType = null !== (_a = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _a ? _a : defaultAttribute[1].connectedType, connectedX = null !== (_b = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _b ? _b : defaultAttribute[1].connectedX, connectedY = null !== (_c = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _c ? _c : defaultAttribute[1].connectedY, connectedStyle = null !== (_d = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _d ? _d : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), isArray(defaultAttribute) ? defaultAttribute.forEach(i => da.push(i)) : da.push(defaultAttribute), da.push(attribute)), connect && "none" === connectedType) return !1;
8273
8189
  context.beginPath();
8274
8190
  const {
8275
8191
  points: points,
@@ -8288,11 +8204,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8288
8204
  offsetX: offsetX,
8289
8205
  offsetY: offsetY,
8290
8206
  offsetZ: offsetZ,
8291
- direction: direction,
8292
- drawConnect: connect,
8293
- mode: connectedType,
8294
- zeroX: connectedX,
8295
- zeroY: connectedY
8207
+ direction: direction
8296
8208
  }), this.beforeRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
8297
8209
  attribute: attribute
8298
8210
  }), context.setShadowBlendStyle && context.setShadowBlendStyle(area, attribute, defaultAttribute);
@@ -8300,7 +8212,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8300
8212
  x: originX = 0,
8301
8213
  x: originY = 0
8302
8214
  } = attribute;
8303
- 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, {
8215
+ return !1 !== fill && (fillCb ? fillCb(context, attribute, defaultAttribute) : fillOpacity && (context.setCommonStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.fill())), this.afterRenderStep(area, context, offsetX, offsetY, !!fillOpacity, !1, fill, !1, defaultAttribute, drawContext, fillCb, null, {
8304
8216
  attribute: attribute
8305
8217
  }), (() => {
8306
8218
  if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
@@ -8310,12 +8222,8 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8310
8222
  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$1.ROW ? "x" : "y", {
8311
8223
  offsetX: offsetX,
8312
8224
  offsetY: offsetY,
8313
- offsetZ: offsetZ,
8314
- drawConnect: connect,
8315
- mode: connectedType,
8316
- zeroX: connectedX,
8317
- zeroY: connectedY
8318
- })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
8225
+ offsetZ: offsetZ
8226
+ })), context.setStrokeStyle(area, attribute, originX - offsetX, originY - offsetY, defaultAttribute), context.stroke();
8319
8227
  }
8320
8228
  })(), !1;
8321
8229
  }
@@ -10861,7 +10769,7 @@ let Line$1 = class Line extends Graphic {
10861
10769
  } = attribute,
10862
10770
  b = aabbBounds;
10863
10771
  return points.forEach(p => {
10864
- !1 === p.defined && "zero" !== connectedType && "connect" !== connectedType || b.add(p.x, p.y);
10772
+ !1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
10865
10773
  }), b;
10866
10774
  }
10867
10775
  updateLineAABBBoundsBySegments(attribute, lineTheme, aabbBounds, graphic) {
@@ -10872,7 +10780,7 @@ let Line$1 = class Line extends Graphic {
10872
10780
  b = aabbBounds;
10873
10781
  return segments.forEach(s => {
10874
10782
  s.points.forEach(p => {
10875
- !1 === p.defined && "zero" !== connectedType && "connect" !== connectedType || b.add(p.x, p.y);
10783
+ !1 === p.defined && "connect" !== connectedType || b.add(p.x, p.y);
10876
10784
  });
10877
10785
  }), b;
10878
10786
  }
@@ -16033,17 +15941,17 @@ function clampText(text, width, height, padding = {}) {
16033
15941
  const maxYWithPadding = height + bottom;
16034
15942
  let dx = 0;
16035
15943
  let dy = 0;
16036
- if (minX < minXWithPadding && maxX - minX <= width) {
15944
+ if (minX < minXWithPadding) {
16037
15945
  dx = -minX;
16038
15946
  }
16039
- else if (maxX > maxXWithPadding && minX - (maxX - width) >= minXWithPadding) {
16040
- dx = width - maxX;
15947
+ else if (maxX > maxXWithPadding) {
15948
+ dx = maxXWithPadding - maxX;
16041
15949
  }
16042
- if (minY < minYWithPadding && maxY - minY <= height) {
15950
+ if (minY < minYWithPadding) {
16043
15951
  dy = -minY;
16044
15952
  }
16045
- else if (maxY > maxYWithPadding && minY - (maxY - height) >= minYWithPadding) {
16046
- dy = height - maxY;
15953
+ else if (maxY > maxYWithPadding) {
15954
+ dy = maxYWithPadding - maxY;
16047
15955
  }
16048
15956
  return { dx, dy };
16049
15957
  }
@@ -16879,7 +16787,7 @@ class LabelBase extends AbstractComponent {
16879
16787
  }
16880
16788
  else {
16881
16789
  if (clampForce) {
16882
- const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap);
16790
+ const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap, overlapPadding);
16883
16791
  if (placedAfterClampForce) {
16884
16792
  continue;
16885
16793
  }
@@ -16894,10 +16802,10 @@ class LabelBase extends AbstractComponent {
16894
16802
  }
16895
16803
  return result;
16896
16804
  }
16897
- _processClampForce(text, bmpTool, bitmap) {
16805
+ _processClampForce(text, bmpTool, bitmap, overlapPadding = 0) {
16898
16806
  const { dy = 0, dx = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
16899
16807
  if (dx === 0 && dy === 0) {
16900
- if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
16808
+ if (canPlace(bmpTool, bitmap, text.AABBBounds, false, overlapPadding)) {
16901
16809
  bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
16902
16810
  return true;
16903
16811
  }
@@ -16973,7 +16881,7 @@ class LabelBase extends AbstractComponent {
16973
16881
  }
16974
16882
  }
16975
16883
  if (!hasPlace && clampForce) {
16976
- const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap);
16884
+ const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap, overlapPadding);
16977
16885
  if (placedAfterClampForce) {
16978
16886
  result.push(text);
16979
16887
  continue;
@@ -29776,6 +29684,6 @@ EmptyTip.defaultAttributes = {
29776
29684
  }
29777
29685
  };
29778
29686
 
29779
- const version = "0.20.21";
29687
+ const version = "0.20.23";
29780
29688
 
29781
29689
  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, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, 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, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.20.21";
1
+ export declare const version = "0.20.23";
2
2
  export * from './core/base';
3
3
  export * from './core/type';
4
4
  export * from './scrollbar';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const version = "0.20.21";
1
+ export const version = "0.20.23";
2
2
 
3
3
  export * from "./core/base";
4
4
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAEjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.20.21\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC;AAEjC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.20.23\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './util';\n"]}
@@ -50,7 +50,7 @@ export declare class LabelBase<T extends BaseLabelAttrs> extends AbstractCompone
50
50
  protected _layout(texts: (IText | IRichText)[]): (IText | IRichText)[];
51
51
  protected _overlapping(labels: (IText | IRichText)[]): (IRichText | IText)[];
52
52
  protected _overlapGlobal(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap): (IRichText | IText)[];
53
- protected _processClampForce(text: IText, bmpTool: BitmapTool, bitmap: Bitmap): boolean;
53
+ protected _processClampForce(text: IText, bmpTool: BitmapTool, bitmap: Bitmap, overlapPadding?: number): boolean;
54
54
  protected _overlapByStrategy(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap): (IRichText | IText)[];
55
55
  protected getBaseMarkGroup(): IGroup;
56
56
  protected getGraphicBounds(graphic?: IGraphic, point?: Partial<PointLocationCfg>, position?: string): IBoundsLike;
package/es/label/base.js CHANGED
@@ -238,7 +238,7 @@ export class LabelBase extends AbstractComponent {
238
238
  const text = result[i], bounds = text.AABBBounds, range = boundToRange(bmpTool, bounds, !0);
239
239
  if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) bitmap.setRange(range); else {
240
240
  if (clampForce) {
241
- if (this._processClampForce(text, bmpTool, bitmap)) continue;
241
+ if (this._processClampForce(text, bmpTool, bitmap, overlapPadding)) continue;
242
242
  }
243
243
  hideOnHit ? text.setAttributes({
244
244
  visible: !1
@@ -247,10 +247,10 @@ export class LabelBase extends AbstractComponent {
247
247
  }
248
248
  return result;
249
249
  }
250
- _processClampForce(text, bmpTool, bitmap) {
250
+ _processClampForce(text, bmpTool, bitmap, overlapPadding = 0) {
251
251
  const {dy: dy = 0, dx: dx = 0} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
252
252
  if (0 === dx && 0 === dy) {
253
- if (canPlace(bmpTool, bitmap, text.AABBBounds)) return bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)),
253
+ if (canPlace(bmpTool, bitmap, text.AABBBounds, !1, overlapPadding)) return bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)),
254
254
  !0;
255
255
  } else if (canPlace(bmpTool, bitmap, {
256
256
  x1: text.AABBBounds.x1 + dx,
@@ -302,7 +302,7 @@ export class LabelBase extends AbstractComponent {
302
302
  break;
303
303
  }
304
304
  if (!hasPlace && clampForce) {
305
- if (this._processClampForce(text, bmpTool, bitmap)) {
305
+ if (this._processClampForce(text, bmpTool, bitmap, overlapPadding)) {
306
306
  result.push(text);
307
307
  continue;
308
308
  }