Re: Generic positioning



On Fri, 2008-10-31 at 10:26 +0000, Damon Chaplin wrote:
> On Wed, 2008-10-29 at 16:06 +0100, Armin Burgmeier wrote:
> > On Wed, 2008-10-29 at 12:37 +0000, Damon Chaplin wrote:
> 
> > > I'll accept a patch that adds x, y, width & height properties to most of
> > > the items that don't have them, with functionality as in your latest
> > > patch. I don't want to add x, y, width & height properties to the
> > > GooCanvasItem interface though.
> > > 
> > > For GooCanvasGroup I'd prefer it if the x & y properties set the origin
> > > of the existing transformation matrix rather than adding an extra
> > > translation.
> > 
> > Wouldn't this make it impossible to get back the x and y properties in
> > get_property() then? I mean, if the group is translated via
> > goo_canvas_item_translate, then this should not add up to the x & y
> > properties (to behave the same was as GooCanvasRect, for example),
> > should it?
> 
> The group has no real x & y properties, so we are basically just
> modifying its transformation matrix anyway.
> 
> I thought it would be better if we made that clear, rather than try to
> explain that the x & y properties are an extra translation applied after
> the group's transformation matrix.
> 
> 
> > >  I'm not sure about adding width & height though - I'd
> > > prefer not to. (Your code for GooCanvasGroup looks wrong as it uses
> > > goo_canvas_item_get_bounds() to get the child extents, but the bounds
> > > are in device space so may have arbitrary transformations on them.)
> > 
> > What code do you mean exactly? I added test code for the group width &
> > height to generic-position-demo.c, and everything behaves as I'd expect,
> > I think.
> 
> goo_canvas_group_get_extent() is wrong. If the group or one of its
> ancestors was rotated all of the child bounds would change (since they
> are in device space). So the new "width" and "height" properties of the
> group would change. But that is inconsistent with all the other items,
> whose width and height remain constant when rotated.
> 
> I don't think there is a way for a group to get the bounds of child
> items in its own coordinate space.

Ah, so there's a problem when the width and height are unset. So maybe
the properties should just return -1 in that case, as
GooCanvasGroupModel does already.

> Damon

Armin



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]