X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Faccessibility%2Fcommon%2Faccessibility-gesture-detector.h;h=616d76e63b47409a190c18aa416b026d8d13d9aa;hb=5b648302d22f4373c4993e9daa35e2ea7de1d758;hp=90d23e351dd2193d5635e6f5a9c954ae0feef3d4;hpb=92b2ba1433ebcade9079ab40c83716f55625d5cc;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/accessibility/common/accessibility-gesture-detector.h b/dali/internal/accessibility/common/accessibility-gesture-detector.h old mode 100644 new mode 100755 index 90d23e3..616d76e --- a/dali/internal/accessibility/common/accessibility-gesture-detector.h +++ b/dali/internal/accessibility/common/accessibility-gesture-detector.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_ACCESSIBILITY_GESTURE_DETECTOR_H__ -#define __DALI_INTERNAL_ACCESSIBILITY_GESTURE_DETECTOR_H__ +#ifndef DALI_INTERNAL_ACCESSIBILITY_GESTURE_DETECTOR_H +#define DALI_INTERNAL_ACCESSIBILITY_GESTURE_DETECTOR_H /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -21,17 +21,17 @@ // EXTERNAL INCLUDES // INTERNAL INCLUDES -#include #include +#include +#include +#include namespace Dali { namespace Integration { -class Core; struct TouchEvent; -struct PanGestureRequest; } namespace Internal @@ -43,7 +43,7 @@ namespace Adaptor /** * Detects an accessibility pan gesture and sends it to the gesture handler. */ -class AccessibilityGestureDetector : public PanGestureDetectorBase +class AccessibilityGestureDetector : public RefObject { public: @@ -64,18 +64,64 @@ public: */ void SetGestureHandler(AccessibilityGestureHandler& handler); + void SendEvent(const Integration::TouchEvent& event); + + void SendEvent(Integration::Scene& scene, const Integration::TouchEvent& event) + { + mScene = &scene; + SendEvent(event); + } + private: /** + * Emits the pan gesture event (performs some smoothing operation). + * @param[in] state The state of the pan. + * @param[in] currentEvent The latest touch event. + */ + void SendPan(AccessibilityGestureEvent::State state, const Integration::TouchEvent& currentEvent); + + /** * Emits the pan gesture event to the gesture handler. * @param[in] gesture The pan gesture event. */ - virtual void EmitPan(const Integration::PanGestureEvent gesture); + void EmitPan(const AccessibilityGestureEvent gesture); private: + /** + * Internal state machine. + */ + enum State + { + Clear, ///< No gesture detected. + Possible, ///< The current touch event data suggests that a gesture is possible. + Started, ///< A gesture has been detected. + Finished, ///< A previously started pan gesture has finished. + Failed, ///< Current touch event data suggests a pan gesture is not possible. + }; + + State mState; ///< The current state of the detector. + + Integration::Scene* mScene; AccessibilityGestureHandler* mGestureHandler; ///< The pointer of accessibility gesture handler bool mPanning; ///< Keep track of panning state, when panning is occuring, this is true. + + std::vector mTouchEvents; ///< A container of all touch events after an initial down event. + + Vector2 mPrimaryTouchDownLocation; ///< The initial touch down point. + Vector2 mThresholdAdjustmentPerFrame; ///< The adjustment per frame at the start of a slow pan. + Vector2 mPreviousPosition; ///< The previous position. + + unsigned int mThresholdAdjustmentsRemaining; ///< No. of threshold adjustments still to apply (for a slow-pan). + unsigned int mThresholdTotalAdjustments; ///< The total number of adjustments required. + + uint32_t mPrimaryTouchDownTime; ///< The initial touch down time. + unsigned int mMinimumTouchesRequired; ///< The minimum touches required before a pan should be emitted. + unsigned int mMaximumTouchesRequired; ///< The maximum touches after which a pan should not be emitted. + unsigned int mMinimumDistanceSquared; ///< The minimum distance squared before pan should start. + unsigned int mMinimumMotionEvents; ///< The minimum motion events before pan should start. + unsigned int mMotionEvents; ///< The motion events received so far (before pan is emitted). }; using AccessibilityGestureDetectorPtr = Dali::IntrusivePtr; @@ -86,4 +132,4 @@ using AccessibilityGestureDetectorPtr = Dali::IntrusivePtr