Tim Ansell wrote: > Hey everyone, > > The patch I have come up with is at the end of the email.
Hey Tim -- I think we did need some management of zorder somehow, but I have a couple questions: 1) in your original email, you said: > 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. 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. 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 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? > 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? -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] _______________________________________________ FloatCanvas mailing list [email protected] http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
