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);
}
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))
{
}
}
- // 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
{
{
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
{
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
{
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