1 #ifndef __DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H__
2 #define __DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/vector-wrapper.h>
25 #include <events/gesture-detector.h>
41 class CoreEventInterface;
44 * When given a set of touch events, this detector attempts to determine if a pinch gesture has taken place.
46 class PinchGestureDetector : public GestureDetector
52 * @param[in] coreEventInterface Used to send events to Core.
53 * @param[in] screenSize The size of the screen.
55 PinchGestureDetector(CoreEventInterface& coreEventInterface, Vector2 screenSize, float minimumPinchDistance);
60 virtual ~PinchGestureDetector();
63 * @brief Sets minimum distance in pixels that the fingers must move towards/away from each other in order to
64 * trigger a pinch gesture
66 * @param[in] distance The minimum pinch distance in pixels
68 void SetMinimumPinchDistance(float distance);
73 * @copydoc Dali::Internal::GestureDetector::SendEvent(const Integration::TouchEvent&)
75 virtual void SendEvent(const Integration::TouchEvent& event);
78 * @copydoc Dali::Internal::GestureDetector::Update(const Integration::GestureRequest&)
80 virtual void Update(const Integration::GestureRequest& request);
85 * Emits the pinch gesture event to the core.
86 * @param[in] state The state of the pinch (whether it's starting, continuing or finished).
87 * @param[in] currentEvent The latest touch event.
89 void SendPinch(Gesture::State state, const Integration::TouchEvent& currentEvent);
94 * Internal state machine.
98 Clear, ///< No gesture detected.
99 Possible, ///< The current touch event data suggests that a gesture is possible.
100 Started, ///< A gesture has been detected.
103 CoreEventInterface& mCoreEventInterface; ///< Used to send events to Core.
104 State mState; ///< The current state of the detector.
105 std::vector<Integration::TouchEvent> mTouchEvents; ///< The touch events since initial touch down.
107 float mMinimumDistanceDelta; ///< The minimum distance before a pinch is applicable.
109 float mStartingDistance; ///< The distance between the two touch points when the pinch is first detected.
112 } // namespace Adaptor
114 } // namespace Internal
118 #endif // __DALI_INTERNAL_PINCH_GESTURE_DETECTOR_H__