/*
- * Copyright (c) 2021 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/actors/actor-impl.h>
#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/events/gesture-requests.h>
{
namespace
{
+DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_PERFORMANCE_MARKER, false);
+constexpr uint32_t DEFAULT_MAXIMUM_ALLOWED_TIME = 500u;
+
/**
* Creates a TapGesture and asks the specified detector to emit its detected signal.
* @param[in] actor The actor on which a tap has occurred.
tap->SetNumberOfTouches(tapEvent.numberOfTouches);
tap->SetScreenPoint(tapEvent.point);
tap->SetLocalPoint(localPoint);
- tap->SetGestureSourceType(tapEvent.gestureSourceType);
+ tap->SetSourceType(tapEvent.sourceType);
+ tap->SetSourceData(tapEvent.sourceData);
Dali::Actor actorHandle(actor);
const GestureDetectorContainer::const_iterator endIter = gestureDetectors.end();
mMinTouchesRequired(1),
mMaxTouchesRequired(1),
mCurrentTapEvent(nullptr),
- mPossibleProcessed(false)
+ mPossibleProcessed(false),
+ mMaximumAllowedTime(DEFAULT_MAXIMUM_ALLOWED_TIME)
{
}
void TapGestureProcessor::Process(Scene& scene, const TapGestureEvent& tapEvent)
{
+ DALI_TRACE_SCOPE(gTraceFilter, "DALI_PROCESS_TAP_GESTURE");
switch(tapEvent.state)
{
case GestureState::POSSIBLE:
request.maxTouches = mMaxTouchesRequired;
Size size = scene.GetSize();
- mGestureRecognizer = new TapGestureRecognizer(*this, Vector2(size.width, size.height), static_cast<const TapGestureRequest&>(request));
+ mGestureRecognizer = new TapGestureRecognizer(*this, Vector2(size.width, size.height), static_cast<const TapGestureRequest&>(request), mMaximumAllowedTime);
}
else
{
UpdateDetection();
}
+void TapGestureProcessor::SetMaximumAllowedTime(uint32_t time)
+{
+ if(time == 0u)
+ {
+ DALI_LOG_WARNING("MaximumAllowedTime must be greater than zero.");
+ return;
+ }
+ if(mMaximumAllowedTime != time)
+ {
+ mMaximumAllowedTime = time;
+
+ if(mGestureRecognizer)
+ {
+ TapGestureRecognizer* tapRecognizer = dynamic_cast<TapGestureRecognizer*>(mGestureRecognizer.Get());
+ if(tapRecognizer)
+ {
+ tapRecognizer->SetMaximumAllowedTime(time);
+ }
+ }
+ }
+}
+
void TapGestureProcessor::UpdateDetection()
{
DALI_ASSERT_DEBUG(!mTapGestureDetectors.empty());
TapGestureDetector* tapDetector(static_cast<TapGestureDetector*>(detector));
- return ((tapDetector->GetMinimumTapsRequired() <= mCurrentTapEvent->numberOfTaps) && (tapDetector->GetMaximumTapsRequired() >= mCurrentTapEvent->numberOfTaps)) &&
- (tapDetector->GetTouchesRequired() == mCurrentTapEvent->numberOfTouches);
+ return (tapDetector->GetMinimumTapsRequired() <= mCurrentTapEvent->numberOfTaps) && (tapDetector->GetTouchesRequired() == mCurrentTapEvent->numberOfTouches);
}
void TapGestureProcessor::EmitGestureSignal(Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates)