[TIMOB-13373] Android: ImageView canScale property does not maintain boundary
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-06-07T23:21:10.000+0000 |
Affected Version/s | n/a |
Fix Version/s | 2013 Sprint 12 API, 2013 Sprint 12, Release 3.2.0 |
Components | Android |
Labels | module_imageview, qe-testadded |
Reporter | Soumya Kanti Kar |
Assignee | Sunila |
Created | 2013-04-02T09:04:10.000+0000 |
Updated | 2013-10-18T06:46:25.000+0000 |
Description
If the following code is run, once the image is displayed, pan the image without zooming. It can be observed that the image is going outside the viewable region and the view becomes green and the image is not longer displayed.
It should be within the viewable region.
var win = Titanium.UI.createWindow({
exitOnClose : true,
navBarHidden : true
});
var parentView = Titanium.UI.createView({
left : 0,
top : 0,
width : '100%',
height : '50%',
backgroundColor : 'red'
});
var imageView = Titanium.UI.createImageView({
left : 0,
top : 0,
width : Titanium.UI.SIZE,
height : Titanium.UI.SIZE,
canScale : true,
enableZoomControls : true,
backgroundColor : 'green'
});
parentView.add(imageView);
win.add(parentView);
win.open();
var xhr = Titanium.Network.createHTTPClient({
onload : function(e) {
Ti.API.error("<<<<<<<<<<<<<<<<<<<<<<<<" + this.responseData);
imageView.image = this.responseData;
},
onerror : function(e) {
alert('<<<Error>>>');
Ti.API.error("The error is: " + e.error);
},
timeout : 10000,
autoEncodeUrl : false
});
xhr.open('GET', 'http://images4.wikia.nocookie.net/__cb20111006233206/disney/images/e/e2/MMCH_Y3.jpg');
xhr.setRequestHeader('content-type', 'application/json');
xhr.setRequestHeader('accept', 'application/json');
xhr.send();
Attachments
File | Date | Size |
---|---|---|
Device_02.png | 2013-04-03T06:16:24.000+0000 | 71561 |
Device_03.png | 2013-04-03T06:16:25.000+0000 | 21675 |
Device_04.png | 2013-04-03T06:16:25.000+0000 | 14745 |
Device_1.jpg | 2013-04-03T06:15:03.000+0000 | 32122 |
Tested on a 4.1 device and 4.2 simulator could not reproduce.
Jamie, I have attached the screenshot showing the issue that we are facing. I have also modified the code a bit, so that it will download an image from remote server. The code has been executed on Sumsung Galaxy S2 running Android 4.2.2. Device_1 ==> This is the first image that is being displayed once the code has been executed. Device_2 ==> Pan (move) the image to bottom-right without zooming. Device_3 ==> Pan the image more so that the background color (green) of the imageview gets more prominent. Device_4 ==> The actual image has been moved away and is no longer visible. This should not happen and it should be within the boundary such that the image is always visible, with or without zooming. This is reproducible in both Android device as well as Android simulator, from Android 2.2 to current version.
Reproduced on Android Simulator 2.2
Is there an update for this issue?
This issue is still reproducible in 3.1.0GA
Behavior implemented If the image is in the original size, scrolling is not allowed If the image is zoomed in, then it can be scrolled until the boundaries, images cannot be scrolled beyond the boundaries.
PR: https://github.com/appcelerator/titanium_mobile/pull/4361
Please add this fix to 3.1.2.
Verified with Fix with: Appc-Studio: 3.2.0.201310170829 Sdk:3.2.0.v20131017152001 alloy:1.2.2 npm:1.3.2 titanium:3.2.0 titanium-code-processor:1.0.3 Device:Google Nexus 7(v4.3) Xcode: 5 imageView canScale property working fine.