@visactor/vrender-components 1.0.19-alpha.0 → 1.0.20
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/line.js.map +1 -1
- package/cjs/axis/tick-data/continuous.js.map +1 -1
- package/cjs/axis/tick-data/util.js.map +1 -1
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/data-zoom/data-zoom.d.ts +12 -83
- package/cjs/data-zoom/data-zoom.js +104 -542
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/data-zoom/interaction.d.ts +65 -0
- package/cjs/data-zoom/interaction.js +179 -0
- package/cjs/data-zoom/interaction.js.map +1 -0
- package/cjs/data-zoom/renderer.d.ts +91 -0
- package/cjs/data-zoom/renderer.js +461 -0
- package/cjs/data-zoom/renderer.js.map +1 -0
- package/cjs/data-zoom/type.d.ts +8 -0
- package/cjs/data-zoom/type.js +11 -3
- package/cjs/data-zoom/type.js.map +1 -1
- package/cjs/data-zoom/utils.d.ts +2 -0
- package/cjs/data-zoom/utils.js +20 -0
- package/cjs/data-zoom/utils.js.map +1 -0
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/config.js +1 -2
- package/cjs/indicator/register.js +2 -1
- package/cjs/label/base.js +1 -1
- package/cjs/label/data-label-register.js +1 -1
- package/cjs/label/dataLabel.js +1 -1
- package/cjs/table-series-number/event-manager.js +7 -6
- package/cjs/table-series-number/event-manager.js.map +1 -1
- package/dist/index.es.js +1094 -748
- package/es/axis/line.js.map +1 -1
- package/es/axis/tick-data/continuous.js.map +1 -1
- package/es/axis/tick-data/util.js.map +1 -1
- package/es/brush/brush.js.map +1 -1
- package/es/data-zoom/data-zoom.d.ts +12 -83
- package/es/data-zoom/data-zoom.js +108 -545
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/data-zoom/interaction.d.ts +65 -0
- package/es/data-zoom/interaction.js +177 -0
- package/es/data-zoom/interaction.js.map +1 -0
- package/es/data-zoom/renderer.d.ts +91 -0
- package/es/data-zoom/renderer.js +458 -0
- package/es/data-zoom/renderer.js.map +1 -0
- package/es/data-zoom/type.d.ts +8 -0
- package/es/data-zoom/type.js +13 -0
- package/es/data-zoom/type.js.map +1 -1
- package/es/data-zoom/utils.d.ts +2 -0
- package/es/data-zoom/utils.js +12 -0
- package/es/data-zoom/utils.js.map +1 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/indicator/config.js +1 -2
- package/es/indicator/register.js +2 -1
- package/es/label/base.js +1 -1
- package/es/label/data-label-register.js +1 -1
- package/es/label/dataLabel.js +1 -1
- package/es/table-series-number/event-manager.js +7 -6
- package/es/table-series-number/event-manager.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,573 +1,141 @@
|
|
|
1
|
-
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
4
|
-
if (null != s && "function" == typeof Object.getOwnPropertySymbols) {
|
|
5
|
-
var i = 0;
|
|
6
|
-
for (p = Object.getOwnPropertySymbols(s); i < p.length; i++) e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]) && (t[p[i]] = s[p[i]]);
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
import { flatten_simplify, vglobal } from "@visactor/vrender-core";
|
|
12
|
-
|
|
13
|
-
import { Bounds, array, clamp, debounce, isFunction, isValid, merge, throttle } from "@visactor/vutils";
|
|
1
|
+
import { array, isFunction, isValid, merge } from "@visactor/vutils";
|
|
14
2
|
|
|
15
3
|
import { AbstractComponent } from "../core/base";
|
|
16
4
|
|
|
17
|
-
import {
|
|
5
|
+
import { IDataZoomEvent, IDataZoomInteractiveEvent } from "./type";
|
|
18
6
|
|
|
19
|
-
import {
|
|
7
|
+
import { DataZoomRenderer } from "./renderer";
|
|
20
8
|
|
|
21
|
-
import {
|
|
9
|
+
import { DataZoomInteraction } from "./interaction";
|
|
22
10
|
|
|
23
11
|
import { loadDataZoomComponent } from "./register";
|
|
24
12
|
|
|
25
|
-
import {
|
|
26
|
-
|
|
27
|
-
const delayMap = {
|
|
28
|
-
debounce: debounce,
|
|
29
|
-
throttle: throttle
|
|
30
|
-
};
|
|
13
|
+
import { DEFAULT_DATA_ZOOM_ATTRIBUTES } from "./config";
|
|
31
14
|
|
|
32
15
|
loadDataZoomComponent();
|
|
33
16
|
|
|
34
17
|
export class DataZoom extends AbstractComponent {
|
|
35
|
-
setPropsFromAttrs() {
|
|
36
|
-
const {start: start, end: end, orient: orient, previewData: previewData, previewPointsX: previewPointsX, previewPointsY: previewPointsY, previewPointsX1: previewPointsX1, previewPointsY1: previewPointsY1} = this.attribute;
|
|
37
|
-
start && (this.state.start = start), end && (this.state.end = end);
|
|
38
|
-
const {width: width, height: height} = this.getLayoutAttrFromConfig();
|
|
39
|
-
this._spanCache = this.state.end - this.state.start, this._isHorizontal = "top" === orient || "bottom" === orient,
|
|
40
|
-
this._layoutCache.max = this._isHorizontal ? width : height, this._layoutCache.attPos = this._isHorizontal ? "x" : "y",
|
|
41
|
-
this._layoutCache.attSize = this._isHorizontal ? "width" : "height", previewData && (this._previewData = previewData),
|
|
42
|
-
isFunction(previewPointsX) && (this._previewPointsX = previewPointsX), isFunction(previewPointsY) && (this._previewPointsY = previewPointsY),
|
|
43
|
-
isFunction(previewPointsX1) && (this._previewPointsX1 = previewPointsX1), isFunction(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
|
|
44
|
-
}
|
|
45
18
|
constructor(attributes, options) {
|
|
46
19
|
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, DataZoom.defaultAttributes, attributes)),
|
|
47
|
-
this.name = "dataZoom", this.
|
|
48
|
-
startPos: {
|
|
49
|
-
x: 0,
|
|
50
|
-
y: 0
|
|
51
|
-
},
|
|
52
|
-
lastPos: {
|
|
53
|
-
x: 0,
|
|
54
|
-
y: 0
|
|
55
|
-
}
|
|
56
|
-
}, this._layoutCache = {
|
|
57
|
-
attPos: "x",
|
|
58
|
-
attSize: "width",
|
|
59
|
-
max: 0
|
|
60
|
-
}, this.state = {
|
|
20
|
+
this.name = "dataZoom", this._state = {
|
|
61
21
|
start: 0,
|
|
62
22
|
end: 1
|
|
63
|
-
}, this.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
end: end,
|
|
92
|
-
tag: this._activeTag
|
|
93
|
-
}));
|
|
94
|
-
}, this._onHandlerPointerMove = 0 === this.attribute.delayTime ? this._pointerMove : delayMap[this.attribute.delayType](this._pointerMove, this.attribute.delayTime),
|
|
95
|
-
this._onHandlerPointerUp = e => {
|
|
96
|
-
const {start: start, end: end, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute;
|
|
97
|
-
if (this._activeState && this._activeTag === DataZoomActiveTag.background) {
|
|
98
|
-
const pos = this.eventPosToStagePos(e);
|
|
99
|
-
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
100
|
-
}
|
|
101
|
-
this._activeState = !1, brushSelect && this.renderDragMask(), this._dispatchEvent("change", {
|
|
102
|
-
start: this.state.start,
|
|
103
|
-
end: this.state.end,
|
|
104
|
-
tag: this._activeTag
|
|
105
|
-
}), this._clearDragEvents();
|
|
23
|
+
}, this.getLayoutAttrFromConfig = () => {
|
|
24
|
+
var _a, _b, _c, _d, _e, _f;
|
|
25
|
+
if (this._layoutCacheFromConfig) return this._layoutCacheFromConfig;
|
|
26
|
+
const {position: positionConfig, size: size, orient: orient, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, backgroundStyle: backgroundStyle = {}} = this.attribute, {width: widthConfig, height: heightConfig} = size, middleHandlerSize = null !== (_b = null === (_a = middleHandlerStyle.background) || void 0 === _a ? void 0 : _a.size) && void 0 !== _b ? _b : 10;
|
|
27
|
+
let width, height, position;
|
|
28
|
+
middleHandlerStyle.visible ? this._isHorizontal ? (width = widthConfig, height = heightConfig - middleHandlerSize,
|
|
29
|
+
position = {
|
|
30
|
+
x: positionConfig.x,
|
|
31
|
+
y: positionConfig.y + middleHandlerSize
|
|
32
|
+
}) : (width = widthConfig - middleHandlerSize, height = heightConfig, position = {
|
|
33
|
+
x: positionConfig.x + ("left" === orient ? middleHandlerSize : 0),
|
|
34
|
+
y: positionConfig.y
|
|
35
|
+
}) : (width = widthConfig, height = heightConfig, position = positionConfig);
|
|
36
|
+
const startHandlerSize = null !== (_c = startHandlerStyle.size) && void 0 !== _c ? _c : this._isHorizontal ? height : width, endHandlerSize = null !== (_d = endHandlerStyle.size) && void 0 !== _d ? _d : this._isHorizontal ? height : width;
|
|
37
|
+
return startHandlerStyle.visible && (this._isHorizontal ? (width -= (startHandlerSize + endHandlerSize) / 2,
|
|
38
|
+
position = {
|
|
39
|
+
x: position.x + startHandlerSize / 2,
|
|
40
|
+
y: position.y
|
|
41
|
+
}) : (height -= (startHandlerSize + endHandlerSize) / 2, position = {
|
|
42
|
+
x: position.x,
|
|
43
|
+
y: position.y + startHandlerSize / 2
|
|
44
|
+
})), height += (null !== (_e = backgroundStyle.lineWidth) && void 0 !== _e ? _e : 2) / 2,
|
|
45
|
+
width += (null !== (_f = backgroundStyle.lineWidth) && void 0 !== _f ? _f : 2) / 2,
|
|
46
|
+
this._layoutCacheFromConfig = {
|
|
47
|
+
position: position,
|
|
48
|
+
width: width,
|
|
49
|
+
height: height
|
|
50
|
+
}, this._layoutCacheFromConfig;
|
|
106
51
|
};
|
|
107
|
-
const {
|
|
108
|
-
this.
|
|
109
|
-
this.
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const selectedTag = brushSelect ? "background" : "middleRect";
|
|
122
|
-
this._selectedBackground && this._selectedBackground.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, selectedTag))),
|
|
123
|
-
brushSelect && this._background && this._background.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "background"))),
|
|
124
|
-
brushSelect && this._previewGroup && this._previewGroup.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, "background"))),
|
|
125
|
-
this._selectedPreviewGroup && this._selectedPreviewGroup.addEventListener("pointerdown", (e => this._onHandlerPointerDown(e, selectedTag))),
|
|
126
|
-
"auto" === showDetail && (this.addEventListener("pointerenter", this._onHandlerPointerEnter),
|
|
127
|
-
this.addEventListener("pointerleave", this._onHandlerPointerLeave)), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
|
|
128
|
-
passive: !1
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
dragMaskSize() {
|
|
132
|
-
const {position: position} = this.attribute, {attPos: attPos, max: max} = this._layoutCache;
|
|
133
|
-
return this._activeCache.lastPos[attPos] - position[attPos] > max ? max + position[attPos] - this._activeCache.startPos[attPos] : this._activeCache.lastPos[attPos] - position[attPos] < 0 ? position[attPos] - this._activeCache.startPos[attPos] : this._activeCache.lastPos[attPos] - this._activeCache.startPos[attPos];
|
|
134
|
-
}
|
|
135
|
-
setStateAttr(start, end, shouldRender) {
|
|
136
|
-
const {zoomLock: zoomLock = !1, minSpan: minSpan = 0, maxSpan: maxSpan = 1} = this.attribute, span = end - start;
|
|
137
|
-
span !== this._spanCache && (zoomLock || span < minSpan || span > maxSpan) || (this._spanCache = span,
|
|
138
|
-
this.state.start = start, this.state.end = end, shouldRender && this.setAttributes({
|
|
139
|
-
start: start,
|
|
140
|
-
end: end
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
_clearDragEvents() {
|
|
144
|
-
const evtTarget = "browser" === vglobal.env ? vglobal : this.stage, triggers = getEndTriggersOfDrag();
|
|
145
|
-
evtTarget.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
146
|
-
capture: !0
|
|
147
|
-
}), triggers.forEach((trigger => {
|
|
148
|
-
evtTarget.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
149
|
-
})), this.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
150
|
-
capture: !0
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
_onHandlerPointerEnter(e) {
|
|
154
|
-
this._showText = !0, this.renderText();
|
|
155
|
-
}
|
|
156
|
-
_onHandlerPointerLeave(e) {
|
|
157
|
-
this._showText = !1, this.renderText();
|
|
158
|
-
}
|
|
159
|
-
backgroundDragZoom(startPos, endPos) {
|
|
160
|
-
const {attPos: attPos, max: max} = this._layoutCache, {position: position} = this.attribute, startPosInComponent = startPos[attPos] - position[attPos], endPosInComponent = endPos[attPos] - position[attPos], start = Math.min(Math.max(Math.min(startPosInComponent, endPosInComponent) / max, 0), 1), end = Math.min(Math.max(Math.max(startPosInComponent, endPosInComponent) / max, 0), 1);
|
|
161
|
-
Math.abs(start - end) < .01 ? this.moveZoomWithMiddle(start) : this.setStateAttr(start, end, !1);
|
|
162
|
-
}
|
|
163
|
-
moveZoomWithMiddle(middle) {
|
|
164
|
-
let offset = middle - (this.state.start + this.state.end) / 2;
|
|
165
|
-
0 !== offset && (offset > 0 ? this.state.end + offset > 1 && (offset = 1 - this.state.end) : offset < 0 && this.state.start + offset < 0 && (offset = -this.state.start),
|
|
166
|
-
this.setStateAttr(this.state.start + offset, this.state.end + offset, !1));
|
|
167
|
-
}
|
|
168
|
-
renderDragMask() {
|
|
169
|
-
const {dragMaskStyle: dragMaskStyle} = this.attribute, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
|
|
170
|
-
this._isHorizontal ? this._dragMask = this._container.createOrUpdateChild("dragMask", Object.assign({
|
|
171
|
-
x: clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.x : this._activeCache.startPos.x, position.x, position.x + width),
|
|
172
|
-
y: position.y,
|
|
173
|
-
width: this._activeState && this._activeTag === DataZoomActiveTag.background && Math.abs(this.dragMaskSize()) || 0,
|
|
174
|
-
height: height
|
|
175
|
-
}, dragMaskStyle), "rect") : this._dragMask = this._container.createOrUpdateChild("dragMask", Object.assign({
|
|
176
|
-
x: position.x,
|
|
177
|
-
y: clamp(this.dragMaskSize() < 0 ? this._activeCache.lastPos.y : this._activeCache.startPos.y, position.y, position.y + height),
|
|
178
|
-
width: width,
|
|
179
|
-
height: this._activeState && this._activeTag === DataZoomActiveTag.background && Math.abs(this.dragMaskSize()) || 0
|
|
180
|
-
}, dragMaskStyle), "rect");
|
|
181
|
-
}
|
|
182
|
-
isTextOverflow(componentBoundsLike, textBounds, layout) {
|
|
183
|
-
if (!textBounds) return !1;
|
|
184
|
-
if (this._isHorizontal) {
|
|
185
|
-
if ("start" === layout) {
|
|
186
|
-
if (textBounds.x1 < componentBoundsLike.x1) return !0;
|
|
187
|
-
} else if (textBounds.x2 > componentBoundsLike.x2) return !0;
|
|
188
|
-
} else if ("start" === layout) {
|
|
189
|
-
if (textBounds.y1 < componentBoundsLike.y1) return !0;
|
|
190
|
-
} else if (textBounds.y2 > componentBoundsLike.y2) return !0;
|
|
191
|
-
return !1;
|
|
192
|
-
}
|
|
193
|
-
setTextAttr(startTextBounds, endTextBounds) {
|
|
194
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
195
|
-
const {startTextStyle: startTextStyle, endTextStyle: endTextStyle} = this.attribute, {formatMethod: startTextFormat} = startTextStyle, restStartTextStyle = __rest(startTextStyle, [ "formatMethod" ]), {formatMethod: endTextFormat} = endTextStyle, restEndTextStyle = __rest(endTextStyle, [ "formatMethod" ]), {start: start, end: end} = this.state;
|
|
196
|
-
this._startValue = this._statePointToData(start), this._endValue = this._statePointToData(end);
|
|
197
|
-
const {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), startTextValue = startTextFormat ? startTextFormat(this._startValue) : this._startValue, endTextValue = endTextFormat ? endTextFormat(this._endValue) : this._endValue, componentBoundsLike = {
|
|
198
|
-
x1: position.x,
|
|
199
|
-
y1: position.y,
|
|
200
|
-
x2: position.x + width,
|
|
201
|
-
y2: position.y + height
|
|
52
|
+
const {start: start, end: end, orient: orient} = this.attribute;
|
|
53
|
+
this._isHorizontal = "top" === orient || "bottom" === orient, start && (this._state.start = start),
|
|
54
|
+
end && (this._state.end = end), this._renderer = new DataZoomRenderer(this._getRendererAttrs()),
|
|
55
|
+
this._interaction = new DataZoomInteraction(this._getInteractionAttrs());
|
|
56
|
+
}
|
|
57
|
+
_getRendererAttrs() {
|
|
58
|
+
return {
|
|
59
|
+
attribute: this.attribute,
|
|
60
|
+
getLayoutAttrFromConfig: this.getLayoutAttrFromConfig,
|
|
61
|
+
setState: state => {
|
|
62
|
+
this._state = state;
|
|
63
|
+
},
|
|
64
|
+
getState: () => this._state,
|
|
65
|
+
getContainer: () => this._container
|
|
202
66
|
};
|
|
203
|
-
let startTextPosition, endTextPosition, startTextAlignStyle, endTextAlignStyle;
|
|
204
|
-
this._isHorizontal ? (startTextPosition = {
|
|
205
|
-
x: position.x + start * width,
|
|
206
|
-
y: position.y + height / 2
|
|
207
|
-
}, endTextPosition = {
|
|
208
|
-
x: position.x + end * width,
|
|
209
|
-
y: position.y + height / 2
|
|
210
|
-
}, startTextAlignStyle = {
|
|
211
|
-
textAlign: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "left" : "right",
|
|
212
|
-
textBaseline: null !== (_b = null === (_a = null == restStartTextStyle ? void 0 : restStartTextStyle.textStyle) || void 0 === _a ? void 0 : _a.textBaseline) && void 0 !== _b ? _b : "middle"
|
|
213
|
-
}, endTextAlignStyle = {
|
|
214
|
-
textAlign: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "right" : "left",
|
|
215
|
-
textBaseline: null !== (_d = null === (_c = null == restEndTextStyle ? void 0 : restEndTextStyle.textStyle) || void 0 === _c ? void 0 : _c.textBaseline) && void 0 !== _d ? _d : "middle"
|
|
216
|
-
}) : (startTextPosition = {
|
|
217
|
-
x: position.x + width / 2,
|
|
218
|
-
y: position.y + start * height
|
|
219
|
-
}, endTextPosition = {
|
|
220
|
-
x: position.x + width / 2,
|
|
221
|
-
y: position.y + end * height
|
|
222
|
-
}, startTextAlignStyle = {
|
|
223
|
-
textAlign: null !== (_f = null === (_e = null == restStartTextStyle ? void 0 : restStartTextStyle.textStyle) || void 0 === _e ? void 0 : _e.textAlign) && void 0 !== _f ? _f : "center",
|
|
224
|
-
textBaseline: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "top" : "bottom"
|
|
225
|
-
}, endTextAlignStyle = {
|
|
226
|
-
textAlign: null !== (_h = null === (_g = null == restEndTextStyle ? void 0 : restEndTextStyle.textStyle) || void 0 === _g ? void 0 : _g.textAlign) && void 0 !== _h ? _h : "center",
|
|
227
|
-
textBaseline: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "bottom" : "top"
|
|
228
|
-
}), this._startText = this.maybeAddLabel(this._container, merge({}, restStartTextStyle, {
|
|
229
|
-
text: startTextValue,
|
|
230
|
-
x: startTextPosition.x,
|
|
231
|
-
y: startTextPosition.y,
|
|
232
|
-
visible: this._showText,
|
|
233
|
-
pickable: !1,
|
|
234
|
-
childrenPickable: !1,
|
|
235
|
-
textStyle: startTextAlignStyle
|
|
236
|
-
}), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, merge({}, restEndTextStyle, {
|
|
237
|
-
text: endTextValue,
|
|
238
|
-
x: endTextPosition.x,
|
|
239
|
-
y: endTextPosition.y,
|
|
240
|
-
visible: this._showText,
|
|
241
|
-
pickable: !1,
|
|
242
|
-
childrenPickable: !1,
|
|
243
|
-
textStyle: endTextAlignStyle
|
|
244
|
-
}), `data-zoom-end-text-${position}`);
|
|
245
67
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
var _a, _b, _c, _d, _e, _f;
|
|
265
|
-
if (this._layoutAttrFromConfig) return this._layoutAttrFromConfig;
|
|
266
|
-
const {position: positionConfig, size: size, orient: orient, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, backgroundStyle: backgroundStyle = {}} = this.attribute, {width: widthConfig, height: heightConfig} = size, middleHandlerSize = null !== (_b = null === (_a = middleHandlerStyle.background) || void 0 === _a ? void 0 : _a.size) && void 0 !== _b ? _b : 10;
|
|
267
|
-
let width, height, position;
|
|
268
|
-
middleHandlerStyle.visible ? this._isHorizontal ? (width = widthConfig, height = heightConfig - middleHandlerSize,
|
|
269
|
-
position = {
|
|
270
|
-
x: positionConfig.x,
|
|
271
|
-
y: positionConfig.y + middleHandlerSize
|
|
272
|
-
}) : (width = widthConfig - middleHandlerSize, height = heightConfig, position = {
|
|
273
|
-
x: positionConfig.x + ("left" === orient ? middleHandlerSize : 0),
|
|
274
|
-
y: positionConfig.y
|
|
275
|
-
}) : (width = widthConfig, height = heightConfig, position = positionConfig);
|
|
276
|
-
const startHandlerSize = null !== (_c = startHandlerStyle.size) && void 0 !== _c ? _c : this._isHorizontal ? height : width, endHandlerSize = null !== (_d = endHandlerStyle.size) && void 0 !== _d ? _d : this._isHorizontal ? height : width;
|
|
277
|
-
return startHandlerStyle.visible && (this._isHorizontal ? (width -= (startHandlerSize + endHandlerSize) / 2,
|
|
278
|
-
position = {
|
|
279
|
-
x: position.x + startHandlerSize / 2,
|
|
280
|
-
y: position.y
|
|
281
|
-
}) : (height -= (startHandlerSize + endHandlerSize) / 2, position = {
|
|
282
|
-
x: position.x,
|
|
283
|
-
y: position.y + startHandlerSize / 2
|
|
284
|
-
})), height += null !== (_e = backgroundStyle.lineWidth / 2) && void 0 !== _e ? _e : 1,
|
|
285
|
-
width += null !== (_f = backgroundStyle.lineWidth / 2) && void 0 !== _f ? _f : 1,
|
|
286
|
-
this._layoutAttrFromConfig = {
|
|
287
|
-
position: position,
|
|
288
|
-
width: width,
|
|
289
|
-
height: height
|
|
290
|
-
}, this._layoutAttrFromConfig;
|
|
291
|
-
}
|
|
292
|
-
render() {
|
|
293
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
|
|
294
|
-
this._layoutAttrFromConfig = null;
|
|
295
|
-
const {orient: orient, backgroundStyle: backgroundStyle, backgroundChartStyle: backgroundChartStyle = {}, selectedBackgroundStyle: selectedBackgroundStyle = {}, selectedBackgroundChartStyle: selectedBackgroundChartStyle = {}, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, brushSelect: brushSelect, zoomLock: zoomLock} = this.attribute, {start: start, end: end} = this.state, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), startHandlerMinSize = null !== (_a = startHandlerStyle.triggerMinSize) && void 0 !== _a ? _a : 40, endHandlerMinSize = null !== (_b = endHandlerStyle.triggerMinSize) && void 0 !== _b ? _b : 40, group = this.createOrUpdateChild("dataZoom-container", {}, "group");
|
|
296
|
-
if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign(Object.assign({
|
|
297
|
-
x: position.x,
|
|
298
|
-
y: position.y,
|
|
299
|
-
width: width,
|
|
300
|
-
height: height,
|
|
301
|
-
cursor: brushSelect ? "crosshair" : "auto"
|
|
302
|
-
}, backgroundStyle), {
|
|
303
|
-
pickable: !zoomLock && (null === (_c = backgroundStyle.pickable) || void 0 === _c || _c)
|
|
304
|
-
}), "rect"), (null === (_d = backgroundChartStyle.line) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("line", group),
|
|
305
|
-
(null === (_e = backgroundChartStyle.area) || void 0 === _e ? void 0 : _e.visible) && this.setPreviewAttributes("area", group),
|
|
306
|
-
brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
307
|
-
x: position.x + start * width,
|
|
308
|
-
y: position.y,
|
|
309
|
-
width: (end - start) * width,
|
|
310
|
-
height: height,
|
|
311
|
-
cursor: brushSelect ? "crosshair" : "move"
|
|
312
|
-
}, selectedBackgroundStyle), {
|
|
313
|
-
pickable: !zoomLock && (null === (_f = selectedBackgroundChartStyle.pickable) || void 0 === _f || _f)
|
|
314
|
-
}), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
315
|
-
x: position.x,
|
|
316
|
-
y: position.y + start * height,
|
|
317
|
-
width: width,
|
|
318
|
-
height: (end - start) * height,
|
|
319
|
-
cursor: brushSelect ? "crosshair" : "move"
|
|
320
|
-
}, selectedBackgroundStyle), {
|
|
321
|
-
pickable: !zoomLock && (null === (_g = selectedBackgroundStyle.pickable) || void 0 === _g || _g)
|
|
322
|
-
}), "rect"), (null === (_h = selectedBackgroundChartStyle.line) || void 0 === _h ? void 0 : _h.visible) && this.setSelectedPreviewAttributes("line", group),
|
|
323
|
-
(null === (_j = selectedBackgroundChartStyle.area) || void 0 === _j ? void 0 : _j.visible) && this.setSelectedPreviewAttributes("area", group),
|
|
324
|
-
this._isHorizontal) {
|
|
325
|
-
if (middleHandlerStyle.visible) {
|
|
326
|
-
const middleHandlerBackgroundSize = (null === (_k = middleHandlerStyle.background) || void 0 === _k ? void 0 : _k.size) || 10;
|
|
327
|
-
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
|
|
328
|
-
x: position.x + start * width,
|
|
329
|
-
y: position.y - middleHandlerBackgroundSize,
|
|
330
|
-
width: (end - start) * width,
|
|
331
|
-
height: middleHandlerBackgroundSize
|
|
332
|
-
}, null === (_l = middleHandlerStyle.background) || void 0 === _l ? void 0 : _l.style), {
|
|
333
|
-
pickable: !zoomLock && (null === (_p = null === (_o = null === (_m = middleHandlerStyle.background) || void 0 === _m ? void 0 : _m.style) || void 0 === _o ? void 0 : _o.pickable) || void 0 === _p || _p)
|
|
334
|
-
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
335
|
-
x: position.x + (start + end) / 2 * width,
|
|
336
|
-
y: position.y - middleHandlerBackgroundSize / 2,
|
|
337
|
-
strokeBoundsBuffer: 0,
|
|
338
|
-
angle: 0,
|
|
339
|
-
symbolType: null !== (_r = null === (_q = middleHandlerStyle.icon) || void 0 === _q ? void 0 : _q.symbolType) && void 0 !== _r ? _r : "square"
|
|
340
|
-
}, middleHandlerStyle.icon), {
|
|
341
|
-
pickable: !zoomLock && (null === (_s = middleHandlerStyle.icon.pickable) || void 0 === _s || _s)
|
|
342
|
-
}), "symbol");
|
|
343
|
-
}
|
|
344
|
-
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
345
|
-
x: position.x + start * width,
|
|
346
|
-
y: position.y + height / 2,
|
|
347
|
-
size: height,
|
|
348
|
-
symbolType: null !== (_t = startHandlerStyle.symbolType) && void 0 !== _t ? _t : "square"
|
|
349
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
|
|
350
|
-
pickable: !zoomLock && (null === (_u = startHandlerStyle.pickable) || void 0 === _u || _u)
|
|
351
|
-
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
352
|
-
x: position.x + end * width,
|
|
353
|
-
y: position.y + height / 2,
|
|
354
|
-
size: height,
|
|
355
|
-
symbolType: null !== (_v = endHandlerStyle.symbolType) && void 0 !== _v ? _v : "square"
|
|
356
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
|
|
357
|
-
pickable: !zoomLock && (null === (_w = endHandlerStyle.pickable) || void 0 === _w || _w)
|
|
358
|
-
}), "symbol");
|
|
359
|
-
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize), startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize), endHandlerWidth = Math.max(this._endHandler.AABBBounds.width(), endHandlerMinSize), endHandlerHeight = Math.max(this._endHandler.AABBBounds.height(), endHandlerMinSize);
|
|
360
|
-
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
|
|
361
|
-
x: position.x + start * width - startHandlerWidth / 2,
|
|
362
|
-
y: position.y + height / 2 - startHandlerHeight / 2,
|
|
363
|
-
width: startHandlerWidth,
|
|
364
|
-
height: startHandlerHeight,
|
|
365
|
-
fill: "white",
|
|
366
|
-
fillOpacity: 0,
|
|
367
|
-
zIndex: 999
|
|
368
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
369
|
-
pickable: !zoomLock
|
|
370
|
-
}), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
|
|
371
|
-
x: position.x + end * width - endHandlerWidth / 2,
|
|
372
|
-
y: position.y + height / 2 - endHandlerHeight / 2,
|
|
373
|
-
width: endHandlerWidth,
|
|
374
|
-
height: endHandlerHeight,
|
|
375
|
-
fill: "white",
|
|
376
|
-
fillOpacity: 0,
|
|
377
|
-
zIndex: 999
|
|
378
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
379
|
-
pickable: !zoomLock
|
|
380
|
-
}), "rect");
|
|
381
|
-
} else {
|
|
382
|
-
if (middleHandlerStyle.visible) {
|
|
383
|
-
const middleHandlerBackgroundSize = (null === (_x = middleHandlerStyle.background) || void 0 === _x ? void 0 : _x.size) || 10;
|
|
384
|
-
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
|
|
385
|
-
x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
|
|
386
|
-
y: position.y + start * height,
|
|
387
|
-
width: middleHandlerBackgroundSize,
|
|
388
|
-
height: (end - start) * height
|
|
389
|
-
}, null === (_y = middleHandlerStyle.background) || void 0 === _y ? void 0 : _y.style), {
|
|
390
|
-
pickable: !zoomLock && (null === (_1 = null === (_0 = null === (_z = middleHandlerStyle.background) || void 0 === _z ? void 0 : _z.style) || void 0 === _0 ? void 0 : _0.pickable) || void 0 === _1 || _1)
|
|
391
|
-
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
392
|
-
x: "left" === orient ? position.x - middleHandlerBackgroundSize / 2 : position.x + width + middleHandlerBackgroundSize / 2,
|
|
393
|
-
y: position.y + (start + end) / 2 * height,
|
|
394
|
-
angle: Math.PI / 180 * 90,
|
|
395
|
-
symbolType: null !== (_3 = null === (_2 = middleHandlerStyle.icon) || void 0 === _2 ? void 0 : _2.symbolType) && void 0 !== _3 ? _3 : "square",
|
|
396
|
-
strokeBoundsBuffer: 0
|
|
397
|
-
}, middleHandlerStyle.icon), {
|
|
398
|
-
pickable: !zoomLock && (null === (_5 = null === (_4 = middleHandlerStyle.icon) || void 0 === _4 ? void 0 : _4.pickable) || void 0 === _5 || _5)
|
|
399
|
-
}), "symbol");
|
|
400
|
-
}
|
|
401
|
-
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
402
|
-
x: position.x + width / 2,
|
|
403
|
-
y: position.y + start * height,
|
|
404
|
-
size: width,
|
|
405
|
-
symbolType: null !== (_6 = startHandlerStyle.symbolType) && void 0 !== _6 ? _6 : "square"
|
|
406
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
|
|
407
|
-
pickable: !zoomLock && (null === (_7 = startHandlerStyle.pickable) || void 0 === _7 || _7)
|
|
408
|
-
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
409
|
-
x: position.x + width / 2,
|
|
410
|
-
y: position.y + end * height,
|
|
411
|
-
size: width,
|
|
412
|
-
symbolType: null !== (_8 = endHandlerStyle.symbolType) && void 0 !== _8 ? _8 : "square"
|
|
413
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
|
|
414
|
-
pickable: !zoomLock && (null === (_9 = endHandlerStyle.pickable) || void 0 === _9 || _9)
|
|
415
|
-
}), "symbol");
|
|
416
|
-
const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize), startHandlerHeight = Math.max(this._startHandler.AABBBounds.height(), startHandlerMinSize), endHandlerWidth = Math.max(this._endHandler.AABBBounds.width(), endHandlerMinSize), endHandlerHeight = Math.max(this._endHandler.AABBBounds.height(), endHandlerMinSize);
|
|
417
|
-
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
|
|
418
|
-
x: position.x + width / 2 + startHandlerWidth / 2,
|
|
419
|
-
y: position.y + start * height - startHandlerHeight / 2,
|
|
420
|
-
width: endHandlerHeight,
|
|
421
|
-
height: endHandlerWidth,
|
|
422
|
-
fill: "white",
|
|
423
|
-
fillOpacity: 0,
|
|
424
|
-
zIndex: 999
|
|
425
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical), {
|
|
426
|
-
pickable: !zoomLock
|
|
427
|
-
}), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
|
|
428
|
-
x: position.x + width / 2 + endHandlerWidth / 2,
|
|
429
|
-
y: position.y + end * height - endHandlerHeight / 2,
|
|
430
|
-
width: endHandlerHeight,
|
|
431
|
-
height: endHandlerWidth,
|
|
432
|
-
fill: "white",
|
|
433
|
-
fillOpacity: 0,
|
|
434
|
-
zIndex: 999
|
|
435
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical), {
|
|
436
|
-
pickable: !zoomLock
|
|
437
|
-
}), "rect");
|
|
438
|
-
}
|
|
439
|
-
this._showText && this.renderText();
|
|
440
|
-
}
|
|
441
|
-
computeBasePoints() {
|
|
442
|
-
const {orient: orient} = this.attribute, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
|
|
443
|
-
let basePointStart, basePointEnd;
|
|
444
|
-
return this._isHorizontal ? (basePointStart = [ {
|
|
445
|
-
x: position.x,
|
|
446
|
-
y: position.y + height
|
|
447
|
-
} ], basePointEnd = [ {
|
|
448
|
-
x: position.x + width,
|
|
449
|
-
y: position.y + height
|
|
450
|
-
} ]) : "left" === orient ? (basePointStart = [ {
|
|
451
|
-
x: position.x + width,
|
|
452
|
-
y: position.y
|
|
453
|
-
} ], basePointEnd = [ {
|
|
454
|
-
x: position.x + width,
|
|
455
|
-
y: position.y + height
|
|
456
|
-
} ]) : (basePointStart = [ {
|
|
457
|
-
x: position.x,
|
|
458
|
-
y: position.y + height
|
|
459
|
-
} ], basePointEnd = [ {
|
|
460
|
-
x: position.x,
|
|
461
|
-
y: position.y
|
|
462
|
-
} ]), {
|
|
463
|
-
basePointStart: basePointStart,
|
|
464
|
-
basePointEnd: basePointEnd
|
|
68
|
+
_getInteractionAttrs() {
|
|
69
|
+
return {
|
|
70
|
+
stage: this.stage,
|
|
71
|
+
attribute: this.attribute,
|
|
72
|
+
startHandlerMask: this._renderer.startHandlerMask,
|
|
73
|
+
endHandlerMask: this._renderer.endHandlerMask,
|
|
74
|
+
middleHandlerSymbol: this._renderer.middleHandlerSymbol,
|
|
75
|
+
middleHandlerRect: this._renderer.middleHandlerRect,
|
|
76
|
+
selectedBackground: this._renderer.selectedBackground,
|
|
77
|
+
background: this._renderer.background,
|
|
78
|
+
previewGroup: this._renderer.previewGroup,
|
|
79
|
+
selectedPreviewGroup: this._renderer.selectedPreviewGroup,
|
|
80
|
+
getLayoutAttrFromConfig: this.getLayoutAttrFromConfig,
|
|
81
|
+
setState: state => {
|
|
82
|
+
this._state = state;
|
|
83
|
+
},
|
|
84
|
+
getState: () => this._state,
|
|
85
|
+
getGlobalTransMatrix: () => this.globalTransMatrix
|
|
465
86
|
};
|
|
466
87
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
})))
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
}
|
|
485
|
-
getPreviewAreaPoints() {
|
|
486
|
-
let previewPoints = this._previewData.map((d => ({
|
|
487
|
-
x: this._previewPointsX && this._previewPointsX(d),
|
|
488
|
-
y: this._previewPointsY && this._previewPointsY(d),
|
|
489
|
-
x1: this._previewPointsX1 && this._previewPointsX1(d),
|
|
490
|
-
y1: this._previewPointsY1 && this._previewPointsY1(d)
|
|
491
|
-
})));
|
|
492
|
-
if (0 === previewPoints.length) return previewPoints;
|
|
493
|
-
previewPoints = this.simplifyPoints(previewPoints);
|
|
494
|
-
const {basePointStart: basePointStart, basePointEnd: basePointEnd} = this.computeBasePoints();
|
|
495
|
-
return basePointStart.concat(previewPoints).concat(basePointEnd);
|
|
88
|
+
bindEvents() {
|
|
89
|
+
this.attribute.disableTriggerEvent ? this.setAttribute("childrenPickable", !1) : (this._interaction.bindEvents(),
|
|
90
|
+
this._interaction.on(IDataZoomInteractiveEvent.stateUpdate, (({shouldRender: shouldRender}) => {
|
|
91
|
+
shouldRender && this._renderer.renderDataZoom(!0);
|
|
92
|
+
})), this._interaction.on(IDataZoomInteractiveEvent.dataZoomUpdate, (({start: start, end: end, tag: tag}) => {
|
|
93
|
+
this._dispatchEvent(IDataZoomEvent.dataZoomChange, {
|
|
94
|
+
start: start,
|
|
95
|
+
end: end,
|
|
96
|
+
tag: tag
|
|
97
|
+
});
|
|
98
|
+
})), this._interaction.on(IDataZoomInteractiveEvent.maskUpdate, (() => {
|
|
99
|
+
this._renderer.renderDragMask();
|
|
100
|
+
})), "auto" === this.attribute.showDetail && (this._container.addEventListener("pointerenter", (() => {
|
|
101
|
+
this._renderer.showText = !0, this._renderer.renderText();
|
|
102
|
+
})), this._container.addEventListener("pointerleave", (() => {
|
|
103
|
+
this._renderer.showText = !1, this._renderer.renderText();
|
|
104
|
+
}))));
|
|
496
105
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
curveType: "basis"
|
|
502
|
-
}, "area");
|
|
503
|
-
const {backgroundChartStyle: backgroundChartStyle = {}} = this.attribute;
|
|
504
|
-
"line" === type && this._previewLine.setAttributes(Object.assign({
|
|
505
|
-
points: this.getPreviewLinePoints(),
|
|
506
|
-
curveType: "basis",
|
|
507
|
-
pickable: !1
|
|
508
|
-
}, backgroundChartStyle.line)), "area" === type && this._previewArea.setAttributes(Object.assign({
|
|
509
|
-
points: this.getPreviewAreaPoints(),
|
|
510
|
-
curveType: "basis",
|
|
511
|
-
pickable: !1
|
|
512
|
-
}, backgroundChartStyle.area));
|
|
106
|
+
setAttributes(params, forceUpdateTag) {
|
|
107
|
+
const {start: start, end: end} = this.attribute;
|
|
108
|
+
start && (this._state.start = start), end && (this._state.end = end), this._renderer.setAttributes(this._getRendererAttrs()),
|
|
109
|
+
this._interaction.setAttributes(this._getInteractionAttrs()), super.setAttributes(params, forceUpdateTag);
|
|
513
110
|
}
|
|
514
|
-
|
|
515
|
-
this.
|
|
516
|
-
|
|
517
|
-
}, "group"), this._selectedPreviewGroup = this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup", {}, "group")),
|
|
518
|
-
"line" === type ? this._selectedPreviewLine = this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine", {}, "line") : this._selectedPreviewArea = this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea", {
|
|
519
|
-
curveType: "basis"
|
|
520
|
-
}, "area");
|
|
521
|
-
const {selectedBackgroundChartStyle: selectedBackgroundChartStyle = {}} = this.attribute, {start: start, end: end} = this.state, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
|
|
522
|
-
this._selectedPreviewGroupClip.setAttributes({
|
|
523
|
-
x: this._isHorizontal ? position.x + start * width : position.x,
|
|
524
|
-
y: this._isHorizontal ? position.y : position.y + start * height,
|
|
525
|
-
width: this._isHorizontal ? (end - start) * width : width,
|
|
526
|
-
height: this._isHorizontal ? height : (end - start) * height,
|
|
527
|
-
clip: !0,
|
|
528
|
-
pickable: !1
|
|
529
|
-
}), this._selectedPreviewGroup.setAttributes({
|
|
530
|
-
x: -(this._isHorizontal ? position.x + start * width : position.x),
|
|
531
|
-
y: -(this._isHorizontal ? position.y : position.y + start * height),
|
|
532
|
-
width: this._isHorizontal ? (end - start) * width : width,
|
|
533
|
-
height: this._isHorizontal ? height : (end - start) * height,
|
|
534
|
-
pickable: !1
|
|
535
|
-
}), "line" === type && this._selectedPreviewLine.setAttributes(Object.assign({
|
|
536
|
-
points: this.getPreviewLinePoints(),
|
|
537
|
-
curveType: "basis",
|
|
538
|
-
pickable: !1
|
|
539
|
-
}, selectedBackgroundChartStyle.line)), "area" === type && this._selectedPreviewArea.setAttributes(Object.assign({
|
|
540
|
-
points: this.getPreviewAreaPoints(),
|
|
541
|
-
curveType: "basis",
|
|
542
|
-
pickable: !1
|
|
543
|
-
}, selectedBackgroundChartStyle.area));
|
|
111
|
+
render() {
|
|
112
|
+
this._layoutCacheFromConfig = null, this._container = this.createOrUpdateChild("datazoom-container", {}, "group"),
|
|
113
|
+
this._renderer.renderDataZoom(), this._interaction.setAttributes(this._getInteractionAttrs());
|
|
544
114
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
return labelShape ? labelShape.setAttributes(attributes) : (labelShape = new Tag(attributes),
|
|
548
|
-
labelShape.name = name), container.add(labelShape), labelShape;
|
|
115
|
+
release(all) {
|
|
116
|
+
super.release(all), this._interaction.clearDragEvents();
|
|
549
117
|
}
|
|
550
118
|
setStartAndEnd(start, end) {
|
|
551
|
-
const {start:
|
|
552
|
-
isValid(start) && isValid(end) && (start !==
|
|
553
|
-
this.state.end = end, startAttr === this.state.start && endAttr === this.state.end || (this.setStateAttr(start, end, !0),
|
|
554
|
-
this._dispatchEvent("change", {
|
|
119
|
+
const {start: startState, end: endState} = this._state;
|
|
120
|
+
isValid(start) && isValid(end) && (start !== startState || end !== endState) && (this._state = {
|
|
555
121
|
start: start,
|
|
556
|
-
end: end
|
|
557
|
-
|
|
558
|
-
|
|
122
|
+
end: end
|
|
123
|
+
}, this._renderer.renderDataZoom(!0), this._dispatchEvent(IDataZoomEvent.dataZoomChange, {
|
|
124
|
+
start: start,
|
|
125
|
+
end: end
|
|
126
|
+
}));
|
|
559
127
|
}
|
|
560
128
|
setPreviewData(data) {
|
|
561
|
-
this.
|
|
129
|
+
this._renderer.previewData = data;
|
|
562
130
|
}
|
|
563
131
|
setText(text, tag) {
|
|
564
|
-
"start" === tag ? this.
|
|
132
|
+
"start" === tag ? this._renderer.startText.setAttribute("text", text) : this._renderer.endText.setAttribute("text", text);
|
|
565
133
|
}
|
|
566
134
|
getStartValue() {
|
|
567
|
-
return this.
|
|
135
|
+
return this._renderer.startValue;
|
|
568
136
|
}
|
|
569
137
|
getEndTextValue() {
|
|
570
|
-
return this.
|
|
138
|
+
return this._renderer.endValue;
|
|
571
139
|
}
|
|
572
140
|
getMiddleHandlerSize() {
|
|
573
141
|
var _a, _b, _c, _d;
|
|
@@ -575,24 +143,19 @@ export class DataZoom extends AbstractComponent {
|
|
|
575
143
|
return Math.max(middleHandlerRectSize, ...array(middleHandlerSymbolSize));
|
|
576
144
|
}
|
|
577
145
|
setPreviewPointsX(callback) {
|
|
578
|
-
isFunction(callback) && (this.
|
|
146
|
+
isFunction(callback) && (this._renderer.previewPointsX = callback);
|
|
579
147
|
}
|
|
580
148
|
setPreviewPointsY(callback) {
|
|
581
|
-
isFunction(callback) && (this.
|
|
149
|
+
isFunction(callback) && (this._renderer.previewPointsY = callback);
|
|
582
150
|
}
|
|
583
151
|
setPreviewPointsX1(callback) {
|
|
584
|
-
isFunction(callback) && (this.
|
|
152
|
+
isFunction(callback) && (this._renderer.previewPointsX1 = callback);
|
|
585
153
|
}
|
|
586
154
|
setPreviewPointsY1(callback) {
|
|
587
|
-
isFunction(callback) && (this.
|
|
155
|
+
isFunction(callback) && (this._renderer.previewPointsY1 = callback);
|
|
588
156
|
}
|
|
589
157
|
setStatePointToData(callback) {
|
|
590
|
-
isFunction(callback) && (this.
|
|
591
|
-
}
|
|
592
|
-
release(all) {
|
|
593
|
-
super.release(all), ("browser" === vglobal.env ? vglobal : this.stage).addEventListener("touchmove", this._handleTouchMove, {
|
|
594
|
-
passive: !1
|
|
595
|
-
}), this._clearDragEvents();
|
|
158
|
+
isFunction(callback) && (this._renderer.statePointToData = callback);
|
|
596
159
|
}
|
|
597
160
|
}
|
|
598
161
|
|