{ "id": "119241", "key": "ALOY-812", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-03-25T16:15:46.000+0000", "created": "2013-08-29T10:39:50.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "alloy", "android", "dip", "px", "tss" ], "versions": [ { "id": "15570", "description": "Alloy 1.2.1", "name": "Alloy 1.2.1", "archived": false, "released": true, "releaseDate": "2013-08-27" } ], "issuelinks": [], "assignee": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updated": "2018-03-07T22:28:27.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "description": "When doing an app for both iOS and Android, I usually set the default unit to {{dp}}. This works great, but some properties like {{borderWidth}} and {{borderRadius}} are always interpreted as {{px}} on Android.\r\n\r\nSo for the right size, I need to use Alloy's builtin {{measurement.dpToPx}}. However, TSS does not (longer) support using methods, only (global) values. This means for every different value I use, I need to pre-calculate the px-value in {{alloy.js}} and store it in {{Alloy.Globals}} so I can use it in the TSS. This is far from ideal.\r\n\r\nWhy not add builtin casting of non-number values to number-values for properties that require that type?\r\n\r\nFor example, in TSS I'd have:\r\n\r\n{code}\r\n\"View\": {\r\n borderWidth: '5dp'\r\n}\r\n{code}\r\n\r\nWhich then would be compiled to: \r\n\r\n{code:javascript}\r\nborderWidth: Alloy.measurement.toNumber('5dp');\r\n{code}\r\n\r\nThe {{Alloy.measurement.toNumber}} method then should read the unit from the string and perform the appropriate conversion to get the number-value (px).", "attachment": [ { "id": "46846", "filename": "S420.png", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-03-25T16:15:16.000+0000", "size": 105815, "mimeType": "image/png" } ], "flagged": false, "summary": "Alloy: Automatically convert string-values for number-properties like borderWidth in TSS", "creator": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "subtasks": [], "reporter": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "environment": "Alloy 1.2.1.GA", "comment": { "comments": [ { "id": "268813", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "Just fixing these properties to also honor the default unit setting in the Titanium SDK would be even better, but of course break existing apps.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2013-08-29T10:40:34.000+0000", "updated": "2013-08-29T10:40:34.000+0000" }, { "id": "298575", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "See the attached screen. I don't believe this is a valid issue. Alloy app, default unit set in tiapp.xml to system with borderWidth:20 on the left and borderWidth:'20dp' on the right.\r\n\r\nIf I set the default unit to dp in tiapp.xml, the result with 20 and '20dp' match, as would be expected.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-03-25T16:15:16.000+0000", "updated": "2014-03-25T16:15:16.000+0000" }, { "id": "298576", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Marking as invalid pending developer response", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-03-25T16:15:46.000+0000", "updated": "2014-03-25T16:15:46.000+0000" }, { "id": "298831", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-03-26T18:26:33.000+0000", "updated": "2014-03-26T18:26:33.000+0000" }, { "id": "301239", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "[~skypanther] this indeed seems to be fixed now https://github.com/appcelerator/titanium_mobile/pull/5521/files added support for specifying a unit with the value.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2014-04-17T12:37:45.000+0000", "updated": "2014-04-17T12:37:45.000+0000" }, { "id": "435342", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as invalid. If this is incorrect, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-03-07T22:28:27.000+0000", "updated": "2018-03-07T22:28:27.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }