1 #ifndef DALI_PINCH_GESTURE_H
2 #define DALI_PINCH_GESTURE_H
5 * Copyright (c) 2020 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/events/gesture.h>
23 #include <dali/public-api/math/vector2.h>
28 namespace Internal DALI_INTERNAL
34 * @addtogroup dali_core_events
39 * @brief A PinchGesture is emitted when the user moves two fingers towards or away from each other.
41 * This gesture can be in one of three states; when the pinch gesture is first detected, its
42 * state is set to Gesture::Started. After this, if there is change in the gesture, the state will
43 * be Gesture::Continuing. Finally, when the gesture ends, the state of the gesture changes to
46 * A pinch gesture will continue to be sent to the actor under the center point of the pinch
47 * until the pinch ends.
50 class DALI_CORE_API PinchGesture: public Gesture
55 * @brief Creates an uninitialized PinchGesture handle.
57 * Calling member functions with an uninitialized Actor handle is not allowed.
63 * @brief Copy constructor.
65 * @param[in] rhs A reference to the copied handle
67 PinchGesture( const PinchGesture& rhs );
70 * @brief Move constructor.
72 * @param[in] rhs A reference to the moved handle
74 PinchGesture( PinchGesture&& rhs );
77 * @brief Assignment operator.
79 * @param[in] rhs A reference to the copied handle
80 * @return A reference to this
82 PinchGesture& operator=( const PinchGesture& rhs );
85 * @brief Assignment operator.
87 * @param[in] rhs A reference to the moved handle
88 * @return A reference to this
90 PinchGesture& operator=( PinchGesture&& rhs );
93 * @brief Non virtual destructor.
99 * @brief The scale factor from the start of the pinch gesture till the latest pinch gesture.
101 * If the user is moving their fingers away from each other, then this value increases.
102 * Conversely, if the user is moving their fingers towards each other, this value will
105 * @return The scale of the pinch (from the pinch start)
107 float GetScale() const;
110 * @brief The speed at which the user is moving their fingers.
112 * This is the pixel movement per second.
114 * @return The speed of the pinch (pixels per second)
116 float GetSpeed() const;
119 * @brief The center point of the two points that caused the pinch gesture in screen coordinates.
121 * @return The current center point of the pinch (in screen coordinates)
123 const Vector2& GetScreenCenterPoint() const;
126 * @brief The center point of the two points that caused the pinch gesture in local actor coordinates.
128 * @return The current center point of the pinch (in local actor coordinates)
130 const Vector2& GetLocalCenterPoint() const;
132 public: // Not intended for application developers
136 * @brief This constructor is used internally to Create an initialized PinchGesture handle.
138 * @param[in] PinchGesture A pointer to a newly allocated Dali resource
141 explicit DALI_INTERNAL PinchGesture( Internal::PinchGesture* pinchGesture );
151 #endif // DALI_PINCH_GESTURE_H