W3C home > Mailing lists > Public > www-svg@w3.org > November 2012

Re: Proposal: Nesting SVG Graphics Elements

From: Rick <graham.rick@gmail.com>
Date: Thu, 29 Nov 2012 19:19:54 -0500
Message-ID: <CAGDjS3cqFz93RObZ-6bMvMzj0JdFbaLo+7HKnEd208O0n9puQw@mail.gmail.com>
To: Doug Schepers <schepers@w3.org>
Cc: SVG public list <www-svg@w3.org>
Or you could group them and drag the group node.

It's what I do.  I know a group has no intrinsic location, but it can have
a transform or a matrix.

Also, when I have text in a movable item I use something else as a drag
target and generally turn those events off.  Text makes a lousy target.

On Thu, Nov 29, 2012 at 2:52 PM, Doug Schepers <schepers@w3.org> wrote:

> Hi, SVG WG-
> I have a proposal that may make SVG2 easier to understand and use for
> people already familiar with the HTML+CSS world.
> The basic idea is to allow rendering elements to also serve as container
> elements, with child rendering elements also rendered. (This is currently
> not very clearly specified in SVG1.1.)
> Currently, to associate 2 rendering elements, you have to use a group,
> like this:
>   <g id="g1">
>     <rect id="r1" x="5" y="10" width="70" height="40" fill="yellow"
> stroke="red" />
>     <text id="t1" x="15" y="35" font-size="12" fill="crimson">Some
> label</text>
>   </g>
> This can be problematic for positioning the elements relative to one
> other, and to moving the whole unit (yes, you can use a transform, but for
> drag-n-drop, you have to know what to grab and drag).
> We could allow authors to do this by simply nesting the text element,
> which would render on top of the rect (using the same Painter's Model), and
> could be positioned relative to the new established coordinate space of the
> parent shape:
>   <rect id="r2" x="5" y="10" width="70" height="40" fill="yellow"
> stroke="red">
>     <text id="t2" x="50%" y="50%" font-size="12" fill="crimson">Some
> label</text>
>   </rect>
> This also carries the benefit of being more accessible and semantic. After
> talking to several designers, I think it matches the conceptual model of
> containment and presentation from HTML and CSS (though it is distinctly
> different in some ways, since SVG merges the content and presentation
> modes).
> The nesting relationship wouldn't have to be one of "visual containment"
> like in the label example... it can be a simple one-directional constraint
> system, which is not hard to deal with:
>   <g id="g3">
>     <rect id="r3" x="100" y="10" width="40" height="40"/>
>     <circle id="c3" cx="170" cy="30" r="20"/>
>   </g>
> Would be visually equivalent to:
>   <rect id="r4" x="100" y="10" width="40" height="40">
>     <circle id="c4" cx="70" cy="20" r="20"/>
>   </rect>
> And when r4 is moved, c4 keeps the same relationship relative to it.
> We would need to sort out many detail, but I think this is doable fairly
> simply, and has a low risk of backwards incompatibility.
> This also solves some problems that I see coming up in SVG2 and Connectors.
> I'd like discuss this briefly in the telcon, before I develop it further.
> Regards-
> -Doug

    "It's hard to believe that something which is neither seen nor felt can
do so much harm."
    "That's true.  But an idea can't be seen or felt.  And that's what kept
the Troglytes in the
mines all these centuries.  A mistaken idea."
-- Vanna and Kirk, "The Cloud Minders", stardate 5819.0
Received on Friday, 30 November 2012 00:20:42 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:30 UTC