2 * Copyright (c) 2017 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>
28 : mTouchPoint( 0, TouchPoint::Started, 0.0f, 0.0f ),
31 mDeviceClass( Device::Class::NONE ),
32 mDeviceSubclass( Device::Subclass::NONE ),
35 mMouseButton( MouseButton::INVALID )
39 Point::Point( const TouchPoint& touchPoint )
40 : mTouchPoint( touchPoint ),
43 mDeviceClass( Device::Class::NONE ),
44 mDeviceSubclass( Device::Subclass::NONE ),
47 mMouseButton( MouseButton::INVALID )
55 void Point::SetDeviceId( int32_t deviceId )
57 mTouchPoint.deviceId = deviceId;
60 void Point::SetState( PointState::Type state )
62 mTouchPoint.state = static_cast< TouchPoint::State >( state );
65 void Point::SetScreenPosition( const Vector2& screenPosition )
67 mTouchPoint.screen = screenPosition;
70 void Point::SetRadius( float radius )
72 mRadius = mEllipseRadius.x = mEllipseRadius.y = radius;
75 void Point::SetRadius( float radius, Vector2 ellipseRadius )
78 mEllipseRadius = ellipseRadius;
81 void Point::SetPressure( float pressure )
86 void Point::SetAngle( Degree angle )
91 int Point::GetDeviceId() const
93 return mTouchPoint.deviceId;
96 PointState::Type Point::GetState() const
98 return static_cast< PointState::Type >( mTouchPoint.state );
101 const Vector2& Point::GetScreenPosition() const
103 return mTouchPoint.screen;
106 float Point::GetRadius() const
111 const Vector2& Point::GetEllipseRadius() const
113 return mEllipseRadius;
116 float Point::GetPressure() const
121 Degree Point::GetAngle() const
126 void Point::SetHitActor( Actor hitActor )
128 mTouchPoint.hitActor = hitActor;
131 void Point::SetLocalPosition( const Vector2& localPosition )
133 mTouchPoint.local = localPosition;
136 Actor Point::GetHitActor() const
138 return mTouchPoint.hitActor;
141 const Vector2& Point::GetLocalPosition() const
143 return mTouchPoint.local;
146 const TouchPoint& Point::GetTouchPoint() const
151 void Point::SetDeviceClass( Device::Class::Type deviceClass )
153 mDeviceClass = deviceClass;
156 void Point::SetDeviceSubclass( Device::Subclass::Type deviceSubclass )
158 mDeviceSubclass = deviceSubclass;
161 Device::Class::Type Point::GetDeviceClass() const
166 Device::Subclass::Type Point::GetDeviceSubclass() const
168 return mDeviceSubclass;
171 MouseButton::Type Point::GetMouseButton() const
176 void Point::SetMouseButton(MouseButton::Type button)
178 mMouseButton = button;
182 } // namespace Integration