@visactor/vrender-components 0.17.11-alpha.3 → 0.17.11
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/data-zoom/data-zoom.d.ts +1 -5
- package/cjs/data-zoom/data-zoom.js +89 -141
- package/cjs/data-zoom/data-zoom.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/base.js +16 -5
- package/cjs/label/base.js.map +1 -1
- package/cjs/marker/area.js +1 -5
- package/cjs/marker/area.js.map +1 -1
- package/cjs/marker/base.d.ts +0 -1
- package/cjs/marker/base.js +3 -6
- package/cjs/marker/base.js.map +1 -1
- package/cjs/marker/line.js +1 -7
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.js +1 -2
- package/cjs/marker/point.js.map +1 -1
- package/es/data-zoom/data-zoom.d.ts +1 -5
- package/es/data-zoom/data-zoom.js +70 -127
- package/es/data-zoom/data-zoom.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/base.js +16 -5
- package/es/label/base.js.map +1 -1
- package/es/marker/area.js +2 -6
- package/es/marker/area.js.map +1 -1
- package/es/marker/base.d.ts +0 -1
- package/es/marker/base.js +3 -6
- package/es/marker/base.js.map +1 -1
- package/es/marker/line.js +2 -8
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.js +2 -3
- package/es/marker/point.js.map +1 -1
- package/package.json +5 -5
- package/dist/index.js +0 -30025
- package/dist/index.min.js +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { FederatedPointerEvent, IGroup } from '@visactor/vrender-core';
|
|
2
|
-
import type {
|
|
3
|
-
import { TextMeasure } from '@visactor/vutils';
|
|
2
|
+
import type { IPointLike } from '@visactor/vutils';
|
|
4
3
|
import { AbstractComponent } from '../core/base';
|
|
5
4
|
import type { TagAttributes } from '../tag';
|
|
6
5
|
import { Tag } from '../tag';
|
|
@@ -155,9 +154,7 @@ export declare class DataZoom extends AbstractComponent<Required<DataZoomAttribu
|
|
|
155
154
|
private _previewPointsY1;
|
|
156
155
|
private _statePointToData;
|
|
157
156
|
private _layoutAttrFromConfig;
|
|
158
|
-
setPropsFromAttrs(): void;
|
|
159
157
|
constructor(attributes: DataZoomAttributes, options?: ComponentOptions);
|
|
160
|
-
setAttributes(params: Partial<Required<DataZoomAttributes>>, forceUpdateTag?: boolean): void;
|
|
161
158
|
protected bindEvents(): void;
|
|
162
159
|
protected dragMaskSize(): number;
|
|
163
160
|
protected setStateAttr(start: number, end: number, shouldRender: boolean): void;
|
|
@@ -173,7 +170,6 @@ export declare class DataZoom extends AbstractComponent<Required<DataZoomAttribu
|
|
|
173
170
|
protected backgroundDragZoom(startPos: IPointLike, endPos: IPointLike): void;
|
|
174
171
|
protected moveZoomWithMiddle(middle: number): void;
|
|
175
172
|
protected renderDragMask(): void;
|
|
176
|
-
protected isTextOverflow(componentBoundsLike: IBoundsLike, textPosition: IPointLike, textMeasure: TextMeasure<ITextMeasureSpec>, textValue: string | number | (string | number)[], layout: 'start' | 'end'): boolean;
|
|
177
173
|
protected renderText(): void;
|
|
178
174
|
protected getLayoutAttrFromConfig(): any;
|
|
179
175
|
protected render(): void;
|
|
@@ -14,28 +14,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
14
14
|
value: !0
|
|
15
15
|
}), exports.DataZoom = void 0;
|
|
16
16
|
|
|
17
|
-
const vrender_core_1 = require("@visactor/vrender-core"), vutils_1 = require("@visactor/vutils"),
|
|
18
|
-
debounce:
|
|
19
|
-
throttle:
|
|
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"), delayMap = {
|
|
18
|
+
debounce: vutils_1.debounce,
|
|
19
|
+
throttle: vutils_1.throttle
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
(0, register_1.loadDataZoomComponent)();
|
|
23
23
|
|
|
24
24
|
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_2.isFunction)(previewPointsX) && (this._previewPointsX = previewPointsX),
|
|
33
|
-
(0, vutils_2.isFunction)(previewPointsY) && (this._previewPointsY = previewPointsY),
|
|
34
|
-
(0, vutils_2.isFunction)(previewPointsX1) && (this._previewPointsX1 = previewPointsX1),
|
|
35
|
-
(0, vutils_2.isFunction)(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
|
|
36
|
-
}
|
|
37
25
|
constructor(attributes, options) {
|
|
38
|
-
super((null == options ? void 0 : options.skipDefault) ? attributes : (0,
|
|
26
|
+
super((null == options ? void 0 : options.skipDefault) ? attributes : (0, vutils_1.merge)({}, DataZoom.defaultAttributes, attributes)),
|
|
39
27
|
this.name = "dataZoom", this._previewData = [], this._activeState = !1, this._activeCache = {
|
|
40
28
|
startPos: {
|
|
41
29
|
x: 0,
|
|
@@ -80,12 +68,15 @@ class DataZoom extends base_1.AbstractComponent {
|
|
|
80
68
|
tag: this._activeTag
|
|
81
69
|
}));
|
|
82
70
|
}), this.attribute.delayTime);
|
|
83
|
-
const {position: position,
|
|
71
|
+
const {start: start, end: end, size: size, orient: orient, showDetail: showDetail, position: position, previewData: previewData, previewPointsX: previewPointsX, previewPointsY: previewPointsY, previewPointsX1: previewPointsX1, previewPointsY1: previewPointsY1, updateStateCallback: updateStateCallback} = this.attribute, {width: width, height: height} = size;
|
|
72
|
+
start && (this.state.start = start), end && (this.state.end = end), this._spanCache = this.state.end - this.state.start,
|
|
73
|
+
this._isHorizontal = "top" === orient || "bottom" === orient, this._layoutCache.max = this._isHorizontal ? width : height,
|
|
74
|
+
this._layoutCache.attPos = this._isHorizontal ? "x" : "y", this._layoutCache.attSize = this._isHorizontal ? "width" : "height",
|
|
84
75
|
this._activeCache.startPos = position, this._activeCache.lastPos = position, this._showText = "auto" !== showDetail && showDetail,
|
|
85
|
-
this.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
76
|
+
previewData && (this._previewData = previewData), (0, vutils_1.isFunction)(previewPointsX) && (this._previewPointsX = previewPointsX),
|
|
77
|
+
(0, vutils_1.isFunction)(previewPointsY) && (this._previewPointsY = previewPointsY),
|
|
78
|
+
(0, vutils_1.isFunction)(previewPointsX1) && (this._previewPointsX1 = previewPointsX1),
|
|
79
|
+
(0, vutils_1.isFunction)(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
|
|
89
80
|
}
|
|
90
81
|
bindEvents() {
|
|
91
82
|
if (this.attribute.disableTriggerEvent) return;
|
|
@@ -160,86 +151,70 @@ class DataZoom extends base_1.AbstractComponent {
|
|
|
160
151
|
renderDragMask() {
|
|
161
152
|
const {dragMaskStyle: dragMaskStyle} = this.attribute, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
|
|
162
153
|
this._isHorizontal ? this._dragMask = this._container.createOrUpdateChild("dragMask", Object.assign({
|
|
163
|
-
x: (0,
|
|
154
|
+
x: (0, vutils_1.clamp)(this.dragMaskSize() < 0 ? this._activeCache.lastPos.x : this._activeCache.startPos.x, position.x, position.x + width),
|
|
164
155
|
y: position.y,
|
|
165
156
|
width: this._activeState && this._activeTag === type_1.DataZoomActiveTag.background && Math.abs(this.dragMaskSize()) || 0,
|
|
166
157
|
height: height
|
|
167
158
|
}, dragMaskStyle), "rect") : this._dragMask = this._container.createOrUpdateChild("dragMask", Object.assign({
|
|
168
159
|
x: position.x,
|
|
169
|
-
y: (0,
|
|
160
|
+
y: (0, vutils_1.clamp)(this.dragMaskSize() < 0 ? this._activeCache.lastPos.y : this._activeCache.startPos.y, position.y, position.y + height),
|
|
170
161
|
width: width,
|
|
171
162
|
height: this._activeState && this._activeTag === type_1.DataZoomActiveTag.background && Math.abs(this.dragMaskSize()) || 0
|
|
172
163
|
}, dragMaskStyle), "rect");
|
|
173
164
|
}
|
|
174
|
-
isTextOverflow(componentBoundsLike, textPosition, textMeasure, textValue, layout) {
|
|
175
|
-
const {width: textWidth, height: textHeight} = textMeasure.fullMeasure(textValue);
|
|
176
|
-
if (this._isHorizontal) if ("start" === layout) {
|
|
177
|
-
if (textPosition.x - textWidth < componentBoundsLike.x1) return !0;
|
|
178
|
-
} else {
|
|
179
|
-
if (textPosition.x + textWidth > componentBoundsLike.x2) return !0;
|
|
180
|
-
} else if ("start" === layout) {
|
|
181
|
-
if (textPosition.y - textHeight < componentBoundsLike.y1) return !0;
|
|
182
|
-
} else {
|
|
183
|
-
if (textPosition.y + textHeight > componentBoundsLike.y2) return !0;
|
|
184
|
-
}
|
|
185
|
-
return !1;
|
|
186
|
-
}
|
|
187
165
|
renderText() {
|
|
188
|
-
const {startTextStyle: startTextStyle, endTextStyle: endTextStyle} = this.attribute, {formatMethod: startTextFormat} = startTextStyle,
|
|
166
|
+
const {startTextStyle: startTextStyle, endTextStyle: endTextStyle} = this.attribute, {formatMethod: startTextFormat} = startTextStyle, restStartStyle = __rest(startTextStyle, [ "formatMethod" ]), {formatMethod: endTextFormat} = endTextStyle, restEndTextStyle = __rest(endTextStyle, [ "formatMethod" ]), {start: start, end: end} = this.state;
|
|
189
167
|
this._startValue = this._statePointToData(start), this._endValue = this._statePointToData(end);
|
|
190
|
-
const {position: position, width: width, height: height} = this.getLayoutAttrFromConfig()
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
}), componentBoundsLike = {
|
|
195
|
-
x1: position.x,
|
|
196
|
-
y1: position.y,
|
|
197
|
-
x2: position.x + width,
|
|
198
|
-
y2: position.y + height
|
|
199
|
-
};
|
|
200
|
-
let startTextPosition, endTextPosition, startTextAlignStyle, endTextAlignStyle;
|
|
201
|
-
this._isHorizontal ? (startTextPosition = {
|
|
168
|
+
const {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
|
|
169
|
+
this._isHorizontal ? (this._startText = this.maybeAddLabel(this._container, (0,
|
|
170
|
+
vutils_1.merge)({}, restStartStyle, {
|
|
171
|
+
text: startTextFormat ? startTextFormat(this._startValue) : this._startValue,
|
|
202
172
|
x: position.x + start * width,
|
|
203
|
-
y: position.y + height / 2
|
|
204
|
-
|
|
173
|
+
y: position.y + height / 2,
|
|
174
|
+
visible: this._showText,
|
|
175
|
+
pickable: !1,
|
|
176
|
+
childrenPickable: !1,
|
|
177
|
+
textStyle: {
|
|
178
|
+
textAlign: "right",
|
|
179
|
+
textBaseline: "middle"
|
|
180
|
+
}
|
|
181
|
+
}), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, (0,
|
|
182
|
+
vutils_1.merge)({}, restEndTextStyle, {
|
|
183
|
+
text: endTextFormat ? endTextFormat(this._endValue) : this._endValue,
|
|
205
184
|
x: position.x + end * width,
|
|
206
|
-
y: position.y + height / 2
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
185
|
+
y: position.y + height / 2,
|
|
186
|
+
visible: this._showText,
|
|
187
|
+
pickable: !1,
|
|
188
|
+
childrenPickable: !1,
|
|
189
|
+
textStyle: {
|
|
190
|
+
textAlign: "left",
|
|
191
|
+
textBaseline: "middle"
|
|
192
|
+
}
|
|
193
|
+
}), `data-zoom-end-text-${position}`)) : (this._startText = this.maybeAddLabel(this._container, (0,
|
|
194
|
+
vutils_1.merge)({}, restStartStyle, {
|
|
195
|
+
text: startTextFormat ? startTextFormat(this._startValue) : this._startValue,
|
|
217
196
|
x: position.x + width / 2,
|
|
218
|
-
y: position.y +
|
|
219
|
-
}, startTextAlignStyle = {
|
|
220
|
-
textAlign: "center",
|
|
221
|
-
textBaseline: this.isTextOverflow(componentBoundsLike, startTextPosition, startTextMeasure, startTextValue, "start") ? "top" : "bottom"
|
|
222
|
-
}, endTextAlignStyle = {
|
|
223
|
-
textAlign: "center",
|
|
224
|
-
textBaseline: this.isTextOverflow(componentBoundsLike, endTextPosition, endTextMeasure, endTextValue, "end") ? "bottom" : "top"
|
|
225
|
-
}), this._startText = this.maybeAddLabel(this._container, (0, vutils_2.merge)({}, restStartTextStyle, {
|
|
226
|
-
text: startTextValue,
|
|
227
|
-
x: startTextPosition.x,
|
|
228
|
-
y: startTextPosition.y,
|
|
197
|
+
y: position.y + start * height,
|
|
229
198
|
visible: this._showText,
|
|
230
199
|
pickable: !1,
|
|
231
200
|
childrenPickable: !1,
|
|
232
|
-
textStyle:
|
|
201
|
+
textStyle: {
|
|
202
|
+
textAlign: "center",
|
|
203
|
+
textBaseline: "bottom"
|
|
204
|
+
}
|
|
233
205
|
}), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, (0,
|
|
234
|
-
|
|
235
|
-
text:
|
|
236
|
-
x:
|
|
237
|
-
y:
|
|
206
|
+
vutils_1.merge)({}, restEndTextStyle, {
|
|
207
|
+
text: endTextFormat ? endTextFormat(this._endValue) : this._endValue,
|
|
208
|
+
x: position.x + width / 2,
|
|
209
|
+
y: position.y + end * height,
|
|
238
210
|
visible: this._showText,
|
|
239
211
|
pickable: !1,
|
|
240
212
|
childrenPickable: !1,
|
|
241
|
-
textStyle:
|
|
242
|
-
|
|
213
|
+
textStyle: {
|
|
214
|
+
textAlign: "center",
|
|
215
|
+
textBaseline: "top"
|
|
216
|
+
}
|
|
217
|
+
}), `data-zoom-end-text-${position}`));
|
|
243
218
|
}
|
|
244
219
|
getLayoutAttrFromConfig() {
|
|
245
220
|
var _a, _b, _c, _d;
|
|
@@ -271,72 +246,60 @@ class DataZoom extends base_1.AbstractComponent {
|
|
|
271
246
|
render() {
|
|
272
247
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
273
248
|
this._layoutAttrFromConfig = null;
|
|
274
|
-
const {orient: orient, backgroundStyle: backgroundStyle, backgroundChartStyle: backgroundChartStyle = {}, selectedBackgroundStyle: selectedBackgroundStyle = {}, selectedBackgroundChartStyle: selectedBackgroundChartStyle = {}, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, brushSelect: brushSelect
|
|
275
|
-
if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign(
|
|
249
|
+
const {orient: orient, backgroundStyle: backgroundStyle, backgroundChartStyle: backgroundChartStyle = {}, selectedBackgroundStyle: selectedBackgroundStyle = {}, selectedBackgroundChartStyle: selectedBackgroundChartStyle = {}, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}, brushSelect: brushSelect} = 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");
|
|
250
|
+
if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign({
|
|
276
251
|
x: position.x,
|
|
277
252
|
y: position.y,
|
|
278
253
|
width: width,
|
|
279
254
|
height: height,
|
|
280
255
|
cursor: brushSelect ? "crosshair" : "auto"
|
|
281
|
-
}, backgroundStyle),
|
|
282
|
-
pickable: !zoomLock
|
|
283
|
-
}), "rect"), (null === (_c = backgroundChartStyle.line) || void 0 === _c ? void 0 : _c.visible) && this.setPreviewAttributes("line", group),
|
|
256
|
+
}, backgroundStyle), "rect"), (null === (_c = backgroundChartStyle.line) || void 0 === _c ? void 0 : _c.visible) && this.setPreviewAttributes("line", group),
|
|
284
257
|
(null === (_d = backgroundChartStyle.area) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("area", group),
|
|
285
|
-
brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(
|
|
258
|
+
brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign({
|
|
286
259
|
x: position.x + start * width,
|
|
287
260
|
y: position.y,
|
|
288
261
|
width: (end - start) * width,
|
|
289
262
|
height: height,
|
|
290
263
|
cursor: brushSelect ? "crosshair" : "move"
|
|
291
|
-
}, selectedBackgroundStyle), {
|
|
292
|
-
pickable: !zoomLock
|
|
293
|
-
}), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
264
|
+
}, selectedBackgroundStyle), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign({
|
|
294
265
|
x: position.x,
|
|
295
266
|
y: position.y + start * height,
|
|
296
267
|
width: width,
|
|
297
268
|
height: (end - start) * height,
|
|
298
269
|
cursor: brushSelect ? "crosshair" : "move"
|
|
299
|
-
}, selectedBackgroundStyle),
|
|
300
|
-
pickable: !zoomLock
|
|
301
|
-
}), "rect"), (null === (_e = selectedBackgroundChartStyle.line) || void 0 === _e ? void 0 : _e.visible) && this.setSelectedPreviewAttributes("line", group),
|
|
270
|
+
}, selectedBackgroundStyle), "rect"), (null === (_e = selectedBackgroundChartStyle.line) || void 0 === _e ? void 0 : _e.visible) && this.setSelectedPreviewAttributes("line", group),
|
|
302
271
|
(null === (_f = selectedBackgroundChartStyle.area) || void 0 === _f ? void 0 : _f.visible) && this.setSelectedPreviewAttributes("area", group),
|
|
303
272
|
this._showText && this.renderText(), this._isHorizontal) {
|
|
304
273
|
if (middleHandlerStyle.visible) {
|
|
305
274
|
const middleHandlerBackgroundSize = (null === (_g = middleHandlerStyle.background) || void 0 === _g ? void 0 : _g.size) || 10;
|
|
306
|
-
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(
|
|
275
|
+
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
|
|
307
276
|
x: position.x + start * width,
|
|
308
277
|
y: position.y - middleHandlerBackgroundSize,
|
|
309
278
|
width: (end - start) * width,
|
|
310
279
|
height: middleHandlerBackgroundSize
|
|
311
|
-
}, null === (_h = middleHandlerStyle.background) || void 0 === _h ? void 0 : _h.style),
|
|
312
|
-
|
|
313
|
-
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
280
|
+
}, null === (_h = middleHandlerStyle.background) || void 0 === _h ? void 0 : _h.style), "rect"),
|
|
281
|
+
this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign({
|
|
314
282
|
x: position.x + (start + end) / 2 * width,
|
|
315
283
|
y: position.y - middleHandlerBackgroundSize / 2,
|
|
316
284
|
strokeBoundsBuffer: 0,
|
|
317
285
|
angle: 0,
|
|
318
286
|
symbolType: null !== (_k = null === (_j = middleHandlerStyle.icon) || void 0 === _j ? void 0 : _j.symbolType) && void 0 !== _k ? _k : "square"
|
|
319
|
-
}, middleHandlerStyle.icon),
|
|
320
|
-
pickable: !zoomLock
|
|
321
|
-
}), "symbol");
|
|
287
|
+
}, middleHandlerStyle.icon), "symbol");
|
|
322
288
|
}
|
|
323
|
-
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(
|
|
289
|
+
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign({
|
|
324
290
|
x: position.x + start * width,
|
|
325
291
|
y: position.y + height / 2,
|
|
326
292
|
size: height,
|
|
327
293
|
symbolType: null !== (_l = startHandlerStyle.symbolType) && void 0 !== _l ? _l : "square"
|
|
328
|
-
}, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle),
|
|
329
|
-
|
|
330
|
-
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
294
|
+
}, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), "symbol"),
|
|
295
|
+
this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign({
|
|
331
296
|
x: position.x + end * width,
|
|
332
297
|
y: position.y + height / 2,
|
|
333
298
|
size: height,
|
|
334
299
|
symbolType: null !== (_m = endHandlerStyle.symbolType) && void 0 !== _m ? _m : "square"
|
|
335
|
-
}, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle),
|
|
336
|
-
pickable: !zoomLock
|
|
337
|
-
}), "symbol");
|
|
300
|
+
}, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), "symbol");
|
|
338
301
|
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);
|
|
339
|
-
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(
|
|
302
|
+
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign({
|
|
340
303
|
x: position.x + start * width - startHandlerWidth / 2,
|
|
341
304
|
y: position.y + height / 2 - startHandlerHeight / 2,
|
|
342
305
|
width: startHandlerWidth,
|
|
@@ -344,9 +307,7 @@ class DataZoom extends base_1.AbstractComponent {
|
|
|
344
307
|
fill: "white",
|
|
345
308
|
fillOpacity: 0,
|
|
346
309
|
zIndex: 999
|
|
347
|
-
}, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
348
|
-
pickable: !zoomLock
|
|
349
|
-
}), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
|
|
310
|
+
}, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign({
|
|
350
311
|
x: position.x + end * width - endHandlerWidth / 2,
|
|
351
312
|
y: position.y + height / 2 - endHandlerHeight / 2,
|
|
352
313
|
width: endHandlerWidth,
|
|
@@ -354,46 +315,37 @@ class DataZoom extends base_1.AbstractComponent {
|
|
|
354
315
|
fill: "white",
|
|
355
316
|
fillOpacity: 0,
|
|
356
317
|
zIndex: 999
|
|
357
|
-
}, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal),
|
|
358
|
-
pickable: !zoomLock
|
|
359
|
-
}), "rect");
|
|
318
|
+
}, config_1.DEFAULT_HANDLER_ATTR_MAP.horizontal), "rect");
|
|
360
319
|
} else {
|
|
361
320
|
if (middleHandlerStyle.visible) {
|
|
362
321
|
const middleHandlerBackgroundSize = (null === (_o = middleHandlerStyle.background) || void 0 === _o ? void 0 : _o.size) || 10;
|
|
363
|
-
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(
|
|
322
|
+
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
|
|
364
323
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
|
|
365
324
|
y: position.y + start * height,
|
|
366
325
|
width: middleHandlerBackgroundSize,
|
|
367
326
|
height: (end - start) * height
|
|
368
|
-
}, null === (_p = middleHandlerStyle.background) || void 0 === _p ? void 0 : _p.style),
|
|
369
|
-
|
|
370
|
-
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
327
|
+
}, null === (_p = middleHandlerStyle.background) || void 0 === _p ? void 0 : _p.style), "rect"),
|
|
328
|
+
this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign({
|
|
371
329
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize / 2 : position.x + width + middleHandlerBackgroundSize / 2,
|
|
372
330
|
y: position.y + (start + end) / 2 * height,
|
|
373
331
|
angle: Math.PI / 180 * 90,
|
|
374
332
|
symbolType: null !== (_r = null === (_q = middleHandlerStyle.icon) || void 0 === _q ? void 0 : _q.symbolType) && void 0 !== _r ? _r : "square",
|
|
375
333
|
strokeBoundsBuffer: 0
|
|
376
|
-
}, middleHandlerStyle.icon),
|
|
377
|
-
pickable: !zoomLock
|
|
378
|
-
}), "symbol");
|
|
334
|
+
}, middleHandlerStyle.icon), "symbol");
|
|
379
335
|
}
|
|
380
|
-
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(
|
|
336
|
+
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign({
|
|
381
337
|
x: position.x + width / 2,
|
|
382
338
|
y: position.y + start * height,
|
|
383
339
|
size: width,
|
|
384
340
|
symbolType: null !== (_s = startHandlerStyle.symbolType) && void 0 !== _s ? _s : "square"
|
|
385
|
-
}, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
|
|
386
|
-
pickable: !zoomLock
|
|
387
|
-
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
341
|
+
}, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign({
|
|
388
342
|
x: position.x + width / 2,
|
|
389
343
|
y: position.y + end * height,
|
|
390
344
|
size: width,
|
|
391
345
|
symbolType: null !== (_t = endHandlerStyle.symbolType) && void 0 !== _t ? _t : "square"
|
|
392
|
-
}, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle),
|
|
393
|
-
pickable: !zoomLock
|
|
394
|
-
}), "symbol");
|
|
346
|
+
}, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), "symbol");
|
|
395
347
|
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);
|
|
396
|
-
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(
|
|
348
|
+
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign({
|
|
397
349
|
x: position.x + width / 2 + startHandlerWidth / 2,
|
|
398
350
|
y: position.y + start * height - startHandlerHeight / 2,
|
|
399
351
|
width: endHandlerHeight,
|
|
@@ -401,9 +353,7 @@ class DataZoom extends base_1.AbstractComponent {
|
|
|
401
353
|
fill: "white",
|
|
402
354
|
fillOpacity: 0,
|
|
403
355
|
zIndex: 999
|
|
404
|
-
}, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), {
|
|
405
|
-
pickable: !zoomLock
|
|
406
|
-
}), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
|
|
356
|
+
}, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign({
|
|
407
357
|
x: position.x + width / 2 + endHandlerWidth / 2,
|
|
408
358
|
y: position.y + end * height - endHandlerHeight / 2,
|
|
409
359
|
width: endHandlerHeight,
|
|
@@ -411,9 +361,7 @@ class DataZoom extends base_1.AbstractComponent {
|
|
|
411
361
|
fill: "white",
|
|
412
362
|
fillOpacity: 0,
|
|
413
363
|
zIndex: 999
|
|
414
|
-
}, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical),
|
|
415
|
-
pickable: !zoomLock
|
|
416
|
-
}), "rect");
|
|
364
|
+
}, config_1.DEFAULT_HANDLER_ATTR_MAP.vertical), "rect");
|
|
417
365
|
}
|
|
418
366
|
}
|
|
419
367
|
computeBasePoints() {
|
|
@@ -517,7 +465,7 @@ class DataZoom extends base_1.AbstractComponent {
|
|
|
517
465
|
}
|
|
518
466
|
setStartAndEnd(start, end) {
|
|
519
467
|
const {start: startAttr, end: endAttr} = this.attribute;
|
|
520
|
-
(0,
|
|
468
|
+
(0, vutils_1.isValid)(start) && (0, vutils_1.isValid)(end) && (start !== this.state.start || end !== this.state.end) && (this.state.start = start,
|
|
521
469
|
this.state.end = end, startAttr === this.state.start && endAttr === this.state.end || (this.setStateAttr(start, end, !0),
|
|
522
470
|
this._dispatchEvent("change", {
|
|
523
471
|
start: start,
|
|
@@ -540,22 +488,22 @@ class DataZoom extends base_1.AbstractComponent {
|
|
|
540
488
|
getMiddleHandlerSize() {
|
|
541
489
|
var _a, _b, _c, _d;
|
|
542
490
|
const {middleHandlerStyle: middleHandlerStyle = {}} = this.attribute, middleHandlerRectSize = null !== (_b = null === (_a = middleHandlerStyle.background) || void 0 === _a ? void 0 : _a.size) && void 0 !== _b ? _b : 10, middleHandlerSymbolSize = null !== (_d = null === (_c = middleHandlerStyle.icon) || void 0 === _c ? void 0 : _c.size) && void 0 !== _d ? _d : 10;
|
|
543
|
-
return Math.max(middleHandlerRectSize, ...(0,
|
|
491
|
+
return Math.max(middleHandlerRectSize, ...(0, vutils_1.array)(middleHandlerSymbolSize));
|
|
544
492
|
}
|
|
545
493
|
setPreviewPointsX(callback) {
|
|
546
|
-
(0,
|
|
494
|
+
(0, vutils_1.isFunction)(callback) && (this._previewPointsX = callback);
|
|
547
495
|
}
|
|
548
496
|
setPreviewPointsY(callback) {
|
|
549
|
-
(0,
|
|
497
|
+
(0, vutils_1.isFunction)(callback) && (this._previewPointsY = callback);
|
|
550
498
|
}
|
|
551
499
|
setPreviewPointsX1(callback) {
|
|
552
|
-
(0,
|
|
500
|
+
(0, vutils_1.isFunction)(callback) && (this._previewPointsX1 = callback);
|
|
553
501
|
}
|
|
554
502
|
setPreviewPointsY1(callback) {
|
|
555
|
-
(0,
|
|
503
|
+
(0, vutils_1.isFunction)(callback) && (this._previewPointsY1 = callback);
|
|
556
504
|
}
|
|
557
505
|
setStatePointToData(callback) {
|
|
558
|
-
(0,
|
|
506
|
+
(0, vutils_1.isFunction)(callback) && (this._statePointToData = callback);
|
|
559
507
|
}
|
|
560
508
|
}
|
|
561
509
|
|