@@ -148,30 +148,33 @@ export class DataZoom<T extends IDataZoomSpec = IDataZoomSpec> extends DataFilte
148148 defaultSize + this . _startHandlerSize / 2
149149 ] ;
150150
151+ const compWidth = this . _computeWidth ( ) ;
152+ const compHeight = this . _computeHeight ( ) ;
153+
151154 if ( this . _isHorizontal ) {
152155 stateScaleRange = this . _visible
153- ? [ this . _startHandlerSize / 2 , this . _computeWidth ( ) - handlerSize + this . _startHandlerSize / 2 ]
156+ ? [ this . _startHandlerSize / 2 , compWidth - handlerSize + this . _startHandlerSize / 2 ]
154157 : defaultRange ;
155158 this . _stateScale . range ( stateScaleRange ) ;
156- this . _valueScale . range ( [ this . _computeHeight ( ) - this . _middleHandlerSize , 0 ] ) ;
157- } else if ( this . layoutOrient === 'left' ) {
158- stateScaleRange = this . _visible
159- ? [ this . _startHandlerSize / 2 , this . _computeHeight ( ) - handlerSize + this . _startHandlerSize / 2 ]
160- : defaultRange ;
161- this . _stateScale . range ( stateScaleRange ) ;
162- this . _valueScale . range ( [ this . _computeWidth ( ) - this . _middleHandlerSize , 0 ] ) ;
159+ this . _valueScale . range ( [ compHeight - this . _middleHandlerSize , 0 ] ) ;
163160 } else {
164161 stateScaleRange = this . _visible
165- ? [ this . _startHandlerSize / 2 , this . _computeHeight ( ) - handlerSize + this . _startHandlerSize / 2 ]
162+ ? [ this . _startHandlerSize / 2 , compHeight - handlerSize + this . _startHandlerSize / 2 ]
166163 : defaultRange ;
164+
167165 this . _stateScale . range ( stateScaleRange ) ;
168- this . _valueScale . range ( [ 0 , this . _computeWidth ( ) - this . _middleHandlerSize ] ) ;
166+
167+ if ( this . layoutOrient === 'left' ) {
168+ this . _valueScale . range ( [ compWidth - this . _middleHandlerSize , 0 ] ) ;
169+ } else {
170+ this . _valueScale . range ( [ 0 , compWidth - this . _middleHandlerSize ] ) ;
171+ }
169172 }
170173 if ( this . _component && this . _cacheVisibility !== false ) {
171174 this . _component . setAttributes ( {
172175 size : {
173- width : this . _computeWidth ( ) ,
174- height : this . _computeHeight ( )
176+ width : compWidth ,
177+ height : compHeight
175178 } ,
176179 position : {
177180 x : this . getLayoutStartPoint ( ) . x ,
@@ -226,7 +229,7 @@ export class DataZoom<T extends IDataZoomSpec = IDataZoomSpec> extends DataFilte
226229 if ( this . _isHorizontal ) {
227230 return this . _backgroundSize + this . _middleHandlerSize ;
228231 }
229- return this . getLayoutRect ( ) . height - ( this . _startHandlerSize + this . _endHandlerSize ) / 2 ;
232+ return this . getLayoutRect ( ) . height ;
230233 }
231234
232235 protected _isScaleValid ( scale : IBaseScale | ILinearScale ) {
@@ -287,8 +290,8 @@ export class DataZoom<T extends IDataZoomSpec = IDataZoomSpec> extends DataFilte
287290 } ,
288291 orient : this . _orient ,
289292 size : {
290- width : this . getLayoutRect ( ) . width ,
291- height : this . getLayoutRect ( ) . height
293+ width : this . _computeWidth ( ) ,
294+ height : this . _computeHeight ( )
292295 } ,
293296 showDetail : spec . showDetail ,
294297 brushSelect : spec . brushSelect ?? false ,
@@ -313,6 +316,7 @@ export class DataZoom<T extends IDataZoomSpec = IDataZoomSpec> extends DataFilte
313316 const isNeedPreview =
314317 this . _isScaleValid ( xScale ) && this . _isScaleValid ( yScale ) && this . _spec . showBackgroundChart !== false ;
315318 const attrs = this . _getAttrs ( isNeedPreview ) ;
319+
316320 if ( this . _component ) {
317321 this . _component . setAttributes ( attrs ) ;
318322 } else {
0 commit comments