Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24442] Android: Ti.UI.View.rect is not updated after animation

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2017-03-08T19:14:47.000+0000
Affected Version/sRelease 6.0.2
Fix Version/sRelease 6.0.3
ComponentsAndroid
Labelsn/a
ReporterGary Mathews
AssigneeGary Mathews
Created2017-03-01T14:35:43.000+0000
Updated2017-11-23T13:20:05.000+0000

Description

- Titanium.UI.View.rect x and y properties are not updated after a transform animation has taken place. *TEST CASE*
var win = Ti.UI.createWindow({backgroundColor: 'gray'}),
    view = Ti.UI.createView({
        left: 0,
        top: 0,
        width: 100,
        height: 100,
        backgroundColor: 'red'
    });

win.addEventListener('open', function() {
    Ti.API.info('Initial');
    Ti.API.info('  rect.x: ' + view.rect.x);
    Ti.API.info('  rect.y: ' + view.rect.y);

    view.animate({
        top: 200,
        left: 200,
        duration: 1000
    }, function() {
        Ti.API.info('After Animation');
        Ti.API.info('  rect.x: ' + view.rect.x);
        Ti.API.info('  rect.y: ' + view.rect.y);
    });
})
win.add(view);
win.open();

Comments

  1. Gary Mathews 2017-03-01

    master: https://github.com/appcelerator/titanium_mobile/pull/8855
  2. Abir Mukherjee 2017-03-08

    [~gmathews] I believe this ticket also needs backport to 6.0.3.
  3. Gary Mathews 2017-03-09

    6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8869
  4. Samir Mohammed 2017-03-09

    Verified fix is present in 6.1.0.v20170309114832 and 6.0.3.v20170309114200. Testing can be found at https://github.com/appcelerator/titanium_mobile/pull/8855
  5. Michael Gangolf 2017-05-10

    Just a side-note: I've updated an app from 6.0.2 to 6.0.4 that has a view inside a view: window -> view a -> view b and I am moving "view b" inside "view a". With this patch I have to subtract the "view a" left position from "view b".rect.x because it is now using getLocationInWindow and before it was returning the x position in my parent view. Perhaps that should be added to the documentation
  6. Michael Gangolf 2017-05-10

    And iOS is referring to the parent view and not the window so the position is not the same!
  7. Guile 2017-11-23

    This fix has raised other problems.
  8. Guile 2017-11-23

JSON Source