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