Re: Dynamic Rendering Order??

I see that several have piped in (Chris, Tobi, Mjumbe). My turn now.

As I remember, the SVG working group considered and reject z-index 
primarily due to assumed implementation complexity. Chris points out other 
reasons which also factored into the decision.

Personally, I am not convinced that the SVG working group made the correct 
decision. z-index is on the list for consideration in SVG2, so it will have 
its day in court again.

Chris mentioned that you can use symbol/use. I would add to his comment 
that the 'use' element can reference 'g' elements also, and that in some 
cases clever application of 'use' can produce the effect of 'z-index'.

<svg>
   <defs>
      <g id="object1">...</g>
      <g id="object2">...</g>
      <g id="object3">...</g>
   </defs>
   <circle id="circle1".../>
   <use id="use1" xlink:href="#object1"/>
   <use id="use2" xlink:href="#object2"/>
   <use id="use3" xlink:href="#object3"/>
   <animate xlink:href="#use2" attributeName="xlink:href"
           begin="circle.click" to="#object3"/>
   <animate xlink:href="#use3" attributeName="xlink:href"
           begin="circle.click" to="#object2"/>
</svg>

In the above example, clicking on the circle swaps the references for the 
second and third 'use' elements, thereby causing the drawing order to 
change. Note that this was done without any JavaScript. (BTW, I didn't run 
the above SVG. It probably has bugs.)

Jon Ferraiolo
SVG 1.0 Editor
jferraio@adobe.com



At 10:02 PM 6/29/01 -0500, Jim Rosenberg wrote:
>Please excuse a question from a < newbie to SVG.
>
>My understanding is that rendering order is determined by the order in which
>something occurs in the SVG document.  I.e. it is not an attribute (if
>that's the right term) like x or y.  I have several questions about this.
>
>Did the SVG committee consider making rendering order an attribute?  If this
>was considered and rejected, I'd be quite curious to know the rationale.
>
>What is the best method of changing rendering order dynamically -- in an on
>mouseOver handler, for instance?  I'm just getting started studying SVG, so
>there is much I don't understand yet.  From what limited amount I do know,
>it looks as though the only choices to do rendering order dynamically are
>(1) create SVG on the fly and (2) have multiple versions of a drawing
>embedded and hide and show groups to pick the one with the right rendering
>order.  Both of these have problems.  For (1) I'm concerned about the
>ramifications for preloading.  (When I want to change the rendering order, I
>*don't* want this to require a new HTTP request, for example.)  (2) could
>get out of hand in a hurry, geometrically exploding the size of the
>document.  Maybe there's another method using something obvious I'm
>overlooking ...
>
>If making rendering order an attribute was not already considered and
>rejected, is there any chance of getting this discussed for an SVG 2.0?
>
>What is the best thinking on how to get dynamic rendering order?
>
>Thanks in advance ...
>
>---
>Jim Rosenberg                            http://www.well.com/user/jer/
>      CIS: 71515,124
>      WELL: jer
>      Internet: jr@amanue.com

Received on Sunday, 1 July 2001 12:21:09 UTC