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)
50 Point::~Point() = default;
52 void Point::SetDeviceId(int32_t deviceId)
54 mTouchPoint.deviceId = deviceId;
57 void Point::SetState(PointState::Type state)
59 mTouchPoint.state = static_cast<PointState::Type>(state);
62 void Point::SetScreenPosition(const Vector2& screenPosition)
64 mTouchPoint.screen = screenPosition;
67 void Point::SetRadius(float radius)
69 mRadius = mEllipseRadius.x = mEllipseRadius.y = radius;
72 void Point::SetRadius(float radius, Vector2 ellipseRadius)
75 mEllipseRadius = ellipseRadius;
78 void Point::SetPressure(float pressure)
83 void Point::SetAngle(Degree angle)
88 int Point::GetDeviceId() const
90 return mTouchPoint.deviceId;
93 PointState::Type Point::GetState() const
95 return static_cast<PointState::Type>(mTouchPoint.state);
98 const Vector2& Point::GetScreenPosition() const
100 return mTouchPoint.screen;
103 float Point::GetRadius() const
108 const Vector2& Point::GetEllipseRadius() const
110 return mEllipseRadius;
113 float Point::GetPressure() const
118 Degree Point::GetAngle() const
123 void Point::SetHitActor(Actor hitActor)
125 mTouchPoint.hitActor = hitActor;
128 void Point::SetLocalPosition(const Vector2& localPosition)
130 mTouchPoint.local = localPosition;
133 Actor Point::GetHitActor() const
135 return mTouchPoint.hitActor;
138 const Vector2& Point::GetLocalPosition() const
140 return mTouchPoint.local;
143 const TouchPoint& Point::GetTouchPoint() const
148 void Point::SetDeviceClass(Device::Class::Type deviceClass)
150 mDeviceClass = deviceClass;
153 void Point::SetDeviceSubclass(Device::Subclass::Type deviceSubclass)
155 mDeviceSubclass = deviceSubclass;
158 Device::Class::Type Point::GetDeviceClass() const
163 Device::Subclass::Type Point::GetDeviceSubclass() const
165 return mDeviceSubclass;
168 MouseButton::Type Point::GetMouseButton() const
173 void Point::SetMouseButton(MouseButton::Type button)
175 mMouseButton = button;
178 } // namespace Integration