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}
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
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