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>
20 #include <dali/public-api/events/mouse-button.h>
29 : mTouchPoint( 0, TouchPoint::Started, 0.0f, 0.0f ),
32 mDeviceClass( Device::Class::NONE ),
33 mDeviceSubclass( Device::Subclass::NONE ),
36 mMouseButton( MouseButton::INVALID )
40 Point::Point( const TouchPoint& touchPoint )
41 : mTouchPoint( touchPoint ),
44 mDeviceClass( Device::Class::NONE ),
45 mDeviceSubclass( Device::Subclass::NONE ),
48 mMouseButton( MouseButton::INVALID )
56 void Point::SetDeviceId( int deviceId )
58 mTouchPoint.deviceId = deviceId;
61 void Point::SetState( PointState::Type state )
63 mTouchPoint.state = static_cast< TouchPoint::State >( state );
66 void Point::SetScreenPosition( const Vector2& screenPosition )
68 mTouchPoint.screen = screenPosition;
71 void Point::SetRadius( float radius )
73 mRadius = mEllipseRadius.x = mEllipseRadius.y = radius;
76 void Point::SetRadius( float radius, Vector2 ellipseRadius )
79 mEllipseRadius = ellipseRadius;
82 void Point::SetPressure( float pressure )
87 void Point::SetAngle( Degree angle )
92 int Point::GetDeviceId() const
94 return mTouchPoint.deviceId;
97 PointState::Type Point::GetState() const
99 return static_cast< PointState::Type >( mTouchPoint.state );
102 const Vector2& Point::GetScreenPosition() const
104 return mTouchPoint.screen;
107 float Point::GetRadius() const
112 const Vector2& Point::GetEllipseRadius() const
114 return mEllipseRadius;
117 float Point::GetPressure() const
122 Degree Point::GetAngle() const
127 void Point::SetHitActor( Actor hitActor )
129 mTouchPoint.hitActor = hitActor;
132 void Point::SetLocalPosition( const Vector2& localPosition )
134 mTouchPoint.local = localPosition;
137 Actor Point::GetHitActor() const
139 return mTouchPoint.hitActor;
142 const Vector2& Point::GetLocalPosition() const
144 return mTouchPoint.local;
147 const TouchPoint& Point::GetTouchPoint() const
152 void Point::SetDeviceClass( Device::Class::Type deviceClass )
154 mDeviceClass = deviceClass;
157 void Point::SetDeviceSubclass( Device::Subclass::Type deviceSubclass )
159 mDeviceSubclass = deviceSubclass;
162 Device::Class::Type Point::GetDeviceClass() const
167 Device::Subclass::Type Point::GetDeviceSubclass() const
169 return mDeviceSubclass;
172 MouseButton::Type Point::GetMouseButton() const
177 void Point::SetMouseButton(MouseButton::Type button)
179 mMouseButton = button;
183 } // namespace Integration