[TIMOB-24442] Android: Ti.UI.View.rect is not updated after animation
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-03-08T19:14:47.000+0000 |
| Affected Version/s | Release 6.0.2 |
| Fix Version/s | Release 6.0.3 |
| Components | Android |
| Labels | n/a |
| Reporter | Gary Mathews |
| Assignee | Gary Mathews |
| Created | 2017-03-01T14:35:43.000+0000 |
| Updated | 2017-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();
master: https://github.com/appcelerator/titanium_mobile/pull/8855
[~gmathews] I believe this ticket also needs backport to 6.0.3.
6_0_X: https://github.com/appcelerator/titanium_mobile/pull/8869
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
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 band I am moving "view b" inside "view a". With this patch I have to subtract the"view a" leftposition from"view b".rect.xbecause it is now usinggetLocationInWindowand before it was returning the x position in my parent view. Perhaps that should be added to the documentationAnd iOS is referring to the parent view and not the window so the position is not the same!
This fix has raised other problems.