@@ -52,8 +52,11 @@ export const MAT_SLIDE_TOGGLE_VALUE_ACCESSOR: any = {
52
52
53
53
/** Change event object emitted by a MatSlideToggle. */
54
54
export class MatSlideToggleChange {
55
- source : MatSlideToggle ;
56
- checked : boolean ;
55
+ constructor (
56
+ /** The source MatSlideToggle of the event. */
57
+ public source : MatSlideToggle ,
58
+ /** The new `checked` value of the MatSlideToggle. */
59
+ public checked : boolean ) { }
57
60
}
58
61
59
62
// Boilerplate for applying mixins to MatSlideToggle.
@@ -250,11 +253,8 @@ export class MatSlideToggle extends _MatSlideToggleMixinBase implements OnDestro
250
253
* Emits a change event on the `change` output. Also notifies the FormControl about the change.
251
254
*/
252
255
private _emitChangeEvent ( ) {
253
- let event = new MatSlideToggleChange ( ) ;
254
- event . source = this ;
255
- event . checked = this . checked ;
256
256
this . onChange ( this . checked ) ;
257
- this . change . emit ( event ) ;
257
+ this . change . emit ( new MatSlideToggleChange ( this , this . checked ) ) ;
258
258
}
259
259
260
260
_onDragStart ( ) {
@@ -353,7 +353,7 @@ class SlideToggleRenderer {
353
353
updateThumbPosition ( distance : number ) : void {
354
354
this . dragPercentage = this . _getDragPercentage ( distance ) ;
355
355
// Calculate the moved distance based on the thumb bar width.
356
- let dragX = ( this . dragPercentage / 100 ) * this . _thumbBarWidth ;
356
+ const dragX = ( this . dragPercentage / 100 ) * this . _thumbBarWidth ;
357
357
applyCssTransform ( this . _thumbEl , `translate3d(${ dragX } px, 0, 0)` ) ;
358
358
}
359
359
0 commit comments