Ticket #4075: simulate-scale-1.0-xo-4.diff

File simulate-scale-1.0-xo-4.diff, 1002 bytes (added by humitos, 11 years ago)

Use "began" signal instead of scale at 1.0 to reset the original_zoom

  • ImageViewerActivity.py

    diff --git a/ImageViewerActivity.py b/ImageViewerActivity.py
    index b33e46c..4850116 100644
    a b class ImageViewerActivity(activity.Activity): 
    123123            zoom_controller = SugarGestures.ZoomController()
    124124            zoom_controller.connect('scale-changed',
    125125                    self.__scale_changed_cb)
     126            zoom_controller.connect('began',
     127                    self.__scale_began_cb)
    126128            zoom_controller.attach(self,
    127129                    SugarGestures.EventControllerFlags.NONE)
    128130
    class ImageViewerActivity(activity.Activity): 
    208210                # Wait for a successful join before trying to get the document
    209211                self.connect("joined", self._joined_cb)
    210212
     213    def __scale_began_cb(self, controller):
     214        self.view._zoom_ori = self.view.zoom
     215
    211216    def __scale_changed_cb(self, controller, scale):
    212217        if scale != self._last_scale:
    213218            self._last_scale = scale