SignalData parentData;
TouchEventFunctor parentFunctor(parentData, false /* Do not consume */);
parent.TouchedSignal().Connect(&application, parentFunctor);
+
+ // Emit a down signal
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+
+ data.Reset();
+ parentData.Reset();
+
// Connect to parent's intercept touched signal
SignalData interceptData;
TouchEventFunctor interceptFunctor(interceptData, true /* Do intercept */);
// Emit a down signal
application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
- // The actor touched signal is not called because the touch is intercepted in the parent.
- DALI_TEST_EQUALS(false, data.functorCalled, TEST_LOCATION);
+
+ // The actor gets interrupted. Because touch is intercepted by parent.
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
DALI_TEST_EQUALS(true, interceptData.functorCalled, TEST_LOCATION);
DALI_TEST_EQUALS(PointState::DOWN, interceptData.receivedTouch.points[0].state, TEST_LOCATION);
DALI_TEST_CHECK(actor == interceptData.receivedTouch.points[0].hitActor);
mLastConsumedActor(),
mCapturingTouchActor(),
mTouchDownConsumedActor(),
- mLastRenderTask()
+ mLastRenderTask(),
+ mLastPrimaryPointState(PointState::FINISHED)
{
DALI_LOG_TRACE_METHOD(gLogFilter);
}
mCapturingTouchActor.SetActor(nullptr);
mTouchDownConsumedActor.SetActor(nullptr);
mLastRenderTask.Reset();
+ mLastPrimaryPointState = PointState::FINISHED;
currentPoint.SetHitActor(Dali::Actor());
// Emit the touch signal
Dali::Actor consumedActor;
+
+ Integration::Point& primaryPoint = touchEventImpl->GetPoint(0);
+ Dali::Actor primaryHitActor = primaryPoint.GetHitActor();
+ PointState::Type primaryPointState = primaryPoint.GetState();
+
if(currentRenderTask)
{
// Emit the intercept touch signal
- Dali::Actor interceptedActor = EmitInterceptTouchSignals(touchEventImpl->GetPoint(0).GetHitActor(), touchEventHandle);
+ Dali::Actor interceptedActor = EmitInterceptTouchSignals(primaryHitActor, touchEventHandle);
if(interceptedActor)
{
+ // If the child is being touched, INTERRUPTED is sent.
+ if(mLastPrimaryHitActor.GetActor() &&
+ mLastPrimaryHitActor.GetActor() != interceptedActor &&
+ mLastRenderTask &&
+ mLastPrimaryPointState != PointState::FINISHED)
+ {
+ EmitTouchSignals(mLastPrimaryHitActor.GetActor(), *mLastRenderTask.Get(), touchEventImpl, PointState::INTERRUPTED);
+ }
+
consumedActor = EmitTouchSignals(interceptedActor, touchEventHandle);
}
else
{
- consumedActor = EmitTouchSignals(touchEventImpl->GetPoint(0).GetHitActor(), touchEventHandle);
+ consumedActor = EmitTouchSignals(primaryHitActor, touchEventHandle);
}
consumed = consumedActor ? true : false;
}
- Integration::Point& primaryPoint = touchEventImpl->GetPoint(0);
- Dali::Actor primaryHitActor = primaryPoint.GetHitActor();
- PointState::Type primaryPointState = primaryPoint.GetState();
-
DALI_LOG_INFO(gLogFilter, Debug::Concise, "PrimaryHitActor: (%p) %s\n", primaryHitActor ? reinterpret_cast<void*>(&primaryHitActor.GetBaseObject()) : NULL, primaryHitActor ? primaryHitActor.GetProperty<std::string>(Dali::Actor::Property::NAME).c_str() : "");
DALI_LOG_INFO(gLogFilter, Debug::Concise, "ConsumedActor: (%p) %s\n", consumedActor ? reinterpret_cast<void*>(&consumedActor.GetBaseObject()) : NULL, consumedActor ? consumedActor.GetProperty<std::string>(Dali::Actor::Property::NAME).c_str() : "");
// 5) If our primary point is an Up event, then the primary point (in multi-touch) will change next
// time so set our last primary actor to NULL. Do the same to the last consumed actor as well.
-
if(primaryPointState == PointState::UP)
{
mLastPrimaryHitActor.SetActor(nullptr);
mLastConsumedActor.SetActor(nullptr);
mCapturingTouchActor.SetActor(nullptr);
mLastRenderTask.Reset();
+ mLastPrimaryPointState = PointState::FINISHED;
}
else
{
mLastConsumedActor.SetActor(nullptr);
}
- mLastRenderTask = currentRenderTask;
+ mLastRenderTask = currentRenderTask;
+ mLastPrimaryPointState = primaryPointState;
}
else
{
mLastConsumedActor.SetActor(nullptr);
mCapturingTouchActor.SetActor(nullptr);
mLastRenderTask.Reset();
+ mLastPrimaryPointState = PointState::FINISHED;
}
}
mLastConsumedActor.SetActor(nullptr);
mLastRenderTask.Reset();
+ mLastPrimaryPointState = PointState::FINISHED;
}
}
// INTERNAL INCLUDES
#include <dali/internal/event/events/actor-observer.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
+#include <dali/public-api/events/point-state.h>
namespace Dali
{
*/
void OnObservedActorDisconnected(Actor* actor);
- ActorObserver mLastPrimaryHitActor; ///< Stores the last primary point hit actor
- ActorObserver mLastConsumedActor; ///< Stores the last consumed actor
- ActorObserver mCapturingTouchActor; ///< Stored the actor that captures touch
- ActorObserver mTouchDownConsumedActor; ///< Stores the touch-down consumed actor
- RenderTaskPtr mLastRenderTask; ///< The RenderTask used for the last hit actor
+ ActorObserver mLastPrimaryHitActor; ///< Stores the last primary point hit actor
+ ActorObserver mLastConsumedActor; ///< Stores the last consumed actor
+ ActorObserver mCapturingTouchActor; ///< Stored the actor that captures touch
+ ActorObserver mTouchDownConsumedActor; ///< Stores the touch-down consumed actor
+ RenderTaskPtr mLastRenderTask; ///< The RenderTask used for the last hit actor
+ PointState::Type mLastPrimaryPointState; ///< Stores the last primary point state
};
} // namespace Internal