Hi Friends,

i had developed the custom list view which is having NSView as a cell with
variable sizes to represent the video clips in the timeline.

and i had implemented the drag and drop for reordering functionality...
that is working as per the expectation...

but i wanted to add the animation while doing the drag and drop like in
"iPhoto"...

(when user drag the item if the mouse co-ords enters the in between region
then the corresponding elements will animate... and animation will end and
it comeback its original position once the mouse left the coords)....

here i am including the drag and drop code.... please help me how i can
implement the above mentioned animation while doing drag and drop...


Thanks & Regards,
Muthu




- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender

{

NSDragOperation theOperation = NSDragOperationNone;

      self.highlightForDragAcceptance = YES;



BOOL dropHighlight = _highlightForDragAcceptance;





     downLocation = [self convertPoint: [sender draggingLocation] fromView:
[self superview]];







    dropindex = [self indexOfCellAtPoint:downLocation];





  theOperation = [timelineViewController validateDrop:sender proposedCell:
dropindex

                     proposedDropHighlight: dropHighlight];




 return theOperation;

}


- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender

{

NSDragOperation theOperation = NSDragOperationNone;

  self.highlightForDragAcceptance = YES;



    BOOL dropHighlight = _highlightForDragAcceptance;



    currentLocation = [self convertPoint: [sender draggingLocation] fromView:
[self superview]];






    NSUInteger _numberOfCells = [[timelineViewController collection] count];

    NSArray * sprites = [timelineViewController collection];







    dropindex = [self indexOfCellAtPoint:currentLocation];







    theOperation = [timelineViewController validateDrop:sender proposedCell:
dropindex

                                  proposedDropHighlight: dropHighlight];





return theOperation;

}



- (void)draggingExited:(id <NSDraggingInfo>)sender

{

#pragma unused(sender)



 self.highlightForDragAcceptance = NO;

}


- (BOOL)prepareForDragOperation:(id<NSDraggingInfo>)sender

{

    sender.animatesToDestination = YES;



return YES;

}



- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender

{

    BOOL highlight = _highlightForDragAcceptance;







BOOL accepted = [timelineViewController acceptDrop:sender cellindex:
dropindex dropHighlight:highlight];

  self.highlightForDragAcceptance = NO;



return accepted;

}



- (void)concludeDragOperation:(id <NSDraggingInfo>)sender

{

#pragma unused(sender)

}



- (void)draggingEnded:(id <NSDraggingInfo>)sender

{

#pragma unused(sender)

     self.highlightForDragAcceptance = NO;

     [self deselectSelectedObjects];

}




- (BOOL)wantsPeriodicDraggingUpdates

{

return YES;

}




- (BOOL)writeCellsWithIndexes:(NSIndexSet*)indexes toPasteboard:(
NSPasteboard *)dragPasteboard

{

    [dragPasteboard declareTypes: [NSArray arrayWithObjects:
NSStringPboardType, nil] owner: self];

[dragPasteboard setString: @"Just Testing" forType: NSStringPboardType];

 return YES;


}


- (NSDragOperation)validateDrop:(id <NSDraggingInfo>)info proposedCell:(
NSUInteger)index

      proposedDropHighlight:(BOOL)dropHighlight;

{

return NSDragOperationCopy;

}


- (BOOL)acceptDrop:(id <NSDraggingInfo>)info cellindex:(NSUInteger)index
dropHighlight:(BOOL)dropHighlight

{

    NSLog(@"Accept Drop");

    NSLog(@"selection index:%i",[spritesController selectionIndex]);

    NSLog(@"drop index:%i",index);



    MVSprite *temp = [collection objectAtIndex: [spritesController
selectionIndex]];



    [spritesController removeObjectAtArrangedObjectIndex:[spritesController
selectionIndex]];

    [spritesController insertObject:temp atArrangedObjectIndex:index];







    NSArray * sprites = [self collection];


 int count = [sprites count];




//layout the subviews


    for (int i=0; i<count; i++)

    {

        MVSprite * current = [sprites objectAtIndex:i];

        if(i == 0)

        {

            current.start = 0;

            current.end = current.start + current.duration;

            [current setAnimate:YES];

            [current.spriteView setSpriteViewFrame];



        }else{

            MVSprite * previous = [sprites objectAtIndex:i-1];



            current.start = previous.end;

            current.end = current.start + current.duration;

            [current setAnimate:YES];

            [current.spriteView setSpriteViewFrame];



        }



    }

}
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to