2 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/public-api/events/pan-gesture-detector.h>
22 #include <dali/internal/event/events/pan-gesture/pan-gesture-detector-impl.h>
26 const Radian PanGestureDetector::DIRECTION_LEFT(-Math::PI);
27 const Radian PanGestureDetector::DIRECTION_RIGHT(0.0f);
28 const Radian PanGestureDetector::DIRECTION_UP(-0.5f * Math::PI);
29 const Radian PanGestureDetector::DIRECTION_DOWN(0.5f * Math::PI);
30 const Radian PanGestureDetector::DIRECTION_HORIZONTAL(Math::PI);
31 const Radian PanGestureDetector::DIRECTION_VERTICAL(-0.5f * Math::PI);
32 const Radian PanGestureDetector::DEFAULT_THRESHOLD(0.25f * Math::PI);
34 PanGestureDetector::PanGestureDetector(Internal::PanGestureDetector* internal)
35 : GestureDetector(internal)
39 PanGestureDetector::PanGestureDetector() = default;
41 PanGestureDetector PanGestureDetector::New()
43 Internal::PanGestureDetectorPtr internal = Internal::PanGestureDetector::New();
45 return PanGestureDetector(internal.Get());
48 PanGestureDetector PanGestureDetector::DownCast(BaseHandle handle)
50 return PanGestureDetector(dynamic_cast<Dali::Internal::PanGestureDetector*>(handle.GetObjectPtr()));
53 PanGestureDetector::~PanGestureDetector() = default;
55 PanGestureDetector::PanGestureDetector(const PanGestureDetector& handle) = default;
57 PanGestureDetector& PanGestureDetector::operator=(const PanGestureDetector& rhs) = default;
59 PanGestureDetector::PanGestureDetector(PanGestureDetector&& handle) = default;
61 PanGestureDetector& PanGestureDetector::operator=(PanGestureDetector&& rhs) = default;
63 void PanGestureDetector::SetMinimumTouchesRequired(uint32_t minimum)
65 GetImplementation(*this).SetMinimumTouchesRequired(minimum);
68 void PanGestureDetector::SetMaximumTouchesRequired(uint32_t maximum)
70 GetImplementation(*this).SetMaximumTouchesRequired(maximum);
73 void PanGestureDetector::SetMaximumMotionEventAge(uint32_t maximumAge)
75 GetImplementation(*this).SetMaximumMotionEventAge(maximumAge);
78 uint32_t PanGestureDetector::GetMinimumTouchesRequired() const
80 return GetImplementation(*this).GetMinimumTouchesRequired();
83 uint32_t PanGestureDetector::GetMaximumTouchesRequired() const
85 return GetImplementation(*this).GetMaximumTouchesRequired();
88 uint32_t PanGestureDetector::GetMaximumMotionEventAge() const
90 return GetImplementation(*this).GetMaximumMotionEventAge();
93 void PanGestureDetector::AddAngle(Radian angle, Radian threshold)
95 GetImplementation(*this).AddAngle(angle, threshold);
98 void PanGestureDetector::AddDirection(Radian direction, Radian threshold)
100 GetImplementation(*this).AddDirection(direction, threshold);
103 size_t PanGestureDetector::GetAngleCount() const
105 return GetImplementation(*this).GetAngleCount();
108 PanGestureDetector::AngleThresholdPair PanGestureDetector::GetAngle(size_t index) const
110 return GetImplementation(*this).GetAngle(static_cast<uint32_t>(index));
113 void PanGestureDetector::ClearAngles()
115 GetImplementation(*this).ClearAngles();
118 void PanGestureDetector::RemoveAngle(Radian angle)
120 GetImplementation(*this).RemoveAngle(angle);
123 void PanGestureDetector::RemoveDirection(Radian direction)
125 GetImplementation(*this).RemoveDirection(direction);
128 PanGestureDetector::DetectedSignalType& PanGestureDetector::DetectedSignal()
130 return GetImplementation(*this).DetectedSignal();
133 void PanGestureDetector::SetPanGestureProperties(const Dali::PanGesture& pan)
135 Internal::PanGestureDetector::SetPanGestureProperties(pan);