evui 3.3.42 → 3.3.43
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/dist/evui.common.js +330 -114
- package/dist/evui.common.js.map +1 -1
- package/dist/evui.umd.js +330 -114
- package/dist/evui.umd.js.map +1 -1
- package/dist/evui.umd.min.js +1 -1
- package/dist/evui.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/calendar/uses.js +3 -1
- package/src/components/chart/element/element.line.js +19 -17
- package/src/components/chartBrush/chartBrush.core.js +330 -105
package/dist/evui.umd.js
CHANGED
|
@@ -7966,7 +7966,7 @@ $({ target: 'Number', stat: true }, {
|
|
|
7966
7966
|
/***/ "9224":
|
|
7967
7967
|
/***/ (function(module) {
|
|
7968
7968
|
|
|
7969
|
-
module.exports = JSON.parse("{\"a\":\"3.3.
|
|
7969
|
+
module.exports = JSON.parse("{\"a\":\"3.3.43\"}");
|
|
7970
7970
|
|
|
7971
7971
|
/***/ }),
|
|
7972
7972
|
|
|
@@ -21155,7 +21155,9 @@ var calendar_uses_useEvent = function useEvent(param) {
|
|
|
21155
21155
|
}, function (curr) {
|
|
21156
21156
|
selectedValue.value = curr;
|
|
21157
21157
|
|
|
21158
|
-
if (props.mode
|
|
21158
|
+
if (props.mode === 'dateRange') {
|
|
21159
|
+
updateCalendarPage(selectedValue.value);
|
|
21160
|
+
} else if (props.mode.includes('Time')) {
|
|
21159
21161
|
var updateValue = [];
|
|
21160
21162
|
|
|
21161
21163
|
if (props.mode === 'dateTime') {
|
|
@@ -35349,28 +35351,33 @@ var element_line_Line = /*#__PURE__*/function () {
|
|
|
35349
35351
|
color: this.color
|
|
35350
35352
|
};
|
|
35351
35353
|
var gdata = this.data;
|
|
35352
|
-
var s = 0;
|
|
35353
|
-
var e = gdata.length - 1;
|
|
35354
|
-
var xpInterval = gdata[1].xp - gdata[0].xp < 6 ? 1.5 : 6;
|
|
35355
35354
|
|
|
35356
|
-
|
|
35357
|
-
var
|
|
35358
|
-
var x = gdata[m].xp;
|
|
35359
|
-
var y = gdata[m].yp;
|
|
35355
|
+
if (gdata !== null && gdata !== void 0 && gdata.length) {
|
|
35356
|
+
var _gdata$;
|
|
35360
35357
|
|
|
35361
|
-
|
|
35362
|
-
|
|
35363
|
-
|
|
35358
|
+
var s = 0;
|
|
35359
|
+
var e = gdata.length - 1;
|
|
35360
|
+
var xpInterval = ((_gdata$ = gdata[1]) === null || _gdata$ === void 0 ? void 0 : _gdata$.xp) - gdata[0].xp < 6 ? 1.5 : 6;
|
|
35364
35361
|
|
|
35365
|
-
|
|
35366
|
-
|
|
35367
|
-
|
|
35362
|
+
while (s <= e) {
|
|
35363
|
+
var m = Math.floor((s + e) / 2);
|
|
35364
|
+
var x = gdata[m].xp;
|
|
35365
|
+
var y = gdata[m].yp;
|
|
35368
35366
|
|
|
35369
|
-
|
|
35370
|
-
|
|
35371
|
-
|
|
35372
|
-
|
|
35373
|
-
|
|
35367
|
+
if (x - xpInterval < xp && xp < x + xpInterval) {
|
|
35368
|
+
item.data = gdata[m];
|
|
35369
|
+
item.index = m;
|
|
35370
|
+
|
|
35371
|
+
if (y - 6 <= yp && yp <= y + 6) {
|
|
35372
|
+
item.hit = true;
|
|
35373
|
+
}
|
|
35374
|
+
|
|
35375
|
+
return item;
|
|
35376
|
+
} else if (x + xpInterval > xp) {
|
|
35377
|
+
e = m - 1;
|
|
35378
|
+
} else {
|
|
35379
|
+
s = m + 1;
|
|
35380
|
+
}
|
|
35374
35381
|
}
|
|
35375
35382
|
}
|
|
35376
35383
|
|
|
@@ -46733,14 +46740,33 @@ function ChartBrushvue_type_template_id_7d0c10ab_render(_ctx, _cache, $props, $s
|
|
|
46733
46740
|
|
|
46734
46741
|
|
|
46735
46742
|
|
|
46743
|
+
var BRUSH_UPDATE_MODE = {
|
|
46744
|
+
WHEEL: {
|
|
46745
|
+
UP: 'MOVEUP_WHEEL',
|
|
46746
|
+
DOWN: 'MOVEDOWN_WHEEL'
|
|
46747
|
+
},
|
|
46748
|
+
GRAB: {
|
|
46749
|
+
UP: 'MOVEUP_GRAB',
|
|
46750
|
+
DOWN: 'MOVEDOWN_GRAB'
|
|
46751
|
+
},
|
|
46752
|
+
BUTTON: {
|
|
46753
|
+
INCREASE: 'INCREASE',
|
|
46754
|
+
DECREASE: 'DECREASE'
|
|
46755
|
+
}
|
|
46756
|
+
};
|
|
46757
|
+
var BUTTON_TYPE = {
|
|
46758
|
+
LEFT: 'leftX',
|
|
46759
|
+
RIGHT: 'rightX'
|
|
46760
|
+
};
|
|
46761
|
+
|
|
46736
46762
|
var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
46737
46763
|
function EvChartBrush(evChart, evChartData, evChartBrushOptions, brushIdx, evChartBrushRef) {
|
|
46738
46764
|
_classCallCheck(this, EvChartBrush);
|
|
46739
46765
|
|
|
46740
46766
|
this.evChart = evChart;
|
|
46741
|
-
this.evChartData = evChartData;
|
|
46742
46767
|
this.evChartBrushOptions = evChartBrushOptions;
|
|
46743
46768
|
this.evChartBrushRef = evChartBrushRef;
|
|
46769
|
+
this.evChartData = evChartData;
|
|
46744
46770
|
this.brushIdx = brushIdx;
|
|
46745
46771
|
|
|
46746
46772
|
if (evChartBrushOptions.value.useDebounce) {
|
|
@@ -46755,7 +46781,6 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
46755
46781
|
key: "init",
|
|
46756
46782
|
value: function init(isResize) {
|
|
46757
46783
|
if (this.brushIdx.start > this.brushIdx.end) {
|
|
46758
|
-
this.initEventState();
|
|
46759
46784
|
this.removeBrushCanvas();
|
|
46760
46785
|
return;
|
|
46761
46786
|
}
|
|
@@ -46787,11 +46812,11 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
46787
46812
|
}, {
|
|
46788
46813
|
key: "drawBrushRect",
|
|
46789
46814
|
value: function drawBrushRect(_ref) {
|
|
46790
|
-
var _this$debounceBrushId;
|
|
46791
|
-
|
|
46792
46815
|
var brushCanvas = _ref.brushCanvas,
|
|
46793
46816
|
isResize = _ref.isResize,
|
|
46794
|
-
isDebounce = _ref.isDebounce
|
|
46817
|
+
isDebounce = _ref.isDebounce,
|
|
46818
|
+
mode = _ref.mode,
|
|
46819
|
+
offsetX = _ref.offsetX;
|
|
46795
46820
|
var _this$evChart = this.evChart,
|
|
46796
46821
|
chartRect = _this$evChart.chartRect,
|
|
46797
46822
|
labelOffset = _this$evChart.labelOffset;
|
|
@@ -46800,21 +46825,57 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
46800
46825
|
return;
|
|
46801
46826
|
}
|
|
46802
46827
|
|
|
46828
|
+
var labelEndIdx = this.evChartData.value.labels.length - 1;
|
|
46829
|
+
this.labelEndIdx = labelEndIdx;
|
|
46803
46830
|
var evChartRange = {
|
|
46804
46831
|
x1: chartRect.x1 + labelOffset.left,
|
|
46805
46832
|
x2: chartRect.x2 - labelOffset.right,
|
|
46806
46833
|
y1: chartRect.y1 + labelOffset.top,
|
|
46807
46834
|
y2: chartRect.y2 - labelOffset.bottom
|
|
46808
46835
|
};
|
|
46809
|
-
var
|
|
46836
|
+
var canvasPosInfo = this.setCanvasWidthHeight(evChartRange, brushCanvas);
|
|
46837
|
+
|
|
46838
|
+
if (isResize && this.isEqualWidth) {
|
|
46839
|
+
return;
|
|
46840
|
+
}
|
|
46841
|
+
|
|
46842
|
+
if (labelEndIdx >= 0) {
|
|
46843
|
+
var brushPosInfo = this.setBrushXAndWidth(canvasPosInfo, offsetX, isDebounce, mode);
|
|
46844
|
+
|
|
46845
|
+
if (canvasPosInfo && brushPosInfo) {
|
|
46846
|
+
this.drawBrush(canvasPosInfo, brushPosInfo, evChartRange, brushCanvas);
|
|
46847
|
+
}
|
|
46848
|
+
}
|
|
46849
|
+
}
|
|
46850
|
+
}, {
|
|
46851
|
+
key: "setCanvasWidthHeight",
|
|
46852
|
+
value: function setCanvasWidthHeight(evChartRange, brushCanvas) {
|
|
46810
46853
|
var brushButtonWidth = 6;
|
|
46811
46854
|
var brushCanvasWidth = evChartRange.x2 - evChartRange.x1 + brushButtonWidth;
|
|
46812
46855
|
var brushCanvasHeight = evChartRange.y2 - evChartRange.y1;
|
|
46813
|
-
var
|
|
46856
|
+
var axesXInterval = (evChartRange.x2 - evChartRange.x1) / this.labelEndIdx;
|
|
46857
|
+
var pixelRatio = window.devicePixelRatio || 1;
|
|
46858
|
+
this.isEqualWidth = brushCanvas.width === Math.floor(brushCanvasWidth * pixelRatio);
|
|
46859
|
+
return {
|
|
46860
|
+
brushButtonWidth: brushButtonWidth,
|
|
46861
|
+
brushCanvasHeight: brushCanvasHeight,
|
|
46862
|
+
brushCanvasWidth: brushCanvasWidth,
|
|
46863
|
+
axesXInterval: axesXInterval,
|
|
46864
|
+
pixelRatio: pixelRatio
|
|
46865
|
+
};
|
|
46866
|
+
}
|
|
46867
|
+
}, {
|
|
46868
|
+
key: "setBrushXAndWidth",
|
|
46869
|
+
value: function setBrushXAndWidth(canvasPosInfo) {
|
|
46870
|
+
var _this$debounceBrushId;
|
|
46814
46871
|
|
|
46815
|
-
|
|
46816
|
-
|
|
46817
|
-
|
|
46872
|
+
var offsetX = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
46873
|
+
var isDebounce = arguments.length > 2 ? arguments[2] : undefined;
|
|
46874
|
+
var mode = arguments.length > 3 ? arguments[3] : undefined;
|
|
46875
|
+
var brushButtonWidth = canvasPosInfo.brushButtonWidth,
|
|
46876
|
+
brushCanvasWidth = canvasPosInfo.brushCanvasWidth,
|
|
46877
|
+
axesXInterval = canvasPosInfo.axesXInterval,
|
|
46878
|
+
pixelRatio = canvasPosInfo.pixelRatio;
|
|
46818
46879
|
|
|
46819
46880
|
if (!isDebounce && this.debounceBrushIdx) {
|
|
46820
46881
|
this.debounceBrushIdx.start = this.brushIdx.start;
|
|
@@ -46822,44 +46883,109 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
46822
46883
|
}
|
|
46823
46884
|
|
|
46824
46885
|
var brushIdx = (_this$debounceBrushId = this.debounceBrushIdx) !== null && _this$debounceBrushId !== void 0 ? _this$debounceBrushId : this.brushIdx;
|
|
46825
|
-
var labelEndIdx = this.evChartData.value.labels.length - 1;
|
|
46826
46886
|
|
|
46827
|
-
|
|
46828
|
-
|
|
46829
|
-
|
|
46830
|
-
|
|
46831
|
-
|
|
46832
|
-
|
|
46833
|
-
|
|
46834
|
-
|
|
46835
|
-
|
|
46836
|
-
|
|
46837
|
-
|
|
46838
|
-
|
|
46839
|
-
|
|
46840
|
-
|
|
46841
|
-
|
|
46842
|
-
|
|
46843
|
-
|
|
46844
|
-
|
|
46845
|
-
|
|
46846
|
-
|
|
46847
|
-
|
|
46848
|
-
|
|
46849
|
-
|
|
46850
|
-
|
|
46851
|
-
|
|
46852
|
-
|
|
46853
|
-
|
|
46854
|
-
|
|
46855
|
-
|
|
46856
|
-
|
|
46857
|
-
|
|
46858
|
-
|
|
46859
|
-
|
|
46860
|
-
|
|
46861
|
-
|
|
46887
|
+
switch (mode) {
|
|
46888
|
+
case BRUSH_UPDATE_MODE.BUTTON.INCREASE:
|
|
46889
|
+
case BRUSH_UPDATE_MODE.BUTTON.DECREASE:
|
|
46890
|
+
this.brushRectWidth = brushCanvasWidth * pixelRatio;
|
|
46891
|
+
|
|
46892
|
+
if (this.curBrushButtonType === BUTTON_TYPE.LEFT) {
|
|
46893
|
+
this.brushRectWidth = this.beforeBrushRectWidth ? this.beforeBrushRectWidth - offsetX : this.brushRectWidth - offsetX;
|
|
46894
|
+
|
|
46895
|
+
if (this.brushRectWidth <= brushButtonWidth) {
|
|
46896
|
+
this.brushRectWidth = brushButtonWidth;
|
|
46897
|
+
} else {
|
|
46898
|
+
this.brushRectX = offsetX * pixelRatio;
|
|
46899
|
+
this.beforeBrushRectX = this.brushRectX;
|
|
46900
|
+
}
|
|
46901
|
+
} else if (this.curBrushButtonType === BUTTON_TYPE.RIGHT) {
|
|
46902
|
+
this.brushRectWidth = offsetX - this.beforeBrushRectX;
|
|
46903
|
+
|
|
46904
|
+
if (this.brushRectWidth <= brushButtonWidth) {
|
|
46905
|
+
this.brushRectWidth = brushButtonWidth;
|
|
46906
|
+
} else {
|
|
46907
|
+
this.brushRectX = this.beforeBrushRectX;
|
|
46908
|
+
this.beforeBrushRectWidth = this.brushRectWidth + this.brushRectX;
|
|
46909
|
+
}
|
|
46910
|
+
}
|
|
46911
|
+
|
|
46912
|
+
break;
|
|
46913
|
+
|
|
46914
|
+
case BRUSH_UPDATE_MODE.GRAB.UP:
|
|
46915
|
+
case BRUSH_UPDATE_MODE.GRAB.DOWN:
|
|
46916
|
+
if (this.brushRectX <= 0 && mode === BRUSH_UPDATE_MODE.GRAB.DOWN || this.brushRectX + this.brushRectWidth >= brushCanvasWidth && mode === BRUSH_UPDATE_MODE.GRAB.UP) {
|
|
46917
|
+
this.offsetXAndRectXInterval = null;
|
|
46918
|
+
} else {
|
|
46919
|
+
if (!this.offsetXAndRectXInterval) {
|
|
46920
|
+
this.offsetXAndRectXInterval = offsetX - this.brushRectX;
|
|
46921
|
+
}
|
|
46922
|
+
|
|
46923
|
+
this.brushRectX = offsetX - this.offsetXAndRectXInterval;
|
|
46924
|
+
}
|
|
46925
|
+
|
|
46926
|
+
break;
|
|
46927
|
+
|
|
46928
|
+
default:
|
|
46929
|
+
if (!offsetX) {
|
|
46930
|
+
this.brushRectX = brushIdx.start * axesXInterval * pixelRatio;
|
|
46931
|
+
this.brushRectWidth = (brushCanvasWidth - (this.labelEndIdx - (brushIdx.end - brushIdx.start)) * axesXInterval) * pixelRatio;
|
|
46932
|
+
this.beforeBrushRectX = this.brushRectX;
|
|
46933
|
+
this.beforeBrushRectWidth = this.brushRectWidth + this.brushRectX;
|
|
46934
|
+
}
|
|
46935
|
+
|
|
46936
|
+
break;
|
|
46862
46937
|
}
|
|
46938
|
+
|
|
46939
|
+
return {
|
|
46940
|
+
brushRectX: this.brushRectX,
|
|
46941
|
+
brushRectWidth: this.brushRectWidth
|
|
46942
|
+
};
|
|
46943
|
+
}
|
|
46944
|
+
}, {
|
|
46945
|
+
key: "drawBrush",
|
|
46946
|
+
value: function drawBrush(canvasPosInfo, brushPosInfo, evChartRange, brushCanvas) {
|
|
46947
|
+
var brushButtonWidth = canvasPosInfo.brushButtonWidth,
|
|
46948
|
+
brushCanvasHeight = canvasPosInfo.brushCanvasHeight,
|
|
46949
|
+
brushCanvasWidth = canvasPosInfo.brushCanvasWidth,
|
|
46950
|
+
axesXInterval = canvasPosInfo.axesXInterval,
|
|
46951
|
+
pixelRatio = canvasPosInfo.pixelRatio;
|
|
46952
|
+
var brushRectX = brushPosInfo.brushRectX,
|
|
46953
|
+
brushRectWidth = brushPosInfo.brushRectWidth;
|
|
46954
|
+
var _this$evChartBrushOpt = this.evChartBrushOptions.value,
|
|
46955
|
+
height = _this$evChartBrushOpt.height,
|
|
46956
|
+
_this$evChartBrushOpt2 = _this$evChartBrushOpt.selection,
|
|
46957
|
+
fillColor = _this$evChartBrushOpt2.fillColor,
|
|
46958
|
+
opacity = _this$evChartBrushOpt2.opacity;
|
|
46959
|
+
var brushRectHeight = height - evChartRange.y1;
|
|
46960
|
+
var brushButtonLeftXPos = brushRectX;
|
|
46961
|
+
var brushButtonRightXPos = brushRectX + brushRectWidth;
|
|
46962
|
+
|
|
46963
|
+
if (!brushCanvas.style.position) {
|
|
46964
|
+
brushCanvas.style.position = 'absolute';
|
|
46965
|
+
brushCanvas.style.top = "".concat(evChartRange.y1, "px");
|
|
46966
|
+
brushCanvas.style.left = "".concat(evChartRange.x1 - brushButtonWidth / 2, "px");
|
|
46967
|
+
}
|
|
46968
|
+
|
|
46969
|
+
if (!this.isEqualWidth) {
|
|
46970
|
+
brushCanvas.width = brushCanvasWidth * pixelRatio;
|
|
46971
|
+
brushCanvas.style.width = "".concat(brushCanvasWidth, "px");
|
|
46972
|
+
brushCanvas.height = brushCanvasHeight * pixelRatio;
|
|
46973
|
+
brushCanvas.style.height = "".concat(brushCanvasHeight, "px");
|
|
46974
|
+
}
|
|
46975
|
+
|
|
46976
|
+
var ctx = brushCanvas.getContext('2d');
|
|
46977
|
+
ctx.clearRect(0, 0, brushCanvasWidth * pixelRatio, brushCanvasHeight * pixelRatio);
|
|
46978
|
+
ctx.fillStyle = fillColor;
|
|
46979
|
+
ctx.globalAlpha = opacity;
|
|
46980
|
+
ctx.fillRect(brushRectX, 0, brushRectWidth, brushRectHeight);
|
|
46981
|
+
ctx.fillRect(brushButtonLeftXPos, 0, brushButtonWidth, brushRectHeight);
|
|
46982
|
+
ctx.fillRect(brushButtonRightXPos - brushButtonWidth, 0, brushButtonWidth, brushRectHeight);
|
|
46983
|
+
this.brushPosInfo = _objectSpread2(_objectSpread2({
|
|
46984
|
+
leftX: brushButtonLeftXPos / pixelRatio,
|
|
46985
|
+
rightX: brushButtonRightXPos / pixelRatio,
|
|
46986
|
+
buttonWidth: brushButtonWidth,
|
|
46987
|
+
axesXInterval: axesXInterval
|
|
46988
|
+
}, canvasPosInfo), brushPosInfo);
|
|
46863
46989
|
}
|
|
46864
46990
|
}, {
|
|
46865
46991
|
key: "addEvent",
|
|
@@ -46894,8 +47020,19 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
46894
47020
|
|
|
46895
47021
|
this.onWheel = function (e) {
|
|
46896
47022
|
e.preventDefault();
|
|
47023
|
+
var mode = e.deltaY > 0 ? BRUSH_UPDATE_MODE.WHEEL.DOWN : BRUSH_UPDATE_MODE.WHEEL.UP;
|
|
47024
|
+
|
|
47025
|
+
_this.updateBrushIdx(mode);
|
|
46897
47026
|
|
|
46898
|
-
_this.
|
|
47027
|
+
if (_this.debounceBrushIdx) {
|
|
47028
|
+
_this.drawBrushRect({
|
|
47029
|
+
brushCanvas: _this.brushCanvas,
|
|
47030
|
+
isDebounce: true,
|
|
47031
|
+
mode: mode
|
|
47032
|
+
});
|
|
47033
|
+
}
|
|
47034
|
+
|
|
47035
|
+
_this.brushIdx.isUseScroll = true;
|
|
46899
47036
|
};
|
|
46900
47037
|
|
|
46901
47038
|
this.onMouseUp = function () {
|
|
@@ -46921,23 +47058,23 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
46921
47058
|
var _this2 = this;
|
|
46922
47059
|
|
|
46923
47060
|
var calDisToCurMouseX = function calDisToCurMouseX(xPos) {
|
|
46924
|
-
return Math.abs(_this2.
|
|
47061
|
+
return Math.abs(_this2.brushPosInfo[xPos] - e.offsetX);
|
|
46925
47062
|
};
|
|
46926
47063
|
|
|
46927
|
-
var buttonType = calDisToCurMouseX(
|
|
46928
|
-
this.curBrushButtonType = buttonType;
|
|
47064
|
+
var buttonType = calDisToCurMouseX(BUTTON_TYPE.RIGHT) > calDisToCurMouseX(BUTTON_TYPE.LEFT) ? BUTTON_TYPE.LEFT : BUTTON_TYPE.RIGHT;
|
|
46929
47065
|
|
|
46930
47066
|
var isMoveRight = function isMoveRight(xPos) {
|
|
46931
|
-
return e.offsetX > _this2.
|
|
47067
|
+
return e.offsetX > _this2.brushPosInfo[xPos];
|
|
46932
47068
|
};
|
|
46933
47069
|
|
|
46934
47070
|
var isMoveLeft = function isMoveLeft(xPos) {
|
|
46935
|
-
return e.offsetX < _this2.
|
|
47071
|
+
return e.offsetX < _this2.brushPosInfo[xPos];
|
|
46936
47072
|
};
|
|
46937
47073
|
|
|
46938
|
-
var isOutsideBrush = isMoveLeft(
|
|
46939
|
-
var isInsideBrush = isMoveRight(
|
|
46940
|
-
var isInsideButton = e.offsetX + this.
|
|
47074
|
+
var isOutsideBrush = isMoveLeft(BUTTON_TYPE.LEFT) || isMoveRight(BUTTON_TYPE.RIGHT);
|
|
47075
|
+
var isInsideBrush = isMoveRight(BUTTON_TYPE.LEFT) && isMoveLeft(BUTTON_TYPE.RIGHT);
|
|
47076
|
+
var isInsideButton = e.offsetX + this.brushPosInfo.buttonWidth >= this.brushPosInfo[buttonType] && e.offsetX - this.brushPosInfo.buttonWidth <= this.brushPosInfo[buttonType];
|
|
47077
|
+
this.curBrushButtonType = isInsideButton && buttonType;
|
|
46941
47078
|
return {
|
|
46942
47079
|
isInsideButton: isInsideButton,
|
|
46943
47080
|
isInsideBrush: isInsideBrush,
|
|
@@ -47009,18 +47146,18 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
47009
47146
|
|
|
47010
47147
|
if (middle > 0.5) {
|
|
47011
47148
|
if ((brushIdx.end - brushIdx.start) % 2 === 0) {
|
|
47012
|
-
clickIdx = Math.round(e.offsetX / this.
|
|
47149
|
+
clickIdx = Math.round(e.offsetX / this.brushPosInfo.axesXInterval);
|
|
47013
47150
|
left = Math.ceil(middle);
|
|
47014
47151
|
right = Math.floor(middle);
|
|
47015
47152
|
} else {
|
|
47016
|
-
clickIdx = Math.ceil(e.offsetX / this.
|
|
47153
|
+
clickIdx = Math.ceil(e.offsetX / this.brushPosInfo.axesXInterval);
|
|
47017
47154
|
left = Math.ceil(middle);
|
|
47018
47155
|
right = Math.floor(middle);
|
|
47019
47156
|
}
|
|
47020
47157
|
} else {
|
|
47021
|
-
clickIdx = Math.floor(e.offsetX / this.
|
|
47158
|
+
clickIdx = Math.floor(e.offsetX / this.brushPosInfo.axesXInterval);
|
|
47022
47159
|
|
|
47023
|
-
if (e.offsetX - clickIdx * this.
|
|
47160
|
+
if (e.offsetX - clickIdx * this.brushPosInfo.axesXInterval > this.brushPosInfo.axesXInterval / 2) {
|
|
47024
47161
|
left = Math.floor(middle);
|
|
47025
47162
|
right = Math.ceil(middle);
|
|
47026
47163
|
} else {
|
|
@@ -47062,40 +47199,53 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
47062
47199
|
}, {
|
|
47063
47200
|
key: "mouseDownAndMove",
|
|
47064
47201
|
value: function mouseDownAndMove(e) {
|
|
47065
|
-
var moveSensitive = this.
|
|
47202
|
+
var moveSensitive = this.debounceBrushIdx ? 0 : this.brushPosInfo.axesXInterval / 3;
|
|
47066
47203
|
var mode;
|
|
47067
47204
|
|
|
47068
47205
|
if (e.offsetX > this.beforeMouseXPos) {
|
|
47069
47206
|
// 오른쪽 이동
|
|
47070
47207
|
if (this.clickBrushInsideX > 0) {
|
|
47071
47208
|
if (this.clickBrushInsideX < e.offsetX - moveSensitive) {
|
|
47072
|
-
mode =
|
|
47209
|
+
mode = BRUSH_UPDATE_MODE.GRAB.UP;
|
|
47210
|
+
this.isUseBrushGrab = true;
|
|
47211
|
+
this.brushIdx.isUseScroll = true;
|
|
47073
47212
|
this.clickBrushInsideX = e.offsetX + moveSensitive;
|
|
47074
47213
|
}
|
|
47075
47214
|
} else {
|
|
47076
|
-
var isMoveRight = e.offsetX - this.
|
|
47215
|
+
var isMoveRight = e.offsetX - this.brushPosInfo[this.curBrushButtonType] > moveSensitive;
|
|
47077
47216
|
|
|
47078
47217
|
if (isMoveRight) {
|
|
47079
|
-
mode = this.curBrushButtonType ===
|
|
47218
|
+
mode = this.curBrushButtonType === BUTTON_TYPE.LEFT ? BRUSH_UPDATE_MODE.BUTTON.DECREASE : BRUSH_UPDATE_MODE.BUTTON.INCREASE;
|
|
47219
|
+
this.brushIdx.isUseButton = true;
|
|
47080
47220
|
}
|
|
47081
47221
|
}
|
|
47082
47222
|
} else if (e.offsetX < this.beforeMouseXPos) {
|
|
47083
47223
|
// 왼쪽 이동
|
|
47084
47224
|
if (this.clickBrushInsideX > 0) {
|
|
47085
47225
|
if (this.clickBrushInsideX > e.offsetX + moveSensitive) {
|
|
47086
|
-
mode =
|
|
47226
|
+
mode = BRUSH_UPDATE_MODE.GRAB.DOWN;
|
|
47227
|
+
this.isUseBrushGrab = true;
|
|
47228
|
+
this.brushIdx.isUseScroll = true;
|
|
47087
47229
|
this.clickBrushInsideX = e.offsetX - moveSensitive;
|
|
47088
47230
|
}
|
|
47089
47231
|
} else {
|
|
47090
|
-
var isMoveLeft = this.
|
|
47232
|
+
var isMoveLeft = this.brushPosInfo[this.curBrushButtonType] - e.offsetX > moveSensitive;
|
|
47091
47233
|
|
|
47092
47234
|
if (isMoveLeft) {
|
|
47093
|
-
mode = this.curBrushButtonType ===
|
|
47235
|
+
mode = this.curBrushButtonType === BUTTON_TYPE.LEFT ? BRUSH_UPDATE_MODE.BUTTON.INCREASE : BRUSH_UPDATE_MODE.BUTTON.DECREASE;
|
|
47236
|
+
this.brushIdx.isUseButton = true;
|
|
47094
47237
|
}
|
|
47095
47238
|
}
|
|
47096
47239
|
}
|
|
47097
47240
|
|
|
47098
|
-
if (
|
|
47241
|
+
if (this.debounceBrushIdx) {
|
|
47242
|
+
this.drawBrushRect({
|
|
47243
|
+
brushCanvas: this.brushCanvas,
|
|
47244
|
+
isDebounce: true,
|
|
47245
|
+
mode: mode,
|
|
47246
|
+
offsetX: e.offsetX
|
|
47247
|
+
});
|
|
47248
|
+
} else {
|
|
47099
47249
|
this.updateBrushIdx(mode);
|
|
47100
47250
|
}
|
|
47101
47251
|
|
|
@@ -47115,28 +47265,28 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
47115
47265
|
var brushIdx = (_this$debounceBrushId3 = this.debounceBrushIdx) !== null && _this$debounceBrushId3 !== void 0 ? _this$debounceBrushId3 : this.brushIdx;
|
|
47116
47266
|
|
|
47117
47267
|
switch (mode) {
|
|
47118
|
-
case
|
|
47119
|
-
|
|
47268
|
+
case BRUSH_UPDATE_MODE.WHEEL.UP:
|
|
47269
|
+
case BRUSH_UPDATE_MODE.GRAB.UP:
|
|
47270
|
+
if (brushIdx.end >= this.labelEndIdx) {
|
|
47120
47271
|
return;
|
|
47121
47272
|
}
|
|
47122
47273
|
|
|
47123
47274
|
brushIdx.start += 1;
|
|
47124
47275
|
brushIdx.end += 1;
|
|
47125
|
-
this.brushIdx.isUseScroll = true;
|
|
47126
47276
|
break;
|
|
47127
47277
|
|
|
47128
|
-
case
|
|
47129
|
-
|
|
47278
|
+
case BRUSH_UPDATE_MODE.WHEEL.DOWN:
|
|
47279
|
+
case BRUSH_UPDATE_MODE.GRAB.DOWN:
|
|
47280
|
+
if (brushIdx.start <= 0) {
|
|
47130
47281
|
return;
|
|
47131
47282
|
}
|
|
47132
47283
|
|
|
47133
47284
|
brushIdx.start -= 1;
|
|
47134
47285
|
brushIdx.end -= 1;
|
|
47135
|
-
this.brushIdx.isUseScroll = true;
|
|
47136
47286
|
break;
|
|
47137
47287
|
|
|
47138
|
-
case
|
|
47139
|
-
if (this.curBrushButtonType ===
|
|
47288
|
+
case BRUSH_UPDATE_MODE.BUTTON.INCREASE:
|
|
47289
|
+
if (this.curBrushButtonType === BUTTON_TYPE.LEFT) {
|
|
47140
47290
|
if (!brushIdx.start) {
|
|
47141
47291
|
return;
|
|
47142
47292
|
}
|
|
@@ -47150,37 +47300,104 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
47150
47300
|
brushIdx.end += 1;
|
|
47151
47301
|
}
|
|
47152
47302
|
|
|
47153
|
-
this.brushIdx.isUseButton = true;
|
|
47154
47303
|
break;
|
|
47155
47304
|
|
|
47156
|
-
case
|
|
47305
|
+
case BRUSH_UPDATE_MODE.BUTTON.DECREASE:
|
|
47157
47306
|
if (brushIdx.start === brushIdx.end - 1) {
|
|
47158
47307
|
return;
|
|
47159
47308
|
}
|
|
47160
47309
|
|
|
47161
|
-
if (this.curBrushButtonType ===
|
|
47310
|
+
if (this.curBrushButtonType === BUTTON_TYPE.LEFT) {
|
|
47162
47311
|
brushIdx.start += 1;
|
|
47163
47312
|
} else {
|
|
47164
47313
|
brushIdx.end -= 1;
|
|
47165
47314
|
}
|
|
47166
47315
|
|
|
47167
|
-
this.brushIdx.isUseButton = true;
|
|
47168
47316
|
break;
|
|
47169
47317
|
|
|
47170
47318
|
default:
|
|
47171
47319
|
break;
|
|
47172
47320
|
}
|
|
47321
|
+
}
|
|
47322
|
+
}, {
|
|
47323
|
+
key: "updateBrushIdxUseXPos",
|
|
47324
|
+
value: function updateBrushIdxUseXPos() {
|
|
47325
|
+
var _this3 = this;
|
|
47326
|
+
|
|
47327
|
+
if (!this.debounceBrushIdx) {
|
|
47328
|
+
return;
|
|
47329
|
+
}
|
|
47330
|
+
|
|
47331
|
+
var calculateBrushIdxByPos = function calculateBrushIdxByPos() {
|
|
47332
|
+
var brushStartIdx;
|
|
47333
|
+
var brushEndIdx;
|
|
47334
|
+
|
|
47335
|
+
if (_this3.brushPosInfo) {
|
|
47336
|
+
var _this3$brushPosInfo = _this3.brushPosInfo,
|
|
47337
|
+
brushRectX = _this3$brushPosInfo.brushRectX,
|
|
47338
|
+
brushRectWidth = _this3$brushPosInfo.brushRectWidth,
|
|
47339
|
+
brushCanvasWidth = _this3$brushPosInfo.brushCanvasWidth,
|
|
47340
|
+
axesXInterval = _this3$brushPosInfo.axesXInterval;
|
|
47341
|
+
|
|
47342
|
+
if (_this3.brushIdx.isUseButton || _this3.isUseBrushGrab) {
|
|
47343
|
+
brushStartIdx = brushRectX / axesXInterval;
|
|
47344
|
+
brushEndIdx = _this3.labelEndIdx - (brushCanvasWidth - (brushRectX + brushRectWidth)) / axesXInterval;
|
|
47345
|
+
|
|
47346
|
+
if (_this3.curBrushButtonType === BUTTON_TYPE.LEFT) {
|
|
47347
|
+
brushStartIdx = Math.round(brushStartIdx);
|
|
47348
|
+
brushEndIdx = _this3.brushIdx.end;
|
|
47349
|
+
|
|
47350
|
+
if (brushStartIdx === brushEndIdx) {
|
|
47351
|
+
brushStartIdx -= 1;
|
|
47352
|
+
}
|
|
47353
|
+
} else if (_this3.curBrushButtonType === BUTTON_TYPE.RIGHT) {
|
|
47354
|
+
brushStartIdx = _this3.brushIdx.start;
|
|
47355
|
+
brushEndIdx = Math.round(brushEndIdx);
|
|
47356
|
+
|
|
47357
|
+
if (brushStartIdx === brushEndIdx) {
|
|
47358
|
+
brushEndIdx += 1;
|
|
47359
|
+
}
|
|
47360
|
+
} else {
|
|
47361
|
+
brushStartIdx = Math.round(brushStartIdx);
|
|
47362
|
+
brushEndIdx = Math.round(brushEndIdx);
|
|
47363
|
+
}
|
|
47364
|
+
|
|
47365
|
+
if (brushEndIdx > _this3.labelEndIdx) {
|
|
47366
|
+
var excessIdx = brushEndIdx - _this3.labelEndIdx;
|
|
47367
|
+
brushStartIdx -= excessIdx;
|
|
47368
|
+
brushEndIdx -= excessIdx;
|
|
47369
|
+
}
|
|
47173
47370
|
|
|
47174
|
-
|
|
47371
|
+
if (brushStartIdx < 0) {
|
|
47372
|
+
var _excessIdx = Math.abs(brushStartIdx);
|
|
47373
|
+
|
|
47374
|
+
brushStartIdx = 0;
|
|
47375
|
+
brushEndIdx += _excessIdx;
|
|
47376
|
+
}
|
|
47377
|
+
}
|
|
47378
|
+
}
|
|
47379
|
+
|
|
47380
|
+
return {
|
|
47381
|
+
brushStartIdx: brushStartIdx,
|
|
47382
|
+
brushEndIdx: brushEndIdx
|
|
47383
|
+
};
|
|
47384
|
+
};
|
|
47385
|
+
|
|
47386
|
+
var _calculateBrushIdxByP = calculateBrushIdxByPos(),
|
|
47387
|
+
brushStartIdx = _calculateBrushIdxByP.brushStartIdx,
|
|
47388
|
+
brushEndIdx = _calculateBrushIdxByP.brushEndIdx;
|
|
47389
|
+
|
|
47390
|
+
if (this.brushIdx.start === brushStartIdx && this.brushIdx.end === brushEndIdx) {
|
|
47175
47391
|
this.drawBrushRect({
|
|
47176
|
-
brushCanvas: this.brushCanvas
|
|
47177
|
-
isResize: false,
|
|
47178
|
-
isDebounce: true
|
|
47392
|
+
brushCanvas: this.brushCanvas
|
|
47179
47393
|
});
|
|
47180
47394
|
}
|
|
47395
|
+
|
|
47396
|
+
this.brushIdx.start = brushStartIdx !== null && brushStartIdx !== void 0 ? brushStartIdx : this.debounceBrushIdx.start;
|
|
47397
|
+
this.brushIdx.end = brushEndIdx !== null && brushEndIdx !== void 0 ? brushEndIdx : this.debounceBrushIdx.end;
|
|
47181
47398
|
}
|
|
47182
47399
|
/**
|
|
47183
|
-
* @param {boolean}
|
|
47400
|
+
* @param {boolean} updateBrushIdxUseXPos to initialize state after update brush index value
|
|
47184
47401
|
*
|
|
47185
47402
|
* @returns {undefined}
|
|
47186
47403
|
*/
|
|
@@ -47188,23 +47405,22 @@ var chartBrush_core_EvChartBrush = /*#__PURE__*/function () {
|
|
|
47188
47405
|
}, {
|
|
47189
47406
|
key: "initEventState",
|
|
47190
47407
|
value: function initEventState() {
|
|
47191
|
-
var
|
|
47408
|
+
var _this4 = this;
|
|
47192
47409
|
|
|
47193
47410
|
var promise = new Promise(function (resolve) {
|
|
47194
|
-
|
|
47195
|
-
_this3.brushIdx.start = _this3.debounceBrushIdx.start;
|
|
47196
|
-
_this3.brushIdx.end = _this3.debounceBrushIdx.end;
|
|
47197
|
-
}
|
|
47411
|
+
_this4.updateBrushIdxUseXPos();
|
|
47198
47412
|
|
|
47199
47413
|
resolve(true);
|
|
47200
47414
|
});
|
|
47201
47415
|
promise.then(function (isUpdateBrushIdx) {
|
|
47202
47416
|
if (isUpdateBrushIdx) {
|
|
47203
|
-
|
|
47204
|
-
|
|
47205
|
-
|
|
47206
|
-
|
|
47207
|
-
|
|
47417
|
+
_this4.clickBrushInsideX = null;
|
|
47418
|
+
_this4.beforeMouseXPos = null;
|
|
47419
|
+
_this4.curBrushButtonType = null;
|
|
47420
|
+
_this4.isUseBrushGrab = false;
|
|
47421
|
+
_this4.offsetXAndRectXInterval = null;
|
|
47422
|
+
_this4.brushIdx.isUseButton = false;
|
|
47423
|
+
_this4.brushIdx.isUseScroll = false;
|
|
47208
47424
|
}
|
|
47209
47425
|
});
|
|
47210
47426
|
}
|