#4034 closed defect (fixed)
ImageViewer: zoom gesture center
Reported by: | godiard | Owned by: | humitos |
---|---|---|---|
Priority: | Unspecified by Maintainer | Milestone: | |
Component: | Imageviewer | Version: | Unspecified |
Severity: | Unspecified | Keywords: | |
Cc: | aguz, dsd | Distribution/OS: | Unspecified |
Bug Status: | Unconfirmed |
Description
when using a gesture to zoom in / out, the image center is displaced
Attachments (3)
Change History (12)
comment:1 Changed 11 years ago by humitos
comment:2 Changed 11 years ago by humitos
This commit removes the image vibration of my initial patch: http://git.sugarlabs.org/imageviewer/mainline/commit/163e6b5e8110e5106fa57dc9d1f4a825c1851e3a
comment:3 Changed 11 years ago by humitos
Taking a look at the eog (Eye Of GNOME - the application to see images on GNOME) I found that it uses: g_signal_handlers_block_matched before setting the adjustment value. I understand that this is to avoid the vibration that my patch added.
http://git.gnome.org/browse/eog/tree/src/eog-scroll-view.c#n311
I tried to use that function but I'm not being able to pass None as the fifth argument and trying with another thing I'm getting a segmentation fault.
Here are a code example:
from gi.repository import Gtk from gi.repository import GObject def my_func(*args, **kargs): print 'my_func was called.' adj = Gtk.Adjustment() sw = Gtk.ScrolledWindow() GObject.signal_handlers_block_matched( adj, GObject.SignalMatchType.DATA, 0, 0, None, my_func, sw)
comment:4 Changed 11 years ago by humitos
Could be related with http://bugs.sugarlabs.org/ticket/4060
comment:5 Changed 11 years ago by humitos
- Cc aguz added
The patch attached implements the "Zoom to fixed point" feature, but it does not work when the image is rotated.
This patch works better in conjunction with this patch on XO-4:
comment:6 follow-up: ↓ 7 Changed 11 years ago by dsd
- Cc dsd added
There are alternatives to GObject.signal_handlers_block_matched which might work better, e.g. signal_handlers_block_by_func. Or you can store the signal ID when you connect it in some "global" variable and block it using that (g_signal_handler_block).
comment:7 in reply to: ↑ 6 Changed 11 years ago by humitos
Replying to dsd:
Or you can store the signal ID when you connect it in some "global" variable and block it using that (g_signal_handler_block).
Yes, but the thing here is that I wanted to disconnect some default behaviour: I didn't connect the adjustment to anything and it was moved by default when the widget changes it size. So, when I change the widget's size and the adjustment value, the adjustment was moved to 0,0 in the middle of my actions and a flickering was noticed.
I have to check this again after applying this patch: http://bugs.sugarlabs.org/attachment/ticket/4060/0001-scrolledwindow-Stop-scrolling-when-a-second-touch-po.patch
comment:8 Changed 11 years ago by humitos
- Resolution set to fixed
- Status changed from new to closed
This is already pushed here:
http://git.sugarlabs.org/imageviewer/mainline/commit/290189d892861a30fb97cefe9197cd2194e89594
Comment: this patch does not work when the image is rotated at 90º or 270º. In that case the patch does not do anything. It works as it was working before: zooming from the left-top corner
From Carlos Garnacho's email: