From 96adaf3d1b17cbff32299000ce89ad18fb6c0baa Mon Sep 17 00:00:00 2001 From: Mikko Viitala Date: Tue, 15 Nov 2016 12:51:12 +0200 Subject: [PATCH 1/5] Correct attribute names for drag events --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 698cbca..3152e57 100644 --- a/README.md +++ b/README.md @@ -54,9 +54,11 @@ Use the axis attribute to lock the dragging to a specific axis. By default, both Use the onDragStart and onDragEnd events to call functions whenever the dragging starts or stops ```html -
+
``` +## Attributes +Use dragScrollExcludedClasses ## Credits / Inspiration * https://github.com/asvd/dragscroll From 73808067f9f91410fc95118834e7a960209b1bff Mon Sep 17 00:00:00 2001 From: Mikko Viitala Date: Tue, 15 Nov 2016 12:55:33 +0200 Subject: [PATCH 2/5] Add usage for dragScrollExcludedClasses --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3152e57..cded916 100644 --- a/README.md +++ b/README.md @@ -57,8 +57,11 @@ Use the onDragStart and onDragEnd events to call functions whenever the dragging
``` -## Attributes -Use dragScrollExcludedClasses +### Other attributes +Use dragScrollExcludedClasses to exclude drag scrolling for elements having certain classes. Class names should be separated using comma. +```html +
+``` ## Credits / Inspiration * https://github.com/asvd/dragscroll From 32d1ee01fe4f2dcd5db7e715d0b4867c5f6fe6a2 Mon Sep 17 00:00:00 2001 From: Mikko Viitala Date: Tue, 15 Nov 2016 12:56:34 +0200 Subject: [PATCH 3/5] Remove unused injection of "vm" --- src/ng-drag-scroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng-drag-scroll.js b/src/ng-drag-scroll.js index 71fa49c..de8119e 100644 --- a/src/ng-drag-scroll.js +++ b/src/ng-drag-scroll.js @@ -13,7 +13,7 @@ //
Lorem ipsum dolor sit amet
var directive = { restrict: 'A', - link: function($scope, $element, $attributes, vm) { + link: function($scope, $element, $attributes) { var enabled = true; var allowedClickOffset = 5; var pushed = false; From 2c0c0406a259711505d8aabbba3874db5e6da96b Mon Sep 17 00:00:00 2001 From: Mikko Viitala Date: Tue, 15 Nov 2016 12:58:13 +0200 Subject: [PATCH 4/5] Move event handler usage after definition --- src/ng-drag-scroll.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ng-drag-scroll.js b/src/ng-drag-scroll.js index de8119e..ef1de18 100644 --- a/src/ng-drag-scroll.js +++ b/src/ng-drag-scroll.js @@ -30,12 +30,6 @@ enabled = newValue !== undefined ? newValue : true; }); - // Set event listeners - $element.on('mousedown', handleMouseDown); - - // Set destroy listener - $scope.$on('$destroy', destroy); - /** * Sets the event listeners for the mouseup and mousedown events */ @@ -172,7 +166,11 @@ } } + // Set event listeners + $element.on('mousedown', handleMouseDown); + // Set destroy listener + $scope.$on('$destroy', destroy); } }; return directive; From 571cfb0cfb40258fa17c930a8e1099af6ea6c98e Mon Sep 17 00:00:00 2001 From: Mikko Viitala Date: Tue, 15 Nov 2016 12:59:14 +0200 Subject: [PATCH 5/5] If excluded class is found, propagate event --- src/ng-drag-scroll.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng-drag-scroll.js b/src/ng-drag-scroll.js index ef1de18..3ce7dbb 100644 --- a/src/ng-drag-scroll.js +++ b/src/ng-drag-scroll.js @@ -54,7 +54,7 @@ if(enabled){ for (var i= 0; i