Skip to content

Commit

Permalink
fix(header): ion-nav-title will fill up available space
Browse files Browse the repository at this point in the history
ion-nav-title will fill up available space

#4661
  • Loading branch information
danbucholtz committed May 6, 2016
1 parent 44d5a0f commit 677d2d4
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions js/angular/controller/headerBarController.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,20 @@ function($scope, $element, $attrs, $q, $ionicConfig, $ionicHistory) {


self.titleTextWidth = function() {
if (!titleTextWidth) {
var bounds = ionic.DomUtil.getTextBounds(getEle(TITLE));
titleTextWidth = Math.min(bounds && bounds.width || 30);
var element = getEle(TITLE);
if ( element ) {
// If the element has a nav-bar-title, use that instead
// to calculate the width of the title
var children = angular.element(element).children();
for ( var i = 0; i < children.length; i++ ) {
if ( angular.element(children[i]).hasClass('nav-bar-title') ) {
element = children[i];
break;
}
}
}
var bounds = ionic.DomUtil.getTextBounds(element);
titleTextWidth = Math.min(bounds && bounds.width || 30);
return titleTextWidth;
};

Expand Down

0 comments on commit 677d2d4

Please sign in to comment.