Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(tabs): fixes tab math to address issues when used within dialog
Browse files Browse the repository at this point in the history
closes #7048. Closes #7118.
  • Loading branch information
Robert Messerle authored and ThomasBurleson committed Feb 12, 2016
1 parent c202973 commit 55b71a4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/tabs/js/tabsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,13 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
function updatePagingWidth() {
var width = 1;
angular.forEach(getElements().dummies, function (element) {
// uses `getBoundingClientRect().width` rather than `offsetWidth` to include decimal values
// when calculating the total width
width += Math.ceil(element.getBoundingClientRect().width);
//-- Uses the larger value between `getBoundingClientRect().width` and `offsetWidth`. This
// prevents `offsetWidth` value from being rounded down and causing wrapping issues, but
// also handles scenarios where `getBoundingClientRect()` is inaccurate (ie. tabs inside
// of a dialog)
width += Math.max(element.offsetWidth, element.getBoundingClientRect().width);
});
angular.element(elements.paging).css('width', width + 'px');
angular.element(elements.paging).css('width', Math.ceil(width) + 'px');
}

function getMaxTabWidth () {
Expand Down

0 comments on commit 55b71a4

Please sign in to comment.