From d73c4dbaf22221decef8e097051384d38435b961 Mon Sep 17 00:00:00 2001 From: sz-p Date: Thu, 12 Mar 2026 10:58:34 +0800 Subject: [PATCH 1/2] fix: fix(dataZoom): data zoom length should take the handle icon width into account #20686 --- src/component/dataZoom/SliderZoomView.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/component/dataZoom/SliderZoomView.ts b/src/component/dataZoom/SliderZoomView.ts index 30422c9c52..384fb5b321 100644 --- a/src/component/dataZoom/SliderZoomView.ts +++ b/src/component/dataZoom/SliderZoomView.ts @@ -297,8 +297,14 @@ class SliderZoomView extends DataZoomView { const rectX = isNaN(rect.x) ? 0 : rect.x; const rectY = isNaN(rect.y) ? 0 : rect.y; - thisGroup.x = location.x - rectX; - thisGroup.y = location.y - rectY; + // there is only scaleX on sliderGroup. + thisGroup.scaleX = this._size[0] / rect.width; + // scaleY on sliderGroup is a bad idea. + // Because of the moveHandleSize maybe greater than zoom bar height. + // clip is better than scale hard. + const scaleY = this._size[1] / rect.height; + thisGroup.x = location.x - rectX * thisGroup.scaleX; + thisGroup.y = location.y - rectY * scaleY; thisGroup.markRedraw(); } From 08b9fa178ac7e8cbd2918f0e6f74896cdbab1eda Mon Sep 17 00:00:00 2001 From: sz-p Date: Thu, 12 Mar 2026 10:59:00 +0800 Subject: [PATCH 2/2] fix: test(dataZoom): data zoom length should take the handle icon width into account #20686 --- test/dataZoom-clip.html | 51 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/test/dataZoom-clip.html b/test/dataZoom-clip.html index b360ee9716..8a120739f9 100644 --- a/test/dataZoom-clip.html +++ b/test/dataZoom-clip.html @@ -39,6 +39,7 @@
+
@@ -290,6 +291,54 @@ + + @@ -298,4 +347,4 @@ - \ No newline at end of file +