@@ -264,6 +264,7 @@ export class MatTooltip implements OnDestroy {
264264 const overlayRef = this . _createOverlay ( ) ;
265265
266266 this . _detach ( ) ;
267+ overlayRef . setDirection ( this . _dir ? this . _dir . value : 'ltr' ) ;
267268 this . _portal = this . _portal || new ComponentPortal ( TooltipComponent , this . _viewContainerRef ) ;
268269 this . _tooltipInstance = overlayRef . attach ( this . _portal ) . instance ;
269270 this . _tooltipInstance . afterHidden ( )
@@ -310,20 +311,12 @@ export class MatTooltip implements OnDestroy {
310311 return this . _overlayRef ;
311312 }
312313
313- const origin = this . _getOrigin ( ) ;
314- const overlay = this . _getOverlayPosition ( ) ;
315- const direction = this . _dir ? this . _dir . value : 'ltr' ;
316-
317314 // Create connected position strategy that listens for scroll events to reposition.
318315 const strategy = this . _overlay . position ( )
319316 . flexibleConnectedTo ( this . _elementRef )
320317 . withTransformOriginOn ( '.mat-tooltip' )
321318 . withFlexibleDimensions ( false )
322- . withViewportMargin ( 8 )
323- . withPositions ( [
324- { ...origin . main , ...overlay . main } ,
325- { ...origin . fallback , ...overlay . fallback }
326- ] ) ;
319+ . withViewportMargin ( 8 ) ;
327320
328321 const scrollableAncestors = this . _scrollDispatcher
329322 . getAncestorScrollContainers ( this . _elementRef ) ;
@@ -341,12 +334,13 @@ export class MatTooltip implements OnDestroy {
341334 } ) ;
342335
343336 this . _overlayRef = this . _overlay . create ( {
344- direction,
345337 positionStrategy : strategy ,
346338 panelClass : TOOLTIP_PANEL_CLASS ,
347339 scrollStrategy : this . _scrollStrategy ( )
348340 } ) ;
349341
342+ this . _updatePosition ( ) ;
343+
350344 this . _overlayRef . detachments ( )
351345 . pipe ( takeUntil ( this . _destroyed ) )
352346 . subscribe ( ( ) => this . _detach ( ) ) ;
@@ -370,11 +364,10 @@ export class MatTooltip implements OnDestroy {
370364 const origin = this . _getOrigin ( ) ;
371365 const overlay = this . _getOverlayPosition ( ) ;
372366
373- position
374- . withPositions ( [
375- { ...origin . main , ...overlay . main } ,
376- { ...origin . fallback , ...overlay . fallback }
377- ] ) ;
367+ position . withPositions ( [
368+ { ...origin . main , ...overlay . main } ,
369+ { ...origin . fallback , ...overlay . fallback }
370+ ] ) ;
378371 }
379372
380373 /**
0 commit comments