Skip to content

Commit 37c6ac8

Browse files
committed
Fixed #317
1 parent aae39e6 commit 37c6ac8

File tree

11 files changed

+194
-201
lines changed

11 files changed

+194
-201
lines changed

dist/css/ionic.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@charset "UTF-8";
12
/*!
23
* Copyright 2013 Drifty Co.
34
* http://drifty.com/

dist/css/themes/ionic-ios7.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@charset "UTF-8";
12
/*!
23
* Copyright 2013 Drifty Co.
34
* http://drifty.com/

dist/js/ionic-angular.js

Lines changed: 83 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,6 @@ angular.module('ionic.ui.header', ['ngAnimate'])
547547

548548
$scope.$watch('title', function(val) {
549549
// Resize the title since the title has changed
550-
console.log('Title changed');
551550
hb.align();
552551
});
553552
}
@@ -708,59 +707,56 @@ angular.module('ionic.ui.content', [])
708707

709708

710709
// Otherwise, supercharge this baby!
711-
// Add timeout to let content render so Scroller.resize grabs the right content height
712-
$timeout(function() {
713-
sv = new ionic.views.Scroll({
714-
el: $element[0],
715-
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
716-
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
717-
scrollingX: $scope.$eval($scope.hasScrollX) == true,
718-
scrollingY: $scope.$eval($scope.hasScrollY) !== false,
719-
scrollEventInterval: parseInt($scope.scrollEventInterval, 10) || 20,
720-
scrollingComplete: function() {
721-
$scope.onScrollComplete({
722-
scrollTop: this.__scrollTop,
723-
scrollLeft: this.__scrollLeft
724-
});
725-
}
726-
});
727-
728-
// Activate pull-to-refresh
729-
if(refresher) {
730-
sv.activatePullToRefresh(50, function() {
731-
refresher.classList.add('active');
732-
}, function() {
733-
refresher.classList.remove('refreshing');
734-
refresher.classList.remove('active');
735-
}, function() {
736-
refresher.classList.add('refreshing');
737-
$scope.onRefresh();
738-
$scope.$parent.$broadcast('scroll.onRefresh');
710+
sv = new ionic.views.Scroll({
711+
el: $element[0],
712+
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
713+
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
714+
scrollingX: $scope.$eval($scope.hasScrollX) == true,
715+
scrollingY: $scope.$eval($scope.hasScrollY) !== false,
716+
scrollEventInterval: parseInt($scope.scrollEventInterval, 10) || 20,
717+
scrollingComplete: function() {
718+
$scope.onScrollComplete({
719+
scrollTop: this.__scrollTop,
720+
scrollLeft: this.__scrollLeft
739721
});
740722
}
723+
});
741724

742-
$element.bind('scroll', function(e) {
743-
$scope.onScroll({
744-
event: e,
745-
scrollTop: e.detail ? e.detail.scrollTop : e.originalEvent ? e.originalEvent.detail.scrollTop : 0,
746-
scrollLeft: e.detail ? e.detail.scrollLeft: e.originalEvent ? e.originalEvent.detail.scrollLeft : 0
747-
});
725+
// Activate pull-to-refresh
726+
if(refresher) {
727+
sv.activatePullToRefresh(50, function() {
728+
refresher.classList.add('active');
729+
}, function() {
730+
refresher.classList.remove('refreshing');
731+
refresher.classList.remove('active');
732+
}, function() {
733+
refresher.classList.add('refreshing');
734+
$scope.onRefresh();
735+
$scope.$parent.$broadcast('scroll.onRefresh');
748736
});
737+
}
749738

750-
$scope.$parent.$on('scroll.resize', function(e) {
751-
// Run the resize after this digest
752-
$timeout(function() {
753-
sv && sv.resize();
754-
})
739+
$element.bind('scroll', function(e) {
740+
$scope.onScroll({
741+
event: e,
742+
scrollTop: e.detail ? e.detail.scrollTop : e.originalEvent ? e.originalEvent.detail.scrollTop : 0,
743+
scrollLeft: e.detail ? e.detail.scrollLeft: e.originalEvent ? e.originalEvent.detail.scrollLeft : 0
755744
});
745+
});
756746

757-
$scope.$parent.$on('scroll.refreshComplete', function(e) {
758-
sv && sv.finishPullToRefresh();
759-
});
760-
761-
// Let child scopes access this
762-
$scope.$parent.scrollView = sv;
763-
}, 500);
747+
$scope.$parent.$on('scroll.resize', function(e) {
748+
// Run the resize after this digest
749+
$timeout(function() {
750+
sv && sv.resize();
751+
})
752+
});
753+
754+
$scope.$parent.$on('scroll.refreshComplete', function(e) {
755+
sv && sv.finishPullToRefresh();
756+
});
757+
758+
// Let child scopes access this
759+
$scope.$parent.scrollView = sv;
764760

765761

766762

@@ -1628,56 +1624,52 @@ angular.module('ionic.ui.scroll', [])
16281624
}
16291625

16301626

1631-
// Otherwise, supercharge this baby!
1632-
// Add timeout to let content render so Scroller.resize grabs the right content height
1633-
$timeout(function() {
1634-
var hasScrollingX = $scope.direction.indexOf('x') >= 0;
1635-
var hasScrollingY = $scope.direction.indexOf('y') >= 0;
1627+
var hasScrollingX = $scope.direction.indexOf('x') >= 0;
1628+
var hasScrollingY = $scope.direction.indexOf('y') >= 0;
16361629

1637-
sv = new ionic.views.Scroll({
1638-
el: $element[0],
1639-
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
1640-
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
1641-
scrollingX: hasScrollingX,
1642-
scrollingY: hasScrollingY
1643-
});
1644-
1645-
// Activate pull-to-refresh
1646-
if(refresher) {
1647-
sv.activatePullToRefresh(refresherHeight, function() {
1648-
refresher.classList.add('active');
1649-
}, function() {
1650-
refresher.classList.remove('refreshing');
1651-
refresher.classList.remove('active');
1652-
}, function() {
1653-
refresher.classList.add('refreshing');
1654-
$scope.onRefresh();
1655-
$scope.$parent.$broadcast('scroll.onRefresh');
1656-
});
1657-
}
1630+
sv = new ionic.views.Scroll({
1631+
el: $element[0],
1632+
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
1633+
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
1634+
scrollingX: hasScrollingX,
1635+
scrollingY: hasScrollingY
1636+
});
16581637

1659-
$element.bind('scroll', function(e) {
1660-
$scope.onScroll({
1661-
event: e,
1662-
scrollTop: e.detail ? e.detail.scrollTop : e.originalEvent ? e.originalEvent.detail.scrollTop : 0,
1663-
scrollLeft: e.detail ? e.detail.scrollLeft: e.originalEvent ? e.originalEvent.detail.scrollLeft : 0
1664-
});
1638+
// Activate pull-to-refresh
1639+
if(refresher) {
1640+
sv.activatePullToRefresh(refresherHeight, function() {
1641+
refresher.classList.add('active');
1642+
}, function() {
1643+
refresher.classList.remove('refreshing');
1644+
refresher.classList.remove('active');
1645+
}, function() {
1646+
refresher.classList.add('refreshing');
1647+
$scope.onRefresh();
1648+
$scope.$parent.$broadcast('scroll.onRefresh');
16651649
});
1650+
}
16661651

1667-
$scope.$parent.$on('scroll.resize', function(e) {
1668-
// Run the resize after this digest
1669-
$timeout(function() {
1670-
sv && sv.resize();
1671-
})
1652+
$element.bind('scroll', function(e) {
1653+
$scope.onScroll({
1654+
event: e,
1655+
scrollTop: e.detail ? e.detail.scrollTop : e.originalEvent ? e.originalEvent.detail.scrollTop : 0,
1656+
scrollLeft: e.detail ? e.detail.scrollLeft: e.originalEvent ? e.originalEvent.detail.scrollLeft : 0
16721657
});
1658+
});
16731659

1674-
$scope.$parent.$on('scroll.refreshComplete', function(e) {
1675-
sv && sv.finishPullToRefresh();
1676-
});
1677-
1678-
// Let child scopes access this
1679-
$scope.$parent.scrollView = sv;
1680-
}, 500);
1660+
$scope.$parent.$on('scroll.resize', function(e) {
1661+
// Run the resize after this digest
1662+
$timeout(function() {
1663+
sv && sv.resize();
1664+
})
1665+
});
1666+
1667+
$scope.$parent.$on('scroll.refreshComplete', function(e) {
1668+
sv && sv.finishPullToRefresh();
1669+
});
1670+
1671+
// Let child scopes access this
1672+
$scope.$parent.scrollView = sv;
16811673
};
16821674
}
16831675
};

dist/js/ionic.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2639,10 +2639,12 @@ ionic.views.Scroll = ionic.views.View.inherit({
26392639
if ('ontouchstart' in window) {
26402640

26412641
container.addEventListener("touchstart", function(e) {
2642+
console.log('TOUCHSTART');
26422643
// Don't react if initial down happens on a form element
26432644
if (e.target.tagName.match(/input|textarea|select/i)) {
26442645
return;
26452646
}
2647+
26462648

26472649
self.doTouchStart(e.touches, e.timeStamp);
26482650
e.preventDefault();
@@ -2759,6 +2761,9 @@ ionic.views.Scroll = ionic.views.View.inherit({
27592761
// Update horiz bar
27602762
if(self.__indicatorX) {
27612763
var width = Math.max(Math.round(self.__clientWidth * self.__clientWidth / (self.__contentWidth)), 20);
2764+
if(width > self.__contentWidth) {
2765+
width = 0;
2766+
}
27622767
self.__indicatorX.size = width;
27632768
self.__indicatorX.minScale = this.options.minScrollbarSizeX / width;
27642769
self.__indicatorX.indicator.style.width = width + 'px';
@@ -2769,6 +2774,9 @@ ionic.views.Scroll = ionic.views.View.inherit({
27692774
// Update vert bar
27702775
if(self.__indicatorY) {
27712776
var height = Math.max(Math.round(self.__clientHeight * self.__clientHeight / (self.__contentHeight)), 20);
2777+
if(height > self.__contentHeight) {
2778+
height = 0;
2779+
}
27722780
self.__indicatorY.size = height;
27732781
self.__indicatorY.minScale = this.options.minScrollbarSizeY / height;
27742782
self.__indicatorY.maxPos = self.__clientHeight - height;
@@ -3864,8 +3872,9 @@ ionic.views.Scroll = ionic.views.View.inherit({
38643872
clearTimeout(self.__sizerTimeout);
38653873
self.__sizerTimeout = setTimeout(function sizer() {
38663874
self.resize();
3867-
if(self.__maxScrollLeft == 0 && self.__maxScrollTop == 0) {
3868-
self.__sizerTimeout = setTimeout(sizer, 1000);
3875+
3876+
if((self.options.scrollingX && self.__maxScrollLeft == 0) || (self.options.scrollingY && self.__maxScrollTop == 0)) {
3877+
//self.__sizerTimeout = setTimeout(sizer, 1000);
38693878
}
38703879
}, 1000);
38713880

js/ext/angular/src/directive/ionicBar.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ angular.module('ionic.ui.header', ['ngAnimate'])
5151

5252
$scope.$watch('title', function(val) {
5353
// Resize the title since the title has changed
54-
console.log('Title changed');
5554
hb.align();
5655
});
5756
}

js/ext/angular/src/directive/ionicContent.js

Lines changed: 45 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -84,59 +84,56 @@ angular.module('ionic.ui.content', [])
8484

8585

8686
// Otherwise, supercharge this baby!
87-
// Add timeout to let content render so Scroller.resize grabs the right content height
88-
$timeout(function() {
89-
sv = new ionic.views.Scroll({
90-
el: $element[0],
91-
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
92-
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
93-
scrollingX: $scope.$eval($scope.hasScrollX) == true,
94-
scrollingY: $scope.$eval($scope.hasScrollY) !== false,
95-
scrollEventInterval: parseInt($scope.scrollEventInterval, 10) || 20,
96-
scrollingComplete: function() {
97-
$scope.onScrollComplete({
98-
scrollTop: this.__scrollTop,
99-
scrollLeft: this.__scrollLeft
100-
});
101-
}
102-
});
103-
104-
// Activate pull-to-refresh
105-
if(refresher) {
106-
sv.activatePullToRefresh(50, function() {
107-
refresher.classList.add('active');
108-
}, function() {
109-
refresher.classList.remove('refreshing');
110-
refresher.classList.remove('active');
111-
}, function() {
112-
refresher.classList.add('refreshing');
113-
$scope.onRefresh();
114-
$scope.$parent.$broadcast('scroll.onRefresh');
87+
sv = new ionic.views.Scroll({
88+
el: $element[0],
89+
scrollbarX: $scope.$eval($scope.scrollbarX) !== false,
90+
scrollbarY: $scope.$eval($scope.scrollbarY) !== false,
91+
scrollingX: $scope.$eval($scope.hasScrollX) == true,
92+
scrollingY: $scope.$eval($scope.hasScrollY) !== false,
93+
scrollEventInterval: parseInt($scope.scrollEventInterval, 10) || 20,
94+
scrollingComplete: function() {
95+
$scope.onScrollComplete({
96+
scrollTop: this.__scrollTop,
97+
scrollLeft: this.__scrollLeft
11598
});
11699
}
117-
118-
$element.bind('scroll', function(e) {
119-
$scope.onScroll({
120-
event: e,
121-
scrollTop: e.detail ? e.detail.scrollTop : e.originalEvent ? e.originalEvent.detail.scrollTop : 0,
122-
scrollLeft: e.detail ? e.detail.scrollLeft: e.originalEvent ? e.originalEvent.detail.scrollLeft : 0
123-
});
124-
});
125-
126-
$scope.$parent.$on('scroll.resize', function(e) {
127-
// Run the resize after this digest
128-
$timeout(function() {
129-
sv && sv.resize();
130-
})
100+
});
101+
102+
// Activate pull-to-refresh
103+
if(refresher) {
104+
sv.activatePullToRefresh(50, function() {
105+
refresher.classList.add('active');
106+
}, function() {
107+
refresher.classList.remove('refreshing');
108+
refresher.classList.remove('active');
109+
}, function() {
110+
refresher.classList.add('refreshing');
111+
$scope.onRefresh();
112+
$scope.$parent.$broadcast('scroll.onRefresh');
131113
});
114+
}
132115

133-
$scope.$parent.$on('scroll.refreshComplete', function(e) {
134-
sv && sv.finishPullToRefresh();
116+
$element.bind('scroll', function(e) {
117+
$scope.onScroll({
118+
event: e,
119+
scrollTop: e.detail ? e.detail.scrollTop : e.originalEvent ? e.originalEvent.detail.scrollTop : 0,
120+
scrollLeft: e.detail ? e.detail.scrollLeft: e.originalEvent ? e.originalEvent.detail.scrollLeft : 0
135121
});
136-
137-
// Let child scopes access this
138-
$scope.$parent.scrollView = sv;
139-
}, 500);
122+
});
123+
124+
$scope.$parent.$on('scroll.resize', function(e) {
125+
// Run the resize after this digest
126+
$timeout(function() {
127+
sv && sv.resize();
128+
})
129+
});
130+
131+
$scope.$parent.$on('scroll.refreshComplete', function(e) {
132+
sv && sv.finishPullToRefresh();
133+
});
134+
135+
// Let child scopes access this
136+
$scope.$parent.scrollView = sv;
140137

141138

142139

0 commit comments

Comments
 (0)