Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-23423] Android: Add rotation, rotationX, rotationY, scaleX, scaleY to view #8010

Merged
merged 5 commits into from Jun 27, 2016

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented May 21, 2016

JIRA: https://jira.appcelerator.org/browse/TIMOB-23423

Optional Description:

Allow to set rotation (x,y,z) and scaling (x,y) to a view without the need of 2dmatrix. Similar to the existing translationX(), translationY() (with a small bugfix allowing to use views with borders, too).

With these settings it is possible to do smooth rotation/scaling in a drag event.
GIF comparing 2dmatrix vs setters: http://migaweb.de/matrix.gif

public void setScaleY(Float scale)
{
setPropertyAndFire(TiC.PROPERTY_SCALE_Y, scale);
}*/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out? Please either uncomment or remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course! Forgot to push the commit after testing it :)

@hansemannn hansemannn changed the title [AC-3646] Android: Add rotation, rotationX, rotationY, scaleX, scaleY to view [TIMOB-23423] Android: Add rotation, rotationX, rotationY, scaleX, scaleY to view May 21, 2016
@@ -895,21 +895,41 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP
ViewCompat.setElevation(nativeView, TiConvert.toFloat(newValue));
}
} else if (key.equals(TiC.PROPERTY_TRANSLATION_X)) {
if (nativeView != null) {
ViewCompat.setTranslationX(nativeView, TiConvert.toFloat(newValue));
if (getOuterView() != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why exactly do we change the nativeView in various properties to 'getOuterView()', but leave properties like elevation to use the "old" way?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my PR I just tested the transformation and didn't test the elevation part. But in my test I found out that nativeView was moving the view inside the borderView complex. I found the function https://github.com/m1ga/titanium_mobile/blob/8d5e2d9e28fdd7c57b097e240d8a76e92906d258/android/titanium/src/java/org/appcelerator/titanium/view/TiUIView.java#L1430 that will take the borderView or nativeView so I thought it would be good to use in my cases so it'll use the proper view. I can test the other cases too with a border view

@hieupham007
Copy link
Contributor

Code reviewed and functionally tested. Looks good, will merge when master becomes 6.0.0

@sgtcoolguy sgtcoolguy modified the milestone: 6.0.0 Jun 17, 2016
@sgtcoolguy sgtcoolguy removed the 6.0.0 label Jun 17, 2016
@hieupham007 hieupham007 merged commit 03f3711 into tidev:master Jun 27, 2016
@m1ga m1ga deleted the rotate branch June 28, 2016 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants