Re: Generic positioning



On Tue, 2008-10-21 at 23:55 +0200, Murray Cumming wrote: 
> We now have a patch for generic positioning in goocanvas. This puts x,
> y, width, and height properties on the GooCanvasItem base interface,
> without changing the behavour of existing x, y, width and height
> properties where they already exist on some items. So it's not an API
> change - just an API addition or simplification.
> 
> This allows applications to move and resize items without special code
> for each type of item. The generic-position-demo shows how this can be
> useful.
> 
> This is simpler than working with transforms and, unlike transforms, it
> does not also affect details such as rectangle borders or specified text
> sizes.
> 
> I'd like this patch to be considered, please.
> http://bugzilla.gnome.org/show_bug.cgi?id=555097

My main problem with this is that if we are going to add x, y, width &
height properties to the GooCanvasItem interface then they should have
well-defined semantics. But they don't - the x and y properties refer to
arbitrary points in the item and the width & height may or may not be
the exact width & height of the item.

I would think that if people see generic x, y, width & height properties
then they will expect them to refer to the top-left coordinate and the
exact width & height of the item.

I wouldn't mind adding x, y, width & height properties to some of the
items though.


If I was writing an application that allowed users to drag items around
and snap them to grids etc. I'd write my own custom items derived from a
base class that supported drag-handles and all the API necessary to do
this generically. I wouldn't really expect the builtin canvas items to
be usable for this, since the functionality desired will probably differ
from application to application.

Damon




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