<snip> > > I need a group of objects to always draw behind another group of > > objects. What I effectively need are layers. Previously, I had be faking > > this by making sure I added them to FloatCanvas in order. > > > > I have finally hit the limit of this approach, as I now need to add and > > remove objects from the bottom layer. > > > > This seems to be similar to the Foreground/Background stuff - I > > effectively need multiple Foregroup layers. > > Did you try to use a GroupObject to manage your layers? It's essentially > the same thing. You can put a bunch of objects in the a Group, and put a > bunch of groups on the canvas. As you add and remove from the group, it > doesn't change where the group ends up on the Canvas.
I had hit the limit of what I could usefully do with the GroupObject. To many things don't work quite right (IE Hit Testing stuff, etc). > That being said, you still might want to move groups up and down, etc. > > However, making DrawOrder a attribute of DrawObject has its limitations, > which I discussed a bit on this list a while back: > > You could have a DrawObject on more than one Canvas (at least in theory > I haven't done this yet. It seems to me that DrawOrder is more an > attribute of the Canvas (or the currently non-existent Document object!) > than a property of the DrawObject itself. Sure, but I needed a working solution now :) > Also, when I think about working with applications with layers, like a > vector drawing app, for instance, I think about the user wanting > operations like: > > move this object up/down > move this object to the top > move this object to the bottom > > Those are all relative movements, so it would be a bit tricky to deal > with them with the DrawOrder attribute, and you're requiring the user to > keep track of all the Objects DrawOrder to know what to set it to > accomplish what they want. You also need everything in Layer X is below everything in Layer Y. This is what is important to me. > You could certainly look at the DrawOrder values of the surrounding > objects, but the math would not always be obvious, particularly if you > had a bunch of objects that have the same DrawOrder in the list already. > > > + self._DrawList.sort(DrawOrder) > > does the list.sort() guarantee that the order will not change for > elements that compare equal? I have no idea, but it doesn't really matter for me :) > > This seems to > > work pretty well. I'm open to suggestions on how to improve it. > > well, what I'd really like to do is create some sort of a Document > Object, that would manage this sort of thing, rather than just having > the _DrawList (and _ForeDrawList). That would also facilitate things > like saving and loading documents, etc. > > I'm imagining that it would have methods like: > > Document.MoveUp(Object) # move Object up one level > > Document.MoveDown(Object) # move Object down one level > > Document.MoveToBottom(Object) # move object to bottom > > Document.MoveToTop(Object) # move object to Top > > Document.MoveAbove(Object1, Object2) # move Object1 one level above Object2 > > Document.MoveBelow(Object1, Object2) # move Object1 one level below Object2 > > You get the idea. > > Thoughts? I'll probably use if you implement it. :) It needs to have absolute movement too however, IE Document.MoveToLevel(level, object) > -Chris I'm currently trying to release my project, so at the moment I don't really have the brain capacity to think about the "proper" way to do it. After the release, I can come back to it and make some better suggestions :) Tim 'Mithro' Ansell _______________________________________________ FloatCanvas mailing list [email protected] http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
