2 * Copyright (c) 2020 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/integration-api/events/point.h>
20 #include <dali/public-api/events/mouse-button.h>
27 : mTouchPoint(0, PointState::STARTED, 0.0f, 0.0f),
30 mDeviceClass(Device::Class::NONE),
31 mDeviceSubclass(Device::Subclass::NONE),
34 mMouseButton(MouseButton::INVALID)
38 Point::Point(const TouchPoint& touchPoint)
39 : mTouchPoint(touchPoint),
42 mDeviceClass(Device::Class::NONE),
43 mDeviceSubclass(Device::Subclass::NONE),
46 mMouseButton(MouseButton::INVALID)
54 void Point::SetDeviceId(int32_t deviceId)
56 mTouchPoint.deviceId = deviceId;
59 void Point::SetState(PointState::Type state)
61 mTouchPoint.state = static_cast<PointState::Type>(state);
64 void Point::SetScreenPosition(const Vector2& screenPosition)
66 mTouchPoint.screen = screenPosition;
69 void Point::SetRadius(float radius)
71 mRadius = mEllipseRadius.x = mEllipseRadius.y = radius;
74 void Point::SetRadius(float radius, Vector2 ellipseRadius)
77 mEllipseRadius = ellipseRadius;
80 void Point::SetPressure(float pressure)
85 void Point::SetAngle(Degree angle)
90 int Point::GetDeviceId() const
92 return mTouchPoint.deviceId;
95 PointState::Type Point::GetState() const
97 return static_cast<PointState::Type>(mTouchPoint.state);
100 const Vector2& Point::GetScreenPosition() const
102 return mTouchPoint.screen;
105 float Point::GetRadius() const
110 const Vector2& Point::GetEllipseRadius() const
112 return mEllipseRadius;
115 float Point::GetPressure() const
120 Degree Point::GetAngle() const
125 void Point::SetHitActor(Actor hitActor)
127 mTouchPoint.hitActor = hitActor;
130 void Point::SetLocalPosition(const Vector2& localPosition)
132 mTouchPoint.local = localPosition;
135 Actor Point::GetHitActor() const
137 return mTouchPoint.hitActor;
140 const Vector2& Point::GetLocalPosition() const
142 return mTouchPoint.local;
145 const TouchPoint& Point::GetTouchPoint() const
150 void Point::SetDeviceClass(Device::Class::Type deviceClass)
152 mDeviceClass = deviceClass;
155 void Point::SetDeviceSubclass(Device::Subclass::Type deviceSubclass)
157 mDeviceSubclass = deviceSubclass;
160 Device::Class::Type Point::GetDeviceClass() const
165 Device::Subclass::Type Point::GetDeviceSubclass() const
167 return mDeviceSubclass;
170 MouseButton::Type Point::GetMouseButton() const
175 void Point::SetMouseButton(MouseButton::Type button)
177 mMouseButton = button;
180 } // namespace Integration