2 * Copyright (c) 2021 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/internal/event/events/touch-event-impl.h>
22 #include <dali/public-api/actors/actor.h>
28 TouchEventPtr TouchEvent::Clone(const TouchEvent& other)
30 TouchEventPtr touchEvent(new TouchEvent);
31 touchEvent->mPoints = other.mPoints;
32 touchEvent->mTime = other.mTime;
36 int32_t TouchEvent::GetDeviceId(std::size_t point) const
38 if(point < mPoints.size())
40 return mPoints[point].GetDeviceId();
45 PointState::Type TouchEvent::GetState(std::size_t point) const
47 if(point < mPoints.size())
49 return mPoints[point].GetState();
51 return PointState::FINISHED;
54 Dali::Actor TouchEvent::GetHitActor(std::size_t point) const
56 if(point < mPoints.size())
58 return mPoints[point].GetHitActor();
63 const Vector2& TouchEvent::GetLocalPosition(std::size_t point) const
65 if(point < mPoints.size())
67 return mPoints[point].GetLocalPosition();
72 const Vector2& TouchEvent::GetScreenPosition(std::size_t point) const
74 if(point < mPoints.size())
76 return mPoints[point].GetScreenPosition();
81 float TouchEvent::GetRadius(std::size_t point) const
83 if(point < mPoints.size())
85 return mPoints[point].GetRadius();
90 const Vector2& TouchEvent::GetEllipseRadius(std::size_t point) const
92 if(point < mPoints.size())
94 return mPoints[point].GetEllipseRadius();
99 float TouchEvent::GetPressure(std::size_t point) const
101 if(point < mPoints.size())
103 return mPoints[point].GetPressure();
108 Degree TouchEvent::GetAngle(std::size_t point) const
110 if(point < mPoints.size())
112 return mPoints[point].GetAngle();
117 const Integration::Point& TouchEvent::GetPoint(std::size_t point) const
119 DALI_ASSERT_DEBUG(point < mPoints.size() && "No point at index");
120 return mPoints[point];
123 Integration::Point& TouchEvent::GetPoint(std::size_t point)
125 DALI_ASSERT_DEBUG(point < mPoints.size() && "No point at index");
126 return mPoints[point];
129 Device::Class::Type TouchEvent::GetDeviceClass(std::size_t point) const
131 if(point < mPoints.size())
133 return mPoints[point].GetDeviceClass();
135 return Device::Class::NONE;
138 Device::Subclass::Type TouchEvent::GetDeviceSubclass(std::size_t point) const
140 if(point < mPoints.size())
142 return mPoints[point].GetDeviceSubclass();
144 return Device::Subclass::NONE;
147 MouseButton::Type TouchEvent::GetMouseButton(std::size_t point) const
149 if(point < mPoints.size())
151 return mPoints[point].GetMouseButton();
153 return MouseButton::INVALID;
156 void TouchEvent::AddPoint(const Integration::Point& point)
158 mPoints.push_back(point);
161 } // namespace Internal