/*
- * Copyright (c) 2015 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.
#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>
UpdateManager& updateManager = tls.GetUpdateManager();
- PropertyNotificationManager& propertyNotificationManager = Stage::GetCurrent()->GetPropertyNotificationManager();
-
+ PropertyNotificationManager& propertyNotificationManager = tls.GetPropertyNotificationManager();
PropertyNotificationPtr propertyNotification = new PropertyNotification(updateManager,
propertyNotificationManager,
target,
componentIndex,
condition);
-
return propertyNotification;
}
int componentIndex,
const Dali::PropertyCondition& condition )
: mUpdateManager( updateManager ),
- mPropertyNotification( NULL ),
+ mPropertyNotification( nullptr ),
mPropertyNotificationManager( propertyNotificationManager ),
mObjectPropertyIndex( target.propertyIndex ),
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 );
}
}
- // 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 );
}
// this method can be called from constructor and on stage connection
if( !mPropertyNotification )
{
- // Create a new PropertyNotification, temporarily owned
- SceneGraph::PropertyNotification* propertyNotification = SceneGraph::PropertyNotification::New( *mObject,
- mObjectPropertyIndex,
- mPropertyType,
- mComponentIndex,
- GetImplementation(mCondition).type,
- mRawConditionArgs,
- mNotifyMode );
- // Keep a const pointer to the PropertyNotification.
- mPropertyNotification = propertyNotification;
-
- // Transfer scene object ownership to the update manager through a message
- AddPropertyNotificationMessage( mUpdateManager, propertyNotification );
+ // Create a new PropertyNotification, keep a const pointer to it
+ mPropertyNotification = SceneGraph::PropertyNotification::New( *mObject,
+ mObjectPropertyIndex,
+ mPropertyType,
+ mComponentIndex,
+ GetImplementation( mCondition ).type,
+ mRawConditionArgs,
+ mNotifyMode,
+ mCompare );
+ OwnerPointer< SceneGraph::PropertyNotification > transferOwnership( const_cast<SceneGraph::PropertyNotification*>( mPropertyNotification ) );
+ AddPropertyNotificationMessage( mUpdateManager, transferOwnership );
}
}
void PropertyNotification::DestroySceneObject()
{
- if ( mPropertyNotification != NULL )
+ if ( mPropertyNotification != nullptr )
{
// Remove PropertyNotification using a message to the update manager
RemovePropertyNotificationMessage( mUpdateManager, *mPropertyNotification );
- mPropertyNotification = NULL;
+ mPropertyNotification = nullptr;
}
}