[Tizen] Make Hittable and touch required function be public 99/298899/2 accepted/tizen/7.0/unified/20230927.090504 accepted/tizen/7.0/unified/20231018.172226 accepted/tizen/7.0/unified/20231024.025344 accepted/tizen/7.0/unified/20231026.165722 accepted/tizen/7.0/unified/20231116.025845 accepted/tizen/7.0/unified/20231122.100640
authorWonsik Jung <sidein@samsung.com>
Fri, 15 Sep 2023 02:47:59 +0000 (11:47 +0900)
committerWonsik Jung <sidein@samsung.com>
Fri, 15 Sep 2023 02:53:14 +0000 (11:53 +0900)
Make Hittable and touch required function be public to use in dali-toolkit

Change-Id: Ib43dc98caebe4f191e2f82f1816b78b5599f21a8

automated-tests/src/dali/utc-Dali-Actor.cpp
dali/devel-api/actors/actor-devel.cpp
dali/devel-api/actors/actor-devel.h
dali/internal/event/actors/actor-impl.h

index 8294c99..4f661b6 100644 (file)
@@ -11751,4 +11751,56 @@ int UtcDaliActorCalculateLookAt(void)
   DALI_TEST_EQUALS(actorQuaternion, Quaternion(), TEST_LOCATION);
 
   END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliActorIsHittable(void)
+{
+  TestApplication application;
+
+  Actor   parent = Actor::New();
+  Vector4 parentColor(1.0f, 0.5f, 0.0f, 0.8f);
+  parent.SetProperty(Actor::Property::COLOR, parentColor);
+  application.GetScene().Add(parent);
+
+  Actor   actor = Actor::New();
+  Vector4 childColor(0.5f, 0.6f, 0.5f, 1.0f);
+  actor.SetProperty(Actor::Property::COLOR, childColor);
+  parent.Add(actor);
+
+  actor.SetProperty(Actor::Property::SENSITIVE, true);
+  actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
+  actor.SetProperty(Actor::Property::VISIBLE, true);
+
+  application.SendNotification();
+  application.Render();
+
+  DALI_TEST_CHECK(DevelActor::IsHittable(actor) == true);
+
+  actor.SetProperty(Actor::Property::SENSITIVE, false);
+  DALI_TEST_CHECK(DevelActor::IsHittable(actor) == false);
+  actor.SetProperty(Actor::Property::SENSITIVE, true);
+
+  actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, false);
+  DALI_TEST_CHECK(DevelActor::IsHittable(actor) == false);
+  actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
+
+  actor.SetProperty(Actor::Property::VISIBLE, false);
+  application.SendNotification();
+  application.Render();
+  DALI_TEST_CHECK(DevelActor::IsHittable(actor) == false);
+
+  END_TEST;
+}
+
+int UtcDaliActorGetTouchRequired(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+  DALI_TEST_CHECK(DevelActor::GetTouchRequired(actor) == false);
+
+  actor.TouchedSignal().Connect(TestTouchCallback);
+  DALI_TEST_CHECK(DevelActor::GetTouchRequired(actor) == true);
+
+  END_TEST;
+}
index 8289468..98588ef 100644 (file)
@@ -85,6 +85,16 @@ void LookAt(Actor actor, Vector3 target, Vector3 up, Vector3 localForward, Vecto
   GetImplementation(actor).SetOrientation(orientation);
 }
 
+bool IsHittable(Actor actor)
+{
+  return GetImplementation(actor).IsHittable();
+}
+
+bool GetTouchRequired(Actor actor)
+{
+  return GetImplementation(actor).GetTouchRequired();
+}
+
 } // namespace DevelActor
 
 } // namespace Dali
index 02130de..06a2bb4 100644 (file)
@@ -433,6 +433,23 @@ DALI_CORE_API Vector4 GetWorldColor(Actor actor);
  */
 DALI_CORE_API void LookAt(Actor actor, Vector3 target, Vector3 up = Vector3::YAXIS, Vector3 localForward = Vector3::ZAXIS, Vector3 localUp = Vector3::YAXIS);
 
+/**
+ * Query whether the actor is actually hittable.  This method checks whether the actor is
+ * sensitive, has the visibility flag set to true and is not fully transparent.
+ *
+ * @param[in] actor The actor for whether is hittable or not
+ * @return true, if it can be hit, false otherwise.
+ */
+DALI_CORE_API bool IsHittable(Actor actor);
+
+/**
+ * Query whether the application or derived actor type requires touch events.
+ *
+ * @param[in] actor The actor for whether is required for touch event or not.
+ * @return True if touch events are required.
+ */
+DALI_CORE_API bool GetTouchRequired(Actor actor);
+
 } // namespace DevelActor
 
 } // namespace Dali
index 4557a03..308f6fa 100644 (file)
@@ -1239,6 +1239,22 @@ public:
   }
 
   /**
+   * @copydoc Dali::DevelActor::IsHittable()
+   */
+  bool IsHittable() const
+  {
+    return (IsUserInteractionEnabled()) && IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
+  }
+
+  /**
+   * @copydoc Dali::DevelActor::GetTouchRequired()
+   */
+  bool GetTouchRequired() const
+  {
+    return !mTouchedSignal.Empty();
+  }
+
+  /**
    * Set whether this view can focus by touch.
    * @param[in] focusable focuable by touch.
    */
@@ -1275,15 +1291,6 @@ public:
   }
 
   /**
-   * Query whether the application or derived actor type requires touch events.
-   * @return True if touch events are required.
-   */
-  bool GetTouchRequired() const
-  {
-    return !mTouchedSignal.Empty();
-  }
-
-  /**
    * Query whether the application or derived actor type requires hover events.
    * @return True if hover events are required.
    */
@@ -1302,16 +1309,6 @@ public:
   }
 
   /**
-   * Query whether the actor is actually hittable.  This method checks whether the actor is
-   * sensitive, has the visibility flag set to true and is not fully transparent.
-   * @return true, if it can be hit, false otherwise.
-   */
-  bool IsHittable() const
-  {
-    return (IsUserInteractionEnabled()) && IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
-  }
-
-  /**
    * Query whether the actor captures all touch after it starts even if touch leaves its boundary.
    * @return true, if it captures all touch after start
    */