2
2
* Copyright 2015 Drifty Co.
3
3
* http://drifty.com/
4
4
*
5
- * Ionic, v1.2.1
5
+ * Ionic, v1.2.2
6
6
* A powerful HTML5 mobile app framework.
7
7
* http://ionicframework.com/
8
8
*
@@ -2307,9 +2307,10 @@ function($ionicLoadingConfig, $ionicBody, $ionicTemplateLoader, $ionicBackdrop,
2307
2307
}
2308
2308
self . element . removeClass ( 'active' ) ;
2309
2309
$ionicBody . removeClass ( 'loading-active' ) ;
2310
- setTimeout ( function ( ) {
2310
+ self . element . removeClass ( 'visible' ) ;
2311
+ ionic . requestAnimationFrame ( function ( ) {
2311
2312
! self . isShown && self . element . removeClass ( 'visible' ) ;
2312
- } , 200 ) ;
2313
+ } ) ;
2313
2314
}
2314
2315
$timeout . cancel ( self . durationTimeout ) ;
2315
2316
self . isShown = false ;
@@ -2559,7 +2560,7 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
2559
2560
self . $el . on ( 'touchmove' , function ( e ) {
2560
2561
//Don't allow scrolling while open by dragging on backdrop
2561
2562
var isInScroll = ionic . DomUtil . getParentOrSelfWithClass ( e . target , 'scroll' ) ;
2562
- if ( ! isInScroll ) {
2563
+ if ( ! isInScroll ) {
2563
2564
e . preventDefault ( ) ;
2564
2565
}
2565
2566
} ) ;
@@ -6825,6 +6826,15 @@ IonicModule
6825
6826
startY = Math . floor ( e . touches [ 0 ] . screenY ) ;
6826
6827
}
6827
6828
6829
+ function handleTouchstart ( e ) {
6830
+ e . touches = e . touches || [ {
6831
+ screenX : e . screenX ,
6832
+ screenY : e . screenY
6833
+ } ] ;
6834
+
6835
+ startY = e . touches [ 0 ] . screenY ;
6836
+ }
6837
+
6828
6838
function handleTouchend ( ) {
6829
6839
// reset Y
6830
6840
startY = null ;
@@ -6861,7 +6871,7 @@ IonicModule
6861
6871
} ] ;
6862
6872
6863
6873
// Force mouse events to have had a down event first
6864
- if ( ! startY && e . type == 'mousemove' ) {
6874
+ if ( ! startY && e . type == 'mousemove' ) {
6865
6875
return ;
6866
6876
}
6867
6877
@@ -6874,14 +6884,16 @@ IonicModule
6874
6884
startY = e . touches [ 0 ] . screenY ;
6875
6885
}
6876
6886
6887
+ deltaY = e . touches [ 0 ] . screenY - startY ;
6888
+
6889
+ // how far have we dragged so far?
6877
6890
// kitkat fix for touchcancel events http://updates.html5rocks.com/2014/05/A-More-Compatible-Smoother-Touch
6878
- if ( ionic . Platform . isAndroid ( ) && ionic . Platform . version ( ) === 4.4 && scrollParent . scrollTop === 0 ) {
6891
+ // Only do this if we're not on crosswalk
6892
+ if ( ionic . Platform . isAndroid ( ) && ionic . Platform . version ( ) === 4.4 && ! ionic . Platform . isCrosswalk ( ) && scrollParent . scrollTop === 0 && deltaY > 0 ) {
6879
6893
isDragging = true ;
6880
6894
e . preventDefault ( ) ;
6881
6895
}
6882
6896
6883
- // how far have we dragged so far?
6884
- deltaY = e . touches [ 0 ] . screenY - startY ;
6885
6897
6886
6898
// if we've dragged up and back down in to native scroll territory
6887
6899
if ( deltaY - dragOffset <= 0 || scrollParent . scrollTop !== 0 ) {
@@ -7034,17 +7046,17 @@ IonicModule
7034
7046
}
7035
7047
7036
7048
7037
- var touchMoveEvent , touchEndEvent ;
7049
+ var touchStartEvent , touchMoveEvent , touchEndEvent ;
7038
7050
if ( window . navigator . pointerEnabled ) {
7039
- // touchStartEvent = 'pointerdown';
7051
+ touchStartEvent = 'pointerdown' ;
7040
7052
touchMoveEvent = 'pointermove' ;
7041
7053
touchEndEvent = 'pointerup' ;
7042
7054
} else if ( window . navigator . msPointerEnabled ) {
7043
- // touchStartEvent = 'MSPointerDown';
7055
+ touchStartEvent = 'MSPointerDown' ;
7044
7056
touchMoveEvent = 'MSPointerMove' ;
7045
7057
touchEndEvent = 'MSPointerUp' ;
7046
7058
} else {
7047
- // touchStartEvent = 'touchstart';
7059
+ touchStartEvent = 'touchstart' ;
7048
7060
touchMoveEvent = 'touchmove' ;
7049
7061
touchEndEvent = 'touchend' ;
7050
7062
}
@@ -7059,6 +7071,7 @@ IonicModule
7059
7071
}
7060
7072
7061
7073
7074
+ ionic . on ( touchStartEvent , handleTouchstart , scrollChild ) ;
7062
7075
ionic . on ( touchMoveEvent , handleTouchmove , scrollChild ) ;
7063
7076
ionic . on ( touchEndEvent , handleTouchend , scrollChild ) ;
7064
7077
ionic . on ( 'mousedown' , handleMousedown , scrollChild ) ;
@@ -7071,6 +7084,7 @@ IonicModule
7071
7084
} ;
7072
7085
7073
7086
function destroy ( ) {
7087
+ ionic . off ( touchStartEvent , handleTouchstart , scrollChild ) ;
7074
7088
ionic . off ( touchMoveEvent , handleTouchmove , scrollChild ) ;
7075
7089
ionic . off ( touchEndEvent , handleTouchend , scrollChild ) ;
7076
7090
ionic . off ( 'mousedown' , handleMousedown , scrollChild ) ;
@@ -7328,6 +7342,7 @@ function($scope,
7328
7342
} ;
7329
7343
7330
7344
self . freezeScroll = scrollView . freeze ;
7345
+ self . freezeScrollShut = scrollView . freezeShut ;
7331
7346
7332
7347
self . freezeAllScrolls = function ( shouldFreeze ) {
7333
7348
for ( var i = 0 ; i < $ionicScrollDelegate . _instances . length ; i ++ ) {
@@ -7509,9 +7524,10 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
7509
7524
// equal 0, otherwise remove the class from the body element
7510
7525
$ionicBody . enableClass ( ( percentage !== 0 ) , 'menu-open' ) ;
7511
7526
7512
- freezeAllScrolls ( false ) ;
7527
+ self . content . setCanScroll ( percentage == 0 ) ;
7513
7528
} ;
7514
7529
7530
+ /*
7515
7531
function freezeAllScrolls(shouldFreeze) {
7516
7532
if (shouldFreeze && !self.isScrollFreeze) {
7517
7533
$ionicScrollDelegate.freezeAllScrolls(shouldFreeze);
@@ -7521,6 +7537,7 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
7521
7537
}
7522
7538
self.isScrollFreeze = shouldFreeze;
7523
7539
}
7540
+ */
7524
7541
7525
7542
/**
7526
7543
* Open the menu the given pixel amount.
@@ -7654,7 +7671,6 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
7654
7671
7655
7672
isAsideExposed = shouldExposeAside ;
7656
7673
if ( ( self . left && self . left . isEnabled ) && ( self . right && self . right . isEnabled ) ) {
7657
- void 0 ;
7658
7674
self . content . setMarginLeftAndRight ( isAsideExposed ? self . left . width : 0 , isAsideExposed ? self . right . width : 0 ) ;
7659
7675
} else if ( self . left && self . left . isEnabled ) {
7660
7676
// set the left marget width if it should be exposed
@@ -7672,8 +7688,6 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
7672
7688
7673
7689
// End a drag with the given event
7674
7690
self . _endDrag = function ( e ) {
7675
- freezeAllScrolls ( false ) ;
7676
-
7677
7691
if ( isAsideExposed ) return ;
7678
7692
7679
7693
if ( isDragging ) {
@@ -7711,7 +7725,7 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
7711
7725
7712
7726
if ( isDragging ) {
7713
7727
self . openAmount ( offsetX + ( lastX - startX ) ) ;
7714
- freezeAllScrolls ( true ) ;
7728
+ //self.content.setCanScroll(false );
7715
7729
}
7716
7730
} ;
7717
7731
@@ -7790,12 +7804,10 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
7790
7804
deregisterBackButtonAction ( ) ;
7791
7805
self . $scope = null ;
7792
7806
if ( self . content ) {
7807
+ self . content . setCanScroll ( true ) ;
7793
7808
self . content . element = null ;
7794
7809
self . content = null ;
7795
7810
}
7796
-
7797
- // ensure scrolls are unfrozen
7798
- freezeAllScrolls ( false ) ;
7799
7811
} ) ;
7800
7812
7801
7813
self . initialize ( {
@@ -9788,6 +9800,8 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
9788
9800
scrollViewOptions : scrollViewOptions
9789
9801
} ) ;
9790
9802
9803
+ $scope . scrollCtrl = scrollCtrl ;
9804
+
9791
9805
$scope . $on ( '$destroy' , function ( ) {
9792
9806
if ( scrollViewOptions ) {
9793
9807
scrollViewOptions . scrollingComplete = noop ;
@@ -12610,6 +12624,22 @@ function($timeout, $ionicGesture, $window) {
12610
12624
element : element [ 0 ] ,
12611
12625
onDrag : function ( ) { } ,
12612
12626
endDrag : function ( ) { } ,
12627
+ setCanScroll : function ( canScroll ) {
12628
+ var c = $element [ 0 ] . querySelector ( '.scroll' ) ;
12629
+
12630
+ if ( ! c ) {
12631
+ return ;
12632
+ }
12633
+
12634
+ var content = angular . element ( c . parentElement ) ;
12635
+ if ( ! content ) {
12636
+ return ;
12637
+ }
12638
+
12639
+ // freeze our scroll container if we have one
12640
+ var scrollScope = content . scope ( ) ;
12641
+ scrollScope . scrollCtrl && scrollScope . scrollCtrl . freezeScrollShut ( ! canScroll ) ;
12642
+ } ,
12613
12643
getTranslateX : function ( ) {
12614
12644
return $scope . sideMenuContentTranslateX || 0 ;
12615
12645
} ,
@@ -12677,9 +12707,7 @@ function($timeout, $ionicGesture, $window) {
12677
12707
12678
12708
// add gesture handlers
12679
12709
var gestureOpts = { stop_browser_behavior : false } ;
12680
- if ( ionic . DomUtil . getParentOrSelfWithClass ( $element [ 0 ] , 'overflow-scroll' ) ) {
12681
- gestureOpts . prevent_default_directions = [ 'left' , 'right' ] ;
12682
- }
12710
+ gestureOpts . prevent_default_directions = [ 'left' , 'right' ] ;
12683
12711
var contentTapGesture = $ionicGesture . on ( 'tap' , onContentTap , $element , gestureOpts ) ;
12684
12712
var dragRightGesture = $ionicGesture . on ( 'dragright' , onDragX , $element , gestureOpts ) ;
12685
12713
var dragLeftGesture = $ionicGesture . on ( 'dragleft' , onDragX , $element , gestureOpts ) ;
@@ -13086,7 +13114,8 @@ IonicModule
13086
13114
. directive ( 'ionSlides' , [
13087
13115
'$animate' ,
13088
13116
'$timeout' ,
13089
- function ( $animate , $timeout ) {
13117
+ '$compile' ,
13118
+ function ( $animate , $timeout , $compile ) {
13090
13119
return {
13091
13120
restrict : 'E' ,
13092
13121
transclude : true ,
@@ -13104,6 +13133,10 @@ function($animate, $timeout) {
13104
13133
13105
13134
this . update = function ( ) {
13106
13135
$timeout ( function ( ) {
13136
+ if ( ! _this . __slider ) {
13137
+ return ;
13138
+ }
13139
+
13107
13140
_this . __slider . update ( ) ;
13108
13141
if ( _this . _options . loop ) {
13109
13142
_this . __slider . createLoop ( ) ;
@@ -13136,7 +13169,7 @@ function($animate, $timeout) {
13136
13169
this . _options = newOptions ;
13137
13170
13138
13171
$timeout ( function ( ) {
13139
- var slider = new ionic . views . Swiper ( $element . children ( ) [ 0 ] , newOptions , $scope ) ;
13172
+ var slider = new ionic . views . Swiper ( $element . children ( ) [ 0 ] , newOptions , $scope , $compile ) ;
13140
13173
13141
13174
_this . __slider = slider ;
13142
13175
$scope . slider = _this . __slider ;
@@ -13149,10 +13182,10 @@ function($animate, $timeout) {
13149
13182
} ] ,
13150
13183
13151
13184
13152
- link : function ( $scope , $element ) {
13185
+ link : function ( $scope ) {
13153
13186
$scope . showPager = true ;
13154
13187
// Disable ngAnimate for slidebox and its children
13155
- $animate . enabled ( false , $element ) ;
13188
+ // $animate.enabled(false, $element);
13156
13189
}
13157
13190
} ;
13158
13191
} ] )
0 commit comments