Skip to content

Commit

Permalink
#40 Finished initial refactor - builds now but failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveFortune committed Nov 29, 2014
1 parent 2a52b7d commit 5156676
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions Pod/Classes/I3BasicRenderDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,10 @@ -(id) init{
-(void) renderDragStart:(I3GestureCoordinator *)coordinator{

id<I3Collection> draggingCollection = coordinator.currentDraggingCollection;
CGPoint dragOrigin = coordinator.currentDragOrigin;
UIView *sourceView = coordinator.currentDraggingItem;

UIView *sourceView = [draggingCollection itemAtPoint:dragOrigin];
UIView *collectionView = draggingCollection.collectionView;

_draggingView = [[I3CloneView alloc] initWithSourceView:sourceView];
_draggingView.frame = [coordinator.arena.superview convertRect:sourceView.frame fromView:collectionView];
_draggingView.frame = [coordinator.arena.superview convertRect:sourceView.frame fromView:draggingCollection.collectionView];
[_draggingView cloneSourceView];

[coordinator.arena.superview addSubview:_draggingView];
Expand All @@ -78,10 +75,10 @@ -(void) renderDraggingFromCoordinator:(I3GestureCoordinator *)coordinator{

-(void) renderResetFromPoint:(CGPoint) at fromCoordinator:(I3GestureCoordinator *)coordinator{

UIView *sourceView = [coordinator.currentDraggingCollection itemAtPoint:coordinator.currentDragOrigin];
UIView *collectionView = coordinator.currentDraggingCollection.collectionView;
id<I3Collection> draggingCollection = coordinator.currentDraggingCollection;
UIView *sourceView = coordinator.currentDraggingItem;

CGRect dragOriginFrame = [coordinator.arena.superview convertRect:sourceView.frame fromView:collectionView];
CGRect dragOriginFrame = [coordinator.arena.superview convertRect:sourceView.frame fromView:draggingCollection.collectionView];
I3CloneView *draggingView = _draggingView;

[UIView animateWithDuration:0.15 animations:^{
Expand All @@ -103,14 +100,13 @@ -(void) renderResetFromPoint:(CGPoint) at fromCoordinator:(I3GestureCoordinator
-(void) renderRearrangeOnPoint:(CGPoint) at fromCoordinator:(I3GestureCoordinator *)coordinator{

id<I3Collection> draggingCollection = coordinator.currentDraggingCollection;
CGPoint dragOrigin = coordinator.currentDragOrigin;
NSIndexPath *atIndex = [draggingCollection indexPathForItemAtPoint:at];

UIView *collectionView = draggingCollection.collectionView;
UIView *superview = coordinator.arena.superview;

UIView *dstSourceView = [draggingCollection itemAtPoint:at];
UIView *sourceView = [draggingCollection itemAtPoint:dragOrigin];

UIView *dstSourceView = [draggingCollection itemAtIndexPath:atIndex];
UIView *sourceView = coordinator.currentDraggingItem;

I3CloneView *exchangeView = [[I3CloneView alloc] initWithSourceView:dstSourceView];
exchangeView.frame = [superview convertRect:dstSourceView.frame fromView:collectionView];
Expand Down Expand Up @@ -186,11 +182,7 @@ -(void) renderDropOnCollection:(id<I3Collection>) dstCollection atPoint:(CGPoint
[_draggingView removeFromSuperview];
_draggingView = nil;

id<I3Collection> draggingCollection = coordinator.currentDraggingCollection;
CGPoint dragOrigin = coordinator.currentDragOrigin;

UIView *sourceView = [draggingCollection itemAtPoint:dragOrigin];
sourceView.alpha = 1;
coordinator.currentDraggingItem.alpha = 1;

}

Expand Down

0 comments on commit 5156676

Please sign in to comment.