@visactor/vrender-components 0.21.1-alpha.0 → 0.21.1
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/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/base.d.ts +1 -0
- package/cjs/label/base.js +26 -19
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/overlap/place.d.ts +1 -1
- package/cjs/label/overlap/place.js +7 -6
- package/cjs/label/overlap/place.js.map +1 -1
- package/cjs/label/overlap/shiftY.js +3 -3
- package/cjs/label/overlap/shiftY.js.map +1 -1
- package/cjs/label/type.d.ts +2 -0
- package/cjs/label/type.js.map +1 -1
- package/cjs/marker/config.js +32 -0
- package/cjs/marker/config.js.map +1 -1
- package/cjs/marker/point.js +5 -2
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +9 -1
- package/cjs/marker/type.js +6 -2
- package/cjs/marker/type.js.map +1 -1
- package/cjs/scrollbar/scrollbar-plugin.js +24 -19
- package/cjs/scrollbar/scrollbar-plugin.js.map +1 -1
- package/dist/index.es.js +177 -75
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/base.d.ts +1 -0
- package/es/label/base.js +26 -19
- package/es/label/base.js.map +1 -1
- package/es/label/overlap/place.d.ts +1 -1
- package/es/label/overlap/place.js +6 -5
- package/es/label/overlap/place.js.map +1 -1
- package/es/label/overlap/shiftY.js +3 -3
- package/es/label/overlap/shiftY.js.map +1 -1
- package/es/label/type.d.ts +2 -0
- package/es/label/type.js.map +1 -1
- package/es/marker/config.js +32 -0
- package/es/marker/config.js.map +1 -1
- package/es/marker/point.js +3 -1
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +9 -1
- package/es/marker/type.js +6 -2
- package/es/marker/type.js.map +1 -1
- package/es/scrollbar/scrollbar-plugin.js +24 -19
- package/es/scrollbar/scrollbar-plugin.js.map +1 -1
- package/package.json +8 -8
package/dist/index.es.js
CHANGED
|
@@ -572,6 +572,7 @@ class SyncHook extends Hook {
|
|
|
572
572
|
|
|
573
573
|
const EnvContribution = Symbol.for("EnvContribution");
|
|
574
574
|
const VGlobal = Symbol.for("VGlobal");
|
|
575
|
+
const DEFAULT_TEXT_FONT_FAMILY$1 = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
|
|
575
576
|
|
|
576
577
|
var __decorate$P = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
577
578
|
var d,
|
|
@@ -2547,7 +2548,7 @@ const DIRECTION_KEY = {
|
|
|
2547
2548
|
};
|
|
2548
2549
|
const defaultFormatting = {
|
|
2549
2550
|
fontSize: 16,
|
|
2550
|
-
fontFamily:
|
|
2551
|
+
fontFamily: DEFAULT_TEXT_FONT_FAMILY$1,
|
|
2551
2552
|
fill: !0,
|
|
2552
2553
|
stroke: !1,
|
|
2553
2554
|
fontWeight: "normal",
|
|
@@ -2573,7 +2574,7 @@ const setTextStyle = (ctx, character) => {
|
|
|
2573
2574
|
fontStyle: character.fontStyle || "",
|
|
2574
2575
|
fontWeight: character.fontWeight || "",
|
|
2575
2576
|
fontSize: fontSize,
|
|
2576
|
-
fontFamily: character.fontFamily
|
|
2577
|
+
fontFamily: character.fontFamily
|
|
2577
2578
|
});
|
|
2578
2579
|
};
|
|
2579
2580
|
function applyFillStyle(ctx, character, b) {
|
|
@@ -3619,19 +3620,19 @@ class Node extends EventEmitter {
|
|
|
3619
3620
|
}
|
|
3620
3621
|
insertBefore(newNode, referenceNode) {
|
|
3621
3622
|
if (!referenceNode) return this.appendChild(newNode);
|
|
3622
|
-
if (this
|
|
3623
|
+
if (this === newNode || newNode === referenceNode) return null;
|
|
3623
3624
|
if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");
|
|
3624
3625
|
return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, newNode._prev = referenceNode._prev, referenceNode._prev ? referenceNode._prev._next = newNode : this._firstChild = newNode, referenceNode._prev = newNode, newNode._next = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
|
|
3625
3626
|
}
|
|
3626
3627
|
insertAfter(newNode, referenceNode) {
|
|
3627
3628
|
if (!referenceNode) return this.appendChild(newNode);
|
|
3628
|
-
if (this
|
|
3629
|
+
if (this === newNode || newNode === referenceNode) return null;
|
|
3629
3630
|
if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");
|
|
3630
3631
|
return referenceNode.parent !== this ? null : (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, referenceNode._next ? (referenceNode._next._prev = newNode, newNode._next = referenceNode._next) : this._lastChild = newNode, referenceNode._next = newNode, newNode._prev = referenceNode, this._idMap || (this._idMap = new Map()), this._idMap.set(newNode._uid, newNode), this._structEdit = !0, this.setCount(newNode.count), newNode);
|
|
3631
3632
|
}
|
|
3632
3633
|
insertInto(newNode, idx) {
|
|
3633
3634
|
if (!this._ignoreWarn && this._nodeList && Logger.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"), idx >= this.childrenCount) return this.appendChild(newNode);
|
|
3634
|
-
if (this
|
|
3635
|
+
if (this === newNode) return null;
|
|
3635
3636
|
if (newNode.isAncestorsOf(this)) throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");
|
|
3636
3637
|
if (newNode.parent && newNode.parent.removeChild(newNode), newNode.parent = this, 0 === idx) newNode._next = this._firstChild, this._firstChild && (this._firstChild._prev = newNode), newNode._prev = null, this._firstChild = newNode;else {
|
|
3637
3638
|
let child = this._firstChild;
|
|
@@ -5896,14 +5897,21 @@ class Group extends Graphic {
|
|
|
5896
5897
|
width: width,
|
|
5897
5898
|
height: height,
|
|
5898
5899
|
path: path,
|
|
5899
|
-
clip = groupTheme.clip
|
|
5900
|
-
display: display
|
|
5900
|
+
clip = groupTheme.clip
|
|
5901
5901
|
} = attribute;
|
|
5902
|
-
|
|
5902
|
+
if (path && path.length ? path.forEach(g => {
|
|
5903
5903
|
aabbBounds.union(g.AABBBounds);
|
|
5904
|
-
}) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), clip
|
|
5905
|
-
|
|
5906
|
-
|
|
5904
|
+
}) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), !clip) {
|
|
5905
|
+
this.forEachChildren(node => {
|
|
5906
|
+
aabbBounds.union(node.AABBBounds);
|
|
5907
|
+
});
|
|
5908
|
+
const {
|
|
5909
|
+
scrollX = 0,
|
|
5910
|
+
scrollY = 0
|
|
5911
|
+
} = attribute;
|
|
5912
|
+
aabbBounds.translate(scrollX, scrollY);
|
|
5913
|
+
}
|
|
5914
|
+
return application.graphicService.updateTempAABBBounds(aabbBounds), application.graphicService.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, this), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
|
|
5907
5915
|
}
|
|
5908
5916
|
doUpdateAABBBounds() {
|
|
5909
5917
|
this.updateAABBBoundsStamp++;
|
|
@@ -7793,7 +7801,7 @@ function drawEachCurve(path, curve, lastCurve, defined0, offsetX, offsetY, offse
|
|
|
7793
7801
|
originP2: originP2
|
|
7794
7802
|
} = curve;
|
|
7795
7803
|
let validP;
|
|
7796
|
-
if (originP1 && !1 !== originP1.defined ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1), defined0) {
|
|
7804
|
+
if (originP1 && !1 !== originP1.defined && !lastCurve ? validP = p0 : originP1 && !1 !== originP2.defined && (validP = null !== (_a = curve.p3) && void 0 !== _a ? _a : curve.p1), defined0) {
|
|
7797
7805
|
newDefined0 = !defined0;
|
|
7798
7806
|
const x = validP ? validP.x : curve.p0.x,
|
|
7799
7807
|
y = validP ? validP.y : curve.p0.y;
|
|
@@ -11477,7 +11485,7 @@ class Wrapper {
|
|
|
11477
11485
|
}
|
|
11478
11486
|
}
|
|
11479
11487
|
|
|
11480
|
-
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
11488
|
+
const RICHTEXT_UPDATE_TAG_KEY = ["width", "height", "ellipsis", "wordBreak", "verticalDirection", "maxHeight", "maxWidth", "textAlign", "textBaseline", "textConfig", "layoutDirection", "fill", "stroke", "fontSize", "fontFamily", "fontStyle", "fontWeight", "lineWidth", "opacity", "fillOpacity", "strokeOpacity", ...GRAPHIC_UPDATE_TAG_KEY];
|
|
11481
11489
|
class RichText extends Graphic {
|
|
11482
11490
|
constructor(params) {
|
|
11483
11491
|
super(params), this.type = "richtext", this._currentHoverIcon = null, this.numberType = RICHTEXT_NUMBER_TYPE, this.onBeforeAttributeUpdate = (val, attributes, key) => {
|
|
@@ -12700,21 +12708,33 @@ let DefaultDrawContribution = class {
|
|
|
12700
12708
|
const renderer = this.getRenderContribution(graphic);
|
|
12701
12709
|
if (!renderer) return;
|
|
12702
12710
|
let tempBounds,
|
|
12703
|
-
retrans =
|
|
12711
|
+
retrans = this.scrollMatrix && (0 !== this.scrollMatrix.e || 0 !== this.scrollMatrix.f);
|
|
12704
12712
|
if (graphic.parent) {
|
|
12705
12713
|
const {
|
|
12706
12714
|
scrollX = 0,
|
|
12707
12715
|
scrollY = 0
|
|
12708
12716
|
} = graphic.parent.attribute;
|
|
12709
|
-
|
|
12710
|
-
|
|
12711
|
-
|
|
12712
|
-
|
|
12717
|
+
(scrollX || scrollY) && (retrans = !0, this.scrollMatrix || (this.scrollMatrix = matrixAllocate.allocate(1, 0, 0, 1, 0, 0)), this.scrollMatrix.translate(-scrollX, -scrollY));
|
|
12718
|
+
}
|
|
12719
|
+
if (retrans && (tempBounds = this.dirtyBounds.clone().transformWithMatrix(this.scrollMatrix)), this.useDirtyBounds && !graphic.isContainer && !isRectIntersect(graphic.AABBBounds, null != tempBounds ? tempBounds : this.dirtyBounds, !1)) {
|
|
12720
|
+
if (retrans && graphic.parent) {
|
|
12721
|
+
const {
|
|
12722
|
+
scrollX = 0,
|
|
12723
|
+
scrollY = 0
|
|
12724
|
+
} = graphic.parent.attribute;
|
|
12725
|
+
this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);
|
|
12713
12726
|
}
|
|
12727
|
+
return;
|
|
12714
12728
|
}
|
|
12715
|
-
if (this.useDirtyBounds && !graphic.isContainer && !isRectIntersect(graphic.AABBBounds, this.dirtyBounds, !1)) return void (retrans && this.dirtyBounds.copy(tempBounds));
|
|
12716
12729
|
const skipDraw = null != drawContext.startAtId && graphic._uid !== drawContext.startAtId;
|
|
12717
|
-
if (graphic._uid === drawContext.startAtId && (drawContext.startAtId = null), params && (params.skipDraw = skipDraw), skipDraw ? graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params) : renderer.draw(graphic, this.currentRenderService, drawContext, params), retrans &&
|
|
12730
|
+
if (graphic._uid === drawContext.startAtId && (drawContext.startAtId = null), params && (params.skipDraw = skipDraw), skipDraw ? graphic.isContainer && renderer.draw(graphic, this.currentRenderService, drawContext, params) : renderer.draw(graphic, this.currentRenderService, drawContext, params), retrans && graphic.parent) {
|
|
12731
|
+
const {
|
|
12732
|
+
scrollX = 0,
|
|
12733
|
+
scrollY = 0
|
|
12734
|
+
} = graphic.parent.attribute;
|
|
12735
|
+
this.scrollMatrix && this.scrollMatrix.translate(scrollX, scrollY);
|
|
12736
|
+
}
|
|
12737
|
+
if (this.InterceptorContributions.length) for (let i = 0; i < this.InterceptorContributions.length; i++) {
|
|
12718
12738
|
const drawContribution = this.InterceptorContributions[i];
|
|
12719
12739
|
if (drawContribution.afterDrawItem && drawContribution.afterDrawItem(graphic, this.currentRenderService, drawContext, this)) return;
|
|
12720
12740
|
}
|
|
@@ -14599,7 +14619,13 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
|
|
|
14599
14619
|
this.clearScrollbar(this.scrollContainer.g, 'all');
|
|
14600
14620
|
}
|
|
14601
14621
|
this.scrollContainer = data !== null && data !== void 0 ? data : this.scrollContainer;
|
|
14622
|
+
if (!data) {
|
|
14623
|
+
return;
|
|
14624
|
+
}
|
|
14602
14625
|
const scrollContainer = data.g;
|
|
14626
|
+
if (!scrollContainer) {
|
|
14627
|
+
return;
|
|
14628
|
+
}
|
|
14603
14629
|
const { width, height, scrollX = 0, scrollY = 0 } = scrollContainer.attribute;
|
|
14604
14630
|
let newScrollX = scrollX;
|
|
14605
14631
|
let newScrollY = scrollY;
|
|
@@ -14615,29 +14641,31 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
|
|
|
14615
14641
|
showV = showV && true;
|
|
14616
14642
|
}
|
|
14617
14643
|
}
|
|
14618
|
-
const
|
|
14619
|
-
childrenBounds.
|
|
14620
|
-
childrenBounds.set(0, 0, scrollContainer.AABBBounds.width(), scrollContainer.AABBBounds.height());
|
|
14621
|
-
const scrollWidth = childrenBounds.width();
|
|
14622
|
-
const scrollHeight = childrenBounds.height();
|
|
14644
|
+
const scrollWidth = this.childrenBounds.width();
|
|
14645
|
+
const scrollHeight = this.childrenBounds.height();
|
|
14623
14646
|
if (showH) {
|
|
14624
|
-
newScrollX =
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14647
|
+
newScrollX = scrollX - ((_a = e.deltaX) !== null && _a !== void 0 ? _a : 0);
|
|
14648
|
+
if (newScrollX > 0) {
|
|
14649
|
+
newScrollX = 0;
|
|
14650
|
+
}
|
|
14651
|
+
else if (newScrollX < width - scrollWidth) {
|
|
14652
|
+
newScrollX = width - scrollWidth;
|
|
14653
|
+
}
|
|
14628
14654
|
}
|
|
14629
14655
|
if (showV) {
|
|
14630
|
-
newScrollY =
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14656
|
+
newScrollY = scrollY - ((_b = e.deltaY) !== null && _b !== void 0 ? _b : 0);
|
|
14657
|
+
if (newScrollY > 0) {
|
|
14658
|
+
newScrollY = 0;
|
|
14659
|
+
}
|
|
14660
|
+
else if (newScrollY < height - scrollHeight) {
|
|
14661
|
+
newScrollY = height - scrollHeight;
|
|
14662
|
+
}
|
|
14634
14663
|
}
|
|
14635
|
-
childrenBounds.translate(-newScrollX, -newScrollY);
|
|
14636
|
-
this.addOrUpdateScroll(showH, showV, scrollContainer.parent, scrollContainer);
|
|
14637
14664
|
scrollContainer.setAttributes({
|
|
14638
|
-
scrollX:
|
|
14639
|
-
scrollY:
|
|
14665
|
+
scrollX: newScrollX,
|
|
14666
|
+
scrollY: newScrollY
|
|
14640
14667
|
});
|
|
14668
|
+
this.addOrUpdateScroll(showH, showV, scrollContainer.parent, scrollContainer);
|
|
14641
14669
|
};
|
|
14642
14670
|
this.handleScrollBarChange = (params) => {
|
|
14643
14671
|
if (!this.scrollContainer ||
|
|
@@ -14711,7 +14739,7 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
|
|
|
14711
14739
|
return isHorozntal ? 'horizontal' : 'vertical';
|
|
14712
14740
|
}
|
|
14713
14741
|
addOrUpdateHScroll(scrollContainer, container, isHorozntal) {
|
|
14714
|
-
var _a;
|
|
14742
|
+
var _a, _b;
|
|
14715
14743
|
const direction = this.getDirection(isHorozntal);
|
|
14716
14744
|
const name = `${(_a = scrollContainer.name) !== null && _a !== void 0 ? _a : scrollContainer._uid}_${this.getDirection(isHorozntal)}_${this.name}`;
|
|
14717
14745
|
const scrollbars = container.children.filter((g) => g.name === name);
|
|
@@ -14754,16 +14782,17 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
|
|
|
14754
14782
|
});
|
|
14755
14783
|
}
|
|
14756
14784
|
const childrenBounds = this.childrenBounds;
|
|
14785
|
+
const { scrollX, scrollY } = scrollContainer.attribute;
|
|
14757
14786
|
if (isHorozntal) {
|
|
14758
14787
|
const ratio = Math.min(this.scrollContainerBounds.width() / childrenBounds.width(), 1);
|
|
14759
|
-
const start = Math.max(Math.min(
|
|
14788
|
+
const start = Math.max(Math.min(scrollX / this.childrenBounds.width(), 0), ratio - 1);
|
|
14760
14789
|
attrs.x = x + dx;
|
|
14761
|
-
attrs.y = y + dy + height -
|
|
14790
|
+
attrs.y = y + dy + height - ((_b = attrs.height) !== null && _b !== void 0 ? _b : 0);
|
|
14762
14791
|
attrs.range = [-start, -start + ratio];
|
|
14763
14792
|
}
|
|
14764
14793
|
else {
|
|
14765
14794
|
const ratio = Math.min(this.scrollContainerBounds.height() / childrenBounds.height(), 1);
|
|
14766
|
-
const start = Math.max(Math.min(
|
|
14795
|
+
const start = Math.max(Math.min(scrollY / this.childrenBounds.height(), 0), ratio - 1);
|
|
14767
14796
|
attrs.x = x + dx + width - this.scrollContainerBounds.width();
|
|
14768
14797
|
attrs.y = y + dy;
|
|
14769
14798
|
attrs.range = [-start, -start + ratio];
|
|
@@ -14803,12 +14832,17 @@ let ScrollBarPlugin = ScrollBarPlugin_1 = class ScrollBarPlugin {
|
|
|
14803
14832
|
showH = overflow === 'scroll-x';
|
|
14804
14833
|
showV = !showH;
|
|
14805
14834
|
}
|
|
14835
|
+
const childrenBounds = this.childrenBounds;
|
|
14836
|
+
childrenBounds.clear();
|
|
14837
|
+
g.forEachChildren((g) => {
|
|
14838
|
+
childrenBounds.union(g.AABBBounds);
|
|
14839
|
+
});
|
|
14806
14840
|
if (!g.AABBBounds.empty()) {
|
|
14807
14841
|
if (showH) {
|
|
14808
|
-
showH = width <
|
|
14842
|
+
showH = width < childrenBounds.width();
|
|
14809
14843
|
}
|
|
14810
14844
|
if (showV) {
|
|
14811
|
-
showV = height <
|
|
14845
|
+
showV = height < childrenBounds.height();
|
|
14812
14846
|
}
|
|
14813
14847
|
}
|
|
14814
14848
|
return showH || showV ? { g: g, showH, showV } : null;
|
|
@@ -16242,14 +16276,19 @@ function canPlace($, bitmap, bound, checkBound = true, pad = 0) {
|
|
|
16242
16276
|
}
|
|
16243
16277
|
return !bitmap.getRange(range);
|
|
16244
16278
|
}
|
|
16245
|
-
function placeToCandidates($, bitmap, text, candidates = [], clampForce = true, pad = 0) {
|
|
16279
|
+
function placeToCandidates($, bitmap, text, candidates = [], clampForce = true, pad = 0, changePosition = false) {
|
|
16246
16280
|
const validCandidates = candidates.filter(candidate => isValid(candidate));
|
|
16247
16281
|
for (let i = 0; i < validCandidates.length; i++) {
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16282
|
+
let measureText;
|
|
16283
|
+
if (changePosition) {
|
|
16284
|
+
measureText = text;
|
|
16285
|
+
}
|
|
16286
|
+
else {
|
|
16287
|
+
measureText = text.clone();
|
|
16288
|
+
}
|
|
16289
|
+
measureText.setAttributes(validCandidates[i]);
|
|
16290
|
+
if (canPlace($, bitmap, measureText.AABBBounds, clampForce, pad)) {
|
|
16291
|
+
bitmap.setRange(boundToRange($, measureText.AABBBounds, true));
|
|
16253
16292
|
return validCandidates[i];
|
|
16254
16293
|
}
|
|
16255
16294
|
}
|
|
@@ -16264,7 +16303,8 @@ function place($, bitmap, s, attrs, text, bounds, labeling) {
|
|
|
16264
16303
|
const userPosition = isFunction(s.position) ? s.position(text.attribute) : s.position;
|
|
16265
16304
|
const positions = (userPosition || defaultLabelPosition(attrs.type));
|
|
16266
16305
|
const candidates = positions.map(p => labeling(text.AABBBounds, bounds, p, attrs.offset));
|
|
16267
|
-
|
|
16306
|
+
const shouldClone = s.restorePosition === false;
|
|
16307
|
+
return placeToCandidates($, bitmap, text, candidates, clampForce, overlapPadding, shouldClone);
|
|
16268
16308
|
}
|
|
16269
16309
|
return false;
|
|
16270
16310
|
}
|
|
@@ -16661,14 +16701,12 @@ function shiftY(texts, option) {
|
|
|
16661
16701
|
textInformation.get(text).attempts = attempts;
|
|
16662
16702
|
};
|
|
16663
16703
|
function adjustPositionInOneGroup(texts) {
|
|
16664
|
-
|
|
16665
|
-
return;
|
|
16666
|
-
}
|
|
16667
|
-
for (let i = texts.length - 1; i > 0; i--) {
|
|
16704
|
+
for (let i = texts.length - 1; i >= 0; i--) {
|
|
16668
16705
|
const curText = texts[i];
|
|
16669
16706
|
const upperText = texts[i - 1];
|
|
16670
16707
|
const lowerText = texts[i + 1];
|
|
16671
|
-
if (isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText)))
|
|
16708
|
+
if ((upperText && isIntersect(getY1(upperText) + getHeight(upperText), getY1(curText))) ||
|
|
16709
|
+
(getY1(curText) === 0 && curText._isClamped)) {
|
|
16672
16710
|
const { y } = labelling(curText);
|
|
16673
16711
|
if (!lowerText || !isIntersect(y + getHeight(curText) / 2, getY1(lowerText))) {
|
|
16674
16712
|
if (y + getHeight(curText) / 2 <= maxY) {
|
|
@@ -17159,10 +17197,16 @@ class LabelBase extends AbstractComponent {
|
|
|
17159
17197
|
const text = result[i];
|
|
17160
17198
|
const bounds = text.AABBBounds;
|
|
17161
17199
|
const range = boundToRange(bmpTool, bounds, true);
|
|
17162
|
-
if (canPlace(bmpTool, bitmap, bounds, clampForce,
|
|
17200
|
+
if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) {
|
|
17163
17201
|
bitmap.setRange(range);
|
|
17164
17202
|
}
|
|
17165
17203
|
else {
|
|
17204
|
+
if (clampForce) {
|
|
17205
|
+
const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap);
|
|
17206
|
+
if (placedAfterClampForce) {
|
|
17207
|
+
continue;
|
|
17208
|
+
}
|
|
17209
|
+
}
|
|
17166
17210
|
if (hideOnHit) {
|
|
17167
17211
|
text.setAttributes({ visible: false });
|
|
17168
17212
|
}
|
|
@@ -17173,6 +17217,26 @@ class LabelBase extends AbstractComponent {
|
|
|
17173
17217
|
}
|
|
17174
17218
|
return result;
|
|
17175
17219
|
}
|
|
17220
|
+
_processClampForce(text, bmpTool, bitmap) {
|
|
17221
|
+
const { dy = 0, dx = 0 } = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
|
|
17222
|
+
if (dx === 0 && dy === 0) {
|
|
17223
|
+
if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
|
|
17224
|
+
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
17225
|
+
return true;
|
|
17226
|
+
}
|
|
17227
|
+
}
|
|
17228
|
+
else if (canPlace(bmpTool, bitmap, {
|
|
17229
|
+
x1: text.AABBBounds.x1 + dx,
|
|
17230
|
+
x2: text.AABBBounds.x2 + dx,
|
|
17231
|
+
y1: text.AABBBounds.y1 + dy,
|
|
17232
|
+
y2: text.AABBBounds.y2 + dy
|
|
17233
|
+
})) {
|
|
17234
|
+
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
|
|
17235
|
+
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
17236
|
+
return true;
|
|
17237
|
+
}
|
|
17238
|
+
return false;
|
|
17239
|
+
}
|
|
17176
17240
|
_overlapByStrategy(labels, option, bmpTool, bitmap) {
|
|
17177
17241
|
var _a;
|
|
17178
17242
|
const { avoidBaseMark, strategy = [], hideOnHit = true, clampForce = true, avoidMarks = [], overlapPadding } = option;
|
|
@@ -17232,22 +17296,8 @@ class LabelBase extends AbstractComponent {
|
|
|
17232
17296
|
}
|
|
17233
17297
|
}
|
|
17234
17298
|
if (!hasPlace && clampForce) {
|
|
17235
|
-
const
|
|
17236
|
-
if (
|
|
17237
|
-
if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
|
|
17238
|
-
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
17239
|
-
result.push(text);
|
|
17240
|
-
continue;
|
|
17241
|
-
}
|
|
17242
|
-
}
|
|
17243
|
-
else if (canPlace(bmpTool, bitmap, {
|
|
17244
|
-
x1: text.AABBBounds.x1 + dx,
|
|
17245
|
-
x2: text.AABBBounds.x2 + dx,
|
|
17246
|
-
y1: text.AABBBounds.y1 + dy,
|
|
17247
|
-
y2: text.AABBBounds.y2 + dy
|
|
17248
|
-
})) {
|
|
17249
|
-
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
|
|
17250
|
-
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, true));
|
|
17299
|
+
const placedAfterClampForce = this._processClampForce(text, bmpTool, bitmap);
|
|
17300
|
+
if (placedAfterClampForce) {
|
|
17251
17301
|
result.push(text);
|
|
17252
17302
|
continue;
|
|
17253
17303
|
}
|
|
@@ -22796,11 +22846,19 @@ var IMarkAreaLabelPosition;
|
|
|
22796
22846
|
IMarkAreaLabelPosition["right"] = "right";
|
|
22797
22847
|
IMarkAreaLabelPosition["top"] = "top";
|
|
22798
22848
|
IMarkAreaLabelPosition["bottom"] = "bottom";
|
|
22849
|
+
IMarkAreaLabelPosition["topLeft"] = "topLeft";
|
|
22850
|
+
IMarkAreaLabelPosition["topRight"] = "topRight";
|
|
22851
|
+
IMarkAreaLabelPosition["bottomLeft"] = "bottomLeft";
|
|
22852
|
+
IMarkAreaLabelPosition["bottomRight"] = "bottomRight";
|
|
22799
22853
|
IMarkAreaLabelPosition["middle"] = "middle";
|
|
22800
22854
|
IMarkAreaLabelPosition["insideLeft"] = "insideLeft";
|
|
22801
22855
|
IMarkAreaLabelPosition["insideRight"] = "insideRight";
|
|
22802
22856
|
IMarkAreaLabelPosition["insideTop"] = "insideTop";
|
|
22803
22857
|
IMarkAreaLabelPosition["insideBottom"] = "insideBottom";
|
|
22858
|
+
IMarkAreaLabelPosition["insideTopLeft"] = "insideTopLeft";
|
|
22859
|
+
IMarkAreaLabelPosition["insideTopRight"] = "insideTopRight";
|
|
22860
|
+
IMarkAreaLabelPosition["insideBottomLeft"] = "insideBottomLeft";
|
|
22861
|
+
IMarkAreaLabelPosition["insideBottomRight"] = "insideBottomRight";
|
|
22804
22862
|
})(IMarkAreaLabelPosition || (IMarkAreaLabelPosition = {}));
|
|
22805
22863
|
var IMarkCommonArcLabelPosition;
|
|
22806
22864
|
(function (IMarkCommonArcLabelPosition) {
|
|
@@ -23630,6 +23688,38 @@ const DEFAULT_CARTESIAN_MARK_AREA_TEXT_STYLE_MAP = {
|
|
|
23630
23688
|
middle: {
|
|
23631
23689
|
textAlign: 'center',
|
|
23632
23690
|
textBaseline: 'middle'
|
|
23691
|
+
},
|
|
23692
|
+
topLeft: {
|
|
23693
|
+
textAlign: 'right',
|
|
23694
|
+
textBaseline: 'top'
|
|
23695
|
+
},
|
|
23696
|
+
insideTopLeft: {
|
|
23697
|
+
textAlign: 'left',
|
|
23698
|
+
textBaseline: 'top'
|
|
23699
|
+
},
|
|
23700
|
+
topRight: {
|
|
23701
|
+
textAlign: 'left',
|
|
23702
|
+
textBaseline: 'top'
|
|
23703
|
+
},
|
|
23704
|
+
insideTopRight: {
|
|
23705
|
+
textAlign: 'right',
|
|
23706
|
+
textBaseline: 'top'
|
|
23707
|
+
},
|
|
23708
|
+
bottomLeft: {
|
|
23709
|
+
textAlign: 'right',
|
|
23710
|
+
textBaseline: 'bottom'
|
|
23711
|
+
},
|
|
23712
|
+
insideBottomLeft: {
|
|
23713
|
+
textAlign: 'left',
|
|
23714
|
+
textBaseline: 'bottom'
|
|
23715
|
+
},
|
|
23716
|
+
bottomRight: {
|
|
23717
|
+
textAlign: 'left',
|
|
23718
|
+
textBaseline: 'bottom'
|
|
23719
|
+
},
|
|
23720
|
+
insideBottomRight: {
|
|
23721
|
+
textAlign: 'right',
|
|
23722
|
+
textBaseline: 'bottom'
|
|
23633
23723
|
}
|
|
23634
23724
|
};
|
|
23635
23725
|
const DEFAULT_MARK_POINT_THEME = {
|
|
@@ -24528,11 +24618,23 @@ class MarkPoint extends Marker {
|
|
|
24528
24618
|
}
|
|
24529
24619
|
computeNewPositionAfterTargetItem(position) {
|
|
24530
24620
|
var _a, _b;
|
|
24531
|
-
const { itemContent = {}, targetSymbol } = this.attribute;
|
|
24621
|
+
const { itemContent = {}, targetSymbol, itemLine } = this.attribute;
|
|
24532
24622
|
const { offsetX: itemContentOffsetX = 0, offsetY: itemContentOffsetY = 0 } = itemContent;
|
|
24533
24623
|
const { offset: targetSymbolOffset = 0, style: targetSymbolStyle, visible: targetItemvisible = false, size: targetSymbolSize } = targetSymbol;
|
|
24534
24624
|
const targetSize = targetItemvisible ? (_b = (_a = targetSymbolStyle.size) !== null && _a !== void 0 ? _a : targetSymbolSize) !== null && _b !== void 0 ? _b : 20 : 0;
|
|
24535
|
-
|
|
24625
|
+
let targetOffsetAngle;
|
|
24626
|
+
if (itemLine.type === 'type-do') {
|
|
24627
|
+
targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, itemContentOffsetX / 2);
|
|
24628
|
+
}
|
|
24629
|
+
else if (itemLine.type === 'type-po') {
|
|
24630
|
+
targetOffsetAngle = deltaXYToAngle(0, itemContentOffsetX);
|
|
24631
|
+
}
|
|
24632
|
+
else if (itemLine.type === 'type-op') {
|
|
24633
|
+
targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, 0);
|
|
24634
|
+
}
|
|
24635
|
+
else {
|
|
24636
|
+
targetOffsetAngle = deltaXYToAngle(itemContentOffsetY, itemContentOffsetX);
|
|
24637
|
+
}
|
|
24536
24638
|
const newPosition = {
|
|
24537
24639
|
x: position.x + (targetSize / 2 + targetSymbolOffset) * Math.cos(targetOffsetAngle),
|
|
24538
24640
|
y: position.y + (targetSize / 2 + targetSymbolOffset) * Math.sin(targetOffsetAngle)
|
|
@@ -29989,6 +30091,6 @@ EmptyTip.defaultAttributes = {
|
|
|
29989
30091
|
}
|
|
29990
30092
|
};
|
|
29991
30093
|
|
|
29992
|
-
const version = "0.21.1
|
|
30094
|
+
const version = "0.21.1";
|
|
29993
30095
|
|
|
29994
30096
|
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, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,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.21.1\";\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"]}
|
package/es/label/base.d.ts
CHANGED
|
@@ -50,6 +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
54
|
protected _overlapByStrategy(labels: (IText | IRichText)[], option: OverlapAttrs, bmpTool: BitmapTool, bitmap: Bitmap): (IRichText | IText)[];
|
|
54
55
|
protected getBaseMarkGroup(): IGroup;
|
|
55
56
|
protected getGraphicBounds(graphic?: IGraphic, point?: Partial<PointLocationCfg>, position?: string): IBoundsLike;
|
package/es/label/base.js
CHANGED
|
@@ -236,12 +236,33 @@ export class LabelBase extends AbstractComponent {
|
|
|
236
236
|
}));
|
|
237
237
|
for (let i = 0; i < result.length; i++) {
|
|
238
238
|
const text = result[i], bounds = text.AABBBounds, range = boundToRange(bmpTool, bounds, !0);
|
|
239
|
-
canPlace(bmpTool, bitmap, bounds, clampForce,
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
if (canPlace(bmpTool, bitmap, bounds, clampForce, overlapPadding)) bitmap.setRange(range); else {
|
|
240
|
+
if (clampForce) {
|
|
241
|
+
if (this._processClampForce(text, bmpTool, bitmap)) continue;
|
|
242
|
+
}
|
|
243
|
+
hideOnHit ? text.setAttributes({
|
|
244
|
+
visible: !1
|
|
245
|
+
}) : bitmap.setRange(range);
|
|
246
|
+
}
|
|
242
247
|
}
|
|
243
248
|
return result;
|
|
244
249
|
}
|
|
250
|
+
_processClampForce(text, bmpTool, bitmap) {
|
|
251
|
+
const {dy: dy = 0, dx: dx = 0} = clampText(text, bmpTool.width, bmpTool.height, bmpTool.padding);
|
|
252
|
+
if (0 === dx && 0 === dy) {
|
|
253
|
+
if (canPlace(bmpTool, bitmap, text.AABBBounds)) return bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)),
|
|
254
|
+
!0;
|
|
255
|
+
} else if (canPlace(bmpTool, bitmap, {
|
|
256
|
+
x1: text.AABBBounds.x1 + dx,
|
|
257
|
+
x2: text.AABBBounds.x2 + dx,
|
|
258
|
+
y1: text.AABBBounds.y1 + dy,
|
|
259
|
+
y2: text.AABBBounds.y2 + dy
|
|
260
|
+
})) return text.setAttributes({
|
|
261
|
+
x: text.attribute.x + dx,
|
|
262
|
+
y: text.attribute.y + dy
|
|
263
|
+
}), bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), !0;
|
|
264
|
+
return !1;
|
|
265
|
+
}
|
|
245
266
|
_overlapByStrategy(labels, option, bmpTool, bitmap) {
|
|
246
267
|
var _a;
|
|
247
268
|
const {avoidBaseMark: avoidBaseMark, strategy: strategy = [], hideOnHit: hideOnHit = !0, clampForce: clampForce = !0, avoidMarks: avoidMarks = [], overlapPadding: overlapPadding} = option, result = [], checkBounds = strategy.some((s => "bound" === s.type));
|
|
@@ -281,22 +302,8 @@ export class LabelBase extends AbstractComponent {
|
|
|
281
302
|
break;
|
|
282
303
|
}
|
|
283
304
|
if (!hasPlace && clampForce) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
if (canPlace(bmpTool, bitmap, text.AABBBounds)) {
|
|
287
|
-
bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
} else if (canPlace(bmpTool, bitmap, {
|
|
291
|
-
x1: text.AABBBounds.x1 + dx,
|
|
292
|
-
x2: text.AABBBounds.x2 + dx,
|
|
293
|
-
y1: text.AABBBounds.y1 + dy,
|
|
294
|
-
y2: text.AABBBounds.y2 + dy
|
|
295
|
-
})) {
|
|
296
|
-
text.setAttributes({
|
|
297
|
-
x: text.attribute.x + dx,
|
|
298
|
-
y: text.attribute.y + dy
|
|
299
|
-
}), bitmap.setRange(boundToRange(bmpTool, text.AABBBounds, !0)), result.push(text);
|
|
305
|
+
if (this._processClampForce(text, bmpTool, bitmap)) {
|
|
306
|
+
result.push(text);
|
|
300
307
|
continue;
|
|
301
308
|
}
|
|
302
309
|
}
|