Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6843] Ti API: 2DMatrix.rotate() can take 2 arguments on Android, only 1 on iOS and Mobile Web

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionWon't Fix
Resolution Date2017-06-26T22:10:05.000+0000
Affected Version/sRelease 1.8.0
Fix Version/sn/a
ComponentsMobileWeb, TiAPI
Labelscore, parity
ReporterTony Lukasavage
AssigneeEric Merriman
Created2011-12-22T08:20:17.000+0000
Updated2017-08-24T20:50:59.000+0000

Description

The Problem

When using 2DMatrix.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 the rotate() function

Comments

  1. Bryan Hughes 2013-01-29

    FYI 2DMatrix.rotate only takes one argument on Mobile Web
  2. Bryan Hughes 2013-04-04

    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.
  3. Lee Morris 2017-08-24

    Mobile Web has been deprecated and will be removed in fixVersion 7.0.0.

JSON Source