Adds (real, pixel based) screen position, calculated in render function.
Change-Id: Ia34490c59643d0ef3b7f64ae05da51547921f615
END_TEST;
}
+int UtcDaliActorCalculateScreenExtents(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ actor.SetPosition(Vector3(2.0f, 2.0f, 16.0f));
+ actor.SetSize(Vector3{ 1.0f, 1.0f, 1.0f });
+
+ application.SendNotification();
+ application.Render();
+
+ auto expectedExtent = Rect<>{ -0.5f, -0.5f, 1.0f, 1.0f };
+ auto actualExtent = DevelActor::CalculateScreenExtents( actor );
+ DALI_TEST_EQUALS( expectedExtent.x, actualExtent.x, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
+ DALI_TEST_EQUALS( expectedExtent.y, actualExtent.y, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
+ DALI_TEST_EQUALS( expectedExtent.width, actualExtent.width, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
+ DALI_TEST_EQUALS( expectedExtent.height, actualExtent.height, Math::MACHINE_EPSILON_10000, TEST_LOCATION );
+
+ Stage::GetCurrent().Remove( actor );
+ END_TEST;
+}
+
// SetPosition(float x, float y)
int UtcDaliActorSetPosition01(void)
{
END_TEST;
}
+int UtcDaliPropertyValueEnum(void)
+{
+ enum class E { zero, e };
+ Property::Value value( E::e );
+ DALI_TEST_EQUALS( static_cast<int>(E::e), static_cast<int>(value.Get<E>()), TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<int>(E::e), value.Get<int>(), TEST_LOCATION );
+ E result;
+ DALI_TEST_EQUALS( true, value.Get( result ), TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<int>(E::e), static_cast<int>(result), TEST_LOCATION );
+ int result2;
+ DALI_TEST_EQUALS( true, value.Get( result2 ), TEST_LOCATION );
+ DALI_TEST_EQUALS( static_cast<int>(E::e), result2, TEST_LOCATION );
+ END_TEST;
+}
+
int UtcDaliPropertyValueOutputStream(void)
{
TestApplication application;
namespace DevelActor
{
+Rect<> CalculateScreenExtents( Actor actor )
+{
+ return GetImplementation( actor ).CalculateScreenExtents();
+}
+
VisibilityChangedSignalType& VisibilityChangedSignal( Actor actor )
{
return GetImplementation( actor ).VisibilityChangedSignal();
// INTERNAL INCLUDES
#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/math/rect.h>
namespace Dali
{
*/
DALI_CORE_API VisibilityChangedSignalType& VisibilityChangedSignal( Actor actor );
+/**
+ * Calculates screen position and size.
+ *
+ * @return pair of two values, position of top-left corner on screen and size respectively.
+ */
+DALI_CORE_API Rect<> CalculateScreenExtents( Actor actor );
+
+
typedef Signal< void (Actor) > ChildChangedSignalType; ///< Called when the actor has a child added or removed
return done;
}
+Rect<> Actor::CalculateScreenExtents( ) const
+{
+ auto screenPosition = GetCurrentScreenPosition();
+ Vector3 size = GetCurrentSize() * GetCurrentWorldScale();
+ Vector3 anchorPointOffSet = size * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT );
+ Vector2 position = Vector2( screenPosition.x - anchorPointOffSet.x, screenPosition.y - anchorPointOffSet.y );
+ return { position.x, position.y, size.x, size.y };
+}
+
bool Actor::GetCachedPropertyValue( Property::Index index, Property::Value& value ) const
{
bool valueSet = true;
}
/**
+ * Calculates screen position and size.
+ *
+ * @return pair of two values, position of top-left corner on screen and size respectively.
+ */
+ Rect<> CalculateScreenExtents( ) const;
+
+ /**
* Sets the size of an actor.
* This does not interfere with the actors scale factor.
* @param [in] width The new width.
mLastGesture = frameGesture;
mLastUnmodifiedGesture = unmodifiedGesture;
- mInGesture &= ~frameInfo.justFinished;
+ mInGesture = mInGesture && !frameInfo.justFinished;
if( mProfiling && frameInfo.justFinished )
{
mProfiling->PrintData();
}
}
- mInGesture &= ~justFinished;
+ mInGesture = mInGesture && !justFinished;
return performUpdate;
}