Re: Get current canvas position



On Mon, 2008-10-13 at 12:52 +0200, Till Harbaum / Lists wrote:
> Hi,
> 
> Am Montag 13 Oktober 2008 schrieb Till Harbaum / Lists:
> > So my solution is indeed to store the scroll position locally.
> Which just turns out to be not so trivial when you change the zoom.
> Since the canvas zooms centered and the scroll position is the upper
> left corner, you'd have to adjust the saved scroll position when you are
> changing the zoom. I haven't yet found out how to do this correctly,
> but it seems i have to determine the currently displayed canvas width and
> and height and add/subtract half of this from/to the saved scroll offset ...
> kinda ugly ... very ugly ...
> 
> Isn't there a way to request the current scroll offset from the canvas? 
> Perhaps a window2world on 0,0?

No, I don't think there is a way at present. You could possibly use some
of the private variables in the GooCanvas struct if you're using C, but
that isn't ideal.

We could add a function to return the offsets, both in pixels and in
device coordinates. (We could return negative numbers if the canvas is
zoomed right out and placed somewhere in the middle of the allocated
space).

Damon




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