/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
DALI_PROPERTY( "screenPosition", VECTOR2, false, false, false, Dali::DevelActor::Property::SCREEN_POSITION )
DALI_PROPERTY( "positionUsesAnchorPoint", BOOLEAN, true, false, false, Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT )
DALI_PROPERTY( "culled", BOOLEAN, false, false, true, Dali::DevelActor::Property::CULLED )
-DALI_PROPERTY( "updateSizeHint", VECTOR2, true, false, true, Dali::DevelActor::Property::UPDATE_SIZE_HINT )
DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties )
// Signals
return *mGestureData;
}
-bool Actor::IsGestureRequred( Gesture::Type type ) const
+bool Actor::IsGestureRequred( DevelGesture::Type type ) const
{
return mGestureData && mGestureData->IsGestureRequred( type );
}
case Dali::Actor::Property::COLOR:
{
- SetColor( property.Get< Vector4 >() );
+ Property::Type type = property.GetType();
+ if( type == Property::VECTOR3 )
+ {
+ Vector3 color = property.Get< Vector3 >();
+ SetColor( Vector4( color.r, color.g, color.b, 1.0f ) );
+ }
+ else if( type == Property::VECTOR4 )
+ {
+ SetColor( property.Get< Vector4 >() );
+ }
break;
}
break;
}
- case Dali::DevelActor::Property::UPDATE_SIZE_HINT:
- {
- SetUpdateSizeHint( property.Get< Vector2 >() );
- break;
- }
-
default:
{
// this can happen in the case of a non-animatable default property so just do nothing
{
if( value.Get( mTargetSize ) )
{
+ if( mRelayoutData )
+ {
+ if( GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::FIXED )
+ {
+ mRelayoutData->preferredSize.width = mTargetSize.width;
+ }
+
+ if( GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::FIXED )
+ {
+ mRelayoutData->preferredSize.height = mTargetSize.height;
+ }
+ }
+
// Notify deriving classes
OnSizeAnimation( animation, mTargetSize );
}
{
if( value.Get( mTargetSize.width ) )
{
+ if( mRelayoutData && GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::FIXED )
+ {
+ mRelayoutData->preferredSize.width = mTargetSize.width;
+ }
+
// Notify deriving classes
OnSizeAnimation( animation, mTargetSize );
}
{
if( value.Get( mTargetSize.height ) )
{
+ if( mRelayoutData && GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::FIXED )
+ {
+ mRelayoutData->preferredSize.height = mTargetSize.height;
+ }
+
// Notify deriving classes
OnSizeAnimation( animation, mTargetSize );
}
{
if( AdjustValue< Vector3 >( mTargetSize, value ) )
{
+ if( mRelayoutData )
+ {
+ if( GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::FIXED )
+ {
+ mRelayoutData->preferredSize.width = mTargetSize.width;
+ }
+
+ if( GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::FIXED )
+ {
+ mRelayoutData->preferredSize.height = mTargetSize.height;
+ }
+ }
+
// Notify deriving classes
OnSizeAnimation( animation, mTargetSize );
}
{
if( AdjustValue< float >( mTargetSize.width, value ) )
{
+ if( mRelayoutData && GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::FIXED )
+ {
+ mRelayoutData->preferredSize.width = mTargetSize.width;
+ }
+
// Notify deriving classes
OnSizeAnimation( animation, mTargetSize );
}
{
if( AdjustValue< float >( mTargetSize.height, value ) )
{
+ if( mRelayoutData && GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::FIXED )
+ {
+ mRelayoutData->preferredSize.height = mTargetSize.height;
+ }
+
// Notify deriving classes
OnSizeAnimation( animation, mTargetSize );
}
break;
}
- case Dali::DevelActor::Property::UPDATE_SIZE_HINT:
- {
- value = GetUpdateSizeHint();
- break;
- }
-
default:
{
// Must be an event-side only property
{
EnsureRelayoutData();
- if( size.width > 0.0f )
+ // If valid width or height, then set the resize policy to FIXED
+ // A 0 width or height may also be required so if the resize policy has not been changed, i.e. is still set to DEFAULT,
+ // then change to FIXED as well
+
+ if( size.width > 0.0f || GetResizePolicy( Dimension::WIDTH ) == ResizePolicy::DEFAULT )
{
SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
}
- if( size.height > 0.0f )
+ if( size.height > 0.0f || GetResizePolicy( Dimension::HEIGHT ) == ResizePolicy::DEFAULT )
{
SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
}
return FLT_MAX; // Default
}
-void Actor::SetUpdateSizeHint( const Vector2& updateSizeHint )
-{
- // node is being used in a separate thread; queue a message to set the value & base value
- SceneGraph::NodeTransformPropertyMessage<Vector3>::Send( GetEventThreadServices(), &GetNode(), &GetNode().mUpdateSizeHint, &SceneGraph::TransformManagerPropertyHandler<Vector3>::Bake, Vector3(updateSizeHint.width, updateSizeHint.height, 0.f ) );
-}
-
-Vector2 Actor::GetUpdateSizeHint() const
-{
- // node is being used in a separate thread; copy the value from the previous update
- Vector3 updateSizeHint = GetNode().GetUpdateSizeHint( GetEventThreadServices().GetEventBufferIndex() );
- return Vector2( updateSizeHint.width, updateSizeHint.height );
-}
-
Object* Actor::GetParentObject() const
{
return mParent;