Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8420] MobileWeb: Specifying a size in points (pt) causes layout errors.

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-06-14T13:51:23.000+0000
Affected Version/sRelease 2.0.0
Fix Version/sRelease 2.1.0, Sprint 2012-12 MW
ComponentsMobileWeb
Labelsparity, qe-port
ReporterArthur Evans
AssigneeBryan Hughes
Created2012-03-29T13:12:52.000+0000
Updated2012-08-08T16:25:48.000+0000

Description

When adding a view with a size specified in points (pt), the layout does not work correctly. Given the following code, the two labels l1 and l2 should be the same size and aligned vertically, as shown in the Android screenshot. Instead, the views are not aligned correctly and the sizes are wrong. The same error occurs if the second view is sized in picas (pc) or ems (em), but not if it is sized in inches or units. A *different* error occurs if it is sized in millimeters, but that is a subject for another bug.
var win1 = Titanium.UI.createWindow({  
    title:'Composite Layout Test',
    backgroundColor:'#fff',
    layout: 'vertical'
});
var l1 = Titanium.UI.createLabel({
	top: 0,
	color:'#999',
	backgroundColor: 'blue',
	text:'1in',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'1in',
	height:'1in'
});
win1.add(l1);

var l2 = Titanium.UI.createLabel({
	top: 0,
	color:'#999',
	backgroundColor: 'red',
	text:'72pt',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'72pt',
	height:'72pt'
});
win1.add(l2);

var l3 = Titanium.UI.createLabel({
	top: 0,
	color:'#999',
	backgroundColor: 'green',
	text:'72 units',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:72,
	height:72
});
win1.add(l3);

win1.open();

Attachments

FileDateSize
composite_layout_android.png2012-03-29T13:12:52.000+00009657
composite_layout_mobileweb.png2012-03-29T13:12:53.000+000036590

Comments

  1. Bryan Hughes 2012-06-12

    Pull Request: https://github.com/appcelerator/titanium_mobile/pull/2380
  2. Lokesh Choudhary 2012-08-07

    Tested On: Titanium studio : 2.1.1.201207271312 SDK version : 2.2.0.v20120807070117 Android 4.0.4 - default ,chrome 18.0 Iphone 4.3.5 - safari mobile Mountain lion(10.8) - chrome 21.0,safari 5.1.4,firefox 14.0.1

JSON Source