Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

doubletap zooming in ScrollView

Hi. I cannot find any way to zoom scrollview by doubletap.

scrollview.addEventListener('doubletap',function(e)
{
    scrollview.zoomScale = 2.0;
});

This doesn't work.

— asked August 4th 2010 by Vitali Virulaine
  • scrollview
  • zoom
0 Comments

2 Answers

  • NOTE: scrollview have zoomScale, but scrollableview have not.

    — answered September 24th 2011 by Bole Chen
    permalink
    0 Comments
  • If someone stumbles upon this question while trying to manage the double tap in a photo gallery…

    You have to build an array of scrollviews, each one with a maxZoomScale and containing an imageView.

    Then:

    scrollableView.addEventListener('doubletap', function(e)
    {
        var photo = scrollableView.views[scrollableView.currentPage];
        (photo.scale <= 1.0) ? photo.zoomScale = 2.0 : photo.zoomScale = 1.0;
    });
    

    Hope this helps somebody.

    — answered February 12th 2012 by Marco Seguri
    permalink
    2 Comments
    • Thanks for this. It does add some doubletap funcionality, but the image stays centered. If the user double taps near the top, it would be better if the image zooms with that point centered.

      — commented October 3rd 2012 by Paul M
    • You're right. You wanna share an improved version of my code?

      — commented October 3rd 2012 by Marco Seguri
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.