@visactor/vrender-components 0.14.3-alpha.2 → 0.14.3-alpha.4
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/axis/base.d.ts +0 -4
- package/cjs/axis/base.js +5 -3
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/circle.d.ts +1 -5
- package/cjs/axis/circle.js +0 -6
- package/cjs/axis/circle.js.map +1 -1
- package/cjs/axis/line.d.ts +0 -5
- package/cjs/axis/line.js +3 -10
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/overlap/auto-rotate.d.ts +1 -9
- package/cjs/axis/overlap/auto-rotate.js +30 -41
- package/cjs/axis/overlap/auto-rotate.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/label/arc.js +3 -2
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.js +29 -43
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/type.d.ts +0 -4
- package/cjs/label/type.js.map +1 -1
- package/cjs/legend/constant.d.ts +1 -2
- package/cjs/legend/constant.js +1 -1
- package/cjs/legend/constant.js.map +1 -1
- package/cjs/legend/discrete/discrete.js +13 -26
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/marker/base.d.ts +0 -3
- package/cjs/marker/base.js +6 -25
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/type.d.ts +0 -6
- package/cjs/marker/type.js.map +1 -1
- package/cjs/util/labelSmartInvert.d.ts +1 -2
- package/cjs/util/labelSmartInvert.js +2 -2
- package/cjs/util/labelSmartInvert.js.map +1 -1
- package/dist/index.js +120 -207
- package/dist/index.min.js +1 -1
- package/es/axis/base.d.ts +0 -4
- package/es/axis/base.js +5 -3
- package/es/axis/base.js.map +1 -1
- package/es/axis/circle.d.ts +1 -5
- package/es/axis/circle.js +0 -6
- package/es/axis/circle.js.map +1 -1
- package/es/axis/line.d.ts +0 -5
- package/es/axis/line.js +3 -11
- package/es/axis/line.js.map +1 -1
- package/es/axis/overlap/auto-rotate.d.ts +1 -9
- package/es/axis/overlap/auto-rotate.js +28 -38
- package/es/axis/overlap/auto-rotate.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/label/arc.js +3 -2
- package/es/label/arc.js.map +1 -1
- package/es/label/base.js +30 -42
- package/es/label/base.js.map +1 -1
- package/es/label/type.d.ts +0 -4
- package/es/label/type.js.map +1 -1
- package/es/legend/constant.d.ts +1 -2
- package/es/legend/constant.js +1 -1
- package/es/legend/constant.js.map +1 -1
- package/es/legend/discrete/discrete.js +13 -26
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/marker/base.d.ts +0 -3
- package/es/marker/base.js +5 -26
- package/es/marker/base.js.map +1 -1
- package/es/marker/type.d.ts +0 -6
- package/es/marker/type.js.map +1 -1
- package/es/util/labelSmartInvert.d.ts +1 -2
- package/es/util/labelSmartInvert.js +1 -1
- package/es/util/labelSmartInvert.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1779,6 +1779,20 @@
|
|
|
1779
1779
|
continue;
|
|
1780
1780
|
}
|
|
1781
1781
|
}
|
|
1782
|
+
if (clampForce) {
|
|
1783
|
+
const { dx = 0, dy = 0 } = clampText(text, bmpTool.width, bmpTool.height);
|
|
1784
|
+
if (!(dx === 0 && dy === 0) &&
|
|
1785
|
+
canPlace(bmpTool, bitmap, {
|
|
1786
|
+
x1: text.AABBBounds.x1 + dx,
|
|
1787
|
+
x2: text.AABBBounds.x2 + dx,
|
|
1788
|
+
y1: text.AABBBounds.y1 + dy,
|
|
1789
|
+
y2: text.AABBBounds.y2 + dy
|
|
1790
|
+
})) {
|
|
1791
|
+
text.setAttributes({ x: text.attribute.x + dx, y: text.attribute.y + dy });
|
|
1792
|
+
result.push(text);
|
|
1793
|
+
continue;
|
|
1794
|
+
}
|
|
1795
|
+
}
|
|
1782
1796
|
let hasPlace = false;
|
|
1783
1797
|
for (let j = 0; j < strategy.length; j++) {
|
|
1784
1798
|
hasPlace = place(bmpTool, bitmap, strategy[j], this.attribute, text, this.getGraphicBounds(baseMark, labels[i]), this.labeling);
|
|
@@ -1974,67 +1988,42 @@
|
|
|
1974
1988
|
return listener;
|
|
1975
1989
|
}
|
|
1976
1990
|
_smartInvert(labels) {
|
|
1977
|
-
var _a, _b, _c, _d;
|
|
1978
1991
|
const option = (this.attribute.smartInvert || {});
|
|
1979
1992
|
const { textType, contrastRatiosThreshold, alternativeColors } = option;
|
|
1980
|
-
const fillStrategy = (_a = option.fillStrategy) !== null && _a !== void 0 ? _a : 'invertSeries';
|
|
1981
|
-
const strokeStrategy = (_b = option.strokeStrategy) !== null && _b !== void 0 ? _b : 'series';
|
|
1982
|
-
const brightColor = (_c = option.brightColor) !== null && _c !== void 0 ? _c : '#ffffff';
|
|
1983
|
-
const darkColor = (_d = option.darkColor) !== null && _d !== void 0 ? _d : '#000000';
|
|
1984
|
-
if (fillStrategy === 'null' && strokeStrategy === 'null') {
|
|
1985
|
-
return;
|
|
1986
|
-
}
|
|
1987
1993
|
for (let i = 0; i < labels.length; i++) {
|
|
1988
1994
|
const label = labels[i];
|
|
1989
1995
|
if (!label) {
|
|
1990
1996
|
continue;
|
|
1991
1997
|
}
|
|
1992
1998
|
const baseMark = this._idToGraphic.get(label.attribute.id);
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
case 'series':
|
|
2002
|
-
label.setAttributes({
|
|
2003
|
-
fill: seriesColor
|
|
2004
|
-
});
|
|
2005
|
-
break;
|
|
2006
|
-
case 'invertSeries':
|
|
2007
|
-
label.setAttributes({
|
|
2008
|
-
fill: invertColor
|
|
2009
|
-
});
|
|
2010
|
-
break;
|
|
2011
|
-
case 'similarSeries':
|
|
2012
|
-
label.setAttributes({
|
|
2013
|
-
fill: simialrColor
|
|
2014
|
-
});
|
|
2015
|
-
break;
|
|
1999
|
+
let isInside = canPlaceInside(label.AABBBounds, baseMark === null || baseMark === void 0 ? void 0 : baseMark.AABBBounds);
|
|
2000
|
+
if (this.attribute.type === 'arc') {
|
|
2001
|
+
if (this.attribute.position === 'inside') {
|
|
2002
|
+
isInside = true;
|
|
2003
|
+
}
|
|
2004
|
+
else {
|
|
2005
|
+
isInside = false;
|
|
2006
|
+
}
|
|
2016
2007
|
}
|
|
2017
|
-
if (label.attribute.lineWidth
|
|
2018
|
-
|
|
2008
|
+
if (label.attribute.stroke && label.attribute.lineWidth > 0) {
|
|
2009
|
+
label.setAttributes({
|
|
2010
|
+
fill: labelSmartInvert(label.attribute.fill, label.attribute.stroke, textType, contrastRatiosThreshold, alternativeColors)
|
|
2011
|
+
});
|
|
2019
2012
|
}
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
label.setAttributes({
|
|
2035
|
-
stroke: simialrColor
|
|
2036
|
-
});
|
|
2037
|
-
break;
|
|
2013
|
+
else if (isInside) {
|
|
2014
|
+
const backgroundColor = baseMark.attribute.fill;
|
|
2015
|
+
const foregroundColor = label.attribute.fill;
|
|
2016
|
+
label.setAttributes({
|
|
2017
|
+
fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)
|
|
2018
|
+
});
|
|
2019
|
+
}
|
|
2020
|
+
else if (label.attribute.lineWidth > 0) {
|
|
2021
|
+
const backgroundColor = label.attribute.stroke;
|
|
2022
|
+
const foregroundColor = label.attribute.fill;
|
|
2023
|
+
label.setAttributes({
|
|
2024
|
+
stroke: baseMark.attribute.fill,
|
|
2025
|
+
fill: labelSmartInvert(foregroundColor, backgroundColor, textType, contrastRatiosThreshold, alternativeColors)
|
|
2026
|
+
});
|
|
2038
2027
|
}
|
|
2039
2028
|
}
|
|
2040
2029
|
}
|
|
@@ -2607,7 +2596,7 @@
|
|
|
2607
2596
|
}
|
|
2608
2597
|
else {
|
|
2609
2598
|
const alignOffset = 0;
|
|
2610
|
-
labelPosition.x = cx + alignOffset + flag * (spaceWidth +
|
|
2599
|
+
labelPosition.x = cx + alignOffset + flag * (spaceWidth + targetCenterOffset);
|
|
2611
2600
|
}
|
|
2612
2601
|
}
|
|
2613
2602
|
_computeAlignOffset(align, labelWidth, alignFlag) {
|
|
@@ -3007,7 +2996,8 @@
|
|
|
3007
2996
|
align: 'arc',
|
|
3008
2997
|
strategy: 'priority',
|
|
3009
2998
|
tangentConstraint: true
|
|
3010
|
-
}
|
|
2999
|
+
},
|
|
3000
|
+
pickable: false
|
|
3011
3001
|
};
|
|
3012
3002
|
|
|
3013
3003
|
const labelComponentMap = {
|
|
@@ -3866,8 +3856,10 @@
|
|
|
3866
3856
|
textStyle = vutils.isFunction(textStyle)
|
|
3867
3857
|
? vutils.merge({}, DEFAULT_AXIS_THEME.label.style, textStyle(tickDatum, index, tickData, layer))
|
|
3868
3858
|
: textStyle;
|
|
3869
|
-
|
|
3870
|
-
|
|
3859
|
+
textStyle = vutils.merge({
|
|
3860
|
+
textAlign: this.getTextAlign(vector),
|
|
3861
|
+
textBaseline: this.getTextBaseline(vector, inside)
|
|
3862
|
+
}, textStyle);
|
|
3871
3863
|
if (vutils.isFunction(textStyle.text)) {
|
|
3872
3864
|
textStyle.text = textStyle.text({
|
|
3873
3865
|
label: tickDatum.label,
|
|
@@ -4033,70 +4025,73 @@
|
|
|
4033
4025
|
item.rotatedBounds = bounds;
|
|
4034
4026
|
});
|
|
4035
4027
|
}
|
|
4036
|
-
function clampAngle(angle = 0) {
|
|
4037
|
-
if (angle < 0) {
|
|
4038
|
-
while (angle < 0) {
|
|
4039
|
-
angle += Math.PI * 2;
|
|
4040
|
-
}
|
|
4041
|
-
}
|
|
4042
|
-
if (angle > 0) {
|
|
4043
|
-
while (angle >= Math.PI * 2) {
|
|
4044
|
-
angle -= Math.PI * 2;
|
|
4045
|
-
}
|
|
4046
|
-
}
|
|
4047
|
-
return angle;
|
|
4048
|
-
}
|
|
4049
4028
|
function rotateYAxis(orient, items) {
|
|
4029
|
+
let align = ['right', 'right', 'center', 'left', 'center', 'left', 'center', 'right', 'right'];
|
|
4030
|
+
let baseline = ['middle', 'middle', 'top', 'top', 'middle', 'middle', 'bottom', 'bottom', 'middle'];
|
|
4031
|
+
if (orient === 'right') {
|
|
4032
|
+
align = ['left', 'right', 'right', 'right', 'left', 'left', 'left', 'left', 'right'];
|
|
4033
|
+
baseline = ['middle', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom'];
|
|
4034
|
+
}
|
|
4050
4035
|
items.forEach((item, i) => {
|
|
4051
|
-
|
|
4036
|
+
let angle = item.attribute.angle || 0;
|
|
4037
|
+
if (angle < 0) {
|
|
4038
|
+
while (angle < 0) {
|
|
4039
|
+
angle += Math.PI * 2;
|
|
4040
|
+
}
|
|
4041
|
+
}
|
|
4042
|
+
if (angle > 0) {
|
|
4043
|
+
while (angle >= Math.PI * 2) {
|
|
4044
|
+
angle -= Math.PI * 2;
|
|
4045
|
+
}
|
|
4046
|
+
}
|
|
4047
|
+
const step = angle / (Math.PI * 0.5);
|
|
4048
|
+
let index;
|
|
4049
|
+
if (step === Math.floor(step)) {
|
|
4050
|
+
index = Math.floor(step) * 2;
|
|
4051
|
+
}
|
|
4052
|
+
else {
|
|
4053
|
+
index = Math.floor(step) * 2 + 1;
|
|
4054
|
+
}
|
|
4055
|
+
item.setAttributes({
|
|
4056
|
+
textAlign: align[index],
|
|
4057
|
+
textBaseline: baseline[index],
|
|
4058
|
+
angle: angle
|
|
4059
|
+
});
|
|
4052
4060
|
});
|
|
4053
4061
|
}
|
|
4054
4062
|
function rotateXAxis(orient, items) {
|
|
4055
|
-
items.forEach(item => {
|
|
4056
|
-
item.setAttributes(Object.assign(Object.assign({}, getXAxisLabelAlign(orient, item.attribute.angle)), { angle: clampAngle(item.attribute.angle) }));
|
|
4057
|
-
});
|
|
4058
|
-
}
|
|
4059
|
-
function getXAxisLabelAlign(orient, angle = 0) {
|
|
4060
4063
|
let align = ['center', 'left', 'left', 'left', 'center', 'right', 'right', 'right', 'left'];
|
|
4061
4064
|
let baseline = ['top', 'top', 'middle', 'bottom', 'bottom', 'bottom', 'middle', 'top', 'top'];
|
|
4062
4065
|
if (orient === 'top') {
|
|
4063
4066
|
align = ['center', 'right', 'right', 'right', 'center', 'left', 'left', 'left', 'right'];
|
|
4064
4067
|
baseline = ['bottom', 'bottom', 'middle', 'top', 'top', 'top', 'middle', 'bottom', 'bottom'];
|
|
4065
4068
|
}
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
}
|
|
4093
|
-
else {
|
|
4094
|
-
index = Math.floor(step) * 2 + 1;
|
|
4095
|
-
}
|
|
4096
|
-
return {
|
|
4097
|
-
textAlign: align[index],
|
|
4098
|
-
textBaseline: baseline[index]
|
|
4099
|
-
};
|
|
4069
|
+
items.forEach(item => {
|
|
4070
|
+
let angle = item.attribute.angle || 0;
|
|
4071
|
+
if (angle < 0) {
|
|
4072
|
+
while (angle < 0) {
|
|
4073
|
+
angle += Math.PI * 2;
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
if (angle > 0) {
|
|
4077
|
+
while (angle >= Math.PI * 2) {
|
|
4078
|
+
angle -= Math.PI * 2;
|
|
4079
|
+
}
|
|
4080
|
+
}
|
|
4081
|
+
const step = angle / (Math.PI * 0.5);
|
|
4082
|
+
let index;
|
|
4083
|
+
if (step === Math.floor(step)) {
|
|
4084
|
+
index = Math.floor(step) * 2;
|
|
4085
|
+
}
|
|
4086
|
+
else {
|
|
4087
|
+
index = Math.floor(step) * 2 + 1;
|
|
4088
|
+
}
|
|
4089
|
+
item.setAttributes({
|
|
4090
|
+
textAlign: align[index],
|
|
4091
|
+
textBaseline: baseline[index],
|
|
4092
|
+
angle
|
|
4093
|
+
});
|
|
4094
|
+
});
|
|
4100
4095
|
}
|
|
4101
4096
|
|
|
4102
4097
|
function autoLimit(labels, config) {
|
|
@@ -4503,23 +4498,14 @@
|
|
|
4503
4498
|
}
|
|
4504
4499
|
return base;
|
|
4505
4500
|
}
|
|
4506
|
-
|
|
4501
|
+
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4507
4502
|
const orient = this.attribute.orient;
|
|
4508
|
-
if (
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
return getYAxisLabelAlign(orient, angle);
|
|
4514
|
-
}
|
|
4503
|
+
if (orient === 'left' || orient === 'right') {
|
|
4504
|
+
rotateYAxis(orient, labelShapes);
|
|
4505
|
+
}
|
|
4506
|
+
else if (orient === 'bottom' || orient === 'top') {
|
|
4507
|
+
rotateXAxis(orient, labelShapes);
|
|
4515
4508
|
}
|
|
4516
|
-
return {
|
|
4517
|
-
textAlign: this.getTextAlign(vector),
|
|
4518
|
-
textBaseline: this.getTextBaseline(vector, inside)
|
|
4519
|
-
};
|
|
4520
|
-
}
|
|
4521
|
-
beforeLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4522
|
-
return;
|
|
4523
4509
|
}
|
|
4524
4510
|
handleLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4525
4511
|
if (vutils.isEmpty(labelShapes)) {
|
|
@@ -4867,12 +4853,6 @@
|
|
|
4867
4853
|
afterLabelsOverlap(labelShapes, labelData, labelContainer, layer, layerCount) {
|
|
4868
4854
|
return;
|
|
4869
4855
|
}
|
|
4870
|
-
getLabelAlign(vector, inside, angle) {
|
|
4871
|
-
return {
|
|
4872
|
-
textAlign: this.getTextAlign(vector),
|
|
4873
|
-
textBaseline: this.getTextBaseline(vector)
|
|
4874
|
-
};
|
|
4875
|
-
}
|
|
4876
4856
|
}
|
|
4877
4857
|
CircleAxis.defaultAttributes = DEFAULT_AXIS_THEME;
|
|
4878
4858
|
|
|
@@ -5763,27 +5743,6 @@
|
|
|
5763
5743
|
})(exports.IMarkPointItemPosition || (exports.IMarkPointItemPosition = {}));
|
|
5764
5744
|
|
|
5765
5745
|
class Marker extends AbstractComponent {
|
|
5766
|
-
_initContainer() {
|
|
5767
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
5768
|
-
const groupClip = vrender.createGroup(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
|
|
5769
|
-
groupClip.name = 'marker-container';
|
|
5770
|
-
const group = vrender.createGroup({
|
|
5771
|
-
x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
|
|
5772
|
-
y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
|
|
5773
|
-
});
|
|
5774
|
-
groupClip.add(group);
|
|
5775
|
-
this._containerClip = groupClip;
|
|
5776
|
-
this.add(groupClip);
|
|
5777
|
-
this._container = group;
|
|
5778
|
-
}
|
|
5779
|
-
_updateContainer() {
|
|
5780
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
5781
|
-
this._containerClip.setAttributes(Object.assign(Object.assign({}, (_a = this.attribute) === null || _a === void 0 ? void 0 : _a.clipRange), { clip: (_c = vutils.isValid((_b = this.attribute) === null || _b === void 0 ? void 0 : _b.clipRange)) !== null && _c !== void 0 ? _c : false }));
|
|
5782
|
-
this._container.setAttributes({
|
|
5783
|
-
x: -((_f = (_e = (_d = this.attribute) === null || _d === void 0 ? void 0 : _d.clipRange) === null || _e === void 0 ? void 0 : _e.x) !== null && _f !== void 0 ? _f : 0),
|
|
5784
|
-
y: -((_j = (_h = (_g = this.attribute) === null || _g === void 0 ? void 0 : _g.clipRange) === null || _h === void 0 ? void 0 : _h.y) !== null && _j !== void 0 ? _j : 0)
|
|
5785
|
-
});
|
|
5786
|
-
}
|
|
5787
5746
|
render() {
|
|
5788
5747
|
var _a, _b;
|
|
5789
5748
|
const markerVisible = (_a = this.attribute.visible) !== null && _a !== void 0 ? _a : true;
|
|
@@ -5793,12 +5752,14 @@
|
|
|
5793
5752
|
this.setAttribute('childrenPickable', false);
|
|
5794
5753
|
}
|
|
5795
5754
|
if (markerVisible) {
|
|
5796
|
-
if (!this.
|
|
5797
|
-
|
|
5798
|
-
|
|
5755
|
+
if (!this._container) {
|
|
5756
|
+
const group = vrender.createGroup({});
|
|
5757
|
+
group.name = 'marker-container';
|
|
5758
|
+
this.add(group);
|
|
5759
|
+
this._container = group;
|
|
5760
|
+
this.initMarker(group);
|
|
5799
5761
|
}
|
|
5800
5762
|
else {
|
|
5801
|
-
this._updateContainer();
|
|
5802
5763
|
this.updateMarker();
|
|
5803
5764
|
}
|
|
5804
5765
|
}
|
|
@@ -6559,7 +6520,6 @@
|
|
|
6559
6520
|
LegendEvent["legendItemHover"] = "legendItemHover";
|
|
6560
6521
|
LegendEvent["legendItemUnHover"] = "legendItemUnHover";
|
|
6561
6522
|
LegendEvent["legendItemClick"] = "legendItemClick";
|
|
6562
|
-
LegendEvent["legendItemAttributeUpdate"] = "legendItemAttributeUpdate";
|
|
6563
6523
|
})(exports.LegendEvent || (exports.LegendEvent = {}));
|
|
6564
6524
|
exports.LEGEND_ELEMENT_NAME = void 0;
|
|
6565
6525
|
(function (LEGEND_ELEMENT_NAME) {
|
|
@@ -6683,21 +6643,12 @@
|
|
|
6683
6643
|
const target = e.target;
|
|
6684
6644
|
if ((_a = target === null || target === void 0 ? void 0 : target.name) === null || _a === void 0 ? void 0 : _a.startsWith(exports.LEGEND_ELEMENT_NAME.item)) {
|
|
6685
6645
|
const legendItem = target.delegate;
|
|
6686
|
-
let attributeUpdate = false;
|
|
6687
|
-
if (legendItem.hasState(exports.LegendStateValue.unSelectedHover) ||
|
|
6688
|
-
legendItem.hasState(exports.LegendStateValue.selectedHover)) {
|
|
6689
|
-
attributeUpdate = true;
|
|
6690
|
-
}
|
|
6691
6646
|
legendItem.removeState(exports.LegendStateValue.unSelectedHover);
|
|
6692
6647
|
legendItem.removeState(exports.LegendStateValue.selectedHover);
|
|
6693
6648
|
legendItem
|
|
6694
6649
|
.getChildren()[0]
|
|
6695
6650
|
.getChildren()
|
|
6696
6651
|
.forEach((child) => {
|
|
6697
|
-
if (!attributeUpdate &&
|
|
6698
|
-
(child.hasState(exports.LegendStateValue.unSelectedHover) || child.hasState(exports.LegendStateValue.selectedHover))) {
|
|
6699
|
-
attributeUpdate = true;
|
|
6700
|
-
}
|
|
6701
6652
|
child.removeState(exports.LegendStateValue.unSelectedHover);
|
|
6702
6653
|
child.removeState(exports.LegendStateValue.selectedHover);
|
|
6703
6654
|
});
|
|
@@ -6705,9 +6656,6 @@
|
|
|
6705
6656
|
if (focusButton) {
|
|
6706
6657
|
focusButton.setAttribute('visible', false);
|
|
6707
6658
|
}
|
|
6708
|
-
if (attributeUpdate) {
|
|
6709
|
-
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
6710
|
-
}
|
|
6711
6659
|
this._dispatchEvent(exports.LegendEvent.legendItemUnHover, legendItem);
|
|
6712
6660
|
}
|
|
6713
6661
|
};
|
|
@@ -6978,30 +6926,15 @@
|
|
|
6978
6926
|
this._appendDataToShape(valueShape, exports.LEGEND_ELEMENT_NAME.itemValue, item, itemGroup, valueAttr === null || valueAttr === void 0 ? void 0 : valueAttr.state);
|
|
6979
6927
|
valueShape.addState(isSelected ? exports.LegendStateValue.selected : exports.LegendStateValue.unSelected);
|
|
6980
6928
|
if (this._itemWidthByUser) {
|
|
6981
|
-
|
|
6929
|
+
valueShape.setAttribute('maxLineWidth', this._itemWidthByUser -
|
|
6982
6930
|
parsedPadding[1] -
|
|
6983
6931
|
parsedPadding[3] -
|
|
6984
6932
|
shapeSize -
|
|
6985
6933
|
shapeSpace -
|
|
6934
|
+
labelShape.AABBBounds.width() -
|
|
6986
6935
|
labelSpace -
|
|
6987
6936
|
focusSpace -
|
|
6988
|
-
valueSpace;
|
|
6989
|
-
const valueBounds = valueShape.AABBBounds;
|
|
6990
|
-
const labelBounds = labelShape.AABBBounds;
|
|
6991
|
-
const valueWidth = valueBounds.width();
|
|
6992
|
-
const labelWidth = labelBounds.width();
|
|
6993
|
-
if (labelWidth > layoutWidth) {
|
|
6994
|
-
if ((layoutWidth - valueWidth) / labelWidth > 0.4) {
|
|
6995
|
-
labelShape.setAttribute('maxLineWidth', layoutWidth - valueWidth);
|
|
6996
|
-
}
|
|
6997
|
-
else {
|
|
6998
|
-
valueShape.setAttribute('maxLineWidth', layoutWidth * 0.5);
|
|
6999
|
-
labelShape.setAttribute('maxLineWidth', layoutWidth * 0.5);
|
|
7000
|
-
}
|
|
7001
|
-
}
|
|
7002
|
-
else {
|
|
7003
|
-
valueShape.setAttribute('maxLineWidth', layoutWidth - labelWidth);
|
|
7004
|
-
}
|
|
6937
|
+
valueSpace);
|
|
7005
6938
|
if (valueAttr.alignRight) {
|
|
7006
6939
|
valueShape.setAttributes({
|
|
7007
6940
|
textAlign: 'right',
|
|
@@ -7151,32 +7084,18 @@
|
|
|
7151
7084
|
return true;
|
|
7152
7085
|
}
|
|
7153
7086
|
_setLegendItemState(legendItem, stateName, keepCurrentStates = true) {
|
|
7154
|
-
let attributeUpdate = false;
|
|
7155
|
-
if (!legendItem.hasState(stateName)) {
|
|
7156
|
-
attributeUpdate = true;
|
|
7157
|
-
}
|
|
7158
7087
|
legendItem.addState(stateName, keepCurrentStates);
|
|
7159
7088
|
legendItem
|
|
7160
7089
|
.getChildren()[0]
|
|
7161
7090
|
.getChildren()
|
|
7162
|
-
.forEach(
|
|
7091
|
+
.forEach(child => {
|
|
7163
7092
|
if (child.name !== exports.LEGEND_ELEMENT_NAME.focus) {
|
|
7164
|
-
if (!attributeUpdate && !child.hasState(stateName)) {
|
|
7165
|
-
attributeUpdate = true;
|
|
7166
|
-
}
|
|
7167
7093
|
child.addState(stateName, keepCurrentStates);
|
|
7168
7094
|
}
|
|
7169
7095
|
});
|
|
7170
|
-
if (attributeUpdate) {
|
|
7171
|
-
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
7172
|
-
}
|
|
7173
7096
|
}
|
|
7174
7097
|
_removeLegendItemState(legendItem, stateNames) {
|
|
7175
|
-
let attributeUpdate = false;
|
|
7176
7098
|
stateNames.forEach(name => {
|
|
7177
|
-
if (!attributeUpdate && legendItem.hasState(name)) {
|
|
7178
|
-
attributeUpdate = true;
|
|
7179
|
-
}
|
|
7180
7099
|
legendItem.removeState(name);
|
|
7181
7100
|
});
|
|
7182
7101
|
legendItem
|
|
@@ -7185,16 +7104,10 @@
|
|
|
7185
7104
|
.forEach(child => {
|
|
7186
7105
|
if (child.name !== exports.LEGEND_ELEMENT_NAME.focus) {
|
|
7187
7106
|
stateNames.forEach(name => {
|
|
7188
|
-
if (!attributeUpdate && child.hasState(name)) {
|
|
7189
|
-
attributeUpdate = true;
|
|
7190
|
-
}
|
|
7191
7107
|
child.removeState(name);
|
|
7192
7108
|
});
|
|
7193
7109
|
}
|
|
7194
7110
|
});
|
|
7195
|
-
if (attributeUpdate) {
|
|
7196
|
-
this._dispatchEvent(exports.LegendEvent.legendItemAttributeUpdate, legendItem);
|
|
7197
|
-
}
|
|
7198
7111
|
}
|
|
7199
7112
|
_getSelectedLegends() {
|
|
7200
7113
|
var _a;
|
|
@@ -10068,7 +9981,7 @@
|
|
|
10068
9981
|
}
|
|
10069
9982
|
Tooltip.defaultAttributes = defaultAttributes;
|
|
10070
9983
|
|
|
10071
|
-
const version = "0.14.3-alpha.
|
|
9984
|
+
const version = "0.14.3-alpha.4";
|
|
10072
9985
|
|
|
10073
9986
|
exports.AbstractComponent = AbstractComponent;
|
|
10074
9987
|
exports.ArcInfo = ArcInfo;
|