Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ImageViewerActivity.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-10-29 20:13:15 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2012-11-06 01:05:28 (GMT)
commit290189d892861a30fb97cefe9197cd2194e89594 (patch)
tree9b0316785ed8811bb25dcd178033316f43a466e9 /ImageViewerActivity.py
parentdeeff1aadcde25b0d3ccbe609f885ec4943fc5a0 (diff)
Zoom Gesture zooms through the gesture's center
When two fingers are used to zoom in/out the image, the center of the gesture is used to zoom the image through it. Signed-off-by: Manuel Kaufmann <humitos@gmail.com> Signed-off-by: Agustin Zubiaga <aguz@sugarlabs.org>
Diffstat (limited to 'ImageViewerActivity.py')
-rw-r--r--ImageViewerActivity.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/ImageViewerActivity.py b/ImageViewerActivity.py
index 0c51699..4850116 100644
--- a/ImageViewerActivity.py
+++ b/ImageViewerActivity.py
@@ -123,6 +123,8 @@ class ImageViewerActivity(activity.Activity):
zoom_controller = SugarGestures.ZoomController()
zoom_controller.connect('scale-changed',
self.__scale_changed_cb)
+ zoom_controller.connect('began',
+ self.__scale_began_cb)
zoom_controller.attach(self,
SugarGestures.EventControllerFlags.NONE)
@@ -208,12 +210,16 @@ class ImageViewerActivity(activity.Activity):
# Wait for a successful join before trying to get the document
self.connect("joined", self._joined_cb)
+ def __scale_began_cb(self, controller):
+ self.view._zoom_ori = self.view.zoom
+
def __scale_changed_cb(self, controller, scale):
if scale != self._last_scale:
self._last_scale = scale
logging.error('Scale changed %f', scale)
self.view._is_touching = True
+ self.view._touch_center = controller.get_center()
self.view.set_zoom_relative(scale)
def handle_view_source(self):