enhance(ionSlideBox): allow scrolling to work

This commit is contained in:
Andrew
2014-10-08 16:32:44 -06:00
parent 8228106145
commit d324bb615a
2 changed files with 6 additions and 13 deletions

View File

@@ -45,7 +45,7 @@ function($ionicSlideBoxDelegate, $window) {
return {
restrict: 'E',
controller: '$ionSlideBox',
require: ['ionSlideBox', '^?$ionicScroll'],
require: ['ionSlideBox'],
transclude: true,
scope: {
selectedIndex: '=?selected',
@@ -62,10 +62,7 @@ function($ionicSlideBoxDelegate, $window) {
return postLink;
}
function postLink(scope, element, attr, ctrls) {
var slideBoxCtrl = ctrls[0];
var scrollCtrl = ctrls[1];
function postLink(scope, element, attr, slideBoxCtrl) {
element.addClass('slider');
var deregister = $ionicSlideBoxDelegate._registerInstance(slideBoxCtrl, attr.delegateHandle);
@@ -79,15 +76,7 @@ function($ionicSlideBoxDelegate, $window) {
throttledReposition();
angular.element($window).on('resize', throttledReposition);
if (scrollCtrl) {
var oldScrollingY = scrollCtrl.scrollView.options.scrollingY;
scrollCtrl.scrollView.options.scrollingY = false;
}
scope.$on('$destroy', function() {
if (scrollCtrl) {
scrollCtrl.scrollView.options.scrollingY = oldScrollingY;
}
angular.element($window).off('resize', throttledReposition);
});

View File

@@ -25,6 +25,10 @@ IonicModule
ionic.offGesture(dragEndGesture, 'dragend', handleDragEnd);
});
element.on('touchmove pointermove mousemove', function(ev) {
if (dragState && dragState.dragging) ev.preventDefault();
});
var dragState;
function handleDragStart(ev) {
if (dragState) return;