2
2
* Copyright 2014 Drifty Co.
3
3
* http://drifty.com/
4
4
*
5
- * Ionic, v1.0.0-rc.1
5
+ * Ionic, v1.0.0-rc.2
6
6
* A powerful HTML5 mobile app framework.
7
7
* http://ionicframework.com/
8
8
*
@@ -2944,8 +2944,9 @@ function($ionicModal, $ionicPosition, $document, $window) {
2944
2944
var buttonOffset = $ionicPosition . offset ( targetEle ) ;
2945
2945
var popoverWidth = popoverEle . prop ( 'offsetWidth' ) ;
2946
2946
var popoverHeight = popoverEle . prop ( 'offsetHeight' ) ;
2947
- var bodyWidth = $document [ 0 ] . body . clientWidth ;
2948
- // clientHeight doesn't work on all platforms for body
2947
+ // Use innerWidth and innerHeight, because clientWidth and clientHeight
2948
+ // doesn't work consistently for body on all platforms
2949
+ var bodyWidth = $window . innerWidth ;
2949
2950
var bodyHeight = $window . innerHeight ;
2950
2951
2951
2952
var popoverCSS = {
@@ -6674,8 +6675,8 @@ IonicModule
6674
6675
scrollParent = $element . parent ( ) . parent ( ) [ 0 ] ;
6675
6676
scrollChild = $element . parent ( ) [ 0 ] ;
6676
6677
6677
- if ( ! scrollParent . classList . contains ( 'ionic-scroll' ) ||
6678
- ! scrollChild . classList . contains ( 'scroll' ) ) {
6678
+ if ( ! scrollParent || ! scrollParent . classList . contains ( 'ionic-scroll' ) ||
6679
+ ! scrollChild || ! scrollChild . classList . contains ( 'scroll' ) ) {
6679
6680
throw new Error ( 'Refresher must be immediate child of ion-content or ion-scroll' ) ;
6680
6681
}
6681
6682
@@ -6778,10 +6779,19 @@ function($scope,
6778
6779
self . __timeout = $timeout ;
6779
6780
6780
6781
self . _scrollViewOptions = scrollViewOptions ; //for testing
6782
+ self . isNative = function ( ) {
6783
+ return ! ! scrollViewOptions . nativeScrolling ;
6784
+ } ;
6781
6785
6782
6786
var element = self . element = scrollViewOptions . el ;
6783
6787
var $element = self . $element = jqLite ( element ) ;
6784
- var scrollView = self . scrollView = new ionic . views . Scroll ( scrollViewOptions ) ;
6788
+ var scrollView ;
6789
+ if ( self . isNative ( ) ) {
6790
+ scrollView = self . scrollView = new ionic . views . ScrollNative ( scrollViewOptions ) ;
6791
+ } else {
6792
+ scrollView = self . scrollView = new ionic . views . Scroll ( scrollViewOptions ) ;
6793
+ }
6794
+
6785
6795
6786
6796
//Attach self to element as a controller so other directives can require this controller
6787
6797
//through `require: '$ionicScroll'
@@ -9279,37 +9289,55 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
9279
9289
9280
9290
if ( $attr . scroll === "false" ) {
9281
9291
//do nothing
9282
- } else if ( attr . overflowScroll === "true" || ! $ionicConfig . scrolling . jsScrolling ( ) ) {
9283
- // use native scrolling
9284
- $element . addClass ( 'overflow-scroll' ) ;
9285
9292
} else {
9286
- var scrollViewOptions = {
9287
- el : $element [ 0 ] ,
9288
- delegateHandle : attr . delegateHandle ,
9289
- locking : ( attr . locking || 'true' ) === 'true' ,
9290
- bouncing : $scope . $eval ( $scope . hasBouncing ) ,
9291
- startX : $scope . $eval ( $scope . startX ) || 0 ,
9292
- startY : $scope . $eval ( $scope . startY ) || 0 ,
9293
- scrollbarX : $scope . $eval ( $scope . scrollbarX ) !== false ,
9294
- scrollbarY : $scope . $eval ( $scope . scrollbarY ) !== false ,
9295
- scrollingX : $scope . direction . indexOf ( 'x' ) >= 0 ,
9296
- scrollingY : $scope . direction . indexOf ( 'y' ) >= 0 ,
9297
- scrollEventInterval : parseInt ( $scope . scrollEventInterval , 10 ) || 10 ,
9298
- scrollingComplete : function ( ) {
9299
- $scope . $onScrollComplete ( {
9300
- scrollTop : this . __scrollTop ,
9301
- scrollLeft : this . __scrollLeft
9302
- } ) ;
9303
- }
9304
- } ;
9293
+ var scrollViewOptions = { } ;
9294
+
9295
+ if ( attr . overflowScroll === "true" || ! $ionicConfig . scrolling . jsScrolling ( ) ) {
9296
+ // use native scrolling
9297
+ $element . addClass ( 'overflow-scroll' ) ;
9298
+
9299
+ scrollViewOptions = {
9300
+ el : $element [ 0 ] ,
9301
+ delegateHandle : attr . delegateHandle ,
9302
+ startX : $scope . $eval ( $scope . startX ) || 0 ,
9303
+ startY : $scope . $eval ( $scope . startY ) || 0 ,
9304
+ nativeScrolling :true
9305
+ } ;
9306
+
9307
+ } else {
9308
+ // Use JS scrolling
9309
+ scrollViewOptions = {
9310
+ el : $element [ 0 ] ,
9311
+ delegateHandle : attr . delegateHandle ,
9312
+ locking : ( attr . locking || 'true' ) === 'true' ,
9313
+ bouncing : $scope . $eval ( $scope . hasBouncing ) ,
9314
+ startX : $scope . $eval ( $scope . startX ) || 0 ,
9315
+ startY : $scope . $eval ( $scope . startY ) || 0 ,
9316
+ scrollbarX : $scope . $eval ( $scope . scrollbarX ) !== false ,
9317
+ scrollbarY : $scope . $eval ( $scope . scrollbarY ) !== false ,
9318
+ scrollingX : $scope . direction . indexOf ( 'x' ) >= 0 ,
9319
+ scrollingY : $scope . direction . indexOf ( 'y' ) >= 0 ,
9320
+ scrollEventInterval : parseInt ( $scope . scrollEventInterval , 10 ) || 10 ,
9321
+ scrollingComplete : function ( ) {
9322
+ $scope . $onScrollComplete ( {
9323
+ scrollTop : this . __scrollTop ,
9324
+ scrollLeft : this . __scrollLeft
9325
+ } ) ;
9326
+ }
9327
+ } ;
9328
+ }
9329
+
9330
+ // init scroll controller with appropriate options
9305
9331
$controller ( '$ionicScroll' , {
9306
9332
$scope : $scope ,
9307
9333
scrollViewOptions : scrollViewOptions
9308
9334
} ) ;
9309
9335
9310
9336
$scope . $on ( '$destroy' , function ( ) {
9311
- scrollViewOptions . scrollingComplete = noop ;
9312
- delete scrollViewOptions . el ;
9337
+ if ( scrollViewOptions ) {
9338
+ scrollViewOptions . scrollingComplete = noop ;
9339
+ delete scrollViewOptions . el ;
9340
+ }
9313
9341
innerElement = null ;
9314
9342
$element = null ;
9315
9343
attr . $$element = null ;
@@ -9926,10 +9954,14 @@ IonicModule
9926
9954
link : function ( $scope , $element , $attrs , ctrls ) {
9927
9955
var infiniteScrollCtrl = ctrls [ 1 ] ;
9928
9956
var scrollCtrl = infiniteScrollCtrl . scrollCtrl = ctrls [ 0 ] ;
9929
- var jsScrolling = infiniteScrollCtrl . jsScrolling = ! ! scrollCtrl ;
9957
+ var jsScrolling = infiniteScrollCtrl . jsScrolling = ! scrollCtrl . isNative ( ) ;
9958
+
9930
9959
// if this view is not beneath a scrollCtrl, it can't be injected, proceed w/ native scrolling
9931
9960
if ( jsScrolling ) {
9932
9961
infiniteScrollCtrl . scrollView = scrollCtrl . scrollView ;
9962
+ $scope . scrollingType = 'js-scrolling' ;
9963
+ //bind to JS scroll events
9964
+ scrollCtrl . $element . on ( 'scroll' , infiniteScrollCtrl . checkBounds ) ;
9933
9965
} else {
9934
9966
// grabbing the scrollable element, to determine dimensions, and current scroll pos
9935
9967
var scrollEl = ionic . DomUtil . getParentOrSelfWithClass ( $element [ 0 ] . parentNode , 'overflow-scroll' ) ;
@@ -9938,14 +9970,10 @@ IonicModule
9938
9970
if ( ! scrollEl ) {
9939
9971
throw 'Infinite scroll must be used inside a scrollable div' ;
9940
9972
}
9941
- }
9942
- //bind to appropriate scroll event
9943
- if ( jsScrolling ) {
9944
- $scope . scrollingType = 'js-scrolling' ;
9945
- scrollCtrl . $element . on ( 'scroll' , infiniteScrollCtrl . checkBounds ) ;
9946
- } else {
9973
+ //bind to native scroll events
9947
9974
infiniteScrollCtrl . scrollEl . addEventListener ( 'scroll' , infiniteScrollCtrl . checkBounds ) ;
9948
9975
}
9976
+
9949
9977
// Optionally check bounds on start after scrollView is fully rendered
9950
9978
var doImmediateCheck = isDefined ( $attrs . immediateCheck ) ? $scope . $eval ( $attrs . immediateCheck ) : true ;
9951
9979
if ( doImmediateCheck ) {
@@ -11524,6 +11552,7 @@ IonicModule
11524
11552
* of the refresher.
11525
11553
* @param {expression= } on-pulling Called when the user starts to pull down
11526
11554
* on the refresher.
11555
+ * @param {string= } pulling-text The text to display while the user is pulling down.
11527
11556
* @param {string= } pulling-icon The icon to display while the user is pulling down.
11528
11557
* Default: 'ion-android-arrow-down'.
11529
11558
* @param {string= } spinner The {@link ionic.directive:ionSpinner} icon to display
@@ -11563,10 +11592,11 @@ IonicModule
11563
11592
// JS Scrolling uses the scroll controller
11564
11593
var scrollCtrl = ctrls [ 0 ] ,
11565
11594
refresherCtrl = ctrls [ 1 ] ;
11566
-
11567
- if ( ! ! scrollCtrl ) {
11595
+ if ( ! scrollCtrl || scrollCtrl . isNative ( ) ) {
11596
+ // Kick off native scrolling
11597
+ refresherCtrl . init ( ) ;
11598
+ } else {
11568
11599
$element [ 0 ] . classList . add ( 'js-scrolling' ) ;
11569
-
11570
11600
scrollCtrl . _setRefresher (
11571
11601
$scope ,
11572
11602
$element [ 0 ] ,
@@ -11578,10 +11608,6 @@ IonicModule
11578
11608
scrollCtrl . scrollView . finishPullToRefresh ( ) ;
11579
11609
} ) ;
11580
11610
} ) ;
11581
-
11582
- } else {
11583
- // Kick off native scrolling
11584
- refresherCtrl . init ( ) ;
11585
11611
}
11586
11612
11587
11613
}
@@ -11951,6 +11977,9 @@ function($timeout, $ionicGesture, $window) {
11951
11977
11952
11978
// add gesture handlers
11953
11979
var gestureOpts = { stop_browser_behavior : false } ;
11980
+ if ( ionic . DomUtil . getParentOrSelfWithClass ( $element [ 0 ] , 'overflow-scroll' ) ) {
11981
+ gestureOpts . prevent_default_directions = [ 'left' , 'right' ] ;
11982
+ }
11954
11983
var contentTapGesture = $ionicGesture . on ( 'tap' , onContentTap , $element , gestureOpts ) ;
11955
11984
var dragRightGesture = $ionicGesture . on ( 'dragright' , onDragX , $element , gestureOpts ) ;
11956
11985
var dragLeftGesture = $ionicGesture . on ( 'dragleft' , onDragX , $element , gestureOpts ) ;
0 commit comments