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(); } 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 +