Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13373] Android: ImageView canScale property does not maintain boundary

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2013-06-07T23:21:10.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 12 API, 2013 Sprint 12, Release 3.2.0
ComponentsAndroid
Labelsmodule_imageview, qe-testadded
ReporterSoumya Kanti Kar
AssigneeSunila
Created2013-04-02T09:04:10.000+0000
Updated2013-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

FileDateSize
Device_02.png2013-04-03T06:16:24.000+000071561
Device_03.png2013-04-03T06:16:25.000+000021675
Device_04.png2013-04-03T06:16:25.000+000014745
Device_1.jpg2013-04-03T06:15:03.000+000032122

Comments

  1. Jamie Buckley 2013-04-02

    Tested on a 4.1 device and 4.2 simulator could not reproduce.
  2. Soumya Kanti Kar 2013-04-03

    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.
  3. Jamie Buckley 2013-04-04

    Reproduced on Android Simulator 2.2
  4. Soumya Kanti Kar 2013-04-16

    Is there an update for this issue?
  5. Soumya Kanti Kar 2013-04-25

    This issue is still reproducible in 3.1.0GA
  6. Sunila 2013-06-06

    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.
  7. Allen Yeung 2013-06-07

    PR: https://github.com/appcelerator/titanium_mobile/pull/4361
  8. Viktor Korol 2013-08-10

    Please add this fix to 3.1.2.
  9. Priya Agarwal 2013-10-18

    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.

JSON Source