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>
27 namespace Internal DALI_INTERNAL
33 * @addtogroup dali_core_events
38 * @brief A PinchGesture is emitted when the user moves two fingers towards or away from each other.
40 * This gesture can be in one of three states; when the pinch gesture is first detected, its
41 * state is set to GestureState::STARTED. After this, if there is change in the gesture, the state will
42 * be GestureState::CONTINUING. Finally, when the gesture ends, the state of the gesture changes to
43 * GestureState::FINISHED.
45 * A pinch gesture will continue to be sent to the actor under the center point of the pinch
46 * until the pinch ends.
49 class DALI_CORE_API PinchGesture : public Gesture
53 * @brief Creates an uninitialized PinchGesture handle.
55 * Calling member functions with an uninitialized Actor handle is not allowed.
61 * @brief Copy constructor.
63 * @param[in] rhs A reference to the copied handle
65 PinchGesture(const PinchGesture& rhs);
68 * @brief Move constructor.
70 * @param[in] rhs A reference to the moved handle
72 PinchGesture(PinchGesture&& rhs) noexcept;
75 * @brief Assignment operator.
77 * @param[in] rhs A reference to the copied handle
78 * @return A reference to this
80 PinchGesture& operator=(const PinchGesture& rhs);
83 * @brief Assignment operator.
85 * @param[in] rhs A reference to the moved handle
86 * @return A reference to this
88 PinchGesture& operator=(PinchGesture&& rhs) noexcept;
91 * @brief Non virtual destructor.
97 * @brief The scale factor from the start of the pinch gesture till the latest pinch gesture.
99 * If the user is moving their fingers away from each other, then this value increases.
100 * Conversely, if the user is moving their fingers towards each other, this value will
103 * @return The scale of the pinch (from the pinch start)
105 float GetScale() const;
108 * @brief The speed at which the user is moving their fingers.
110 * This is the pixel movement per second.
112 * @return The speed of the pinch (pixels per second)
114 float GetSpeed() const;
117 * @brief The center point of the two points that caused the pinch gesture in screen coordinates.
119 * @return The current center point of the pinch (in screen coordinates)
121 const Vector2& GetScreenCenterPoint() const;
124 * @brief The center point of the two points that caused the pinch gesture in local actor coordinates.
126 * @return The current center point of the pinch (in local actor coordinates)
128 const Vector2& GetLocalCenterPoint() const;
130 public: // Not intended for application developers
133 * @brief This constructor is used internally to Create an initialized PinchGesture handle.
135 * @param[in] PinchGesture A pointer to a newly allocated Dali resource
138 explicit DALI_INTERNAL PinchGesture(Internal::PinchGesture* pinchGesture);
147 #endif // DALI_PINCH_GESTURE_H