Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24793] Android: Ti.UI.View.center is incorrectly calculated

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-06-08T22:10:09.000+0000
Affected Version/sRelease 6.1.0
Fix Version/sRelease 6.1.1
ComponentsAndroid
Labelsn/a
ReporterGary Mathews
AssigneeJoshua Quick
Created2017-06-07T15:23:51.000+0000
Updated2017-06-15T01:24:44.000+0000

Description

- The center property of View is incorrectly calculated, producing invalid positioning.
var window = Ti.UI.createWindow({backgroundColor: 'gray'}),
    a = Ti.UI.createView({backgroundColor: 'red', width: 200, height: 200, top: 0, left: 0}),
    b = Ti.UI.createView({backgroundColor: 'blue', width: 100, height: 100, center: {x: 150, y: 150}}),
    btn_a = Ti.UI.createButton({title: 'TOP LEFT', bottom: 0, left: 0, width: '50%'}),
    btn_b = Ti.UI.createButton({title: 'ZERO', bottom: 0, right: 0, width: '50%'});

btn_a.addEventListener('click', function(){
    b.center = {x: 50, y: 50};
});

btn_b.addEventListener('click', function(){
    b.center = {x: 0, y: 0};
});

window.add([btn_a, btn_b, a, b]);
window.open();

Comments

  1. Gary Mathews 2017-06-07

    master: https://github.com/appcelerator/titanium_mobile/pull/9125
  2. Gary Mathews 2017-06-07

    6_1_X: https://github.com/appcelerator/titanium_mobile/pull/9126
  3. Lokesh Choudhary 2017-06-08

    FR passed for master. Waiting for the recent fix to go into the backport PR.
  4. Lokesh Choudhary 2017-06-08

    FR passed for backport PR
  5. Lokesh Choudhary 2017-06-09

    Verified the fix in SDK 6.2.0.v20170609120851 & 6.1.1.v20170609120621. Used the steps in the PR to test. Closing. Studio Ver: 4.9.0.201705302345 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.2.2 Ti CLI Ver: 5.0.14 Alloy Ver: 1.9.11 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Pixel --- Android 7.1.1 ⇨ google Nexus 5 --- Android 6.0.1

JSON Source