[TIMOB-10371] Blackberry: Imageview parity for scaling behavior
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-06-18T04:07:57.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.1.2, Release 3.2.0 |
Components | BlackBerry |
Labels | layout, parity |
Reporter | Vishal Duggal |
Assignee | Josh Roesslein |
Created | 2012-08-09T11:08:59.000+0000 |
Updated | 2017-03-06T18:05:32.000+0000 |
Description
As part of TIMOB-3749 scaling behavior of imageViews was changed. If either width or height of image view are set to follow SIZE behavior('auto',Ti.UI.SIZE,undefined) then the image is scaled with aspect ratio intact. Otherwise the image is scaled ignoring aspect ratio. Test code below
var win = Ti.UI.createWindow({
backgroundColor:'#fff',
layout:'vertical'
});
var image = Ti.UI.createImageView({
image: "http://www.catravelservices.com/management/hotels/pictures/Mawamba_lodge_nature.jpg",
backgroundColor : "red"
});
var label = Ti.UI.createLabel({
text:'Results Here'
})
var updateLabel = function(){
var size = image.size;
label.text = 'ImageView size is '+size.width+'x'+size.height;
}
var controlsContainer = Ti.UI.createView({
height:Ti.UI.SIZE
})
var widthControls = Ti.UI.createView({
width:'50%',
layout:'vertical',
left:0,
height:Ti.UI.SIZE
})
var heightControls = Ti.UI.createView({
width:'50%',
layout:'vertical',
right:0,
height:Ti.UI.SIZE
})
controlsContainer.add(widthControls);
controlsContainer.add(heightControls);
var b1 = Ti.UI.createButton({title:'WIDTH=SIZE'})
var b2 = Ti.UI.createButton({title:'WIDTH=165'})
var b3 = Ti.UI.createButton({title:'WIDTH=250'})
var b4 = Ti.UI.createButton({title:'HEIGHT=SIZE'})
var b5 = Ti.UI.createButton({title:'HEIGHT=50'})
var b6 = Ti.UI.createButton({title:'HEIGHT=165'})
b1.addEventListener('click',function(e){
image.width=Ti.UI.SIZE;
setTimeout(updateLabel,500);
})
b2.addEventListener('click',function(e){
image.width=165;
setTimeout(updateLabel,500);
})
b3.addEventListener('click',function(e){
image.width=250;
setTimeout(updateLabel,500);
})
b4.addEventListener('click',function(e){
image.height=Ti.UI.SIZE;
setTimeout(updateLabel,500);
})
b5.addEventListener('click',function(e){
image.height=50;
setTimeout(updateLabel,500);
})
b6.addEventListener('click',function(e){
image.height=165;
setTimeout(updateLabel,500);
})
win.add(image);
widthControls.add(b1);
widthControls.add(b2);
widthControls.add(b3);
heightControls.add(b4);
heightControls.add(b5);
heightControls.add(b6);
win.add(controlsContainer);
win.add(label)
win.open();
Closing ticket due to time passed and the fact that we no longer offer support for BlackBerry.