/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
+#include <dali/integration-api/trace.h>
#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/events/gesture-requests.h>
#include <dali/internal/event/events/multi-point-event-util.h>
{
namespace // unnamed namespace
{
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
#if defined(DEBUG_ENABLED)
Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_PAN_PROCESSOR");
mSceneObject = nullptr; // mSceneObject is owned and destroyed by update manager (there is only one of these for now)
}
-void PanGestureProcessor::Process(Scene& scene, const PanGestureEvent& panEvent)
+void PanGestureProcessor::Process(Scene& scene, const PanGestureEvent& panEvent, Actor* actor)
{
#if defined(DEBUG_ENABLED)
DALI_LOG_TRACE_METHOD(gLogFilter);
DALI_LOG_INFO(gLogFilter, Debug::General, " Positions: Current: (%.0f, %.0f), Previous: (%.0f, %.0f)\n", panEvent.currentPosition.x, panEvent.currentPosition.y, panEvent.previousPosition.x, panEvent.previousPosition.y);
#endif
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_PROCESS_PAN_GESTURE");
+
switch(panEvent.state)
{
case GestureState::POSSIBLE:
ResetActor();
HitTestAlgorithm::Results hitTestResults;
- if(HitTest(scene, panEvent.currentPosition, hitTestResults))
+ if(actor)
+ {
+ SetActor(actor);
+ mPossiblePanPosition = panEvent.currentPosition;
+ }
+ else if(HitTest(scene, panEvent.currentPosition, hitTestResults))
{
SetActor(&GetImplementation(hitTestResults.actor));
mPossiblePanPosition = panEvent.currentPosition;
// it can be told when the gesture ends as well.
HitTestAlgorithm::Results hitTestResults;
- HitTest(scene, panEvent.previousPosition, hitTestResults); // Hit Test previous position
+ if(actor)
+ {
+ hitTestResults.actor = Dali::Actor(actor);
+ hitTestResults.renderTask = panEvent.renderTask;
+
+ Vector2 actorCoords;
+ actor->ScreenToLocal(*hitTestResults.renderTask.Get(), actorCoords.x, actorCoords.y, panEvent.currentPosition.x, panEvent.currentPosition.y);
+ hitTestResults.actorCoordinates = actorCoords;
+ }
+ else
+ {
+ HitTest(scene, panEvent.previousPosition, hitTestResults); // Hit Test previous position
+ }
if(hitTestResults.actor)
{
// Set mCurrentPanEvent to use inside overridden methods called in ProcessAndEmit()
mCurrentPanEvent = &panEvent;
- ProcessAndEmit(hitTestResults);
+ if(actor)
+ {
+ ProcessAndEmitActor(hitTestResults);
+ }
+ else
+ {
+ ProcessAndEmit(hitTestResults);
+ }
mCurrentPanEvent = nullptr;
}
else
mSceneObject->AddGesture(*pan.Get());
}
+ DALI_TRACE_BEGIN_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_EMIT_PAN_GESTURE_SIGNAL", [&](std::ostringstream& oss) {
+ oss << "[" << gestureDetectors.size() << "]";
+ });
+
Dali::Actor actorHandle(actor);
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
{
static_cast<PanGestureDetector*>(*iter)->EmitPanGestureSignal(actorHandle, Dali::PanGesture(pan.Get()));
}
+
+ DALI_TRACE_END_WITH_MESSAGE_GENERATOR(gTraceFilter, "DALI_EMIT_PAN_GESTURE_SIGNAL", [&](std::ostringstream& oss) {
+ oss << "[" << gestureDetectors.size() << "]";
+ });
}
}