Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23451] Android: Window rect attribute return wrong device height and width value

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionNeeds more info
Resolution Date2018-12-11T08:39:16.000+0000
Affected Version/sRelease 5.2.2
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterSharif AbuDarda
AssigneeUnknown
Created2016-05-28T05:26:14.000+0000
Updated2018-12-11T08:39:16.000+0000

Description

Hello, Below is a test case which demonstrates the issue.
var window = Ti.UI.createWindow( {
    'width'  : '100%',
    'height' : '100%'
} );

window.addEventListener( 'click', function ( event ) {

    console.log( 'x: ' + Math.round( event.x ) );
    console.log( 'y: ' + Math.round( event.y ) );

    console.log( 'window width:  ' + event.source.rect.width );
    console.log( 'window height: ' + event.source.rect.height );

    console.log( 'screen width:  ' + Ti.Platform.displayCaps.platformWidth );
    console.log( 'screen height: ' + Ti.Platform.displayCaps.platformHeight );
} );

window.open();
As the window width and height is 100% to the device screen, The value of
console.log( 'window width:  ' + event.source.rect.width );
and
console.log( 'screen width:  ' + Ti.Platform.displayCaps.platformWidth );
should be same. Also, same goes for height values.

Tested Environment:

SDK: 5.2.2.GA Android 4.4.2

Comments

  1. Hieu Pham 2016-05-31

    Window's height is different than displayCaps height because of the title bar. As you can see, the window isn't exactly fullscreen. The width return are identical.

JSON Source