Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8473] iOS: Pinch event doesn't update correctly the zoomScale property of the ScrollView

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-04-04T04:26:47.000+0000
Affected Version/sRelease 1.8.0.1, Release 2.0.0, Release 1.8.2
Fix Version/sRelease 3.0.2
ComponentsiOS
Labelsapi
ReporterRoger Mabillard
Assigneejithinpv
Created2012-02-09T02:01:07.000+0000
Updated2017-03-23T21:12:47.000+0000

Description

Issue

When you pinch & zoom the image, the scale value prints correctly after the scale event, but if you then double tap the image, it does not use that new scale value we just zoomed to, but the old scale value that was there just before the pinch event.

Reproduction steps

1. Run code below 2. Pinch & zoom the image 3. Double tap 4. Noticed at the console it does not use that new scale value we just zoomed to, but the old scale value that was there just before the pinch event.

Tested on

iOS simulator 5

Repro sequence


Titanium.UI.setBackgroundColor('#fff');

var win = Titanium.UI.createWindow({  
    backgroundColor:'#fff'
});


var image = 'wallpaper.jpg';

var ratio = 1.0;

var imageScrollView = Ti.UI.createScrollView({
	maxZoomScale:4.0,
	minZoomScale:1.0,
	top:0,
	width:320,
	height:480,
	showVerticalScrollIndicator:true,
    showHorizontalScrollIndicator:true,
    contentWidth: image.width,
	contentHeight: image.height,
	zoomScale:ratio
});

var imageView = Ti.UI.createImageView({
	image:image,
	width:320,
	height:480
});

imageScrollView.add(imageView);

imageView.addEventListener('doubletap', function(e) {
	
	Ti.API.info('doubletap detected.');
	Ti.API.info('zoomScale is ' + imageScrollView.zoomScale);
	
	if (imageScrollView.zoomScale < 4.0) {
		imageScrollView.zoomScale *= 2.0;
	}
	
	else {
		imageScrollView.zoomScale = ratio;
	}
	
});

imageScrollView.addEventListener('scale', function(e) {
	Ti.API.info('new imageScrollView zoomScale is ' + e.scale);
});

win.add(imageScrollView);

win.open();

Here is an example from the console:

{noformat} [INFO] Application started [INFO] ScrollView-zoomScale/1.0 (1.8.0.1.fbdc96f) [INFO] new imageScrollView zoomScale is 1 [INFO] new imageScrollView zoomScale is 2.464661121368408 [INFO] doubletap detected. [INFO] zoomScale is 1 [INFO] new imageScrollView zoomScale is 2 {noformat}

Attachments

FileDateSize
ScrollView-zoomScale.zip2012-02-09T02:01:07.000+00002635885
wallpaper.jpg2012-03-31T22:14:16.000+0000340441

Comments

  1. jithinpv 2013-04-04

    Issue does not reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0 console: [INFO] :   new imageScrollView zoomScale is 1 [INFO] :   new imageScrollView zoomScale is 1.0424460172653198 [INFO] :   doubletap detected. [INFO] :   zoomScale is 1.0424460172653198 [INFO] :   new imageScrollView zoomScale is 2.0848920345306396 [INFO] :   new imageScrollView zoomScale is 2.5215344429016113 [INFO] :   doubletap detected. [INFO] :   zoomScale is 2.5215344429016113 [INFO] :   new imageScrollView zoomScale is 4
  2. Lee Morris 2017-03-23

    Can verify this ticket as "Cannot Reproduce". Tested with the following environment; iPhone 7 and Simulator (10.2) MacOS 10.11.6 (15G31) Studio 4.8.1.201612050850 Ti SDK 6.0.3 GA Appc NPM 4.2.8 Appc CLI 6.1.0 Ti CLI 5.0.11 Alloy 1.9.5 Arrow 1.10.1 Xcode 8.2 (8C38) Node v4.6.0 Java 1.7.0_80

JSON Source