Smooth zooming
- From: Lindley M French <lfrench1 gmu edu>
- To: gtk-list gnome org
- Subject: Smooth zooming
- Date: Wed, 20 Feb 2008 11:24:04 -0500
I've asked this question on several Gtk forums on previous occasions, but never got much of a response. As this list seems a bit more active, perhaps my luck will be better here.
I'm trying to implement a zoomable + scrollable window which remains centered on the same point while it zooms. To this end, I have the following hierarchy:
vbox
scrolled_window
draw_area
hscale
Now, I've set the callback on the hscale to call set_size_request on the draw_area. The notion is that "zooming" is simply making the internals of the scrolled window larger.
In order to maintain focus on the same area, I have a "percentage" variable visible to both the "value-changed" and "changed" handlers on the horizontal and vertical scrollbars. (They each have their own percentage.)
Whenever value-changed is called, the percentage of the bounds is updated. Whenever changed is called, the value is *also* updated along with the bounds, using the known percentage.
This all works pretty well. However, I drag the hscale zoom control around, the drawn figure appears to "stutter" between the proper position and some offset relative to the speed at which I'm dragging it.
I can only assume a draw is taking place between when the draw_area's notion of it's upper-left is changed, and when it's notion of what part is visible is changed. I've tried to avoid this by setting a flag indicating a zoom adjustment is in progress (so don't draw), but it's still happening.
So the question is, when is a zoom adjustment "finished"? Right now, I'm assuming it's done after both scrollbars' value-changed signal is called. But perhaps I should be keying off a signal from the draw-area itself instead?
I don't know the signal kickoff sequence well enough to figure this out.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]