[TIMOB-8978] Ti API: View.size, View.rect should report values in defaultunit, not system unit
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-06-18T10:28:26.000+0000 |
Affected Version/s | Release 2.0.1 |
Fix Version/s | Release 2.1.0, Sprint 2012-12 Core |
Components | TiAPI |
Labels | core, parity, qe-port |
Reporter | Arthur Evans |
Assignee | Neeraj Gupta |
Created | 2012-05-03T15:16:37.000+0000 |
Updated | 2012-08-09T15:13:18.000+0000 |
Description
Currently, it appears that Ti.View.size and Ti.View.rect are reported in system default units, regardless of the setting of ti.ui.defaultunit. On Android, this means that these values are reported in pixels, even if you're specifying your entire UI in DIPs.
(On iOS, they're reported in DIPs, which is usually what you want anyway; and in mobile web, px and DIP are the same thing.)
Is there any reason that we couldn't report these values in defaultunit so that users can do simple math with them without having to convert them back into the unit of their choice?
Testing
---- Testing will need to be run on both iOS and Android, ideally with displays which have different densities (in order to ensure that the non-DIP values are treated correctly). Create a new project, with the following app.js:Replace the
ti.ui.defaultunit
property intiapp.xml
with the following values: * unset (not present) ** *iOS*: The units are displayed in DIP ** *Android*: The units are displayed in px *px
*in
Values should be displayed for the appropriate unit type on various devices. Feel free to contact me for further information, but the most important thing to remember is that 1 dip = 2px on iOS, and 1 in = 160 dip. *NOTE:* Android has a bug where non-px values are always reported as rounded to the nearest integer. This needs to be fixed so that rect sizes can be reported accurately for in/cm/mm.Verified fix with: Titanium Studio, build: 2.1.1.201207271312 Titanium SDK: 2.1.1.v20120727140110