@@ -348,7 +348,7 @@ export class MatSlider extends _MatSliderMixinBase
348
348
get _trackBackgroundStyles ( ) : { [ key : string ] : string } {
349
349
const axis = this . vertical ? 'Y' : 'X' ;
350
350
const scale = this . vertical ? `1, ${ 1 - this . percent } , 1` : `${ 1 - this . percent } , 1, 1` ;
351
- const sign = this . _invertMouseCoords ? '-' : '' ;
351
+ const sign = this . _shouldInvertMouseCoords ( ) ? '-' : '' ;
352
352
353
353
return {
354
354
// scale3d avoids some rendering issues in Chrome. See #12071.
@@ -360,7 +360,7 @@ export class MatSlider extends _MatSliderMixinBase
360
360
get _trackFillStyles ( ) : { [ key : string ] : string } {
361
361
const axis = this . vertical ? 'Y' : 'X' ;
362
362
const scale = this . vertical ? `1, ${ this . percent } , 1` : `${ this . percent } , 1, 1` ;
363
- const sign = this . _invertMouseCoords ? '' : '-' ;
363
+ const sign = this . _shouldInvertMouseCoords ( ) ? '' : '-' ;
364
364
365
365
return {
366
366
// scale3d avoids some rendering issues in Chrome. See #12071.
@@ -373,7 +373,7 @@ export class MatSlider extends _MatSliderMixinBase
373
373
let axis = this . vertical ? 'Y' : 'X' ;
374
374
// For a horizontal slider in RTL languages we push the ticks container off the left edge
375
375
// instead of the right edge to avoid causing a horizontal scrollbar to appear.
376
- let sign = ! this . vertical && this . _direction == 'rtl' ? '' : '-' ;
376
+ let sign = ! this . vertical && this . _getDirection ( ) == 'rtl' ? '' : '-' ;
377
377
let offset = this . _tickIntervalPercent / 2 * 100 ;
378
378
return {
379
379
'transform' : `translate${ axis } (${ sign } ${ offset } %)`
@@ -388,8 +388,8 @@ export class MatSlider extends _MatSliderMixinBase
388
388
// Depending on the direction we pushed the ticks container, push the ticks the opposite
389
389
// direction to re-center them but clip off the end edge. In RTL languages we need to flip the
390
390
// ticks 180 degrees so we're really cutting off the end edge abd not the start.
391
- let sign = ! this . vertical && this . _direction == 'rtl' ? '-' : '' ;
392
- let rotate = ! this . vertical && this . _direction == 'rtl' ? ' rotate(180deg)' : '' ;
391
+ let sign = ! this . vertical && this . _getDirection ( ) == 'rtl' ? '-' : '' ;
392
+ let rotate = ! this . vertical && this . _getDirection ( ) == 'rtl' ? ' rotate(180deg)' : '' ;
393
393
let styles : { [ key : string ] : string } = {
394
394
'backgroundSize' : backgroundSize ,
395
395
// Without translateZ ticks sometimes jitter as the slider moves on Chrome & Firefox.
@@ -411,7 +411,7 @@ export class MatSlider extends _MatSliderMixinBase
411
411
// For a horizontal slider in RTL languages we push the thumb container off the left edge
412
412
// instead of the right edge to avoid causing a horizontal scrollbar to appear.
413
413
let invertOffset =
414
- ( this . _direction == 'rtl' && ! this . vertical ) ? ! this . _invertAxis : this . _invertAxis ;
414
+ ( this . _getDirection ( ) == 'rtl' && ! this . vertical ) ? ! this . _invertAxis : this . _invertAxis ;
415
415
let offset = ( invertOffset ? this . percent : 1 - this . percent ) * 100 ;
416
416
return {
417
417
'transform' : `translate${ axis } (-${ offset } %)`
@@ -442,12 +442,12 @@ export class MatSlider extends _MatSliderMixinBase
442
442
* Whether mouse events should be converted to a slider position by calculating their distance
443
443
* from the right or bottom edge of the slider as opposed to the top or left.
444
444
*/
445
- private get _invertMouseCoords ( ) {
446
- return ( this . _direction == 'rtl' && ! this . vertical ) ? ! this . _invertAxis : this . _invertAxis ;
445
+ private _shouldInvertMouseCoords ( ) {
446
+ return ( this . _getDirection ( ) == 'rtl' && ! this . vertical ) ? ! this . _invertAxis : this . _invertAxis ;
447
447
}
448
448
449
449
/** The language direction for this slider element. */
450
- private get _direction ( ) {
450
+ private _getDirection ( ) {
451
451
return ( this . _dir && this . _dir . value == 'rtl' ) ? 'rtl' : 'ltr' ;
452
452
}
453
453
@@ -597,14 +597,14 @@ export class MatSlider extends _MatSliderMixinBase
597
597
// expect left to mean increment. Therefore we flip the meaning of the side arrow keys for
598
598
// RTL. For inverted sliders we prefer a good a11y experience to having it "look right" for
599
599
// sighted users, therefore we do not swap the meaning.
600
- this . _increment ( this . _direction == 'rtl' ? 1 : - 1 ) ;
600
+ this . _increment ( this . _getDirection ( ) == 'rtl' ? 1 : - 1 ) ;
601
601
break ;
602
602
case UP_ARROW :
603
603
this . _increment ( 1 ) ;
604
604
break ;
605
605
case RIGHT_ARROW :
606
606
// See comment on LEFT_ARROW about the conditions under which we flip the meaning.
607
- this . _increment ( this . _direction == 'rtl' ? - 1 : 1 ) ;
607
+ this . _increment ( this . _getDirection ( ) == 'rtl' ? - 1 : 1 ) ;
608
608
break ;
609
609
case DOWN_ARROW :
610
610
this . _increment ( - 1 ) ;
@@ -646,7 +646,7 @@ export class MatSlider extends _MatSliderMixinBase
646
646
// The exact value is calculated from the event and used to find the closest snap value.
647
647
let percent = this . _clamp ( ( posComponent - offset ) / size ) ;
648
648
649
- if ( this . _invertMouseCoords ) {
649
+ if ( this . _shouldInvertMouseCoords ( ) ) {
650
650
percent = 1 - percent ;
651
651
}
652
652
0 commit comments