@@ -4,7 +4,7 @@ import {NG_VALUE_ACCESSOR} from '@angular/common';
4
4
import { Form } from '../../util/form' ;
5
5
import { isTrueProperty , isNumber , isString , isPresent , clamp } from '../../util/util' ;
6
6
import { Item } from '../item/item' ;
7
- import { pointerCoord , Coordinates } from '../../util/dom' ;
7
+ import { pointerCoord , Coordinates , raf } from '../../util/dom' ;
8
8
9
9
10
10
const RANGE_VALUE_ACCESSOR = new Provider (
@@ -343,11 +343,11 @@ export class Range {
343
343
this . _renderer . setElementStyle ( this . _bar . nativeElement , 'left' , barL ) ;
344
344
this . _renderer . setElementStyle ( this . _bar . nativeElement , 'right' , barR ) ;
345
345
346
- this . createTicks ( ) ;
347
-
348
346
// add touchstart/mousedown listeners
349
347
this . _renderer . listen ( this . _slider . nativeElement , 'touchstart' , this . pointerDown . bind ( this ) ) ;
350
348
this . _mouseRemove = this . _renderer . listen ( this . _slider . nativeElement , 'mousedown' , this . pointerDown . bind ( this ) ) ;
349
+
350
+ this . createTicks ( ) ;
351
351
}
352
352
353
353
/**
@@ -544,18 +544,18 @@ export class Range {
544
544
*/
545
545
createTicks ( ) {
546
546
if ( this . _snaps ) {
547
- this . _ticks = [ ] ;
548
- for ( var value = this . _min ; value <= this . _max ; value += this . _step ) {
549
- var ratio = this . valueToRatio ( value ) ;
550
- this . _ticks . push ( {
551
- ratio : ratio ,
552
- left : ` ${ ratio * 100 } %` ,
553
- } ) ;
554
- }
555
- this . updateTicks ( ) ;
556
-
557
- } else {
558
- this . _ticks = null ;
547
+ raf ( ( ) => {
548
+ // TODO: Fix to not use RAF
549
+ this . _ticks = [ ] ;
550
+ for ( var value = this . _min ; value <= this . _max ; value += this . _step ) {
551
+ var ratio = this . valueToRatio ( value ) ;
552
+ this . _ticks . push ( {
553
+ ratio : ratio ,
554
+ left : ` ${ ratio * 100 } %` ,
555
+ } ) ;
556
+ }
557
+ this . updateTicks ( ) ;
558
+ } ) ;
559
559
}
560
560
}
561
561
0 commit comments