Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-909] display width/height are not always correct

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:54:38.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.4.0
ComponentsiOS
Labelsn/a
ReporterNolan Wright
AssigneeBlain Hamon
Created2011-04-15T02:39:01.000+0000
Updated2011-04-17T01:54:38.000+0000

Description

http://helpdesk.appcelerator.net/tickets/2091">http://helpdesk.appcelerator.net/tickets/2091

run Platform => Platform data.

if you lay the device down the height/width report values for landscape even though the phone is in portrait

Comments

  1. Nolan Wright 2011-04-15

    Also, if your app starts in landscape, the values are incorrect. here't the code:

    var appwin = Titanium.UI.createWindow();
    appwin.orientationModes = [

               Titanium.UI.LANDSCAPE_LEFT,
               Titanium.UI.LANDSCAPE_RIGHT
           ];
       

    var trackedItemLabel = Ti.UI.createLabel({

               width:160,
               backgroundColor: '#f00',
               height:40,
               text: 'click',
               textAlign:'center',
               font: {fontFamily:'Helvetica Neue',fontSize:20},
               left: 100,
               top: 100
       

    });

    appwin.add(trackedItemLabel);

    trackedItemLabel.addEventListener("click",function(e) {

       Ti.API.info('Ti.Platform.displayCaps.platformWidth = ' + Ti.Platform.displayCaps.platformWidth);
       

    });

    appwin.open();

  2. Jeff Haynie 2011-04-15

    (from [a3daa3e6417c09713741ad82b048ec0d4cf6cf96]) Closes #909; Distinction between Device orientation and UI orientation made, adding Ti.Platform.displayCaps.isUIPortrait , which is now used by platformWidth and platformHeight. http://github.com/appcelerator/titanium_mobile/commit/a3daa3e6417c09713741ad82b048ec0d4cf6cf96"> http://github.com/appcelerator/titanium_mobile/commit/a3daa3e6417c0...

JSON Source