Dragging a group of objects
Dragging a group of objects
- Subject: Dragging a group of objects
- From: Lorenzo <email@hidden>
- Date: Wed, 14 May 2003 14:09:19 +0200
Hi,
I can drag a bunch of objects pretty well putting them into a temporary
NSView then dragging that NSView. Then on mouseUp: I remove the objects from
this NSView and I add back the objects to their original NSView.
The problem is that when I put some objects into the temporary NSView, they
lose their front/back order in relation to the other objects that remained
into the original NSView.
e.g. I have 4 objects in a view.
The sort position from Front to Back is 1, 2, 3, 4.
So, for example, if I move the object 1 over the object 2, the object 1
covers the object 2. And so forth.
I select the 2nd and 4th objects, thus I put quickly them into the temporary
NSView, then I drag the NSView, but since the NSView is one only object, all
the objects within this NSView have the same Front/Back level in relation to
the objects 1 and 3 that remained into the original NSView.
So, if I put the temporary NSView to the Front, during the drag both the
object 2 and 4 cover the object 1 and 3 (wrong).
The order becomes: 2, 4, 1, 3.
And if I put the temporary NSView at the Back, during the drag both the
object 1 and 3 cover the object 2 and 4 (wrong).
The order becomes: 1, 3, 2, 4.
More, I tried to don't group the objects I want to drag into an NSView,
and instead I built an NSArray listing all the object I need to drag.
But, when I try to use this loop inside the mouseDragged:
for(i = 0; i < totObjects; i++){
obj = [objectsToMoveArray objectAtIndex:i];
[obj setFrameOrigin:[obj newOrigin:delta]];
}
it works so slow....
Any better solution?
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.