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