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

Commit

Permalink
update(tabs): use Math.ceil( )
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBurleson committed Nov 23, 2015
1 parent a1889cd commit a242a5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/tabs/js/tabsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,9 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp

function updatePagingWidth() {
var width = 1;
angular.forEach(getElements().dummies, function (element) { width += element.offsetWidth + 1; });
angular.forEach(getElements().dummies, function (element) {
width += Math.ceil(element.offsetWidth);
});
angular.element(elements.paging).css('width', width + 'px');
}

Expand Down

2 comments on commit a242a5f

@alexandrebrasil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ThomasBurleson "element.offsetWidth" is already an Integer when the forEach loop is executed, so Math.ceiling it returns the same value. I've tested the bugs the previous version (commit a120a35) solved, and they still happen when using the Math.ceil version. You can check it here by adding 4 tabs with "lk" (no quotes) as the title.

EDIT: tested on Chrome

@corentin-gautier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ThomasBurleson,

I was wondering, why do you even need to set a width at all ? As far as I can see it could work fine without ( http://codepen.io/anon/pen/wKbraZ ) the only thing I did was:

md-pagination-wrapper {
  width: auto!important;
  white-space: nowrap;
}
.md-tab {
  display: inline-block;
  float: none;
}

But maybe the width have a purpose that I didn't see, in that case please ignore me ;)

Please sign in to comment.