@@ -31737,10 +31737,11 @@ function placeToCandidates($, bitmap, text) {
3173731737 let candidates = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
3173831738 let clampForce = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : !0;
3173931739 let pad = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
31740+ let changePosition = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
3174031741 const validCandidates = candidates.filter(candidate => isValid$1(candidate));
3174131742 for (let i = 0; i < validCandidates.length; i++) {
31742- const tempText = text.clone() ;
31743- if (tempText. setAttributes(validCandidates[i]), tempText.update(), canPlace($, bitmap, tempText .AABBBounds, clampForce, pad)) return bitmap.setRange(boundToRange($, tempText .AABBBounds, !0)), validCandidates[i];
31743+ let measureText ;
31744+ if (measureText = changePosition ? text : text.clone(), measureText. setAttributes(validCandidates[i]), canPlace($, bitmap, measureText .AABBBounds, clampForce, pad)) return bitmap.setRange(boundToRange($, measureText .AABBBounds, !0)), validCandidates[i];
3174431745 }
3174531746 return !1;
3174631747}
@@ -31750,8 +31751,9 @@ function place$2($, bitmap, s, attrs, text, bounds, labeling) {
3175031751 overlapPadding = null === (_b = attrs.overlap) || void 0 === _b ? void 0 : _b.overlapPadding;
3175131752 if ("bound" === s.type || "position" === s.type) {
3175231753 if (isFunction$1(labeling)) {
31753- const candidates = ((isFunction$1(s.position) ? s.position(text.attribute) : s.position) || defaultLabelPosition(attrs.type)).map(p => labeling(text.AABBBounds, bounds, p, attrs.offset));
31754- return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding);
31754+ const candidates = ((isFunction$1(s.position) ? s.position(text.attribute) : s.position) || defaultLabelPosition(attrs.type)).map(p => labeling(text.AABBBounds, bounds, p, attrs.offset)),
31755+ shouldClone = !1 === s.restorePosition;
31756+ return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding, shouldClone);
3175531757 }
3175631758 return !1;
3175731759 }
@@ -32135,18 +32137,18 @@ function shiftY(texts, option) {
3213532137 textInformation.get(text).attempts = attempts;
3213632138 };
3213732139 function adjustPositionInOneGroup(texts) {
32138- var text;
32139- if (1 !== texts.length) for (let i = texts.length - 1; i > 0; i--) {
32140+ for (let i = texts.length - 1; i >= 0; i--) {
3214032141 const curText = texts[i],
3214132142 upperText = texts[i - 1],
3214232143 lowerText = texts[i + 1];
32143- if (isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText))) {
32144+ if (upperText && isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText)) || 0 === getY1(curText) && curText._isClamped ) {
3214432145 const {
3214532146 y: y
3214632147 } = labelling(curText);
3214732148 lowerText && isIntersect(y + getHeight(curText) / 2, getY1(lowerText)) || y + getHeight(curText) / 2 <= maxY && setY1(curText, getY1(curText) + y - (text = curText, textInformation.get(text).y));
3214832149 }
3214932150 }
32151+ var text;
3215032152 }
3215132153 texts.sort((a, b) => a.attribute.x - b.attribute.x);
3215232154 for (const text of texts) {
@@ -32510,12 +32512,35 @@ class LabelBase extends AbstractComponent {
3251032512 const text = result[i],
3251132513 bounds = text.AABBBounds,
3251232514 range = boundToRange(bmpTool, bounds, !0);
32513- canPlace(bmpTool, bitmap, bounds, clampForce, text._isClamped ? 0 : overlapPadding) ? bitmap.setRange(range) : hideOnHit ? text.setAttributes({
32514- visible: !1
32515- }) : bitmap.setRange(range);
32515+ if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) bitmap.setRange(range);else {
32516+ if (clampForce) {
32517+ if (this._processClampForce(text, bmpTool, bitmap)) continue;
32518+ }
32519+ hideOnHit ? text.setAttributes({
32520+ visible: !1
32521+ }) : bitmap.setRange(range);
32522+ }
3251632523 }
3251732524 return result;
3251832525 }
32526+ _processClampForce(text, bmpTool, bitmap) {
32527+ const {
32528+ dy = 0,
32529+ dx = 0
32530+ } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
32531+ if (0 === dx && 0 === dy) {
32532+ if (canPlace(bmpTool, bitmap, text.AABBBounds)) return bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), !0;
32533+ } else if (canPlace(bmpTool, bitmap, {
32534+ x1: text.AABBBounds.x1 + dx,
32535+ x2: text.AABBBounds.x2 + dx,
32536+ y1: text.AABBBounds.y1 + dy,
32537+ y2: text.AABBBounds.y2 + dy
32538+ })) return text.setAttributes({
32539+ x: text.attribute.x + dx,
32540+ y: text.attribute.y + dy
32541+ }), bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), !0;
32542+ return !1;
32543+ }
3251932544 _overlapByStrategy(labels, option, bmpTool, bitmap) {
3252032545 var _a;
3252132546 const {
@@ -32564,25 +32589,8 @@ class LabelBase extends AbstractComponent {
3256432589 break;
3256532590 }
3256632591 if (!hasPlace && clampForce) {
32567- const {
32568- dx = 0,
32569- dy = 0
32570- } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
32571- if (0 === dx && 0 === dy) {
32572- if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
32573- bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
32574- continue;
32575- }
32576- } else if (canPlace(bmpTool, bitmap, {
32577- x1: text.AABBBounds.x1 + dx,
32578- x2: text.AABBBounds.x2 + dx,
32579- y1: text.AABBBounds.y1 + dy,
32580- y2: text.AABBBounds.y2 + dy
32581- })) {
32582- text.setAttributes({
32583- x: text.attribute.x + dx,
32584- y: text.attribute.y + dy
32585- }), bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
32592+ if (this._processClampForce(text, bmpTool, bitmap)) {
32593+ result.push(text);
3258632594 continue;
3258732595 }
3258832596 }
@@ -61920,7 +61928,7 @@ const registerVChartCore = () => {
6192061928};
6192161929registerVChartCore();
6192261930
61923- const version = "1.12.14 ";
61931+ const version = "1.12.15 ";
6192461932
6192561933const addVChartProperty = (data, op) => {
6192661934 const context = op.beforeCall();
0 commit comments