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 ),
38 Point::Point( const TouchPoint& touchPoint )
39 : mTouchPoint( touchPoint ),
42 mDeviceClass( Device::Class::NONE ),
43 mDeviceSubclass( Device::Subclass::NONE ),
53 void Point::SetDeviceId( int deviceId )
55 mTouchPoint.deviceId = deviceId;
58 void Point::SetState( PointState::Type state )
60 mTouchPoint.state = static_cast< TouchPoint::State >( state );
63 void Point::SetScreenPosition( const Vector2& screenPosition )
65 mTouchPoint.screen = screenPosition;
68 void Point::SetRadius( float radius )
70 mRadius = mEllipseRadius.x = mEllipseRadius.y = radius;
73 void Point::SetRadius( float radius, Vector2 ellipseRadius )
76 mEllipseRadius = ellipseRadius;
79 void Point::SetPressure( float pressure )
84 void Point::SetAngle( Degree angle )
89 int Point::GetDeviceId() const
91 return mTouchPoint.deviceId;
94 PointState::Type Point::GetState() const
96 return static_cast< PointState::Type >( mTouchPoint.state );
99 const Vector2& Point::GetScreenPosition() const
101 return mTouchPoint.screen;
104 float Point::GetRadius() const
109 const Vector2& Point::GetEllipseRadius() const
111 return mEllipseRadius;
114 float Point::GetPressure() const
119 Degree Point::GetAngle() const
124 void Point::SetHitActor( Actor hitActor )
126 mTouchPoint.hitActor = hitActor;
129 void Point::SetLocalPosition( const Vector2& localPosition )
131 mTouchPoint.local = localPosition;
134 Actor Point::GetHitActor() const
136 return mTouchPoint.hitActor;
139 const Vector2& Point::GetLocalPosition() const
141 return mTouchPoint.local;
144 const TouchPoint& Point::GetTouchPoint() const
149 void Point::SetDeviceClass( Device::Class::Type deviceClass )
151 mDeviceClass = deviceClass;
154 void Point::SetDeviceSubclass( Device::Subclass::Type deviceSubclass )
156 mDeviceSubclass = deviceSubclass;
159 Device::Class::Type Point::GetDeviceClass() const
164 Device::Subclass::Type Point::GetDeviceSubclass() const
166 return mDeviceSubclass;
169 } // namespace Integration