Modify condition to remove subproperty animation
authorkhee85.lee <khee85.lee@samsung.com>
Fri, 25 Oct 2013 12:03:03 +0000 (21:03 +0900)
committerkhee85.lee <khee85.lee@samsung.com>
Fri, 25 Oct 2013 12:03:03 +0000 (21:03 +0900)
Change-Id: I19b0b0b0f69f176feca148fb651dcb643a3ff1d0
Signed-off-by: khee85.lee <khee85.lee@samsung.com>
src/ui/animations/FUiAnim_VisualElementImpl.cpp
src/ui/inc/FUiAnim_VisualElementImpl.h

index a2739da..8148d1f 100644 (file)
@@ -541,7 +541,7 @@ _VisualElementImpl::CreateImplicitAnimationIfNeeded( const String& property,
                if (unlikely(pAnimation))
                {
                        /// WARNING:
-                       //      Adding property animation causes previous animation for same property to be removed in Animation Manager.
+                       //      Adding animation causes previous animation for same property to be removed in Animation Manager.
                        if (unlikely(IsFailed(AddAnimation(null, *pAnimation))))
                        {
                                pAnimationManager->RemoveAnimationByProperty(*__pPresentation->__pPublicInstance, property);
@@ -1190,13 +1190,12 @@ _VisualElementImpl::GetBounds(void) const
 }
 
 result
-_VisualElementImpl::SetBoundsI(const FloatRectangle& bounds)
+_VisualElementImpl::SetBoundsI(const FloatRectangle& bounds, bool& sizeChanged)
 {
        _Rectanglef boundsAdjusted(bounds);
-       FloatRectangle oldValue(__bounds);
 
        result r =  E_SUCCESS;
-       bool sizeChanged = false;
+       sizeChanged = false;
 
        if (unlikely(GetSharedData().pEventListener != null))
        {
@@ -1298,39 +1297,39 @@ _VisualElementImpl::SetBoundsI(const FloatRectangle& bounds)
                }
        }
 
-       // observer
-       if(IS_MODEL(this) && IS_NEEDED_UPDATE_PRESENTATION(this))
-       {
-               FloatRectangle currentValue = __pPresentation->__bounds;
-
-               static const String* subProperties[] = {        pVeSubPropBoundsSize, pVeSubPropBoundsPosition, NULL };
-               if(CreateImplicitAnimationIfNeeded(*pVePropBounds,      __bounds, currentValue, subProperties ) == false)
-               {
-                       __pPresentation->SetBoundsProperty(__bounds);
-               }
-
-               VE_DELEGATE(this, InvokeOnBoundsChanged, oldValue);
-
-               if(__pBoundsChangedCallback && sizeChanged == true)
-               {
-                       (*__pBoundsChangedCallback)(__pBoundsChangedCallbackData);
-               }
-
-       }
-
        return r;
 }
 
-
 result
 _VisualElementImpl::SetBounds(const FloatRectangle& bounds)
 {
        SysTryReturnResult(NID_UI_ANIM, IS_MODEL(this), E_INVALID_OPERATION, "VisualElement is not Model object.");
        result r = E_SUCCESS;
+       bool sizeChanged = false;
+       FloatRectangle oldValue(__bounds);
+
+       static const String* subProperties[] = {pVeSubPropBoundsSize, pVeSubPropBoundsPosition, NULL };
 
        if (IS_INTERNAL_CLASS(__pPublicInstance))
        {
-               r = SetBoundsI(bounds);
+               r = SetBoundsI(bounds, sizeChanged);
+
+               if(IS_MODEL(this) && IS_NEEDED_UPDATE_PRESENTATION(this))
+               {
+                       FloatRectangle currentValue = __pPresentation->__bounds;
+
+                       if(CreateImplicitAnimationIfNeeded(*pVePropBounds,      __bounds, currentValue, subProperties) == false)
+                       {
+                               __pPresentation->SetBoundsProperty(__bounds);
+                       }
+
+                       VE_DELEGATE(this, InvokeOnBoundsChanged, oldValue);
+
+                       if(__pBoundsChangedCallback && sizeChanged == true)
+                       {
+                               (*__pBoundsChangedCallback)(__pBoundsChangedCallbackData);
+                       }
+               }
        }
        else
        {
@@ -1354,7 +1353,29 @@ _VisualElementImpl::SetBoundsProperty(const Variant& v)
 {
        SysTryReturn(NID_UI_ANIM, v.GetType() == VARIANT_TYPE_FLOAT_RECTANGLE, E_INVALID_ARG, E_INVALID_ARG, STR_ERROR_INVALID_VARIANT_ARG_TYPE);
 
-       return SetBoundsI(v.ToFloatRectangle());
+       bool sizeChanged = false;
+       FloatRectangle oldValue(__bounds);
+       static const String* subProperties[] = {pVeSubPropBoundsSize, pVeSubPropBoundsPosition, NULL };
+
+       result r = SetBoundsI(v.ToFloatRectangle(), sizeChanged);
+
+       if(IS_MODEL(this) && IS_NEEDED_UPDATE_PRESENTATION(this))
+       {
+               FloatRectangle currentValue = __pPresentation->__bounds;
+
+               if(CreateImplicitAnimationIfNeeded(*pVePropBounds,      __bounds, currentValue, subProperties) == false)
+               {
+                       __pPresentation->SetBoundsProperty(__bounds);
+               }
+
+               VE_DELEGATE(this, InvokeOnBoundsChanged, oldValue);
+
+               if(__pBoundsChangedCallback && sizeChanged == true)
+               {
+                       (*__pBoundsChangedCallback)(__pBoundsChangedCallbackData);
+               }
+       }
+       return r;
 }
 
 Variant
@@ -1370,8 +1391,29 @@ _VisualElementImpl::SetBoundsPositionSubProperty(const Variant& v)
 {
        SysTryReturn(NID_UI_ANIM, v.GetType() == VARIANT_TYPE_FLOAT_POINT, E_INVALID_ARG, E_INVALID_ARG, STR_ERROR_INVALID_VARIANT_ARG_TYPE);
 
+       bool sizeChanged = false;
+       FloatRectangle oldValue(__bounds);
        const FloatPoint& position = v.ToFloatPoint();
-       return SetBoundsProperty(Variant(FloatRectangle(position.x, position.y, __bounds.width, __bounds.height)));
+       result r = SetBoundsI(FloatRectangle(position.x, position.y, __bounds.width, __bounds.height), sizeChanged);
+
+       if(IS_MODEL(this) && IS_NEEDED_UPDATE_PRESENTATION(this))
+       {
+               FloatPoint currentValue(__pPresentation->__bounds.x, __pPresentation->__bounds.y);
+
+               if(CreateImplicitAnimationIfNeeded(*pVeSubPropBoundsPosition,   Variant(FloatPoint(__bounds.x, __bounds.y)) , currentValue, null) == false)
+               {
+                       __pPresentation->SetBoundsPositionSubProperty(Variant(FloatPoint(__bounds.x, __bounds.y)));
+               }
+
+               VE_DELEGATE(this, InvokeOnBoundsChanged, oldValue);
+
+               if(__pBoundsChangedCallback && sizeChanged == true)
+               {
+                       (*__pBoundsChangedCallback)(__pBoundsChangedCallbackData);
+               }
+       }
+
+       return r;
 }
 
 Variant
@@ -1387,8 +1429,28 @@ _VisualElementImpl::SetBoundsSizeSubProperty(const Variant& v)
 {
        SysTryReturn(NID_UI_ANIM, v.GetType() == VARIANT_TYPE_FLOAT_DIMENSION, E_INVALID_ARG, E_INVALID_ARG, STR_ERROR_INVALID_VARIANT_ARG_TYPE);
 
+       FloatRectangle oldValue(__bounds);
+       bool sizeChanged = false;
        const FloatDimension& size = v.ToFloatDimension();
-       return SetBoundsProperty(Variant(FloatRectangle(__bounds.x, __bounds.y, size.width, size.height)));
+       result r = SetBoundsI(FloatRectangle(__bounds.x, __bounds.y, size.width, size.height), sizeChanged);
+
+       if(IS_MODEL(this) && IS_NEEDED_UPDATE_PRESENTATION(this))
+       {
+               FloatDimension currentValue(__pPresentation->__bounds.width, __pPresentation->__bounds.height);
+
+               if(CreateImplicitAnimationIfNeeded(*pVeSubPropBoundsSize, Variant(FloatDimension(__bounds.width, __bounds.height)), currentValue, null) == false)
+               {
+                       __pPresentation->SetBoundsSizeSubProperty(Variant(FloatDimension(__bounds .width, __bounds.height)));
+               }
+
+               VE_DELEGATE(this, InvokeOnBoundsChanged, oldValue);
+
+               if(__pBoundsChangedCallback && sizeChanged == true)
+               {
+                       (*__pBoundsChangedCallback)(__pBoundsChangedCallbackData);
+               }
+       }
+       return r;
 }
 
 float
index 9cd7fea..09fbd64 100644 (file)
@@ -996,7 +996,7 @@ private:
                _VisualElementCoordinateSystem::MakeIntegralDimension(width, height);
        }
 
-       result SetBoundsI(const Tizen::Graphics::FloatRectangle& bounds);
+       result SetBoundsI(const Tizen::Graphics::FloatRectangle& bounds, bool& sizeChanged);
        result SetZPositionI(float zPosition);
        result SetShowOpacityI(float showOpacity);
        result SetShowStateI(bool show);