1 #ifndef DALI_INTERNAL_EVENT_PINCH_GESTURE_RECOGNIZER_H
2 #define DALI_INTERNAL_EVENT_PINCH_GESTURE_RECOGNIZER_H
5 * Copyright (c) 2019 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 <dali/internal/event/events/gesture-recognizer.h>
26 #include <dali/internal/event/events/pinch-gesture/pinch-gesture-event.h>
40 * When given a set of touch events, this detector attempts to determine if a pinch gesture has taken place.
42 class PinchGestureRecognizer : public GestureRecognizer
46 using Observer = RecognizerObserver<PinchGestureEvent>;
50 * @param[in] screenSize The size of the screen.
51 * @param[in] screenDpi The dpi value of the screen
52 * @param[in] minimumPinchDistance in pixels
54 PinchGestureRecognizer(Observer& observer, Vector2 screenSize, Vector2 screenDpi, float minimumPinchDistance);
59 virtual ~PinchGestureRecognizer();
63 void SetMinimumPinchDistance(float value);
66 * @copydoc Dali::Internal::GestureDetector::SendEvent(const Integration::TouchEvent&)
68 virtual void SendEvent(const Integration::TouchEvent& event);
71 * @copydoc Dali::Internal::GestureDetector::Update(const Integration::GestureRequest&)
73 virtual void Update(const GestureRequest& request);
78 * Emits the pinch gesture event to the core.
79 * @param[in] state The state of the pinch (whether it's starting, continuing or finished).
80 * @param[in] currentEvent The latest touch event.
82 void SendPinch(Gesture::State state, const Integration::TouchEvent& currentEvent);
86 // Reference to the gesture processor for this recognizer
90 * Internal state machine.
94 Clear, ///< No gesture detected.
95 Possible, ///< The current touch event data suggests that a gesture is possible.
96 Started, ///< A gesture has been detected.
99 State mState; ///< The current state of the detector.
100 std::vector<Integration::TouchEvent> mTouchEvents; ///< The touch events since initial touch down.
102 float mDefaultMinimumDistanceDelta; ///< The default value of the mMinimumDistanceDelta.
104 float mMinimumDistanceDelta; ///< The minimum distance before a pinch is applicable.
106 float mStartingDistance; ///< The distance between the two touch points when the pinch is first detected.
109 } // namespace Internal
113 #endif // DALI_INTERNAL_EVENT_PINCH_GESTURE_RECOGNIZER_H