Re: how to know the offset of a canvas



On Mon, 2013-09-30 at 07:46 -0400, dmg wrote:
Hi everybody,

I have a canvas that is bigger than the window where it is displayed.

There is a function  goo_canvas_scroll_to  to scroll the canvas to a
given position.
is there an inverse of this function? Is there a way to know the coordinates
of the top/left position being displayed?

I don't think there is a specific function.

I think you'll have to use the adjustments to get the position and then
goo_canvas_convert_from_pixels() to convert to canvas coordinates.

e.g. maybe something like this:

 double x = gtk_adjustment_get_value (canvas->hadjustment)
 double y = gtk_adjustment_get_value (canvas->yadjustment)
 goo_canvas_convert_from_pixels (canvas, &x, &y);

Damon




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