[TIMOB-6843] Ti API: 2DMatrix.rotate() can take 2 arguments on Android, only 1 on iOS and Mobile Web
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2017-06-26T22:10:05.000+0000 |
Affected Version/s | Release 1.8.0 |
Fix Version/s | n/a |
Components | MobileWeb, TiAPI |
Labels | core, parity |
Reporter | Tony Lukasavage |
Assignee | Eric Merriman |
Created | 2011-12-22T08:20:17.000+0000 |
Updated | 2017-08-24T20:50:59.000+0000 |
Description
The Problem
When using2DMatrix.rotate()
to rotate views, this function can take 2 arguments on Android, and only one on iOS and Mobile Web. In the source code found here:
[https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/view/Ti2DMatrix.java#L140-152](https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/titanium/view/Ti2DMatrix.java#L140-152)
We see that Android takes 2 arguments because in the single argument form it resets the rotation transform back to zero instead of using its existing transformation. While this gives Android developers a chance to better control their animations, it creates a parity issue. For exmaple:
Ti.UI.create2DMatrix().rotate(45, 0);
if animated on a view will rotate it from 45 to 0 on Android, but it will rotate it from its existing position to 45 on iOS. There will be no errors as iOS will just ignore the 2nd argument, but it will behave differently on each platform.
Proposed Solutions
1. Modify the Android source to use any existing transform for its original position instead of just reseting it to zero. 2. Modify the iOS source so that it can also accept a starting and ending rotation for therotate()
function
FYI 2DMatrix.rotate only takes one argument on Mobile Web
As it turns out, this is an amazingly difficult problem to solve because matrices in Android are not true affine transforms (they have some extra sauce applied). This means that achieving parity in rotate is surprisingly difficult. The better solution is to just wait until we create a new, non-matrix based animation system.
Mobile Web has been deprecated and will be removed in fixVersion 7.0.0.