|
@@ -1,12 +1,12 @@
|
|
|
-From c31e49b00d1934045e3ff6613ce2a39467304879 Mon Sep 17 00:00:00 2001
|
|
|
+From 047b5156fa009bc8e45a9f5de8bb9c54d24188cb Mon Sep 17 00:00:00 2001
|
|
|
From: Carola Nitz <nitz.carola@googlemail.com>
|
|
|
-Date: Sat, 8 Feb 2014 21:09:43 +0100
|
|
|
+Date: Sat, 15 Mar 2014 22:08:32 +0100
|
|
|
Subject: [PATCH] Added a delegate method to remove item from folder
|
|
|
|
|
|
---
|
|
|
- .../LXReorderableCollectionViewFlowLayout.h | 1 +
|
|
|
- .../LXReorderableCollectionViewFlowLayout.m | 8 +++++++-
|
|
|
- 2 files changed, 8 insertions(+), 1 deletion(-)
|
|
|
+ .../LXReorderableCollectionViewFlowLayout.h | 1 +
|
|
|
+ .../LXReorderableCollectionViewFlowLayout.m | 7 ++++++-
|
|
|
+ 2 files changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
|
|
diff --git a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.h b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.h
|
|
|
index 76617f4..45c3843 100755
|
|
@@ -21,31 +21,30 @@ index 76617f4..45c3843 100755
|
|
|
- (BOOL)collectionView:(UICollectionView *)collectionView canMoveItemAtIndexPath:(NSIndexPath *)indexPath;
|
|
|
- (BOOL)collectionView:(UICollectionView *)collectionView itemAtIndexPath:(NSIndexPath *)fromIndexPath canMoveToIndexPath:(NSIndexPath *)toIndexPath;
|
|
|
diff --git a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m
|
|
|
-index 5e7008f..86f4f4f 100755
|
|
|
+index e1289b2..5a6d3e7 100755
|
|
|
--- a/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m
|
|
|
+++ b/LXReorderableCollectionViewFlowLayout/LXReorderableCollectionViewFlowLayout.m
|
|
|
-@@ -239,6 +239,7 @@ static NSString * const kLXCollectionViewKeyPath = @"collectionView";
|
|
|
+@@ -240,6 +240,7 @@ static NSString * const kLXCollectionViewKeyPath = @"collectionView";
|
|
|
translation = CGPointMake(0.0f, distance);
|
|
|
} break;
|
|
|
case LXScrollingDirectionLeft: {
|
|
|
+ [self.dataSource collectionView:self.collectionView removeItemFromFolderAtIndexPathIfNeeded:_selectedItemIndexPath];
|
|
|
distance = -distance;
|
|
|
- CGFloat minX = 0.0f;
|
|
|
+ CGFloat minX = 0.0f - contentInset.left;
|
|
|
|
|
|
-@@ -249,6 +250,7 @@ static NSString * const kLXCollectionViewKeyPath = @"collectionView";
|
|
|
+@@ -250,6 +251,7 @@ static NSString * const kLXCollectionViewKeyPath = @"collectionView";
|
|
|
translation = CGPointMake(distance, 0.0f);
|
|
|
} break;
|
|
|
case LXScrollingDirectionRight: {
|
|
|
+ [self.dataSource collectionView:self.collectionView removeItemFromFolderAtIndexPathIfNeeded:_selectedItemIndexPath];
|
|
|
- CGFloat maxX = MAX(contentSize.width, frameSize.width) - frameSize.width;
|
|
|
+ CGFloat maxX = MAX(contentSize.width, frameSize.width) - frameSize.width + contentInset.right;
|
|
|
|
|
|
if ((contentOffset.x + distance) >= maxX) {
|
|
|
-@@ -383,7 +385,11 @@ static NSString * const kLXCollectionViewKeyPath = @"collectionView";
|
|
|
+@@ -384,7 +386,10 @@ static NSString * const kLXCollectionViewKeyPath = @"collectionView";
|
|
|
CGPoint viewCenter = self.currentView.center = LXS_CGPointAdd(self.currentViewCenter, self.panTranslationInCollectionView);
|
|
|
|
|
|
[self invalidateLayoutIfNecessary];
|
|
|
-
|
|
|
-+
|
|
|
+ //TODO: start a timer to not immediately trigger the remove from folder
|
|
|
+ if (self.currentView.center.x < 0 || self.currentView.center.x > self.collectionView.frame.size.width) {
|
|
|
+ [self.dataSource collectionView:self.collectionView removeItemFromFolderAtIndexPathIfNeeded:_selectedItemIndexPath];
|
|
@@ -54,5 +53,5 @@ index 5e7008f..86f4f4f 100755
|
|
|
case UICollectionViewScrollDirectionVertical: {
|
|
|
if (viewCenter.y < (CGRectGetMinY(self.collectionView.bounds) + self.scrollingTriggerEdgeInsets.top)) {
|
|
|
--
|
|
|
-1.8.3.4 (Apple Git-47)
|
|
|
+1.8.5.2 (Apple Git-48)
|
|
|
|