@visactor/vrender-components 0.20.10-alpha.1 → 0.20.11-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/cjs/axis/overlap/auto-hide.js +4 -5
  2. package/cjs/axis/overlap/auto-hide.js.map +1 -1
  3. package/cjs/axis/overlap/auto-wrap.js +19 -6
  4. package/cjs/axis/overlap/auto-wrap.js.map +1 -1
  5. package/cjs/index.d.ts +1 -1
  6. package/cjs/index.js +1 -1
  7. package/cjs/index.js.map +1 -1
  8. package/cjs/label/base.d.ts +4 -2
  9. package/cjs/label/base.js +34 -7
  10. package/cjs/label/base.js.map +1 -1
  11. package/cjs/label/overlap/place.js +3 -1
  12. package/cjs/label/overlap/place.js.map +1 -1
  13. package/cjs/label/overlap/scaler.d.ts +6 -0
  14. package/cjs/label/overlap/scaler.js +16 -14
  15. package/cjs/label/overlap/scaler.js.map +1 -1
  16. package/cjs/label/overlap/shiftY.d.ts +8 -0
  17. package/cjs/label/overlap/shiftY.js +47 -0
  18. package/cjs/label/overlap/shiftY.js.map +1 -0
  19. package/cjs/label/type.d.ts +8 -1
  20. package/cjs/label/type.js.map +1 -1
  21. package/dist/index.es.js +335 -110
  22. package/es/axis/overlap/auto-hide.js +4 -4
  23. package/es/axis/overlap/auto-hide.js.map +1 -1
  24. package/es/axis/overlap/auto-wrap.js +19 -7
  25. package/es/axis/overlap/auto-wrap.js.map +1 -1
  26. package/es/index.d.ts +1 -1
  27. package/es/index.js +1 -1
  28. package/es/index.js.map +1 -1
  29. package/es/label/base.d.ts +4 -2
  30. package/es/label/base.js +34 -5
  31. package/es/label/base.js.map +1 -1
  32. package/es/label/overlap/place.js +4 -2
  33. package/es/label/overlap/place.js.map +1 -1
  34. package/es/label/overlap/scaler.d.ts +6 -0
  35. package/es/label/overlap/scaler.js +11 -10
  36. package/es/label/overlap/scaler.js.map +1 -1
  37. package/es/label/overlap/shiftY.d.ts +8 -0
  38. package/es/label/overlap/shiftY.js +41 -0
  39. package/es/label/overlap/shiftY.js.map +1 -0
  40. package/es/label/type.d.ts +8 -1
  41. package/es/label/type.js.map +1 -1
  42. package/package.json +5 -5
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, cos, sin, pi, isArray, pointAt, isNumber, getDecimalPlaces, isNil, Color, OBBBounds, has, normalTransform, isValidUrl, isBase64, acos, sqrt, transformBoundsWithMatrix, arrayEqual, getContextFont, rotatePoint, clampAngleByRadian, asin, Bounds, getRectIntersect, isRectIntersect, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, array, isValidNumber, calculateAnchorOfBounds, computeQuadrant, isGreater, isLess, isNumberClose, normalizeAngle, flattenArray, cloneDeep, get, last, isRotateAABBIntersect, mixin, isEqual, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, polygonContainPoint } from '@visactor/vutils';
1
+ import { tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, Point, PointService, abs, max, min, atan2, epsilon, Matrix, pi2, Logger, isNumberClose, TextMeasure, EventEmitter, isBoolean, isObject, isFunction, isString, cos, sin, pi, isArray, pointAt, isNumber, getDecimalPlaces, isNil, Color, OBBBounds, has, normalTransform, isValidUrl, isBase64, acos, sqrt, transformBoundsWithMatrix, arrayEqual, getContextFont, rotatePoint, clampAngleByRadian, asin, Bounds, getRectIntersect, isRectIntersect, isPlainObject, merge, clamp, clampRange, normalizePadding, debounce, throttle, hexToRgb, crossProduct, isValid, isEmpty, rectInsideAnotherRect, radianToDegree, getAngleByPoint, polarToCartesian, array, isValidNumber, calculateAnchorOfBounds, computeQuadrant, isGreater, isLess, normalizeAngle, flattenArray, cloneDeep, get, last, isRotateAABBIntersect, mixin, isEqual, interpolateString, minInArray, maxInArray, binaryFuzzySearchInNumberRange, polygonContainPoint } from '@visactor/vutils';
2
2
  import { isContinuous, isDiscrete, LinearScale } from '@visactor/vscale';
3
3
 
4
4
  class Generator {
@@ -860,11 +860,12 @@ function parseSvgPath(str) {
860
860
  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) {
861
861
  for (let i = 0, len = coordsStrArr.length; i < len; i++) coordStr = coordsStrArr[i], coordNumber = parseFloat(coordStr), Number.isNaN(coordNumber) || currCommandData.push(coordNumber);
862
862
  if (standardCommandLen = commandLengths[commandChar], currCommandData.length - 1 > standardCommandLen) {
863
- let subCommand;
863
+ let subCommand,
864
+ bestCommandChar = commandChar;
864
865
  for (let i = 1, len = currCommandData.length; i < len; i += standardCommandLen) {
865
- subCommand = [commandChar];
866
+ subCommand = [bestCommandChar];
866
867
  for (let j = i, subLen = i + standardCommandLen; j < subLen; j++) subCommand.push(currCommandData[j]);
867
- result.push(subCommand);
868
+ result.push(subCommand), "m" === bestCommandChar ? bestCommandChar = "l" : "M" === bestCommandChar && (bestCommandChar = "L");
868
869
  }
869
870
  } else result.push(currCommandData);
870
871
  } else result.push(currCommandData);
@@ -2075,6 +2076,7 @@ const DefaultAttribute = Object.assign(Object.assign(Object.assign({
2075
2076
  zIndex: 0,
2076
2077
  layout: null,
2077
2078
  boundsPadding: 0,
2079
+ fillStrokeOrder: 0,
2078
2080
  renderStyle: "default",
2079
2081
  pickMode: "accurate",
2080
2082
  customPickShape: null,
@@ -2145,6 +2147,7 @@ const DefaultLineAttribute = Object.assign(Object.assign(Object.assign({}, Defau
2145
2147
  });
2146
2148
  const DefaultPathAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
2147
2149
  path: new CustomPath2D(),
2150
+ fillStrokeOrder: 1,
2148
2151
  customPath: () => {
2149
2152
  Logger.getInstance().warn("空函数");
2150
2153
  }
@@ -2817,7 +2820,7 @@ let DefaultWindow = class {
2817
2820
  }
2818
2821
  hasSubView() {
2819
2822
  const viewBox = this._handler.getViewBox();
2820
- return !(0 === viewBox.x1 && 0 === viewBox.y1 && this.width === viewBox.width() && this.height === viewBox.height());
2823
+ return !(0 === viewBox.x1 && 0 === viewBox.y1 && isNumberClose(this.width, viewBox.width()) && isNumberClose(this.height, viewBox.height()));
2821
2824
  }
2822
2825
  isVisible(bbox) {
2823
2826
  return this._handler.isVisible(bbox);
@@ -7494,7 +7497,8 @@ let DefaultCanvasArcRender = class extends BaseRender {
7494
7497
  fill = arcAttribute.fill,
7495
7498
  stroke = arcAttribute.stroke,
7496
7499
  x: originX = arcAttribute.x,
7497
- y: originY = arcAttribute.y
7500
+ y: originY = arcAttribute.y,
7501
+ fillStrokeOrder = arcAttribute.fillStrokeOrder
7498
7502
  } = arc.attribute,
7499
7503
  data = this.valid(arc, arcAttribute, fillCb, strokeCb);
7500
7504
  if (!data) return;
@@ -7530,7 +7534,17 @@ let DefaultCanvasArcRender = class extends BaseRender {
7530
7534
  isFullStroke: isFullStroke,
7531
7535
  stroke: arrayStroke
7532
7536
  } = parseStroke(stroke);
7533
- if ((doFill || isFullStroke) && (context.beginPath(), drawArcPath(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) {
7537
+ if (doFill || isFullStroke) {
7538
+ context.beginPath(), drawArcPath(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);
7539
+ const _runFill = () => {
7540
+ doFill && (fillCb ? fillCb(context, arc.attribute, arcAttribute) : fVisible && (context.setCommonStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.fill()));
7541
+ },
7542
+ _runStroke = () => {
7543
+ doStroke && isFullStroke && (strokeCb ? strokeCb(context, arc.attribute, arcAttribute) : sVisible && (context.setStrokeStyle(arc, arc.attribute, originX - x, originY - y, arcAttribute), context.stroke()));
7544
+ };
7545
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
7546
+ }
7547
+ if (!isFullStroke && doStroke) {
7534
7548
  context.beginPath();
7535
7549
  drawArcPath(arc, context, x, y, outerRadius, innerRadius, arrayStroke);
7536
7550
  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());
@@ -7548,14 +7562,20 @@ let DefaultCanvasArcRender = class extends BaseRender {
7548
7562
  fill = arcAttribute.fill
7549
7563
  } = arc.attribute,
7550
7564
  startAngle = endAngle;
7551
- 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) {
7552
- const color = fill;
7553
- if ("conical" === color.gradient) {
7554
- const lastColor = getConicGradientAt(0, 0, endAngle, color);
7555
- fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
7556
- }
7557
- }
7558
- doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
7565
+ 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);
7566
+ const _runFill = () => {
7567
+ if (doFill) {
7568
+ const color = fill;
7569
+ if ("conical" === color.gradient) {
7570
+ const lastColor = getConicGradientAt(0, 0, endAngle, color);
7571
+ fillCb || fillVisible && (context.setCommonStyle(arc, arc.attribute, x, y, arcAttribute), context.fillStyle = lastColor, context.fill());
7572
+ }
7573
+ }
7574
+ },
7575
+ _runStroke = () => {
7576
+ doStroke && (strokeCb || sVisible && (context.setStrokeStyle(arc, arc.attribute, x, y, arcAttribute), context.stroke()));
7577
+ };
7578
+ _runFill(), _runStroke();
7559
7579
  }
7560
7580
  }
7561
7581
  this.afterRenderStep(arc, context, x, y, doFill, doStroke, fVisible, sVisible, arcAttribute, drawContext, fillCb, strokeCb), tempChangeConicalColor && (fill.startAngle += conicalOffset, fill.endAngle += conicalOffset);
@@ -7593,7 +7613,8 @@ let DefaultCanvasCircleRender = class extends BaseRender {
7593
7613
  startAngle = circleAttribute.startAngle,
7594
7614
  endAngle = circleAttribute.endAngle,
7595
7615
  x: originX = circleAttribute.x,
7596
- y: originY = circleAttribute.y
7616
+ y: originY = circleAttribute.y,
7617
+ fillStrokeOrder = circleAttribute.fillStrokeOrder
7597
7618
  } = circle.attribute,
7598
7619
  data = this.valid(circle, circleAttribute, fillCb, strokeCb);
7599
7620
  if (!data) return;
@@ -7603,7 +7624,14 @@ let DefaultCanvasCircleRender = class extends BaseRender {
7603
7624
  doFill: doFill,
7604
7625
  doStroke: doStroke
7605
7626
  } = data;
7606
- 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);
7627
+ 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);
7628
+ const _runFill = () => {
7629
+ doFill && (fillCb ? fillCb(context, circle.attribute, circleAttribute) : fVisible && (context.setCommonStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.fill()));
7630
+ },
7631
+ _runStroke = () => {
7632
+ doStroke && (strokeCb ? strokeCb(context, circle.attribute, circleAttribute) : sVisible && (context.setStrokeStyle(circle, circle.attribute, originX - x, originY - y, circleAttribute), context.stroke()));
7633
+ };
7634
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(circle, context, x, y, doFill, doStroke, fVisible, sVisible, circleAttribute, drawContext, fillCb, strokeCb);
7607
7635
  }
7608
7636
  draw(circle, renderService, drawContext, params) {
7609
7637
  const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle;
@@ -8044,7 +8072,7 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8044
8072
  super(), this.areaRenderContribitions = areaRenderContribitions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(areaRenderContribitions);
8045
8073
  }
8046
8074
  drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
8047
- var _a, _b, _c, _d, _e;
8075
+ var _a, _b, _c;
8048
8076
  const {
8049
8077
  points: points
8050
8078
  } = area.attribute;
@@ -8068,28 +8096,31 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8068
8096
  x: originX = 0,
8069
8097
  x: originY = 0
8070
8098
  } = area.attribute;
8071
- 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, {
8099
+ !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, {
8072
8100
  attribute: area.attribute
8073
- }), stroke) {
8074
- const {
8075
- stroke = areaAttribute && areaAttribute.stroke
8076
- } = area.attribute;
8077
- if (isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
8078
- context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
8079
- for (let i = 1; i < points.length; i++) {
8080
- const p = points[i];
8081
- context.lineTo(p.x + offsetX, p.y + offsetY, z);
8082
- }
8083
- } else if (stroke[2]) {
8084
- const endP = points[points.length - 1];
8085
- context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
8086
- for (let i = points.length - 2; i >= 0; i--) {
8087
- const p = points[i];
8088
- 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);
8101
+ }), (() => {
8102
+ var _a, _b;
8103
+ if (stroke) {
8104
+ const {
8105
+ stroke = areaAttribute && areaAttribute.stroke
8106
+ } = area.attribute;
8107
+ if (isArray(stroke) && (stroke[0] || stroke[2]) && !1 === stroke[1]) if (context.beginPath(), stroke[0]) {
8108
+ context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
8109
+ for (let i = 1; i < points.length; i++) {
8110
+ const p = points[i];
8111
+ context.lineTo(p.x + offsetX, p.y + offsetY, z);
8112
+ }
8113
+ } else if (stroke[2]) {
8114
+ const endP = points[points.length - 1];
8115
+ context.moveTo(endP.x + offsetX, endP.y + offsetY, z);
8116
+ for (let i = points.length - 2; i >= 0; i--) {
8117
+ const p = points[i];
8118
+ 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);
8119
+ }
8089
8120
  }
8121
+ strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
8090
8122
  }
8091
- strokeCb ? strokeCb(context, area.attribute, areaAttribute) : (context.setStrokeStyle(area, area.attribute, originX - offsetX, originY - offsetY, areaAttribute), context.stroke());
8092
- }
8123
+ })();
8093
8124
  }
8094
8125
  drawShape(area, context, x, y, drawContext, params, fillCb, strokeCb) {
8095
8126
  var _a, _b, _c, _d, _e, _f;
@@ -8254,23 +8285,24 @@ let DefaultCanvasAreaRender = class extends BaseRender {
8254
8285
  x: originX = 0,
8255
8286
  x: originY = 0
8256
8287
  } = attribute;
8257
- 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, {
8288
+ 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, {
8258
8289
  attribute: attribute
8259
- }), !1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
8260
- const {
8261
- stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
8262
- } = attribute;
8263
- 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", {
8264
- offsetX: offsetX,
8265
- offsetY: offsetY,
8266
- offsetZ: offsetZ,
8267
- drawConnect: connect,
8268
- mode: connectedType,
8269
- zeroX: connectedX,
8270
- zeroY: connectedY
8271
- })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
8272
- }
8273
- return !1;
8290
+ }), (() => {
8291
+ if (!1 !== stroke) if (strokeCb) strokeCb(context, attribute, defaultAttribute);else {
8292
+ const {
8293
+ stroke = defaultAttribute && defaultAttribute[1] && defaultAttribute[1].stroke
8294
+ } = attribute;
8295
+ 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", {
8296
+ offsetX: offsetX,
8297
+ offsetY: offsetY,
8298
+ offsetZ: offsetZ,
8299
+ drawConnect: connect,
8300
+ mode: connectedType,
8301
+ zeroX: connectedX,
8302
+ zeroY: connectedY
8303
+ })), context.setStrokeStyle(area, connect ? connectedStyle : attribute, originX - offsetX, originY - offsetY, connect ? da : defaultAttribute), context.stroke();
8304
+ }
8305
+ })(), !1;
8274
8306
  }
8275
8307
  };
8276
8308
  DefaultCanvasAreaRender = __decorate$D([injectable(), __param$t(0, inject(ContributionProvider)), __param$t(0, named(AreaRenderContribution)), __metadata$w("design:paramtypes", [Object])], DefaultCanvasAreaRender);
@@ -8302,7 +8334,8 @@ let DefaultCanvasPathRender = class extends BaseRender {
8302
8334
  const pathAttribute = null !== (_a = this.tempTheme) && void 0 !== _a ? _a : getTheme(path, null == params ? void 0 : params.theme).path,
8303
8335
  {
8304
8336
  x: originX = pathAttribute.x,
8305
- y: originY = pathAttribute.y
8337
+ y: originY = pathAttribute.y,
8338
+ fillStrokeOrder = pathAttribute.fillStrokeOrder
8306
8339
  } = path.attribute,
8307
8340
  z = null !== (_b = this.z) && void 0 !== _b ? _b : 0,
8308
8341
  data = this.valid(path, pathAttribute, fillCb, strokeCb);
@@ -8317,7 +8350,14 @@ let DefaultCanvasPathRender = class extends BaseRender {
8317
8350
  const path2D = null !== (_c = path.attribute.path) && void 0 !== _c ? _c : pathAttribute.path;
8318
8351
  renderCommandList(path2D.commandList, context, x, y, 1, 1, z);
8319
8352
  }
8320
- 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);
8353
+ context.setShadowBlendStyle && context.setShadowBlendStyle(path, path.attribute, pathAttribute), this.beforeRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
8354
+ const _runStroke = () => {
8355
+ doStroke && (strokeCb ? strokeCb(context, path.attribute, pathAttribute) : sVisible && (context.setStrokeStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.stroke()));
8356
+ },
8357
+ _runFill = () => {
8358
+ doFill && (fillCb ? fillCb(context, path.attribute, pathAttribute) : fVisible && (context.setCommonStyle(path, path.attribute, originX - x, originY - y, pathAttribute), context.fill()));
8359
+ };
8360
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(path, context, x, y, doFill, doStroke, fVisible, sVisible, pathAttribute, drawContext, fillCb, strokeCb);
8321
8361
  }
8322
8362
  draw(path, renderService, drawContext, params) {
8323
8363
  const pathAttribute = getTheme(path, null == params ? void 0 : params.theme).path;
@@ -8361,7 +8401,8 @@ let DefaultCanvasRectRender = class extends BaseRender {
8361
8401
  x1: x1,
8362
8402
  y1: y1,
8363
8403
  x: originX = rectAttribute.x,
8364
- y: originY = rectAttribute.y
8404
+ y: originY = rectAttribute.y,
8405
+ fillStrokeOrder = rectAttribute.fillStrokeOrder
8365
8406
  } = rect.attribute;
8366
8407
  let {
8367
8408
  width: width,
@@ -8380,7 +8421,14 @@ let DefaultCanvasRectRender = class extends BaseRender {
8380
8421
  doFill: doFill,
8381
8422
  doStroke: doStroke
8382
8423
  };
8383
- 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);
8424
+ context.setShadowBlendStyle && context.setShadowBlendStyle(rect, rect.attribute, rectAttribute), this.beforeRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
8425
+ const _runFill = () => {
8426
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, rect.attribute, rectAttribute) : fVisible && (context.setCommonStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.fill()));
8427
+ },
8428
+ _runStroke = () => {
8429
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, rect.attribute, rectAttribute) : sVisible && (context.setStrokeStyle(rect, rect.attribute, originX - x, originY - y, rectAttribute), context.stroke()));
8430
+ };
8431
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
8384
8432
  }
8385
8433
  draw(rect, renderService, drawContext, params) {
8386
8434
  const rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect;
@@ -8416,7 +8464,8 @@ let DefaultCanvasSymbolRender = class extends BaseRender {
8416
8464
  x: originX = symbolAttribute.x,
8417
8465
  y: originY = symbolAttribute.y,
8418
8466
  scaleX = symbolAttribute.scaleX,
8419
- scaleY = symbolAttribute.scaleY
8467
+ scaleY = symbolAttribute.scaleY,
8468
+ fillStrokeOrder = symbolAttribute.fillStrokeOrder
8420
8469
  } = symbol.attribute,
8421
8470
  data = this.valid(symbol, symbolAttribute, fillCb, strokeCb);
8422
8471
  if (!data) return;
@@ -8439,14 +8488,27 @@ let DefaultCanvasSymbolRender = class extends BaseRender {
8439
8488
  const obj = Object.assign({}, a);
8440
8489
  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;
8441
8490
  }
8442
- 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()));
8491
+ const _runFill = () => {
8492
+ a.fill && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : (context.setCommonStyle(symbol, a, originX - x, originY - y, symbolAttribute), context.fill()));
8493
+ },
8494
+ _runStroke = () => {
8495
+ a.stroke && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : (context.setStrokeStyle(symbol, a, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
8496
+ };
8497
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke());
8443
8498
  };
8444
8499
  if (keepDirIn3d && context.camera && context.project) {
8445
8500
  const p = context.project(x, y, z),
8446
8501
  camera = context.camera;
8447
8502
  context.camera = null, !1 === parsedPath.draw(context, isArray(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX, p.x, p.y, void 0, callback) && context.closePath(), context.camera = camera;
8448
8503
  } else !1 === parsedPath.draw(context, size, x, y, z, callback) && context.closePath();
8449
- 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);
8504
+ context.setShadowBlendStyle && context.setShadowBlendStyle(symbol, symbol.attribute, symbolAttribute), this.beforeRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
8505
+ const _runFill = () => {
8506
+ doFill && !parsedPath.isSvg && (fillCb ? fillCb(context, symbol.attribute, symbolAttribute) : fVisible && (context.setCommonStyle(symbol, symbol.attribute, originX - x, originY - y, symbolAttribute), context.fill()));
8507
+ },
8508
+ _runStroke = () => {
8509
+ doStroke && !parsedPath.isSvg && (strokeCb ? strokeCb(context, symbol.attribute, symbolAttribute) : sVisible && (context.setStrokeStyle(symbol, symbol.attribute, (originX - x) / scaleX, (originY - y) / scaleY, symbolAttribute), context.stroke()));
8510
+ };
8511
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(symbol, context, x, y, doFill, doStroke, fVisible, sVisible, symbolAttribute, drawContext, fillCb, strokeCb);
8450
8512
  }
8451
8513
  draw(symbol, renderService, drawContext, params) {
8452
8514
  const symbolAttribute = getTheme(symbol, null == params ? void 0 : params.theme).symbol;
@@ -8820,7 +8882,8 @@ let DefaultCanvasPolygonRender = class extends BaseRender {
8820
8882
  cornerRadius = polygonAttribute.cornerRadius,
8821
8883
  x: originX = polygonAttribute.x,
8822
8884
  y: originY = polygonAttribute.y,
8823
- closePath = polygonAttribute.closePath
8885
+ closePath = polygonAttribute.closePath,
8886
+ fillStrokeOrder = polygonAttribute.fillStrokeOrder
8824
8887
  } = polygon.attribute,
8825
8888
  data = this.valid(polygon, polygonAttribute, fillCb, strokeCb);
8826
8889
  if (!data) return;
@@ -8830,7 +8893,14 @@ let DefaultCanvasPolygonRender = class extends BaseRender {
8830
8893
  doFill: doFill,
8831
8894
  doStroke: doStroke
8832
8895
  } = data;
8833
- context.beginPath(), cornerRadius <= 0 || isArray(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);
8896
+ context.beginPath(), cornerRadius <= 0 || isArray(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);
8897
+ const _runFill = () => {
8898
+ doFill && (fillCb ? fillCb(context, polygon.attribute, polygonAttribute) : fVisible && (context.setCommonStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.fill()));
8899
+ },
8900
+ _runStroke = () => {
8901
+ doStroke && (strokeCb ? strokeCb(context, polygon.attribute, polygonAttribute) : sVisible && (context.setStrokeStyle(polygon, polygon.attribute, originX - x, originY - y, polygonAttribute), context.stroke()));
8902
+ };
8903
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(polygon, context, x, y, doFill, doStroke, fVisible, sVisible, polygonAttribute, drawContext, fillCb, strokeCb);
8834
8904
  }
8835
8905
  draw(polygon, renderService, drawContext, params) {
8836
8906
  const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon;
@@ -8873,7 +8943,8 @@ let DefaultCanvasGroupRender = class {
8873
8943
  cornerRadius = groupAttribute.cornerRadius,
8874
8944
  path = groupAttribute.path,
8875
8945
  lineWidth = groupAttribute.lineWidth,
8876
- visible = groupAttribute.visible
8946
+ visible = groupAttribute.visible,
8947
+ fillStrokeOrder = groupAttribute.fillStrokeOrder
8877
8948
  } = group.attribute,
8878
8949
  fVisible = rectFillVisible(opacity, fillOpacity, width, height, fill),
8879
8950
  sVisible = rectStrokeVisible(opacity, strokeOpacity, width, height),
@@ -8899,7 +8970,14 @@ let DefaultCanvasGroupRender = class {
8899
8970
  };
8900
8971
  this._groupRenderContribitions.forEach(c => {
8901
8972
  c.time === BaseRenderContributionTime.beforeFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke);
8902
- }), 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 => {
8973
+ }), clip && context.clip(), context.setShadowBlendStyle && context.setShadowBlendStyle(group, group.attribute, groupAttribute);
8974
+ const _runFill = () => {
8975
+ doFillOrStroke.doFill && (fillCb ? fillCb(context, group.attribute, groupAttribute) : fVisible && (context.setCommonStyle(group, group.attribute, x, y, groupAttribute), context.fill()));
8976
+ },
8977
+ _runStroke = () => {
8978
+ doFillOrStroke.doStroke && (strokeCb ? strokeCb(context, group.attribute, groupAttribute) : sVisible && (context.setStrokeStyle(group, group.attribute, x, y, groupAttribute), context.stroke()));
8979
+ };
8980
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this._groupRenderContribitions.forEach(c => {
8903
8981
  c.time === BaseRenderContributionTime.afterFillStroke && c.drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb);
8904
8982
  });
8905
8983
  }
@@ -8965,6 +9043,7 @@ let DefaultCanvasImageRender = class extends BaseRender {
8965
9043
  x: originX = imageAttribute.x,
8966
9044
  y: originY = imageAttribute.y,
8967
9045
  cornerRadius = imageAttribute.cornerRadius,
9046
+ fillStrokeOrder = imageAttribute.fillStrokeOrder,
8968
9047
  image: url
8969
9048
  } = image.attribute,
8970
9049
  data = this.valid(image, imageAttribute, fillCb);
@@ -8975,20 +9054,26 @@ let DefaultCanvasImageRender = class extends BaseRender {
8975
9054
  doFill: doFill,
8976
9055
  doStroke: doStroke
8977
9056
  } = data;
8978
- 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) {
8979
- if (!url || !image.resources) return;
8980
- const res = image.resources.get(url);
8981
- if ("success" !== res.state) return;
8982
- let needRestore = !1;
8983
- 0 === cornerRadius || isArray(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);
8984
- let repeat = 0;
8985
- if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
8986
- const pattern = context.createPattern(res.data, repeatStr[repeat]);
8987
- context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
8988
- } else context.drawImage(res.data, x, y, width, height);
8989
- needRestore && context.restore();
8990
- }
8991
- 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);
9057
+ context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute), this.beforeRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
9058
+ const _runFill = () => {
9059
+ if (doFill) if (fillCb) fillCb(context, image.attribute, imageAttribute);else if (fVisible) {
9060
+ if (!url || !image.resources) return;
9061
+ const res = image.resources.get(url);
9062
+ if ("success" !== res.state) return;
9063
+ let needRestore = !1;
9064
+ 0 === cornerRadius || isArray(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);
9065
+ let repeat = 0;
9066
+ if ("repeat" === repeatX && (repeat |= 1), "repeat" === repeatY && (repeat |= 2), repeat) {
9067
+ const pattern = context.createPattern(res.data, repeatStr[repeat]);
9068
+ context.fillStyle = pattern, context.translate(x, y, !0), context.fillRect(0, 0, width, height), context.translate(-x, -y, !0);
9069
+ } else context.drawImage(res.data, x, y, width, height);
9070
+ needRestore && context.restore();
9071
+ }
9072
+ },
9073
+ _runStroke = () => {
9074
+ doStroke && (strokeCb ? strokeCb(context, image.attribute, imageAttribute) : sVisible && (context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute), context.stroke()));
9075
+ };
9076
+ fillStrokeOrder ? (_runStroke(), _runFill()) : (_runFill(), _runStroke()), this.afterRenderStep(image, context, x, y, doFill, !1, fVisible, !1, imageAttribute, drawContext, fillCb);
8992
9077
  }
8993
9078
  draw(image, renderService, drawContext) {
8994
9079
  const {
@@ -15804,19 +15889,22 @@ function bitmapTool(width, height, padding = { top: 0, left: 0, right: 0, bottom
15804
15889
  scale.height = height;
15805
15890
  return scale;
15806
15891
  }
15807
- function boundToRange($, bound, clamp$1 = false) {
15808
- if (clamp$1) {
15809
- const { x1, x2, y1, y2 } = bound;
15810
- const _x1 = clamp(x1, 0, $.width);
15811
- const _x2 = clamp(x2, 0, $.width);
15812
- const _y1 = clamp(y1, 0, $.height);
15813
- const _y2 = clamp(y2, 0, $.height);
15814
- return {
15815
- x1: $.x(_x1),
15816
- x2: $.x(_x2),
15817
- y1: $.y(_y1),
15818
- y2: $.y(_y2)
15819
- };
15892
+ function clampRangeByBitmap($, range) {
15893
+ const { x1, x2, y1, y2 } = range;
15894
+ const _x1 = clamp(x1, 0, $.width);
15895
+ const _x2 = clamp(x2, 0, $.width);
15896
+ const _y1 = clamp(y1, 0, $.height);
15897
+ const _y2 = clamp(y2, 0, $.height);
15898
+ return {
15899
+ x1: $.x(_x1),
15900
+ x2: $.x(_x2),
15901
+ y1: $.y(_y1),
15902
+ y2: $.y(_y2)
15903
+ };
15904
+ }
15905
+ function boundToRange($, bound, clamp = false) {
15906
+ if (clamp) {
15907
+ return clampRangeByBitmap($, bound);
15820
15908
  }
15821
15909
  return {
15822
15910
  x1: $.x(bound.x1),
@@ -15837,10 +15925,13 @@ function canPlace($, bitmap, bound, checkBound = true, pad = 0) {
15837
15925
  };
15838
15926
  }
15839
15927
  range = boundToRange($, range);
15840
- const outOfBounds = checkBound && bitmap.outOfBounds(range);
15841
- if (outOfBounds) {
15928
+ const outOfBounds = bitmap.outOfBounds(range);
15929
+ if (checkBound && outOfBounds) {
15842
15930
  return false;
15843
15931
  }
15932
+ if (outOfBounds) {
15933
+ range = clampRangeByBitmap($, range);
15934
+ }
15844
15935
  return !bitmap.getRange(range);
15845
15936
  }
15846
15937
  function placeToCandidates($, bitmap, text, candidates = [], clampForce = true, pad = 0) {
@@ -16221,6 +16312,71 @@ function loadLabelComponent() {
16221
16312
  registerLine();
16222
16313
  }
16223
16314
 
16315
+ function shiftY(texts, option = {}) {
16316
+ const { maxIterations = 10, maxError = 0.1, padding = 1, maxY = Number.MAX_VALUE } = option;
16317
+ const n = texts.length;
16318
+ if (n <= 1) {
16319
+ return texts;
16320
+ }
16321
+ const isIntersect = ([a, b], [c, d]) => {
16322
+ return d > a && b > c;
16323
+ };
16324
+ const textInformation = new Map();
16325
+ const getY0 = (text) => textInformation.get(text).y0;
16326
+ const getY = (text) => textInformation.get(text).y;
16327
+ const getHeight = (text) => textInformation.get(text).height;
16328
+ const getX1 = (text) => textInformation.get(text).x1;
16329
+ const getX2 = (text) => textInformation.get(text).x2;
16330
+ const setY = (text, y) => {
16331
+ textInformation.get(text).y = y;
16332
+ };
16333
+ for (const text of texts) {
16334
+ const { y1, y2, x1, x2 } = text.AABBBounds;
16335
+ textInformation.set(text, { y0: y1, y: y1, height: y2 - y1, x1, x2 });
16336
+ }
16337
+ for (let iter = 0; iter < maxIterations; iter++) {
16338
+ texts.sort((a, b) => getY(a) - getY(b));
16339
+ let error = 0;
16340
+ for (let i = 0; i < n - 1; i++) {
16341
+ const curText = texts[i];
16342
+ let j = i + 1;
16343
+ let nextText;
16344
+ while ((nextText = texts[j]) &&
16345
+ !isIntersect([getX1(curText), getX2(curText)], [getX1(nextText), getX2(nextText)])) {
16346
+ j += 1;
16347
+ }
16348
+ if (nextText) {
16349
+ const y0 = getY(curText);
16350
+ const h0 = getHeight(curText);
16351
+ const y1 = getY(nextText);
16352
+ const delta = y1 - (y0 + h0);
16353
+ if (delta < padding) {
16354
+ const newDelta = (padding - delta) / 2;
16355
+ error = Math.max(error, newDelta);
16356
+ if (y1 + newDelta + getHeight(nextText) > maxY) {
16357
+ setY(curText, y0 - (padding - delta));
16358
+ }
16359
+ else if (y0 - newDelta < 0) {
16360
+ setY(nextText, y1 + (padding - delta));
16361
+ }
16362
+ else {
16363
+ setY(curText, y0 - newDelta);
16364
+ setY(nextText, y1 + newDelta);
16365
+ }
16366
+ }
16367
+ }
16368
+ }
16369
+ if (error < maxError) {
16370
+ break;
16371
+ }
16372
+ }
16373
+ for (const text of texts) {
16374
+ const finalY = text.attribute.y + getY(text) - getY0(text);
16375
+ text.setAttribute('y', finalY);
16376
+ }
16377
+ return texts;
16378
+ }
16379
+
16224
16380
  loadLabelComponent();
16225
16381
  class LabelBase extends AbstractComponent {
16226
16382
  setBitmap(bitmap) {
@@ -16534,12 +16690,11 @@ class LabelBase extends AbstractComponent {
16534
16690
  return texts;
16535
16691
  }
16536
16692
  _overlapping(labels) {
16537
- var _a, _b, _c, _d;
16693
+ var _a, _b, _c;
16538
16694
  if (labels.length === 0) {
16539
16695
  return [];
16540
16696
  }
16541
16697
  const option = (isObject(this.attribute.overlap) ? this.attribute.overlap : {});
16542
- const result = [];
16543
16698
  const baseMarkGroup = this.getBaseMarkGroup();
16544
16699
  const size = (_a = option.size) !== null && _a !== void 0 ? _a : {
16545
16700
  width: (_b = baseMarkGroup === null || baseMarkGroup === void 0 ? void 0 : baseMarkGroup.AABBBounds.width()) !== null && _b !== void 0 ? _b : 0,
@@ -16548,12 +16703,55 @@ class LabelBase extends AbstractComponent {
16548
16703
  if (size.width === 0 || size.height === 0) {
16549
16704
  return labels;
16550
16705
  }
16551
- const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [], overlapPadding } = option;
16706
+ const { strategy, priority } = option;
16552
16707
  const bmpTool = this._bmpTool || bitmapTool(size.width, size.height);
16553
16708
  const bitmap = this._bitmap || bmpTool.bitmap();
16709
+ if (priority) {
16710
+ labels = labels.sort((a, b) => priority(b.attribute.data) - priority(a.attribute.data));
16711
+ }
16712
+ if ((strategy === null || strategy === void 0 ? void 0 : strategy.type) === 'shiftY') {
16713
+ return this._overlapGlobal(labels, option, bmpTool, bitmap);
16714
+ }
16715
+ return this._overlapByStrategy(labels, option, bmpTool, bitmap);
16716
+ }
16717
+ _overlapGlobal(labels, option, bmpTool, bitmap) {
16718
+ let result = labels.filter(label => label.attribute.visible && label.attribute.opacity !== 0);
16719
+ const { clampForce = true, hideOnHit = true, overlapPadding, strategy } = option;
16720
+ if (clampForce) {
16721
+ for (let i = 0; i < result.length; i++) {
16722
+ const text = labels[i];
16723
+ const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);
16724
+ if (dx !== 0 || dy !== 0) {
16725
+ text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
16726
+ }
16727
+ }
16728
+ }
16729
+ result = shiftY(result, Object.assign({ maxY: bmpTool.height }, strategy));
16730
+ for (let i = 0; i < result.length; i++) {
16731
+ const text = result[i];
16732
+ const bounds = text.AABBBounds;
16733
+ const range = boundToRange(bmpTool, bounds, true);
16734
+ if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) {
16735
+ bitmap.setRange(range);
16736
+ }
16737
+ else {
16738
+ if (hideOnHit) {
16739
+ text.setAttributes({ visible: false });
16740
+ }
16741
+ else {
16742
+ bitmap.setRange(range);
16743
+ }
16744
+ }
16745
+ }
16746
+ return result;
16747
+ }
16748
+ _overlapByStrategy(labels, option, bmpTool, bitmap) {
16749
+ var _a;
16750
+ const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [], overlapPadding } = option;
16751
+ const result = [];
16554
16752
  const checkBounds = strategy.some(s => s.type === 'bound');
16555
16753
  if (avoidBaseMark) {
16556
- (_d = this._baseMarks) === null || _d === void 0 ? void 0 : _d.forEach(mark => {
16754
+ (_a = this._baseMarks) === null || _a === void 0 ? void 0 : _a.forEach(mark => {
16557
16755
  mark.AABBBounds && bitmap.setRange(boundToRange(bmpTool, mark.AABBBounds, true));
16558
16756
  });
16559
16757
  }
@@ -16570,7 +16768,7 @@ class LabelBase extends AbstractComponent {
16570
16768
  });
16571
16769
  }
16572
16770
  for (let i = 0; i < labels.length; i++) {
16573
- if (labels[i].visible === false) {
16771
+ if (labels[i].attribute.visible === false) {
16574
16772
  continue;
16575
16773
  }
16576
16774
  const text = labels[i];
@@ -18902,13 +19100,13 @@ function autoHide(labels, config) {
18902
19100
  const shouldCheck = (length, visibility, checkLength = true) => {
18903
19101
  return checkLength ? length < 3 || visibility : visibility;
18904
19102
  };
18905
- let checkFirst = shouldCheck(items.length, config.firstVisible, false);
18906
- const checkLast = shouldCheck(items.length, config.lastVisible);
19103
+ const checkFirst = shouldCheck(items.length, config.firstVisible, false);
19104
+ let checkLast = shouldCheck(items.length, config.lastVisible);
18907
19105
  const firstSourceItem = source[0];
18908
19106
  const lastSourceItem = last(source);
18909
19107
  if (textIntersect(firstSourceItem, lastSourceItem, sep) && checkFirst && checkLast) {
18910
19108
  lastSourceItem.setAttribute('opacity', 0);
18911
- checkFirst = false;
19109
+ checkLast = false;
18912
19110
  }
18913
19111
  forceItemVisible$1(firstSourceItem, items, checkFirst, (item) => textIntersect(item, firstSourceItem, sep));
18914
19112
  forceItemVisible$1(lastSourceItem, items, checkLast, (item) => textIntersect(item, lastSourceItem, sep) ||
@@ -19180,9 +19378,9 @@ function autoWrap(labels, config) {
19180
19378
  if (isEmpty(labels) || !isValidNumber(limitLength)) {
19181
19379
  return;
19182
19380
  }
19183
- const verticalLimitLength = axisLength / labels.length;
19184
- labels.forEach(label => {
19185
- var _a;
19381
+ let verticalLimitLength = axisLength / labels.length;
19382
+ labels.forEach((label, index) => {
19383
+ var _a, _b, _c, _d, _e;
19186
19384
  const angle = label.attribute.angle;
19187
19385
  const isHorizontal = isAngleHorizontal(angle);
19188
19386
  const isVertical = isAngleVertical(angle);
@@ -19191,13 +19389,25 @@ function autoWrap(labels, config) {
19191
19389
  if (isVertical && Math.floor(label.AABBBounds.height()) <= limitLength) {
19192
19390
  return;
19193
19391
  }
19194
- if (isHorizontal && Math.floor(label.AABBBounds.width()) <= verticalLimitLength) {
19195
- return;
19392
+ if (isHorizontal) {
19393
+ const curLabelX = label.attribute.x;
19394
+ const nextLabelX = (_a = labels[index + 1]) === null || _a === void 0 ? void 0 : _a.attribute.x;
19395
+ const lastLabelX = (_b = labels[index - 1]) === null || _b === void 0 ? void 0 : _b.attribute.x;
19396
+ const minGap = getLabelMinGap(curLabelX, nextLabelX, lastLabelX);
19397
+ if (isValidNumber(minGap)) {
19398
+ verticalLimitLength = min(verticalLimitLength, minGap);
19399
+ }
19196
19400
  }
19197
19401
  }
19198
19402
  else {
19199
- if (isVertical && Math.floor(label.AABBBounds.height()) <= verticalLimitLength) {
19200
- return;
19403
+ if (isVertical) {
19404
+ const curLabelY = label.attribute.y;
19405
+ const nextLabelY = (_c = labels[index + 1]) === null || _c === void 0 ? void 0 : _c.attribute.y;
19406
+ const lastLabelY = (_d = labels[index - 1]) === null || _d === void 0 ? void 0 : _d.attribute.y;
19407
+ const minGap = getLabelMinGap(curLabelY, nextLabelY, lastLabelY);
19408
+ if (isValidNumber(minGap)) {
19409
+ verticalLimitLength = min(verticalLimitLength, minGap);
19410
+ }
19201
19411
  }
19202
19412
  if (isHorizontal && Math.floor(label.AABBBounds.width()) <= limitLength) {
19203
19413
  return;
@@ -19227,12 +19437,27 @@ function autoWrap(labels, config) {
19227
19437
  }
19228
19438
  label.setAttributes({
19229
19439
  maxLineWidth: limitLabelLength,
19230
- ellipsis: (_a = label.attribute.ellipsis) !== null && _a !== void 0 ? _a : ellipsis,
19440
+ ellipsis: (_e = label.attribute.ellipsis) !== null && _e !== void 0 ? _e : ellipsis,
19231
19441
  whiteSpace: 'normal',
19232
19442
  heightLimit
19233
19443
  });
19234
19444
  });
19235
19445
  }
19446
+ function getLabelMinGap(current, next, prev) {
19447
+ let minGap;
19448
+ if (isValidNumber(next)) {
19449
+ minGap = Math.abs(next - current);
19450
+ }
19451
+ if (isValidNumber(prev)) {
19452
+ if (isValidNumber(minGap)) {
19453
+ minGap = Math.min(Math.abs(current - prev), minGap);
19454
+ }
19455
+ else {
19456
+ minGap = Math.abs(current - prev);
19457
+ }
19458
+ }
19459
+ return minGap;
19460
+ }
19236
19461
 
19237
19462
  function alignAxisLabels(labels, start, containerSize, orient, align) {
19238
19463
  if (orient === 'left' || orient === 'right') {
@@ -29157,6 +29382,6 @@ EmptyTip.defaultAttributes = {
29157
29382
  }
29158
29383
  };
29159
29384
 
29160
- const version = "0.20.10-alpha.1";
29385
+ const version = "0.20.11-alpha.0";
29161
29386
 
29162
29387
  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 };