On Mon, 2010-07-12 at 16:16 +0200, donn wrote:
> On 12/07/2010 15:36, Rob Bradford wrote:
> > Easy:
> See?, everyone tells me this. :D
> 
> > If you're using Clutter 1.3/1.4 then use the new constraints API:
> > http://docs.clutter-project.org/docs/clutter/1.3/ClutterBindConstraint.html
> I wish. I am using Python so it's the 1.0 bindings. I use 1.3.6 under 
> the hood, but the new stuff beyond gobject properties is not exposed 
> yet. (Unless there's a way through said properties?)
> 
> 
> > If you're using 1.2 then you want to listen to the allocation-changed
> > signal on the group and then apply the width and height of the group to
> > your background rectangle.
> 
> I translated your C into Python. The Group connects it's 
> 'allocation-changed' signal to a method in my Rectangle class. In there 
> I get the ClutterActorBox box and —
> 1. It changes size ONLY if I add actors to the right/down of the Group's 
> (0,0) point. i.e.:
>   a. Actor ONE : set_position(0,0); grp.add(ONE)
>   b. Actor TWO : set_position(200,200); grp.add(TWO)
> 2. It does *NOT* change the size if I do:
>   a. Actor TWO : set_position(-200,0); grp.add(TWO)
> 

Oh. You're using negative offsets (and I guess with an anchor point?)
That's pretty mad. ClutterGroup doesn't calculate the way you think it
does. If you want to continue using negative offsets you'll need to
calulate the size yourself....

Here's some pseudo code

min_x, min_y = 0
max_x, max_y = 0

for (actor in groups.children)
{
  min_x = MIN (actor.x, min_x)
  max_x = MAX (actor.x + actor.width, max_x)

  min_y = MIN (actor.y, min_y)
  max_y = MAX (actor.y + actor.height, max_y)
}

w = max_x - min_x
h = max_y - min_y

Cheerio,

Rob

_______________________________________________
clutter-app-devel-list mailing list
[email protected]
http://lists.clutter-project.org/listinfo/clutter-app-devel-list

Reply via email to