@visactor/vrender-components 0.18.0-alpha.0 → 0.18.0-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/base.js +24 -24
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/grid/base.js +1 -1
- package/cjs/axis/grid/base.js.map +1 -1
- package/cjs/axis/line.js +59 -52
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/overlap/auto-hide.d.ts +1 -0
- package/cjs/axis/overlap/auto-hide.js +10 -2
- package/cjs/axis/overlap/auto-hide.js.map +1 -1
- package/cjs/axis/overlap/auto-limit.d.ts +1 -0
- package/cjs/axis/overlap/auto-limit.js +5 -3
- package/cjs/axis/overlap/auto-limit.js.map +1 -1
- package/cjs/axis/type.d.ts +1 -0
- package/cjs/axis/type.js.map +1 -1
- package/cjs/brush/brush.js +4 -4
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/checkbox/checkbox.js +2 -1
- package/cjs/checkbox/checkbox.js.map +1 -1
- package/cjs/core/type.d.ts +10 -8
- package/cjs/core/type.js.map +1 -1
- package/cjs/data-zoom/data-zoom.d.ts +6 -1
- package/cjs/data-zoom/data-zoom.js +180 -118
- package/cjs/data-zoom/data-zoom.js.map +1 -1
- package/cjs/data-zoom/type.d.ts +1 -0
- package/cjs/data-zoom/type.js.map +1 -1
- package/cjs/index.d.ts +2 -1
- package/cjs/index.js +3 -2
- package/cjs/index.js.map +1 -1
- package/cjs/indicator/indicator.d.ts +3 -1
- package/cjs/indicator/indicator.js +60 -46
- package/cjs/indicator/indicator.js.map +1 -1
- package/cjs/indicator/type.d.ts +1 -0
- package/cjs/indicator/type.js.map +1 -1
- package/cjs/label/arc.d.ts +2 -2
- package/cjs/label/arc.js +38 -35
- package/cjs/label/arc.js.map +1 -1
- package/cjs/label/base.d.ts +6 -8
- package/cjs/label/base.js +92 -65
- package/cjs/label/base.js.map +1 -1
- package/cjs/label/line.js +3 -4
- package/cjs/label/line.js.map +1 -1
- package/cjs/label/type.d.ts +15 -8
- package/cjs/label/type.js.map +1 -1
- package/cjs/label/util.d.ts +4 -0
- package/cjs/label/util.js +24 -3
- package/cjs/label/util.js.map +1 -1
- package/cjs/legend/base.js +1 -1
- package/cjs/legend/base.js.map +1 -1
- package/cjs/legend/color/color.d.ts +7 -0
- package/cjs/legend/color/color.js +16 -2
- package/cjs/legend/color/color.js.map +1 -1
- package/cjs/legend/discrete/discrete.d.ts +6 -2
- package/cjs/legend/discrete/discrete.js +139 -69
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/legend/discrete/type.d.ts +17 -7
- package/cjs/legend/discrete/type.js.map +1 -1
- package/cjs/legend/register.js +2 -2
- package/cjs/legend/register.js.map +1 -1
- package/cjs/legend/size/size.d.ts +1 -0
- package/cjs/legend/size/size.js +4 -1
- package/cjs/legend/size/size.js.map +1 -1
- package/cjs/legend/type.d.ts +2 -2
- package/cjs/legend/type.js.map +1 -1
- package/cjs/marker/area.js +5 -1
- package/cjs/marker/area.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/cjs/marker/line.js +7 -1
- package/cjs/marker/line.js.map +1 -1
- package/cjs/marker/point.d.ts +1 -0
- package/cjs/marker/point.js +24 -11
- package/cjs/marker/point.js.map +1 -1
- package/cjs/marker/type.d.ts +1 -0
- package/cjs/marker/type.js.map +1 -1
- package/cjs/pager/pager.js +5 -3
- package/cjs/pager/pager.js.map +1 -1
- package/cjs/scrollbar/scrollbar.js +19 -5
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/segment/segment.js +1 -1
- package/cjs/segment/segment.js.map +1 -1
- package/cjs/slider/slider.d.ts +27 -0
- package/cjs/slider/slider.js +102 -13
- package/cjs/slider/slider.js.map +1 -1
- package/cjs/slider/type.d.ts +9 -1
- package/cjs/slider/type.js.map +1 -1
- package/cjs/tag/tag.js +28 -42
- package/cjs/tag/tag.js.map +1 -1
- package/cjs/title/title.js +2 -2
- package/cjs/title/title.js.map +1 -1
- package/cjs/tooltip/tooltip.js +1 -1
- package/cjs/tooltip/tooltip.js.map +1 -1
- package/cjs/util/limit-shape.d.ts +4 -0
- package/cjs/util/limit-shape.js +13 -4
- package/cjs/util/limit-shape.js.map +1 -1
- package/cjs/util/text.d.ts +5 -2
- package/cjs/util/text.js +19 -6
- package/cjs/util/text.js.map +1 -1
- package/es/axis/base.js +22 -26
- package/es/axis/base.js.map +1 -1
- package/es/axis/grid/base.js +1 -1
- package/es/axis/grid/base.js.map +1 -1
- package/es/axis/line.js +59 -50
- package/es/axis/line.js.map +1 -1
- package/es/axis/overlap/auto-hide.d.ts +1 -0
- package/es/axis/overlap/auto-hide.js +10 -2
- package/es/axis/overlap/auto-hide.js.map +1 -1
- package/es/axis/overlap/auto-limit.d.ts +1 -0
- package/es/axis/overlap/auto-limit.js +5 -3
- package/es/axis/overlap/auto-limit.js.map +1 -1
- package/es/axis/type.d.ts +1 -0
- package/es/axis/type.js.map +1 -1
- package/es/brush/brush.js +4 -4
- package/es/brush/brush.js.map +1 -1
- package/es/checkbox/checkbox.js +2 -1
- package/es/checkbox/checkbox.js.map +1 -1
- package/es/core/type.d.ts +10 -8
- package/es/core/type.js.map +1 -1
- package/es/data-zoom/data-zoom.d.ts +6 -1
- package/es/data-zoom/data-zoom.js +179 -116
- package/es/data-zoom/data-zoom.js.map +1 -1
- package/es/data-zoom/type.d.ts +1 -0
- package/es/data-zoom/type.js.map +1 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +3 -1
- package/es/index.js.map +1 -1
- package/es/indicator/indicator.d.ts +3 -1
- package/es/indicator/indicator.js +57 -47
- package/es/indicator/indicator.js.map +1 -1
- package/es/indicator/type.d.ts +1 -0
- package/es/indicator/type.js.map +1 -1
- package/es/label/arc.d.ts +2 -2
- package/es/label/arc.js +38 -35
- package/es/label/arc.js.map +1 -1
- package/es/label/base.d.ts +6 -8
- package/es/label/base.js +92 -65
- package/es/label/base.js.map +1 -1
- package/es/label/line.js +3 -4
- package/es/label/line.js.map +1 -1
- package/es/label/type.d.ts +15 -8
- package/es/label/type.js.map +1 -1
- package/es/label/util.d.ts +4 -0
- package/es/label/util.js +22 -2
- package/es/label/util.js.map +1 -1
- package/es/legend/base.js +1 -1
- package/es/legend/base.js.map +1 -1
- package/es/legend/color/color.d.ts +7 -0
- package/es/legend/color/color.js +17 -3
- package/es/legend/color/color.js.map +1 -1
- package/es/legend/discrete/discrete.d.ts +6 -2
- package/es/legend/discrete/discrete.js +141 -67
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/legend/discrete/type.d.ts +17 -7
- package/es/legend/discrete/type.js.map +1 -1
- package/es/legend/register.js +3 -1
- package/es/legend/register.js.map +1 -1
- package/es/legend/size/size.d.ts +1 -0
- package/es/legend/size/size.js +4 -1
- package/es/legend/size/size.js.map +1 -1
- package/es/legend/type.d.ts +2 -2
- package/es/legend/type.js.map +1 -1
- package/es/marker/area.js +6 -2
- package/es/marker/area.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/es/marker/line.js +8 -2
- package/es/marker/line.js.map +1 -1
- package/es/marker/point.d.ts +1 -0
- package/es/marker/point.js +25 -11
- package/es/marker/point.js.map +1 -1
- package/es/marker/type.d.ts +1 -0
- package/es/marker/type.js.map +1 -1
- package/es/pager/pager.js +4 -3
- package/es/pager/pager.js.map +1 -1
- package/es/scrollbar/scrollbar.js +19 -5
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/segment/segment.js +1 -1
- package/es/segment/segment.js.map +1 -1
- package/es/slider/slider.d.ts +27 -0
- package/es/slider/slider.js +102 -13
- package/es/slider/slider.js.map +1 -1
- package/es/slider/type.d.ts +9 -1
- package/es/slider/type.js.map +1 -1
- package/es/tag/tag.js +29 -45
- package/es/tag/tag.js.map +1 -1
- package/es/title/title.js +3 -3
- package/es/title/title.js.map +1 -1
- package/es/tooltip/tooltip.js +1 -1
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/util/limit-shape.d.ts +4 -0
- package/es/util/limit-shape.js +11 -3
- package/es/util/limit-shape.js.map +1 -1
- package/es/util/text.d.ts +5 -2
- package/es/util/text.js +17 -5
- package/es/util/text.js.map +1 -1
- package/package.json +3 -3
- package/dist/index.js +0 -29932
- package/dist/index.min.js +0 -1
|
@@ -8,9 +8,9 @@ var __rest = this && this.__rest || function(s, e) {
|
|
|
8
8
|
return t;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
import { vglobal } from "@visactor/vrender-core";
|
|
11
|
+
import { flatten_simplify, vglobal } from "@visactor/vrender-core";
|
|
12
12
|
|
|
13
|
-
import { array, clamp, debounce, isFunction, isValid, merge, throttle } from "@visactor/vutils";
|
|
13
|
+
import { Bounds, array, clamp, debounce, isFunction, isValid, merge, throttle } from "@visactor/vutils";
|
|
14
14
|
|
|
15
15
|
import { AbstractComponent } from "../core/base";
|
|
16
16
|
|
|
@@ -30,6 +30,16 @@ const delayMap = {
|
|
|
30
30
|
loadDataZoomComponent();
|
|
31
31
|
|
|
32
32
|
export class DataZoom extends AbstractComponent {
|
|
33
|
+
setPropsFromAttrs() {
|
|
34
|
+
const {start: start, end: end, orient: orient, previewData: previewData, previewPointsX: previewPointsX, previewPointsY: previewPointsY, previewPointsX1: previewPointsX1, previewPointsY1: previewPointsY1} = this.attribute;
|
|
35
|
+
start && (this.state.start = start), end && (this.state.end = end);
|
|
36
|
+
const {width: width, height: height} = this.getLayoutAttrFromConfig();
|
|
37
|
+
this._spanCache = this.state.end - this.state.start, this._isHorizontal = "top" === orient || "bottom" === orient,
|
|
38
|
+
this._layoutCache.max = this._isHorizontal ? width : height, this._layoutCache.attPos = this._isHorizontal ? "x" : "y",
|
|
39
|
+
this._layoutCache.attSize = this._isHorizontal ? "width" : "height", previewData && (this._previewData = previewData),
|
|
40
|
+
isFunction(previewPointsX) && (this._previewPointsX = previewPointsX), isFunction(previewPointsY) && (this._previewPointsY = previewPointsY),
|
|
41
|
+
isFunction(previewPointsX1) && (this._previewPointsX1 = previewPointsX1), isFunction(previewPointsY1) && (this._previewPointsY1 = previewPointsY1);
|
|
42
|
+
}
|
|
33
43
|
constructor(attributes, options) {
|
|
34
44
|
super((null == options ? void 0 : options.skipDefault) ? attributes : merge({}, DataZoom.defaultAttributes, attributes)),
|
|
35
45
|
this.name = "dataZoom", this._previewData = [], this._activeState = !1, this._activeCache = {
|
|
@@ -57,11 +67,10 @@ export class DataZoom extends AbstractComponent {
|
|
|
57
67
|
this._activeItem = this._background), this._activeState = !0, this._activeCache.startPos = this.eventPosToStagePos(e),
|
|
58
68
|
this._activeCache.lastPos = this.eventPosToStagePos(e), "browser" === vglobal.env && (vglobal.addEventListener("pointermove", this._onHandlerPointerMove, {
|
|
59
69
|
capture: !0
|
|
60
|
-
}), vglobal.addEventListener("pointerup", this._onHandlerPointerUp.
|
|
61
|
-
this.addEventListener("pointermove", this._onHandlerPointerMove, {
|
|
70
|
+
}), vglobal.addEventListener("pointerup", this._onHandlerPointerUp)), this.addEventListener("pointermove", this._onHandlerPointerMove, {
|
|
62
71
|
capture: !0
|
|
63
72
|
});
|
|
64
|
-
}, this.
|
|
73
|
+
}, this._pointerMove = e => {
|
|
65
74
|
e.stopPropagation();
|
|
66
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;
|
|
67
76
|
let {start: start, end: end} = this.state;
|
|
@@ -70,20 +79,36 @@ export class DataZoom extends AbstractComponent {
|
|
|
70
79
|
start = end + dis, this._activeTag = DataZoomActiveTag.startHandler) : end += dis),
|
|
71
80
|
this._activeCache.lastPos = pos, brushSelect && this.renderDragMask()), start = Math.min(Math.max(start, 0), 1),
|
|
72
81
|
end = Math.min(Math.max(end, 0), 1), startAttr === start && endAttr === end || (this.setStateAttr(start, end, !0),
|
|
73
|
-
this._dispatchEvent("change", {
|
|
82
|
+
realTime && this._dispatchEvent("change", {
|
|
74
83
|
start: start,
|
|
75
84
|
end: end,
|
|
76
85
|
tag: this._activeTag
|
|
77
86
|
}));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
87
|
+
}, this._onHandlerPointerMove = 0 === this.attribute.delayTime ? this._pointerMove : delayMap[this.attribute.delayType](this._pointerMove, this.attribute.delayTime),
|
|
88
|
+
this._onHandlerPointerUp = e => {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
const {start: start, end: end, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute;
|
|
91
|
+
if (this._activeState && this._activeTag === DataZoomActiveTag.background) {
|
|
92
|
+
const pos = this.eventPosToStagePos(e);
|
|
93
|
+
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
94
|
+
}
|
|
95
|
+
this._activeState = !1, brushSelect && this.renderDragMask(), start === this.state.start && end === this.state.end || (this.setStateAttr(this.state.start, this.state.end, !0),
|
|
96
|
+
this._dispatchEvent("change", {
|
|
97
|
+
start: this.state.start,
|
|
98
|
+
end: this.state.end,
|
|
99
|
+
tag: this._activeTag
|
|
100
|
+
})), "browser" === vglobal.env && (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
101
|
+
capture: !0
|
|
102
|
+
}), vglobal.removeEventListener("pointerup", this._onHandlerPointerUp)), this.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
103
|
+
capture: !0
|
|
104
|
+
}), this.removeEventListener("pointerup", this._onHandlerPointerUp);
|
|
105
|
+
};
|
|
106
|
+
const {position: position, showDetail: showDetail} = attributes;
|
|
83
107
|
this._activeCache.startPos = position, this._activeCache.lastPos = position, this._showText = "auto" !== showDetail && showDetail,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
108
|
+
this.setPropsFromAttrs();
|
|
109
|
+
}
|
|
110
|
+
setAttributes(params, forceUpdateTag) {
|
|
111
|
+
super.setAttributes(params, forceUpdateTag), this.setPropsFromAttrs();
|
|
87
112
|
}
|
|
88
113
|
bindEvents() {
|
|
89
114
|
if (this.attribute.disableTriggerEvent) return;
|
|
@@ -115,31 +140,12 @@ export class DataZoom extends AbstractComponent {
|
|
|
115
140
|
}
|
|
116
141
|
eventPosToStagePos(e) {
|
|
117
142
|
var _a, _b;
|
|
118
|
-
const {x: x, y: y} = vglobal.mapToCanvasPoint(e);
|
|
143
|
+
const {x: x, y: y} = vglobal.mapToCanvasPoint(e, this.stage.window.getContext().canvas.nativeCanvas);
|
|
119
144
|
return {
|
|
120
145
|
x: x - ((null === (_a = this.stage) || void 0 === _a ? void 0 : _a.x) || 0),
|
|
121
146
|
y: y - ((null === (_b = this.stage) || void 0 === _b ? void 0 : _b.y) || 0)
|
|
122
147
|
};
|
|
123
148
|
}
|
|
124
|
-
_onHandlerPointerUp(e) {
|
|
125
|
-
e.preventDefault();
|
|
126
|
-
const {start: start, end: end, brushSelect: brushSelect, realTime: realTime = !0} = this.attribute;
|
|
127
|
-
if (this._activeState && this._activeTag === DataZoomActiveTag.background) {
|
|
128
|
-
const pos = this.eventPosToStagePos(e);
|
|
129
|
-
this.backgroundDragZoom(this._activeCache.startPos, pos);
|
|
130
|
-
}
|
|
131
|
-
this._activeState = !1, brushSelect && this.renderDragMask(), realTime && start === this.state.start && end === this.state.end || (this.setStateAttr(this.state.start, this.state.end, !0),
|
|
132
|
-
this._dispatchEvent("change", {
|
|
133
|
-
start: this.state.start,
|
|
134
|
-
end: this.state.end,
|
|
135
|
-
tag: this._activeTag
|
|
136
|
-
})), "browser" === vglobal.env && (vglobal.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
137
|
-
capture: !0
|
|
138
|
-
}), vglobal.removeEventListener("pointerup", this._onHandlerPointerUp.bind(this))),
|
|
139
|
-
this.removeEventListener("pointermove", this._onHandlerPointerMove, {
|
|
140
|
-
capture: !0
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
149
|
_onHandlerPointerEnter(e) {
|
|
144
150
|
e.stopPropagation(), this._showText = !0, this.renderText();
|
|
145
151
|
}
|
|
@@ -169,60 +175,84 @@ export class DataZoom extends AbstractComponent {
|
|
|
169
175
|
height: this._activeState && this._activeTag === DataZoomActiveTag.background && Math.abs(this.dragMaskSize()) || 0
|
|
170
176
|
}, dragMaskStyle), "rect");
|
|
171
177
|
}
|
|
172
|
-
|
|
173
|
-
|
|
178
|
+
isTextOverflow(componentBoundsLike, textBounds, layout) {
|
|
179
|
+
if (!textBounds) return !1;
|
|
180
|
+
if (this._isHorizontal) {
|
|
181
|
+
if ("start" === layout) {
|
|
182
|
+
if (textBounds.x1 < componentBoundsLike.x1) return !0;
|
|
183
|
+
} else if (textBounds.x2 > componentBoundsLike.x2) return !0;
|
|
184
|
+
} else if ("start" === layout) {
|
|
185
|
+
if (textBounds.y1 < componentBoundsLike.y1) return !0;
|
|
186
|
+
} else if (textBounds.y2 > componentBoundsLike.y2) return !0;
|
|
187
|
+
return !1;
|
|
188
|
+
}
|
|
189
|
+
setTextAttr(startTextBounds, endTextBounds) {
|
|
190
|
+
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;
|
|
174
191
|
this._startValue = this._statePointToData(start), this._endValue = this._statePointToData(end);
|
|
175
|
-
const {position: position, width: width, height: height} = this.getLayoutAttrFromConfig()
|
|
176
|
-
|
|
177
|
-
|
|
192
|
+
const {position: position, width: width, height: height} = this.getLayoutAttrFromConfig(), startTextValue = startTextFormat ? startTextFormat(this._startValue) : this._startValue, endTextValue = endTextFormat ? endTextFormat(this._endValue) : this._endValue, componentBoundsLike = {
|
|
193
|
+
x1: position.x,
|
|
194
|
+
y1: position.y,
|
|
195
|
+
x2: position.x + width,
|
|
196
|
+
y2: position.y + height
|
|
197
|
+
};
|
|
198
|
+
let startTextPosition, endTextPosition, startTextAlignStyle, endTextAlignStyle;
|
|
199
|
+
this._isHorizontal ? (startTextPosition = {
|
|
178
200
|
x: position.x + start * width,
|
|
179
|
-
y: position.y + height / 2
|
|
180
|
-
|
|
181
|
-
pickable: !1,
|
|
182
|
-
childrenPickable: !1,
|
|
183
|
-
textStyle: {
|
|
184
|
-
textAlign: "right",
|
|
185
|
-
textBaseline: "middle"
|
|
186
|
-
}
|
|
187
|
-
}), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, merge({}, restEndTextStyle, {
|
|
188
|
-
text: endTextFormat ? endTextFormat(this._endValue) : this._endValue,
|
|
201
|
+
y: position.y + height / 2
|
|
202
|
+
}, endTextPosition = {
|
|
189
203
|
x: position.x + end * width,
|
|
190
|
-
y: position.y + height / 2
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}), `data-zoom-end-text-${position}`)) : (this._startText = this.maybeAddLabel(this._container, merge({}, restStartStyle, {
|
|
199
|
-
text: startTextFormat ? startTextFormat(this._startValue) : this._startValue,
|
|
204
|
+
y: position.y + height / 2
|
|
205
|
+
}, startTextAlignStyle = {
|
|
206
|
+
textAlign: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "left" : "right",
|
|
207
|
+
textBaseline: "middle"
|
|
208
|
+
}, endTextAlignStyle = {
|
|
209
|
+
textAlign: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "right" : "left",
|
|
210
|
+
textBaseline: "middle"
|
|
211
|
+
}) : (startTextPosition = {
|
|
200
212
|
x: position.x + width / 2,
|
|
201
|
-
y: position.y + start * height
|
|
213
|
+
y: position.y + start * height
|
|
214
|
+
}, endTextPosition = {
|
|
215
|
+
x: position.x + width / 2,
|
|
216
|
+
y: position.y + end * height
|
|
217
|
+
}, startTextAlignStyle = {
|
|
218
|
+
textAlign: "center",
|
|
219
|
+
textBaseline: this.isTextOverflow(componentBoundsLike, startTextBounds, "start") ? "top" : "bottom"
|
|
220
|
+
}, endTextAlignStyle = {
|
|
221
|
+
textAlign: "center",
|
|
222
|
+
textBaseline: this.isTextOverflow(componentBoundsLike, endTextBounds, "end") ? "bottom" : "top"
|
|
223
|
+
}), this._startText = this.maybeAddLabel(this._container, merge({}, restStartTextStyle, {
|
|
224
|
+
text: startTextValue,
|
|
225
|
+
x: startTextPosition.x,
|
|
226
|
+
y: startTextPosition.y,
|
|
202
227
|
visible: this._showText,
|
|
203
228
|
pickable: !1,
|
|
204
229
|
childrenPickable: !1,
|
|
205
|
-
textStyle:
|
|
206
|
-
textAlign: "center",
|
|
207
|
-
textBaseline: "bottom"
|
|
208
|
-
}
|
|
230
|
+
textStyle: startTextAlignStyle
|
|
209
231
|
}), `data-zoom-start-text-${position}`), this._endText = this.maybeAddLabel(this._container, merge({}, restEndTextStyle, {
|
|
210
|
-
text:
|
|
211
|
-
x:
|
|
212
|
-
y:
|
|
232
|
+
text: endTextValue,
|
|
233
|
+
x: endTextPosition.x,
|
|
234
|
+
y: endTextPosition.y,
|
|
213
235
|
visible: this._showText,
|
|
214
236
|
pickable: !1,
|
|
215
237
|
childrenPickable: !1,
|
|
216
|
-
textStyle:
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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 Bounds).set(x1, y1, x2, y2).intersects(endTextBounds)) {
|
|
248
|
+
const direction = "bottom" === this.attribute.orient || "right" === this.attribute.orient ? -1 : 1;
|
|
249
|
+
this._isHorizontal ? this._startText.setAttribute("dy", startTextDy + direction * Math.abs(endTextBounds.y1 - endTextBounds.y2)) : this._startText.setAttribute("dx", startTextDx + direction * Math.abs(endTextBounds.x1 - endTextBounds.x2));
|
|
250
|
+
} else this._isHorizontal ? this._startText.setAttribute("dy", startTextDy) : this._startText.setAttribute("dx", startTextDx);
|
|
221
251
|
}
|
|
222
252
|
getLayoutAttrFromConfig() {
|
|
223
|
-
var _a, _b, _c, _d;
|
|
253
|
+
var _a, _b, _c, _d, _e, _f;
|
|
224
254
|
if (this._layoutAttrFromConfig) return this._layoutAttrFromConfig;
|
|
225
|
-
const {position: positionConfig, size: size, orient: orient, middleHandlerStyle: middleHandlerStyle = {}, startHandlerStyle: startHandlerStyle = {}, endHandlerStyle: endHandlerStyle = {}} = 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;
|
|
255
|
+
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;
|
|
226
256
|
let width, height, position;
|
|
227
257
|
middleHandlerStyle.visible ? this._isHorizontal ? (width = widthConfig, height = heightConfig - middleHandlerSize,
|
|
228
258
|
position = {
|
|
@@ -239,69 +269,84 @@ export class DataZoom extends AbstractComponent {
|
|
|
239
269
|
y: position.y
|
|
240
270
|
}) : (height -= (startHandlerSize + endHandlerSize) / 2, position = {
|
|
241
271
|
x: position.x,
|
|
242
|
-
y: position.y + startHandlerSize
|
|
243
|
-
})),
|
|
272
|
+
y: position.y + startHandlerSize / 2
|
|
273
|
+
})), height += null !== (_e = backgroundStyle.lineWidth / 2) && void 0 !== _e ? _e : 1,
|
|
274
|
+
width += null !== (_f = backgroundStyle.lineWidth / 2) && void 0 !== _f ? _f : 1,
|
|
275
|
+
this._layoutAttrFromConfig = {
|
|
244
276
|
position: position,
|
|
245
277
|
width: width,
|
|
246
278
|
height: height
|
|
247
279
|
}, this._layoutAttrFromConfig;
|
|
248
280
|
}
|
|
249
281
|
render() {
|
|
250
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
282
|
+
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;
|
|
251
283
|
this._layoutAttrFromConfig = null;
|
|
252
|
-
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");
|
|
253
|
-
if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign({
|
|
284
|
+
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");
|
|
285
|
+
if (this._container = group, this._background = group.createOrUpdateChild("background", Object.assign(Object.assign({
|
|
254
286
|
x: position.x,
|
|
255
287
|
y: position.y,
|
|
256
288
|
width: width,
|
|
257
289
|
height: height,
|
|
258
290
|
cursor: brushSelect ? "crosshair" : "auto"
|
|
259
|
-
}, backgroundStyle),
|
|
260
|
-
|
|
261
|
-
|
|
291
|
+
}, backgroundStyle), {
|
|
292
|
+
pickable: !zoomLock && (null === (_c = backgroundStyle.pickable) || void 0 === _c || _c)
|
|
293
|
+
}), "rect"), (null === (_d = backgroundChartStyle.line) || void 0 === _d ? void 0 : _d.visible) && this.setPreviewAttributes("line", group),
|
|
294
|
+
(null === (_e = backgroundChartStyle.area) || void 0 === _e ? void 0 : _e.visible) && this.setPreviewAttributes("area", group),
|
|
295
|
+
brushSelect && this.renderDragMask(), this._isHorizontal ? this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
262
296
|
x: position.x + start * width,
|
|
263
297
|
y: position.y,
|
|
264
298
|
width: (end - start) * width,
|
|
265
299
|
height: height,
|
|
266
300
|
cursor: brushSelect ? "crosshair" : "move"
|
|
267
|
-
}, selectedBackgroundStyle),
|
|
301
|
+
}, selectedBackgroundStyle), {
|
|
302
|
+
pickable: !zoomLock && (null === (_f = selectedBackgroundChartStyle.pickable) || void 0 === _f || _f)
|
|
303
|
+
}), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
|
|
268
304
|
x: position.x,
|
|
269
305
|
y: position.y + start * height,
|
|
270
306
|
width: width,
|
|
271
307
|
height: (end - start) * height,
|
|
272
308
|
cursor: brushSelect ? "crosshair" : "move"
|
|
273
|
-
}, selectedBackgroundStyle),
|
|
274
|
-
|
|
275
|
-
|
|
309
|
+
}, selectedBackgroundStyle), {
|
|
310
|
+
pickable: !zoomLock && (null === (_g = selectedBackgroundStyle.pickable) || void 0 === _g || _g)
|
|
311
|
+
}), "rect"), (null === (_h = selectedBackgroundChartStyle.line) || void 0 === _h ? void 0 : _h.visible) && this.setSelectedPreviewAttributes("line", group),
|
|
312
|
+
(null === (_j = selectedBackgroundChartStyle.area) || void 0 === _j ? void 0 : _j.visible) && this.setSelectedPreviewAttributes("area", group),
|
|
313
|
+
this._isHorizontal) {
|
|
276
314
|
if (middleHandlerStyle.visible) {
|
|
277
|
-
const middleHandlerBackgroundSize = (null === (
|
|
278
|
-
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
|
|
315
|
+
const middleHandlerBackgroundSize = (null === (_k = middleHandlerStyle.background) || void 0 === _k ? void 0 : _k.size) || 10;
|
|
316
|
+
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
|
|
279
317
|
x: position.x + start * width,
|
|
280
318
|
y: position.y - middleHandlerBackgroundSize,
|
|
281
319
|
width: (end - start) * width,
|
|
282
320
|
height: middleHandlerBackgroundSize
|
|
283
|
-
}, null === (
|
|
284
|
-
|
|
321
|
+
}, null === (_l = middleHandlerStyle.background) || void 0 === _l ? void 0 : _l.style), {
|
|
322
|
+
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)
|
|
323
|
+
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
285
324
|
x: position.x + (start + end) / 2 * width,
|
|
286
325
|
y: position.y - middleHandlerBackgroundSize / 2,
|
|
287
326
|
strokeBoundsBuffer: 0,
|
|
288
327
|
angle: 0,
|
|
289
|
-
symbolType: null !== (
|
|
290
|
-
}, middleHandlerStyle.icon),
|
|
328
|
+
symbolType: null !== (_r = null === (_q = middleHandlerStyle.icon) || void 0 === _q ? void 0 : _q.symbolType) && void 0 !== _r ? _r : "square"
|
|
329
|
+
}, middleHandlerStyle.icon), {
|
|
330
|
+
pickable: !zoomLock && (null === (_s = middleHandlerStyle.icon.pickable) || void 0 === _s || _s)
|
|
331
|
+
}), "symbol");
|
|
291
332
|
}
|
|
292
|
-
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign({
|
|
333
|
+
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
293
334
|
x: position.x + start * width,
|
|
294
335
|
y: position.y + height / 2,
|
|
295
336
|
size: height,
|
|
296
|
-
symbolType: null !== (
|
|
297
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle),
|
|
337
|
+
symbolType: null !== (_t = startHandlerStyle.symbolType) && void 0 !== _t ? _t : "square"
|
|
338
|
+
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
|
|
339
|
+
pickable: !zoomLock && (null === (_u = startHandlerStyle.pickable) || void 0 === _u || _u)
|
|
340
|
+
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
298
341
|
x: position.x + end * width,
|
|
299
342
|
y: position.y + height / 2,
|
|
300
343
|
size: height,
|
|
301
|
-
symbolType: null !== (
|
|
302
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle),
|
|
344
|
+
symbolType: null !== (_v = endHandlerStyle.symbolType) && void 0 !== _v ? _v : "square"
|
|
345
|
+
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
|
|
346
|
+
pickable: !zoomLock && (null === (_w = endHandlerStyle.pickable) || void 0 === _w || _w)
|
|
347
|
+
}), "symbol");
|
|
303
348
|
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);
|
|
304
|
-
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign({
|
|
349
|
+
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
|
|
305
350
|
x: position.x + start * width - startHandlerWidth / 2,
|
|
306
351
|
y: position.y + height / 2 - startHandlerHeight / 2,
|
|
307
352
|
width: startHandlerWidth,
|
|
@@ -309,7 +354,9 @@ export class DataZoom extends AbstractComponent {
|
|
|
309
354
|
fill: "white",
|
|
310
355
|
fillOpacity: 0,
|
|
311
356
|
zIndex: 999
|
|
312
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal),
|
|
357
|
+
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
358
|
+
pickable: !zoomLock
|
|
359
|
+
}), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
|
|
313
360
|
x: position.x + end * width - endHandlerWidth / 2,
|
|
314
361
|
y: position.y + height / 2 - endHandlerHeight / 2,
|
|
315
362
|
width: endHandlerWidth,
|
|
@@ -317,37 +364,46 @@ export class DataZoom extends AbstractComponent {
|
|
|
317
364
|
fill: "white",
|
|
318
365
|
fillOpacity: 0,
|
|
319
366
|
zIndex: 999
|
|
320
|
-
}, DEFAULT_HANDLER_ATTR_MAP.horizontal),
|
|
367
|
+
}, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
|
|
368
|
+
pickable: !zoomLock
|
|
369
|
+
}), "rect");
|
|
321
370
|
} else {
|
|
322
371
|
if (middleHandlerStyle.visible) {
|
|
323
|
-
const middleHandlerBackgroundSize = (null === (
|
|
324
|
-
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign({
|
|
372
|
+
const middleHandlerBackgroundSize = (null === (_x = middleHandlerStyle.background) || void 0 === _x ? void 0 : _x.size) || 10;
|
|
373
|
+
this._middleHandlerRect = group.createOrUpdateChild("middleHandlerRect", Object.assign(Object.assign({
|
|
325
374
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
|
|
326
375
|
y: position.y + start * height,
|
|
327
376
|
width: middleHandlerBackgroundSize,
|
|
328
377
|
height: (end - start) * height
|
|
329
|
-
}, null === (
|
|
330
|
-
|
|
378
|
+
}, null === (_y = middleHandlerStyle.background) || void 0 === _y ? void 0 : _y.style), {
|
|
379
|
+
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)
|
|
380
|
+
}), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
|
|
331
381
|
x: "left" === orient ? position.x - middleHandlerBackgroundSize / 2 : position.x + width + middleHandlerBackgroundSize / 2,
|
|
332
382
|
y: position.y + (start + end) / 2 * height,
|
|
333
383
|
angle: Math.PI / 180 * 90,
|
|
334
|
-
symbolType: null !== (
|
|
384
|
+
symbolType: null !== (_3 = null === (_2 = middleHandlerStyle.icon) || void 0 === _2 ? void 0 : _2.symbolType) && void 0 !== _3 ? _3 : "square",
|
|
335
385
|
strokeBoundsBuffer: 0
|
|
336
|
-
}, middleHandlerStyle.icon),
|
|
386
|
+
}, middleHandlerStyle.icon), {
|
|
387
|
+
pickable: !zoomLock && (null === (_5 = null === (_4 = middleHandlerStyle.icon) || void 0 === _4 ? void 0 : _4.pickable) || void 0 === _5 || _5)
|
|
388
|
+
}), "symbol");
|
|
337
389
|
}
|
|
338
|
-
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign({
|
|
390
|
+
this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
|
|
339
391
|
x: position.x + width / 2,
|
|
340
392
|
y: position.y + start * height,
|
|
341
393
|
size: width,
|
|
342
|
-
symbolType: null !== (
|
|
343
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle),
|
|
394
|
+
symbolType: null !== (_6 = startHandlerStyle.symbolType) && void 0 !== _6 ? _6 : "square"
|
|
395
|
+
}, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
|
|
396
|
+
pickable: !zoomLock && (null === (_7 = startHandlerStyle.pickable) || void 0 === _7 || _7)
|
|
397
|
+
}), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
|
|
344
398
|
x: position.x + width / 2,
|
|
345
399
|
y: position.y + end * height,
|
|
346
400
|
size: width,
|
|
347
|
-
symbolType: null !== (
|
|
348
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle),
|
|
401
|
+
symbolType: null !== (_8 = endHandlerStyle.symbolType) && void 0 !== _8 ? _8 : "square"
|
|
402
|
+
}, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
|
|
403
|
+
pickable: !zoomLock && (null === (_9 = endHandlerStyle.pickable) || void 0 === _9 || _9)
|
|
404
|
+
}), "symbol");
|
|
349
405
|
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);
|
|
350
|
-
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign({
|
|
406
|
+
this._startHandlerMask = group.createOrUpdateChild("startHandlerMask", Object.assign(Object.assign({
|
|
351
407
|
x: position.x + width / 2 + startHandlerWidth / 2,
|
|
352
408
|
y: position.y + start * height - startHandlerHeight / 2,
|
|
353
409
|
width: endHandlerHeight,
|
|
@@ -355,7 +411,9 @@ export class DataZoom extends AbstractComponent {
|
|
|
355
411
|
fill: "white",
|
|
356
412
|
fillOpacity: 0,
|
|
357
413
|
zIndex: 999
|
|
358
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical),
|
|
414
|
+
}, DEFAULT_HANDLER_ATTR_MAP.vertical), {
|
|
415
|
+
pickable: !zoomLock
|
|
416
|
+
}), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
|
|
359
417
|
x: position.x + width / 2 + endHandlerWidth / 2,
|
|
360
418
|
y: position.y + end * height - endHandlerHeight / 2,
|
|
361
419
|
width: endHandlerHeight,
|
|
@@ -363,8 +421,11 @@ export class DataZoom extends AbstractComponent {
|
|
|
363
421
|
fill: "white",
|
|
364
422
|
fillOpacity: 0,
|
|
365
423
|
zIndex: 999
|
|
366
|
-
}, DEFAULT_HANDLER_ATTR_MAP.vertical),
|
|
424
|
+
}, DEFAULT_HANDLER_ATTR_MAP.vertical), {
|
|
425
|
+
pickable: !zoomLock
|
|
426
|
+
}), "rect");
|
|
367
427
|
}
|
|
428
|
+
this._showText && this.renderText();
|
|
368
429
|
}
|
|
369
430
|
computeBasePoints() {
|
|
370
431
|
const {orient: orient} = this.attribute, {position: position, width: width, height: height} = this.getLayoutAttrFromConfig();
|
|
@@ -393,22 +454,24 @@ export class DataZoom extends AbstractComponent {
|
|
|
393
454
|
};
|
|
394
455
|
}
|
|
395
456
|
getPreviewLinePoints() {
|
|
396
|
-
|
|
457
|
+
let previewPoints = this._previewData.map((d => ({
|
|
397
458
|
x: this._previewPointsX && this._previewPointsX(d),
|
|
398
459
|
y: this._previewPointsY && this._previewPointsY(d)
|
|
399
460
|
})));
|
|
400
461
|
if (0 === previewPoints.length) return previewPoints;
|
|
462
|
+
this.attribute.tolerance && (previewPoints = flatten_simplify(previewPoints, this.attribute.tolerance, !1));
|
|
401
463
|
const {basePointStart: basePointStart, basePointEnd: basePointEnd} = this.computeBasePoints();
|
|
402
464
|
return basePointStart.concat(previewPoints).concat(basePointEnd);
|
|
403
465
|
}
|
|
404
466
|
getPreviewAreaPoints() {
|
|
405
|
-
|
|
467
|
+
let previewPoints = this._previewData.map((d => ({
|
|
406
468
|
x: this._previewPointsX && this._previewPointsX(d),
|
|
407
469
|
y: this._previewPointsY && this._previewPointsY(d),
|
|
408
470
|
x1: this._previewPointsX1 && this._previewPointsX1(d),
|
|
409
471
|
y1: this._previewPointsY1 && this._previewPointsY1(d)
|
|
410
472
|
})));
|
|
411
473
|
if (0 === previewPoints.length) return previewPoints;
|
|
474
|
+
this.attribute.tolerance && (previewPoints = flatten_simplify(previewPoints, this.attribute.tolerance, !1));
|
|
412
475
|
const {basePointStart: basePointStart, basePointEnd: basePointEnd} = this.computeBasePoints();
|
|
413
476
|
return basePointStart.concat(previewPoints).concat(basePointEnd);
|
|
414
477
|
}
|