Re: [chlor-develop] Delete-Operation and Z-Ordering
Status: Pre-Alpha
Brought to you by:
lenny222
|
From: <chl...@li...> - 2006-04-06 21:27:10
|
Am 06.04.2006 um 23:05 schrieb chlor-develop- ad...@li...: > Alas, using the add operation as the inverse of the remove > operation on a mutable array isn't correct, as we would loose the z- > ordering during drawing (e.g. removing the first drawn object, > hitting undo and adding it at the end of the array makes it the > last object being drawn and thus the topmost, right?). i think insertObject:atIndex: is the way to go? > Okay, how in general should we go for z-ordering? Shall we use the > array position within CLayer implicitly as the z-order? Shall the z- > order work across layers? Shall every CObject carry its own z-order > then as a third coordinate? The CObjects shouldn't be bothered with that. The according visitor could and should handle this. If it is asked to "delete" objects it should do the following: 1) go and find the CGroup which is owning the objects to delete 2) For each to object/group find out the index needed to readd it 3) Keep track of the to be removed objects (don't destroy the objects, just remove them form the groups) 4) Register the according undo operation with the objects from step 3) and the indices from step 2) Bye, Lenny |