Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24825] Windows: Ti.UI.View.center is incorrectly calculated

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-08-17T17:22:23.000+0000
Affected Version/sRelease 6.1.0
Fix Version/sRelease 6.2.0
ComponentsWindows
Labelsn/a
ReporterGary Mathews
AssigneeKota Iguchi
Created2017-06-15T01:24:43.000+0000
Updated2017-08-18T17:50:10.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%'};
});

window.add([btn_a, a, b]);
window.open();
Expected: The "center" property is supposed to be relative to the parent's top-left corner.

Comments

  1. Kota Iguchi 2017-06-22

    https://github.com/appcelerator/titanium_mobile_windows/pull/1022
  2. Kota Iguchi 2017-08-07

    https://github.com/appcelerator/titanium_mobile_windows/pull/1064
  3. Samir Mohammed 2017-08-08

    [~kiguchi] Master is merged waiting for 6_2_X:
  4. Samir Mohammed 2017-08-18

    Verified fix in SDK Version 7.0.0.v20170818091652 and SDK Version: 6.2.0.v20170816173122 Test and other information can be found at: Master: https://github.com/appcelerator/titanium_mobile_windows/pull/1064 6_2_X: https://github.com/appcelerator/titanium_mobile_windows/pull/1069

JSON Source