Object nesting (pairing)

110 views
Skip to first unread message

Telkuni Tsuru

unread,
Aug 5, 2011, 10:52:28 PM8/5/11
to Raphaël
Hi folks !

I'd like to ask the description for objects nesting (pairing).

For example, a disk (parent) has one smaller disk (child). The center
of child
is set at a little right to parent center.

I've tried various codes, but failed :

var R = Raphael(0, 0, 800, 600);

var blueObj = R.circle(300, 200, 100) //parent
.attr({fill: "hsb(.6, 1, 1)", stroke: "none", opacity: .5});
var purpObj = R.blueObj.circle(0, 20, 50)//child
.attr({fill: "hsb(.8, 1, 1)", stroke: "none", opacity: .5});

** Above description is one of them.

What modified description should I use ?
** I want to move the disk pair by mouse dragging for the parent.


Thank you,
------------------------------
Telkuni Tsuru @Japan

Ed Davies

unread,
Aug 6, 2011, 7:04:57 AM8/6/11
to Raphaël
Raphael doesn't have any concept of relations like parent/child
between graphical objects. If you want operations like drag to work on
multiple objects then you need to arrange for that in your code.

Raphael sets, http://raphaeljs.com/reference.html#set , are not
essential for this but can be helpful as they allow you to apply
operations to a group of objects easily.

On Aug 6, 2:52 am, Telkuni Tsuru <tsuru.telk...@gmail.com> wrote:
> Hi folks !
>
> I'd like to ask the description for objects nesting (pairing)....

Telkuni Tsuru

unread,
Aug 6, 2011, 10:08:39 AM8/6/11
to Raphaël
Thank you Ed,

I understood.
What I want to do is to realize objects operation of Flash-
ActionScript.


On 8月6日, 午後8:04, Ed Davies <ggl.rtq.0...@edavies.nildram.co.uk> wrote:
> Raphael doesn't have any concept of relations like parent/child
> between graphical objects.


------------------------------
Telkuni Tsuru @Japan

Clifford Heath

unread,
Aug 6, 2011, 10:38:20 AM8/6/11
to raph...@googlegroups.com
On 07/08/2011, at 12:08 AM, Telkuni Tsuru wrote:
> I understood.
> What I want to do is to realize objects operation of Flash-
> ActionScript.

Raphael tends to work differently, but I have made object groups
by creating a parent object and multiple child objects, and overriding
some of the parent's methods (translate, toFront, toBack, remove,
and others if I need them) so they affect the children objects as well.

It's very ad-hoc... but Raphael doesn't yet have compound graphic
objects like most other graphic toolkits. Everyone wants them, and
pretty-much all newcomers expect them, but Dmitry seems to think
they aren't needed.

Clifford Heath.

Jonah Fox

unread,
Aug 6, 2011, 10:40:01 AM8/6/11
to raph...@googlegroups.com
Use Raphael Sets -- it sounds like you are recreating some of their
functionality. They aren't perfect/complete - but offer pretty good
way of maning compound objects.

> --
> You received this message because you are subscribed to the Google Groups
> "Raphaël" group.
> To post to this group, send an email to raph...@googlegroups.com.
> To unsubscribe from this group, send email to
> raphaeljs+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/raphaeljs?hl=en-GB.
>
>

Clifford Heath

unread,
Aug 6, 2011, 7:09:24 PM8/6/11
to raph...@googlegroups.com
On 07/08/2011, at 12:40 AM, Jonah Fox wrote:
> Use Raphael Sets -- it sounds like you are recreating some of their
> functionality.

I'm perfectly well aware of what sets can and can't do, and no, they
simply don't work for my purpose.

In addition, both Sets and my method are hugely slower than using
native grouping operators. Raphael seriously needs to expose them.

Clifford Heath.

Jonah Fox

unread,
Aug 6, 2011, 7:15:53 PM8/6/11
to raph...@googlegroups.com
What don't they do that you need ? Are the native methods reconcilable
under one wrapper API ?

Tapped on my fone

jscheel

unread,
Aug 16, 2011, 2:12:12 PM8/16/11
to Raphaël
Gah, just discovered this. Really makes things tough seeing that
parent-child relationships make an incredible amount of sense here.

On Aug 6, 6:04 am, Ed Davies <ggl.rtq.0...@edavies.nildram.co.uk>
wrote:
> Raphael doesn't have any concept of relations like parent/child
> between graphical objects. If you want operations like drag to work on
> multiple objects then you need to arrange for that in your code.
>
> Raphaelsets,http://raphaeljs.com/reference.html#set, are not
Reply all
Reply to author
Forward
0 new messages