Renaming of enum values for coding standards compliance.
[platform/core/uifw/dali-core.git] / dali / internal / event / common / property-notification-impl.cpp
index f119eda..33222bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/math/vector2.h>
 #include <dali/public-api/math/radian.h>
+#include <dali/public-api/actors/actor.h>
 #include <dali/internal/event/actors/actor-impl.h>
 #include <dali/internal/event/common/property-notification-manager.h>
 #include <dali/internal/event/common/object-impl.h>
@@ -46,21 +47,13 @@ PropertyNotificationPtr PropertyNotification::New(Property& target,
 
   UpdateManager& updateManager = tls.GetUpdateManager();
 
-  StagePtr stage = Stage::GetCurrent();
-  if( stage )
-  {
-    PropertyNotificationManager& propertyNotificationManager = stage->GetPropertyNotificationManager();
-    PropertyNotificationPtr propertyNotification = new PropertyNotification(updateManager,
-                                                                            propertyNotificationManager,
-                                                                            target,
-                                                                            componentIndex,
-                                                                            condition);
-    return propertyNotification;
-  }
-  else
-  {
-    return NULL;
-  }
+  PropertyNotificationManager& propertyNotificationManager = tls.GetPropertyNotificationManager();
+  PropertyNotificationPtr propertyNotification = new PropertyNotification(updateManager,
+                                                                          propertyNotificationManager,
+                                                                          target,
+                                                                          componentIndex,
+                                                                          condition);
+  return propertyNotification;
 }
 
 PropertyNotification::PropertyNotification( UpdateManager& updateManager,
@@ -75,8 +68,9 @@ PropertyNotification::PropertyNotification( UpdateManager& updateManager,
   mPropertyType( Property::NONE ),
   mComponentIndex( componentIndex ),
   mCondition( condition ),
-  mNotifyMode( Dali::PropertyNotification::NotifyOnTrue ),
-  mNotifyResult( false )
+  mNotifyMode( Dali::PropertyNotification::NOTIFY_ON_TRUE ),
+  mNotifyResult( false ),
+  mCompare( false )
 {
   const Internal::PropertyCondition& conditionImpl = GetImplementation( condition );
 
@@ -109,15 +103,22 @@ PropertyNotification::PropertyNotification( UpdateManager& updateManager,
       }
     }
 
-    // Check if target scene-object already present, and if so create our notification
-    // scene-object
-    const SceneGraph::PropertyOwner* object = mObject->GetSceneObject();
-    if (object)
+  // In Size Property case, swapping components occurs sometimes.
+  // To cover swapping components, previous and current components should be compared.
+  if( mObjectPropertyIndex == Dali::Actor::Property::SIZE
+      && mObject->GetPropertyType(mObjectPropertyIndex) == Property::VECTOR3 )
+  {
+    mCompare = true;
+    for( int i = 0; i < 3; ++i )
     {
-      CreateSceneObject();
+      mRawConditionArgs.PushBack( 0.0f );
     }
   }
 
+    // all objects always have scene object
+    CreateSceneObject();
+  }
+
   // Connect to the property notification manager
   mPropertyNotificationManager.PropertyNotificationCreated( *this );
 }
@@ -219,7 +220,8 @@ void PropertyNotification::CreateSceneObject()
                                                                    mComponentIndex,
                                                                    GetImplementation( mCondition ).type,
                                                                    mRawConditionArgs,
-                                                                   mNotifyMode );
+                                                                   mNotifyMode,
+                                                                   mCompare );
     OwnerPointer< SceneGraph::PropertyNotification > transferOwnership( const_cast<SceneGraph::PropertyNotification*>( mPropertyNotification ) );
     AddPropertyNotificationMessage( mUpdateManager, transferOwnership );
   }