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
Conversation
public void setScaleY(Float scale) | ||
{ | ||
setPropertyAndFire(TiC.PROPERTY_SCALE_Y, scale); | ||
}*/ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
@@ -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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Code reviewed and functionally tested. Looks good, will merge when master becomes 6.0.0 |
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