From 0427230a245e6589a04b244cdbcbdcb666ea4e30 Mon Sep 17 00:00:00 2001 From: Drumstix42 Date: Wed, 18 Nov 2020 09:18:40 -0500 Subject: [PATCH] Update tooltip.js positionTooltip - update `positionTooltip` fn to apply the proper class to tooltips/popovers when using "auto" placement determination - now if a popover with "auto right" ends up being calculated to the left, the popover will receive the correct `left` class, and not `right` --- src/tooltip/tooltip.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tooltip/tooltip.js b/src/tooltip/tooltip.js index 70e1455..24a3062 100644 --- a/src/tooltip/tooltip.js +++ b/src/tooltip/tooltip.js @@ -162,7 +162,8 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s if (!positionTimeout) { positionTimeout = $timeout(function() { var placementClasses = $position.parsePlacement(ttScope.placement); - var placement = placementClasses[1] === 'center' ? placementClasses[0] : placementClasses[0] + '-' + placementClasses[1]; + var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody, true); + var placement = ttPosition.placement; // need to add classes prior to placement to allow correct tooltip width calculations if (!tooltip.hasClass(placementClasses[0])) { @@ -176,7 +177,6 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s } // Take into account tooltup margins, since boostrap css draws tooltip arrow inside margins - var ttPosition = $position.positionElements(element, tooltip, ttScope.placement, appendToBody, true); var initialHeight = angular.isDefined(tooltip.offsetHeight) ? tooltip.offsetHeight : tooltip.prop('offsetHeight'); var elementPos = appendToBody ? $position.offset(element) : $position.position(element); tooltip.css({ top: ttPosition.top + 'px', left: ttPosition.left + 'px' }); -- 2.52.0