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