@@ -209,7 +209,7 @@ export class ScrollbarDirective implements AfterViewInit, OnDestroy, OnChanges {
209
209
horizontalTrackbar . thickness = this . _calcThicknessBar ( Axis . X ) ;
210
210
horizontalTrackbar . bar = new Bar ( ) ;
211
211
horizontalTrackbar . bar . element = this . _horizontalBarElement ;
212
- horizontalTrackbar . bar . size = this . _calcSizeBar ( Axis . X ) ;
212
+ horizontalTrackbar . bar . size = this . _calcSizeBar ( Axis . X , horizontalTrackbar . thickness ) ;
213
213
horizontalTrackbar . bar . offset = this . _calcPositionBar ( Axis . X , horizontalTrackbar . bar . size ) ;
214
214
this . _model . scrollbar . trackbars . push ( horizontalTrackbar ) ;
215
215
@@ -219,7 +219,7 @@ export class ScrollbarDirective implements AfterViewInit, OnDestroy, OnChanges {
219
219
verticalTrackbar . thickness = this . _calcThicknessBar ( Axis . Y ) ;
220
220
verticalTrackbar . bar = new Bar ( ) ;
221
221
verticalTrackbar . bar . element = this . _verticalBarElement ;
222
- verticalTrackbar . bar . size = this . _calcSizeBar ( Axis . Y ) ;
222
+ verticalTrackbar . bar . size = this . _calcSizeBar ( Axis . Y , verticalTrackbar . thickness ) ;
223
223
verticalTrackbar . bar . offset = this . _calcPositionBar ( Axis . Y , verticalTrackbar . bar . size ) ;
224
224
this . _model . scrollbar . trackbars . push ( verticalTrackbar ) ;
225
225
}
@@ -376,8 +376,8 @@ export class ScrollbarDirective implements AfterViewInit, OnDestroy, OnChanges {
376
376
* @param offsetBottom - Bottom offset
377
377
*/
378
378
private _updateResizeContainerSize ( offsetRight : number , offsetBottom : number ) : void {
379
- this . _renderer . setStyle ( this . _resizeElement , 'height' , `calc(100% - ${ offsetBottom } px)` ) ;
380
- this . _renderer . setStyle ( this . _resizeElement , 'width' , `calc(100% - ${ offsetRight } px)` ) ;
379
+ this . _renderer . setStyle ( this . _resizeElement , 'min- height' , `calc(100% - ${ offsetBottom } px)` ) ;
380
+ this . _renderer . setStyle ( this . _resizeElement , 'min- width' , `calc(100% - ${ offsetRight } px)` ) ;
381
381
}
382
382
383
383
/**
@@ -399,8 +399,8 @@ export class ScrollbarDirective implements AfterViewInit, OnDestroy, OnChanges {
399
399
* @param offsetBottom - Bottom offset
400
400
*/
401
401
private _hideNativeScrollbar ( offsetRight : number , offsetBottom : number ) : void {
402
- this . _renderer . setStyle ( this . _offsetElement , 'right' , `-${ offsetRight } px` ) ;
403
- this . _renderer . setStyle ( this . _offsetElement , 'bottom' , `-${ offsetBottom } px` ) ;
402
+ this . _renderer . setStyle ( this . _offsetElement , 'right' , `-${ offsetRight + 1 } px` ) ;
403
+ this . _renderer . setStyle ( this . _offsetElement , 'bottom' , `-${ offsetBottom + 1 } px` ) ;
404
404
}
405
405
406
406
/**
@@ -448,15 +448,15 @@ export class ScrollbarDirective implements AfterViewInit, OnDestroy, OnChanges {
448
448
* @param axis - X for horizontal, Y for vertical
449
449
* @returns size.
450
450
*/
451
- private _calcSizeBar ( axis : Axis ) : number {
452
- const contentSize = axis === Axis . X ? ( < any > this . _contentElement ) . scrollWidth : ( < any > this . _contentElement ) . scrollHeight ;
451
+ private _calcSizeBar ( axis : Axis , offset : number ) : number {
452
+ const contentSize = axis === Axis . X ? ( < any > this . _contentElement ) . scrollWidth - offset : ( < any > this . _contentElement ) . scrollHeight - offset ;
453
453
const hostSize = axis === Axis . X ? ( < any > this . _element . nativeElement ) . clientWidth : ( < any > this . _element . nativeElement ) . clientHeight ;
454
454
455
455
if ( hostSize + 1 >= contentSize || contentSize === 0 ) {
456
456
return 0 ;
457
457
}
458
458
459
- const sizeBar = ~ ~ ( ( hostSize * hostSize ) / contentSize ) ;
459
+ const sizeBar = ~ ~ ( ( hostSize * hostSize ) / ( contentSize + offset ) ) ;
460
460
461
461
if ( this . _config . barMaxSize > 0 && sizeBar > this . _config . barMaxSize ) {
462
462
return this . _config . barMaxSize ;
@@ -477,11 +477,11 @@ export class ScrollbarDirective implements AfterViewInit, OnDestroy, OnChanges {
477
477
this . _contentElement [ 'offsetHeight' ] - this . _contentElement [ 'clientHeight' ] ;
478
478
479
479
if ( thickness > this . _config . trackbarMaxThickness ) {
480
- return this . _config . trackbarMaxThickness + 1 ;
480
+ return this . _config . trackbarMaxThickness ;
481
481
} else if ( thickness < this . _config . trackbarMinThickness ) {
482
- return this . _config . trackbarMinThickness + 1 ;
482
+ return this . _config . trackbarMinThickness ;
483
483
} else {
484
- return thickness + 1 ;
484
+ return thickness ;
485
485
}
486
486
}
487
487
0 commit comments