@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
55} ) ;
66exports . default = void 0 ;
77
8+ var _bowser = _interopRequireDefault ( require ( "bowser" ) ) ;
9+
810var _propTypes = _interopRequireDefault ( require ( "prop-types" ) ) ;
911
1012var _react = _interopRequireDefault ( require ( "react" ) ) ;
@@ -53,6 +55,9 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
5355
5456function _defineProperty ( obj , key , value ) { if ( key in obj ) { Object . defineProperty ( obj , key , { value : value , enumerable : true , configurable : true , writable : true } ) ; } else { obj [ key ] = value ; } return obj ; }
5557
58+ var browser = global . window && global . window . navigator && _bowser . default . getParser ( global . window . navigator . userAgent ) ;
59+
60+ var engine = browser && browser . getEngine ( ) . name ;
5661var defaultStyles = {
5762 holder : {
5863 position : "relative" ,
@@ -272,7 +277,18 @@ function (_React$Component) {
272277
273278 if ( params . axis === _Track . TYPE_X ) {
274279 _this . props . thumbXProps . onDrag && _this . props . thumbXProps . onDrag ( params ) ;
275- _this . contentEl . scrollLeft = Scrollbar . computeScrollForOffset ( ( 0 , _getInnerSizes . getInnerWidth ) ( _this . trackXEl ) , _this . thumbXEl . clientWidth , params . offset , _this . contentEl . scrollWidth , _this . contentEl . clientWidth ) ;
280+ var trackWidth = ( 0 , _getInnerSizes . getInnerWidth ) ( _this . trackXEl ) ;
281+ var offset = params . offset ;
282+
283+ if ( _this . state . isRtl ) {
284+ if ( engine === "Trident" || engine === "EdgeHTML" ) {
285+ offset = trackWidth - offset ;
286+ } else if ( engine !== "Blink" ) {
287+ offset -= _this . thumbXEl . clientWidth / 2 ;
288+ }
289+ }
290+
291+ _this . contentEl . scrollLeft = Scrollbar . computeScrollForOffset ( trackWidth , _this . thumbXEl . clientWidth , offset , _this . contentEl . scrollWidth , _this . contentEl . clientWidth ) ;
276292 }
277293
278294 if ( params . axis === _Track . TYPE_Y ) {
@@ -304,11 +320,15 @@ function (_React$Component) {
304320 }
305321
306322 if ( this . props . scrollTop !== prevProps . scrollTop ) {
307- this . contentEl . scrollTop = this . props . scrollTop || 0 ;
323+ if ( typeof this . props . scrollTop !== "undefined" ) {
324+ this . contentEl . scrollTop = this . props . scrollTop ;
325+ }
308326 }
309327
310328 if ( this . props . scrollLeft !== prevProps . scrollLeft ) {
311- this . contentEl . scrollLeft = this . props . scrollLeft || 0 ;
329+ if ( typeof this . props . scrollLeft !== "undefined" ) {
330+ this . contentEl . scrollLeft = this . props . scrollLeft ;
331+ }
312332 }
313333 }
314334 } , {
@@ -319,8 +339,15 @@ function (_React$Component) {
319339 this . contentEl . addEventListener ( "scroll" , this . handleScrollEvent , {
320340 passive : true
321341 } ) ;
322- this . contentEl . scrollTop = this . props . scrollTop || 0 ;
323- this . contentEl . scrollLeft = this . props . scrollLeft || 0 ;
342+
343+ if ( typeof this . props . scrollTop !== "undefined" ) {
344+ this . contentEl . scrollTop = this . props . scrollTop ;
345+ }
346+
347+ if ( typeof this . props . scrollLeft !== "undefined" ) {
348+ this . contentEl . scrollLeft = this . props . scrollLeft ;
349+ }
350+
324351 this . update ( ) ;
325352 }
326353 } , {
@@ -542,7 +569,11 @@ function (_React$Component) {
542569 var _thumbOffset = Scrollbar . computeThumbOffset ( _trackSize , _thumbSize , scrollValues . scrollWidth , scrollValues . clientWidth , scrollValues . scrollLeft ) ;
543570
544571 if ( this . state . isRtl ) {
545- _thumbOffset = _thumbSize + _thumbOffset - _trackSize ;
572+ if ( engine === "Blink" ) {
573+ _thumbOffset = _thumbSize + _thumbOffset - _trackSize ;
574+ } else if ( engine === "Trident" || engine === "EdgeHTML" ) {
575+ _thumbOffset *= - 1 ;
576+ }
546577 }
547578
548579 this . thumbXEl . style . transform = "translateX(" . concat ( _thumbOffset , "px)" ) ;
0 commit comments