@@ -34,14 +34,15 @@ import {Subject} from 'rxjs/Subject';
3434import { Dir } from '../core/rtl/dir' ;
3535import 'rxjs/add/operator/first' ;
3636import { ScrollDispatcher } from '../core/overlay/scroll/scroll-dispatcher' ;
37+ import { Subscription } from 'rxjs' ;
3738
3839export type TooltipPosition = 'left' | 'right' | 'above' | 'below' | 'before' | 'after' ;
3940
4041/** Time in ms to delay before changing the tooltip visibility to hidden */
4142export const TOUCHEND_HIDE_DELAY = 1500 ;
4243
4344/** Time in ms to throttle repositioning after scroll events. */
44- export const SCROLL_THROTTLE_MS = 0 ;
45+ export const SCROLL_THROTTLE_MS = 20 ;
4546
4647/**
4748 * Directive that attaches a material design tooltip to the host element. Animates the showing and
@@ -62,6 +63,7 @@ export const SCROLL_THROTTLE_MS = 0;
6263export class MdTooltip implements OnInit , OnDestroy {
6364 _overlayRef : OverlayRef ;
6465 _tooltipInstance : TooltipComponent ;
66+ scrollSubscription : Subscription ;
6567
6668 private _position : TooltipPosition = 'below' ;
6769
@@ -137,7 +139,7 @@ export class MdTooltip implements OnInit, OnDestroy {
137139 ngOnInit ( ) {
138140 // When a scroll on the page occurs, update the position in case this tooltip needs
139141 // to be repositioned.
140- this . _scrollDispatcher . scrolled ( SCROLL_THROTTLE_MS ) . subscribe ( ( ) => {
142+ this . scrollSubscription = this . _scrollDispatcher . scrolled ( SCROLL_THROTTLE_MS ) . subscribe ( ( ) => {
141143 if ( this . _overlayRef ) {
142144 this . _overlayRef . updatePosition ( ) ;
143145 }
@@ -151,6 +153,8 @@ export class MdTooltip implements OnInit, OnDestroy {
151153 if ( this . _tooltipInstance ) {
152154 this . _disposeTooltip ( ) ;
153155 }
156+
157+ this . scrollSubscription . unsubscribe ( ) ;
154158 }
155159
156160 /** Shows the tooltip after the delay in ms, defaults to tooltip-delay-show or 0ms if no input */
0 commit comments