@dexteel/mesf-core 7.10.0 → 7.10.1
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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +7 -0
- package/dist/index.esm.js +63 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [7.10.1](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v7.10.0...@dexteel/mesf-core-v7.10.1) (2025-12-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **trendings-v2:** anchor zoom to mouse cursor position ([d3b959a](https://github.com/dexteel/mesf-core-frontend/commit/d3b959ae547ef6c0db0faa3e5f35c706844617e7))
|
|
9
|
+
|
|
3
10
|
## [7.10.0](https://github.com/dexteel/mesf-core-frontend/compare/@dexteel/mesf-core-v7.9.0...@dexteel/mesf-core-v7.10.0) (2025-12-29)
|
|
4
11
|
|
|
5
12
|
|
package/dist/index.esm.js
CHANGED
|
@@ -15908,7 +15908,7 @@ var TrendingChartV2 = function (_a) {
|
|
|
15908
15908
|
}); }), true);
|
|
15909
15909
|
})(),
|
|
15910
15910
|
dataZoom: __spreadArray([
|
|
15911
|
-
__assign({ type: "inside", xAxisIndex: useSeparateGrids ? [0, 1] : [0], zoomOnMouseWheel:
|
|
15911
|
+
__assign({ type: "inside", xAxisIndex: useSeparateGrids ? [0, 1] : [0], zoomOnMouseWheel: false, moveOnMouseMove: true, moveOnMouseWheel: false, preventDefaultMouseMove: false }, (zoomState ? { start: zoomState.start, end: zoomState.end } : {}))
|
|
15912
15912
|
], ([
|
|
15913
15913
|
__assign({ type: "slider", xAxisIndex: useSeparateGrids ? [0, 1] : [0], bottom: 3, height: 19, handleSize: "80%", showDetail: true, filterMode: "none" }, (zoomState
|
|
15914
15914
|
? { start: zoomState.start, end: zoomState.end }
|
|
@@ -16164,8 +16164,8 @@ var TrendingChartV2 = function (_a) {
|
|
|
16164
16164
|
return;
|
|
16165
16165
|
var handleKeyDown = function (e) {
|
|
16166
16166
|
var range = timeScopeEnd.getTime() - timeScopeStart.getTime();
|
|
16167
|
-
var smallStep = range * 0.01;
|
|
16168
|
-
var largeStep = range * 0.05;
|
|
16167
|
+
var smallStep = range * 0.01;
|
|
16168
|
+
var largeStep = range * 0.05;
|
|
16169
16169
|
var step = e.shiftKey ? largeStep : smallStep;
|
|
16170
16170
|
switch (e.key) {
|
|
16171
16171
|
case "ArrowLeft":
|
|
@@ -16192,7 +16192,6 @@ var TrendingChartV2 = function (_a) {
|
|
|
16192
16192
|
break;
|
|
16193
16193
|
case "Tab":
|
|
16194
16194
|
e.preventDefault();
|
|
16195
|
-
// Switch between cursors
|
|
16196
16195
|
setSelectedCursor(selectedCursor === "cursor1" ? "cursor2" : "cursor1");
|
|
16197
16196
|
break;
|
|
16198
16197
|
}
|
|
@@ -16209,6 +16208,66 @@ var TrendingChartV2 = function (_a) {
|
|
|
16209
16208
|
updateCursor2Time,
|
|
16210
16209
|
setSelectedCursor,
|
|
16211
16210
|
]);
|
|
16211
|
+
// Custom wheel zoom handler to correctly anchor zoom to mouse cursor position
|
|
16212
|
+
// ECharts' built-in zoom has a bug with multiple grids - it always uses the first grid's coordinates
|
|
16213
|
+
useEffect(function () {
|
|
16214
|
+
var _a;
|
|
16215
|
+
var echartsInstance = (_a = chartRef.current) === null || _a === void 0 ? void 0 : _a.getEchartsInstance();
|
|
16216
|
+
if (!echartsInstance || !chartArea)
|
|
16217
|
+
return;
|
|
16218
|
+
var zr = echartsInstance.getZr();
|
|
16219
|
+
if (!zr)
|
|
16220
|
+
return;
|
|
16221
|
+
var handleWheel = function (e) {
|
|
16222
|
+
var _a, _b;
|
|
16223
|
+
var wheelEvent = e.event;
|
|
16224
|
+
var mouseX = e.offsetX;
|
|
16225
|
+
if (mouseX < chartArea.left || mouseX > chartArea.right)
|
|
16226
|
+
return;
|
|
16227
|
+
wheelEvent.preventDefault();
|
|
16228
|
+
wheelEvent.stopPropagation();
|
|
16229
|
+
var option = echartsInstance.getOption();
|
|
16230
|
+
var dataZoomArray = option.dataZoom;
|
|
16231
|
+
if (!dataZoomArray || dataZoomArray.length === 0)
|
|
16232
|
+
return;
|
|
16233
|
+
var currentStart = (_a = dataZoomArray[0].start) !== null && _a !== void 0 ? _a : 0;
|
|
16234
|
+
var currentEnd = (_b = dataZoomArray[0].end) !== null && _b !== void 0 ? _b : 100;
|
|
16235
|
+
var fullRangeStart = timeScopeStart.getTime();
|
|
16236
|
+
var fullRangeEnd = timeScopeEnd.getTime();
|
|
16237
|
+
var fullRange = fullRangeEnd - fullRangeStart;
|
|
16238
|
+
var visibleStart = fullRangeStart + (fullRange * currentStart) / 100;
|
|
16239
|
+
var visibleEnd = fullRangeStart + (fullRange * currentEnd) / 100;
|
|
16240
|
+
var visibleRange = visibleEnd - visibleStart;
|
|
16241
|
+
var chartWidth = chartArea.right - chartArea.left;
|
|
16242
|
+
var mouseProgress = (mouseX - chartArea.left) / chartWidth;
|
|
16243
|
+
var mouseTimestamp = visibleStart + visibleRange * mouseProgress;
|
|
16244
|
+
var zoomFactor = wheelEvent.deltaY > 0 ? 1.2 : 1 / 1.2;
|
|
16245
|
+
var newVisibleRange = visibleRange * zoomFactor;
|
|
16246
|
+
var newVisibleStart = mouseTimestamp - newVisibleRange * mouseProgress;
|
|
16247
|
+
var newVisibleEnd = mouseTimestamp + newVisibleRange * (1 - mouseProgress);
|
|
16248
|
+
var newStart = ((newVisibleStart - fullRangeStart) / fullRange) * 100;
|
|
16249
|
+
var newEnd = ((newVisibleEnd - fullRangeStart) / fullRange) * 100;
|
|
16250
|
+
if (newStart < 0) {
|
|
16251
|
+
newEnd -= newStart;
|
|
16252
|
+
newStart = 0;
|
|
16253
|
+
}
|
|
16254
|
+
if (newEnd > 100) {
|
|
16255
|
+
newStart -= newEnd - 100;
|
|
16256
|
+
newEnd = 100;
|
|
16257
|
+
}
|
|
16258
|
+
newStart = Math.max(0, newStart);
|
|
16259
|
+
newEnd = Math.min(100, newEnd);
|
|
16260
|
+
echartsInstance.dispatchAction({
|
|
16261
|
+
type: "dataZoom",
|
|
16262
|
+
start: newStart,
|
|
16263
|
+
end: newEnd,
|
|
16264
|
+
});
|
|
16265
|
+
};
|
|
16266
|
+
zr.on("mousewheel", handleWheel);
|
|
16267
|
+
return function () {
|
|
16268
|
+
zr.off("mousewheel", handleWheel);
|
|
16269
|
+
};
|
|
16270
|
+
}, [chartArea, timeScopeStart, timeScopeEnd, chartInstance]);
|
|
16212
16271
|
return (React__default.createElement(Paper, { sx: { height: "100%", p: 1, position: "relative" } },
|
|
16213
16272
|
isLoading && (React__default.createElement("div", { style: {
|
|
16214
16273
|
position: "absolute",
|