2
2
* Copyright 2015 Drifty Co.
3
3
* http://drifty.com/
4
4
*
5
- * Ionic, v1.2.0
5
+ * Ionic, v1.2.1
6
6
* A powerful HTML5 mobile app framework.
7
7
* http://ionicframework.com/
8
8
*
@@ -2556,6 +2556,13 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
2556
2556
2557
2557
return $timeout ( function ( ) {
2558
2558
if ( ! self . _isShown ) return ;
2559
+ self . $el . on ( 'touchmove' , function ( e ) {
2560
+ //Don't allow scrolling while open by dragging on backdrop
2561
+ var isInScroll = ionic . DomUtil . getParentOrSelfWithClass ( e . target , 'scroll' ) ;
2562
+ if ( ! isInScroll ) {
2563
+ e . preventDefault ( ) ;
2564
+ }
2565
+ } ) ;
2559
2566
//After animating in, allow hide on backdrop click
2560
2567
self . $el . on ( 'click' , function ( e ) {
2561
2568
if ( self . backdropClickToClose && e . target === self . el && stack . isHighest ( self ) ) {
@@ -4701,8 +4708,9 @@ function($timeout, $document, $q, $ionicClickBlock, $ionicConfig, $ionicNavBarDe
4701
4708
if ( renderStart && renderEnd ) {
4702
4709
// CSS "auto" transitioned, not manually transitioned
4703
4710
// wait a frame so the styles apply before auto transitioning
4704
- ionic . requestAnimationFrame ( onReflow ) ;
4705
-
4711
+ $timeout ( function ( ) {
4712
+ ionic . requestAnimationFrame ( onReflow ) ;
4713
+ } ) ;
4706
4714
} else if ( ! renderEnd ) {
4707
4715
// just the start of a manual transition
4708
4716
// but it will not render the end of the transition
@@ -6808,13 +6816,22 @@ IonicModule
6808
6816
$onPulling : '&onPulling'
6809
6817
} ) ;
6810
6818
6819
+ function handleMousedown ( e ) {
6820
+ e . touches = e . touches || [ {
6821
+ screenX : e . screenX ,
6822
+ screenY : e . screenY
6823
+ } ] ;
6824
+ // Mouse needs this
6825
+ startY = Math . floor ( e . touches [ 0 ] . screenY ) ;
6826
+ }
6827
+
6811
6828
function handleTouchend ( ) {
6829
+ // reset Y
6830
+ startY = null ;
6812
6831
// if this wasn't an overscroll, get out immediately
6813
6832
if ( ! canOverscroll && ! isDragging ) {
6814
6833
return ;
6815
6834
}
6816
- // reset Y
6817
- startY = null ;
6818
6835
// the user has overscrolled but went back to native scrolling
6819
6836
if ( ! isDragging ) {
6820
6837
dragOffset = 0 ;
@@ -6838,13 +6855,23 @@ IonicModule
6838
6855
}
6839
6856
6840
6857
function handleTouchmove ( e ) {
6858
+ e . touches = e . touches || [ {
6859
+ screenX : e . screenX ,
6860
+ screenY : e . screenY
6861
+ } ] ;
6862
+
6863
+ // Force mouse events to have had a down event first
6864
+ if ( ! startY && e . type == 'mousemove' ) {
6865
+ return ;
6866
+ }
6867
+
6841
6868
// if multitouch or regular scroll event, get out immediately
6842
6869
if ( ! canOverscroll || e . touches . length > 1 ) {
6843
6870
return ;
6844
6871
}
6845
6872
//if this is a new drag, keep track of where we start
6846
6873
if ( startY === null ) {
6847
- startY = parseInt ( e . touches [ 0 ] . screenY , 10 ) ;
6874
+ startY = e . touches [ 0 ] . screenY ;
6848
6875
}
6849
6876
6850
6877
// kitkat fix for touchcancel events http://updates.html5rocks.com/2014/05/A-More-Compatible-Smoother-Touch
@@ -6854,7 +6881,7 @@ IonicModule
6854
6881
}
6855
6882
6856
6883
// how far have we dragged so far?
6857
- deltaY = parseInt ( e . touches [ 0 ] . screenY , 10 ) - startY ;
6884
+ deltaY = e . touches [ 0 ] . screenY - startY ;
6858
6885
6859
6886
// if we've dragged up and back down in to native scroll territory
6860
6887
if ( deltaY - dragOffset <= 0 || scrollParent . scrollTop !== 0 ) {
@@ -6865,7 +6892,7 @@ IonicModule
6865
6892
}
6866
6893
6867
6894
if ( isDragging ) {
6868
- nativescroll ( scrollParent , parseInt ( deltaY - dragOffset , 10 ) * - 1 ) ;
6895
+ nativescroll ( scrollParent , deltaY - dragOffset * - 1 ) ;
6869
6896
}
6870
6897
6871
6898
// if we're not at overscroll 0 yet, 0 out
@@ -6890,7 +6917,7 @@ IonicModule
6890
6917
6891
6918
isDragging = true ;
6892
6919
// overscroll according to the user's drag so far
6893
- overscroll ( parseInt ( ( deltaY - dragOffset ) / 3 , 10 ) ) ;
6920
+ overscroll ( ( deltaY - dragOffset ) / 3 ) ;
6894
6921
6895
6922
// update the icon accordingly
6896
6923
if ( ! activated && lastOverscroll > ptrThreshold ) {
@@ -6986,7 +7013,7 @@ IonicModule
6986
7013
// fraction based on the easing method
6987
7014
easedT = easeOutCubic ( time ) ;
6988
7015
6989
- overscroll ( parseInt ( ( easedT * ( Y - from ) ) + from , 10 ) ) ;
7016
+ overscroll ( Math . floor ( ( easedT * ( Y - from ) ) + from ) ) ;
6990
7017
6991
7018
if ( time < 1 ) {
6992
7019
ionic . requestAnimationFrame ( scroll ) ;
@@ -7007,6 +7034,21 @@ IonicModule
7007
7034
}
7008
7035
7009
7036
7037
+ var touchMoveEvent , touchEndEvent ;
7038
+ if ( window . navigator . pointerEnabled ) {
7039
+ //touchStartEvent = 'pointerdown';
7040
+ touchMoveEvent = 'pointermove' ;
7041
+ touchEndEvent = 'pointerup' ;
7042
+ } else if ( window . navigator . msPointerEnabled ) {
7043
+ //touchStartEvent = 'MSPointerDown';
7044
+ touchMoveEvent = 'MSPointerMove' ;
7045
+ touchEndEvent = 'MSPointerUp' ;
7046
+ } else {
7047
+ //touchStartEvent = 'touchstart';
7048
+ touchMoveEvent = 'touchmove' ;
7049
+ touchEndEvent = 'touchend' ;
7050
+ }
7051
+
7010
7052
self . init = function ( ) {
7011
7053
scrollParent = $element . parent ( ) . parent ( ) [ 0 ] ;
7012
7054
scrollChild = $element . parent ( ) [ 0 ] ;
@@ -7016,17 +7058,24 @@ IonicModule
7016
7058
throw new Error ( 'Refresher must be immediate child of ion-content or ion-scroll' ) ;
7017
7059
}
7018
7060
7019
- ionic . on ( 'touchmove' , handleTouchmove , scrollChild ) ;
7020
- ionic . on ( 'touchend' , handleTouchend , scrollChild ) ;
7061
+
7062
+ ionic . on ( touchMoveEvent , handleTouchmove , scrollChild ) ;
7063
+ ionic . on ( touchEndEvent , handleTouchend , scrollChild ) ;
7064
+ ionic . on ( 'mousedown' , handleMousedown , scrollChild ) ;
7065
+ ionic . on ( 'mousemove' , handleTouchmove , scrollChild ) ;
7066
+ ionic . on ( 'mouseup' , handleTouchend , scrollChild ) ;
7021
7067
ionic . on ( 'scroll' , handleScroll , scrollParent ) ;
7022
7068
7023
7069
// cleanup when done
7024
7070
$scope . $on ( '$destroy' , destroy ) ;
7025
7071
} ;
7026
7072
7027
7073
function destroy ( ) {
7028
- ionic . off ( 'touchmove' , handleTouchmove , scrollChild ) ;
7029
- ionic . off ( 'touchend' , handleTouchend , scrollChild ) ;
7074
+ ionic . off ( touchMoveEvent , handleTouchmove , scrollChild ) ;
7075
+ ionic . off ( touchEndEvent , handleTouchend , scrollChild ) ;
7076
+ ionic . off ( 'mousedown' , handleMousedown , scrollChild ) ;
7077
+ ionic . off ( 'mousemove' , handleTouchmove , scrollChild ) ;
7078
+ ionic . off ( 'mouseup' , handleTouchend , scrollChild ) ;
7030
7079
ionic . off ( 'scroll' , handleScroll , scrollParent ) ;
7031
7080
scrollParent = null ;
7032
7081
scrollChild = null ;
@@ -10464,7 +10513,15 @@ IonicModule
10464
10513
this . $scope = $scope ;
10465
10514
this . $element = $element ;
10466
10515
10467
- this . input = $element [ 0 ] . querySelector ( 'input,textarea' ) ;
10516
+ this . setInputAriaLabeledBy = function ( id ) {
10517
+ var inputs = $element [ 0 ] . querySelectorAll ( 'input,textarea' ) ;
10518
+ inputs . length && inputs [ 0 ] . setAttribute ( 'aria-labelledby' , id ) ;
10519
+ } ;
10520
+
10521
+ this . focus = function ( ) {
10522
+ var inputs = $element [ 0 ] . querySelectorAll ( 'input,textarea' ) ;
10523
+ inputs . length && inputs [ 0 ] . focus ( ) ;
10524
+ } ;
10468
10525
} ]
10469
10526
} ;
10470
10527
} ] ) ;
@@ -10511,12 +10568,13 @@ IonicModule
10511
10568
$element . attr ( 'id' , id ) ;
10512
10569
}
10513
10570
10514
- if ( ionInputCtrl && ionInputCtrl . input ) {
10515
- ionInputCtrl . input . setAttribute ( 'aria-labelledby' , id ) ;
10571
+ if ( ionInputCtrl ) {
10572
+
10573
+ ionInputCtrl . setInputAriaLabeledBy ( id ) ;
10516
10574
10517
10575
$element . on ( 'click' , function ( ) {
10518
10576
$timeout ( function ( ) {
10519
- ionInputCtrl . input . focus ( ) ;
10577
+ ionInputCtrl . focus ( ) ;
10520
10578
} ) ;
10521
10579
} ) ;
10522
10580
}
@@ -10545,8 +10603,8 @@ IonicModule
10545
10603
$element . attr ( 'id' , id ) ;
10546
10604
}
10547
10605
10548
- if ( ionInputCtrl && ionInputCtrl . input ) {
10549
- ionInputCtrl . input . setAttribute ( 'aria-labelledby' , id ) ;
10606
+ if ( ionInputCtrl ) {
10607
+ ionInputCtrl . setInputAriaLabeledBy ( id ) ;
10550
10608
}
10551
10609
10552
10610
} ;
@@ -12319,7 +12377,7 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
12319
12377
if ( ! $scope . direction ) { $scope . direction = 'y' ; }
12320
12378
var isPaging = $scope . $eval ( $scope . paging ) === true ;
12321
12379
12322
- if ( nativeScrolling ) {
12380
+ if ( nativeScrolling ) {
12323
12381
$element . addClass ( 'overflow-scroll' ) ;
12324
12382
}
12325
12383
@@ -13047,7 +13105,9 @@ function($animate, $timeout) {
13047
13105
this . update = function ( ) {
13048
13106
$timeout ( function ( ) {
13049
13107
_this . __slider . update ( ) ;
13050
- _this . __slider . createLoop ( ) ;
13108
+ if ( _this . _options . loop ) {
13109
+ _this . __slider . createLoop ( ) ;
13110
+ }
13051
13111
13052
13112
// Don't allow pager to show with > 10 slides
13053
13113
if ( _this . __slider . slides . length > 10 ) {
@@ -13073,8 +13133,10 @@ function($animate, $timeout) {
13073
13133
preloadImages : false
13074
13134
} , options ) ;
13075
13135
13136
+ this . _options = newOptions ;
13137
+
13076
13138
$timeout ( function ( ) {
13077
- var slider = new ionic . views . Swiper ( $element . children ( ) [ 0 ] , newOptions ) ;
13139
+ var slider = new ionic . views . Swiper ( $element . children ( ) [ 0 ] , newOptions , $scope ) ;
13078
13140
13079
13141
_this . __slider = slider ;
13080
13142
$scope . slider = _this . __slider ;
0 commit comments