22 * Copyright 2015 Drifty Co.
33 * http://drifty.com/
44 *
5- * Ionic, v1.2.0
5+ * Ionic, v1.2.1
66 * A powerful HTML5 mobile app framework.
77 * http://ionicframework.com/
88 *
@@ -2556,6 +2556,13 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
25562556
25572557 return $timeout ( function ( ) {
25582558 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+ } ) ;
25592566 //After animating in, allow hide on backdrop click
25602567 self . $el . on ( 'click' , function ( e ) {
25612568 if ( self . backdropClickToClose && e . target === self . el && stack . isHighest ( self ) ) {
@@ -4701,8 +4708,9 @@ function($timeout, $document, $q, $ionicClickBlock, $ionicConfig, $ionicNavBarDe
47014708 if ( renderStart && renderEnd ) {
47024709 // CSS "auto" transitioned, not manually transitioned
47034710 // wait a frame so the styles apply before auto transitioning
4704- ionic . requestAnimationFrame ( onReflow ) ;
4705-
4711+ $timeout ( function ( ) {
4712+ ionic . requestAnimationFrame ( onReflow ) ;
4713+ } ) ;
47064714 } else if ( ! renderEnd ) {
47074715 // just the start of a manual transition
47084716 // but it will not render the end of the transition
@@ -6808,13 +6816,22 @@ IonicModule
68086816 $onPulling : '&onPulling'
68096817 } ) ;
68106818
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+
68116828 function handleTouchend ( ) {
6829+ // reset Y
6830+ startY = null ;
68126831 // if this wasn't an overscroll, get out immediately
68136832 if ( ! canOverscroll && ! isDragging ) {
68146833 return ;
68156834 }
6816- // reset Y
6817- startY = null ;
68186835 // the user has overscrolled but went back to native scrolling
68196836 if ( ! isDragging ) {
68206837 dragOffset = 0 ;
@@ -6838,13 +6855,23 @@ IonicModule
68386855 }
68396856
68406857 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+
68416868 // if multitouch or regular scroll event, get out immediately
68426869 if ( ! canOverscroll || e . touches . length > 1 ) {
68436870 return ;
68446871 }
68456872 //if this is a new drag, keep track of where we start
68466873 if ( startY === null ) {
6847- startY = parseInt ( e . touches [ 0 ] . screenY , 10 ) ;
6874+ startY = e . touches [ 0 ] . screenY ;
68486875 }
68496876
68506877 // kitkat fix for touchcancel events http://updates.html5rocks.com/2014/05/A-More-Compatible-Smoother-Touch
@@ -6854,7 +6881,7 @@ IonicModule
68546881 }
68556882
68566883 // how far have we dragged so far?
6857- deltaY = parseInt ( e . touches [ 0 ] . screenY , 10 ) - startY ;
6884+ deltaY = e . touches [ 0 ] . screenY - startY ;
68586885
68596886 // if we've dragged up and back down in to native scroll territory
68606887 if ( deltaY - dragOffset <= 0 || scrollParent . scrollTop !== 0 ) {
@@ -6865,7 +6892,7 @@ IonicModule
68656892 }
68666893
68676894 if ( isDragging ) {
6868- nativescroll ( scrollParent , parseInt ( deltaY - dragOffset , 10 ) * - 1 ) ;
6895+ nativescroll ( scrollParent , deltaY - dragOffset * - 1 ) ;
68696896 }
68706897
68716898 // if we're not at overscroll 0 yet, 0 out
@@ -6890,7 +6917,7 @@ IonicModule
68906917
68916918 isDragging = true ;
68926919 // overscroll according to the user's drag so far
6893- overscroll ( parseInt ( ( deltaY - dragOffset ) / 3 , 10 ) ) ;
6920+ overscroll ( ( deltaY - dragOffset ) / 3 ) ;
68946921
68956922 // update the icon accordingly
68966923 if ( ! activated && lastOverscroll > ptrThreshold ) {
@@ -6986,7 +7013,7 @@ IonicModule
69867013 // fraction based on the easing method
69877014 easedT = easeOutCubic ( time ) ;
69887015
6989- overscroll ( parseInt ( ( easedT * ( Y - from ) ) + from , 10 ) ) ;
7016+ overscroll ( Math . floor ( ( easedT * ( Y - from ) ) + from ) ) ;
69907017
69917018 if ( time < 1 ) {
69927019 ionic . requestAnimationFrame ( scroll ) ;
@@ -7007,6 +7034,21 @@ IonicModule
70077034 }
70087035
70097036
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+
70107052 self . init = function ( ) {
70117053 scrollParent = $element . parent ( ) . parent ( ) [ 0 ] ;
70127054 scrollChild = $element . parent ( ) [ 0 ] ;
@@ -7016,17 +7058,24 @@ IonicModule
70167058 throw new Error ( 'Refresher must be immediate child of ion-content or ion-scroll' ) ;
70177059 }
70187060
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 ) ;
70217067 ionic . on ( 'scroll' , handleScroll , scrollParent ) ;
70227068
70237069 // cleanup when done
70247070 $scope . $on ( '$destroy' , destroy ) ;
70257071 } ;
70267072
70277073 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 ) ;
70307079 ionic . off ( 'scroll' , handleScroll , scrollParent ) ;
70317080 scrollParent = null ;
70327081 scrollChild = null ;
@@ -10464,7 +10513,15 @@ IonicModule
1046410513 this . $scope = $scope ;
1046510514 this . $element = $element ;
1046610515
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+ } ;
1046810525 } ]
1046910526 } ;
1047010527} ] ) ;
@@ -10511,12 +10568,13 @@ IonicModule
1051110568 $element . attr ( 'id' , id ) ;
1051210569 }
1051310570
10514- if ( ionInputCtrl && ionInputCtrl . input ) {
10515- ionInputCtrl . input . setAttribute ( 'aria-labelledby' , id ) ;
10571+ if ( ionInputCtrl ) {
10572+
10573+ ionInputCtrl . setInputAriaLabeledBy ( id ) ;
1051610574
1051710575 $element . on ( 'click' , function ( ) {
1051810576 $timeout ( function ( ) {
10519- ionInputCtrl . input . focus ( ) ;
10577+ ionInputCtrl . focus ( ) ;
1052010578 } ) ;
1052110579 } ) ;
1052210580 }
@@ -10545,8 +10603,8 @@ IonicModule
1054510603 $element . attr ( 'id' , id ) ;
1054610604 }
1054710605
10548- if ( ionInputCtrl && ionInputCtrl . input ) {
10549- ionInputCtrl . input . setAttribute ( 'aria-labelledby' , id ) ;
10606+ if ( ionInputCtrl ) {
10607+ ionInputCtrl . setInputAriaLabeledBy ( id ) ;
1055010608 }
1055110609
1055210610 } ;
@@ -12319,7 +12377,7 @@ function($timeout, $controller, $ionicBind, $ionicConfig) {
1231912377 if ( ! $scope . direction ) { $scope . direction = 'y' ; }
1232012378 var isPaging = $scope . $eval ( $scope . paging ) === true ;
1232112379
12322- if ( nativeScrolling ) {
12380+ if ( nativeScrolling ) {
1232312381 $element . addClass ( 'overflow-scroll' ) ;
1232412382 }
1232512383
@@ -13047,7 +13105,9 @@ function($animate, $timeout) {
1304713105 this . update = function ( ) {
1304813106 $timeout ( function ( ) {
1304913107 _this . __slider . update ( ) ;
13050- _this . __slider . createLoop ( ) ;
13108+ if ( _this . _options . loop ) {
13109+ _this . __slider . createLoop ( ) ;
13110+ }
1305113111
1305213112 // Don't allow pager to show with > 10 slides
1305313113 if ( _this . __slider . slides . length > 10 ) {
@@ -13073,8 +13133,10 @@ function($animate, $timeout) {
1307313133 preloadImages : false
1307413134 } , options ) ;
1307513135
13136+ this . _options = newOptions ;
13137+
1307613138 $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 ) ;
1307813140
1307913141 _this . __slider = slider ;
1308013142 $scope . slider = _this . __slider ;
0 commit comments