You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ky...@apache.org on 2018/10/15 09:53:17 UTC

[incubator-weex] branch master updated: [Android] fix transform origin not right when animating with AnimationModule (#1634)

This is an automated email from the ASF dual-hosted git repository.

kyork pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new d86ae20  [Android] fix transform origin not right when animating with AnimationModule (#1634)
d86ae20 is described below

commit d86ae20e9b396fe921d0c56fdee6f59b40c148c9
Author: yxping <yx...@users.noreply.github.com>
AuthorDate: Mon Oct 15 17:53:13 2018 +0800

    [Android] fix transform origin not right when animating with AnimationModule (#1634)
---
 .../java/com/taobao/weex/ui/action/GraphicActionAnimation.java     | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAnimation.java b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAnimation.java
index 6df77b2..4023b0c 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAnimation.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/action/GraphicActionAnimation.java
@@ -41,6 +41,7 @@ import android.view.animation.LinearInterpolator;
 import com.alibaba.fastjson.JSONObject;
 import com.taobao.weex.WXSDKInstance;
 import com.taobao.weex.WXSDKManager;
+import com.taobao.weex.common.Constants;
 import com.taobao.weex.ui.animation.BackgroundColorProperty;
 import com.taobao.weex.ui.animation.HeightProperty;
 import com.taobao.weex.ui.animation.WXAnimationBean;
@@ -120,6 +121,12 @@ public class GraphicActionAnimation extends BasicGraphicAction {
 
     if (null != mAnimationBean.styles) {
       if(styleNeedInit) {
+        // Synchronize transformOrigin between component styles and animation style before
+        // animation start.
+        String transformOrigin = (String) component.getStyles().get(Constants.Name.TRANSFORM_ORIGIN);
+        if (TextUtils.isEmpty(mAnimationBean.styles.transformOrigin)) {
+          mAnimationBean.styles.transformOrigin = transformOrigin;
+        }
         mAnimationBean.styles.init(mAnimationBean.styles.transformOrigin,
             mAnimationBean.styles.transform, (int) component.getLayoutWidth(),
             (int) component.getLayoutHeight(),