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/internal/event/events/touch-data-impl.h>
22 #include <dali/public-api/actors/actor.h>
30 TouchData::TouchData()
36 TouchData::TouchData( unsigned long time )
42 TouchDataPtr TouchData::Clone( const TouchData& other )
44 TouchDataPtr touchData( new TouchData );
45 touchData->mPoints = other.mPoints;
46 touchData->mTime = other.mTime;
50 TouchData::~TouchData()
54 unsigned long TouchData::GetTime() const
59 std::size_t TouchData::GetPointCount() const
61 return mPoints.size();
64 int32_t TouchData::GetDeviceId( std::size_t point ) const
66 if( point < mPoints.size() )
68 return mPoints[ point ].GetDeviceId();
73 PointState::Type TouchData::GetState( std::size_t point ) const
75 if( point < mPoints.size() )
77 return mPoints[ point ].GetState();
79 return PointState::FINISHED;
82 Dali::Actor TouchData::GetHitActor( std::size_t point ) const
84 if( point < mPoints.size() )
86 return mPoints[ point ].GetHitActor();
91 const Vector2& TouchData::GetLocalPosition( std::size_t point ) const
93 if( point < mPoints.size() )
95 return mPoints[ point ].GetLocalPosition();
100 const Vector2& TouchData::GetScreenPosition( std::size_t point ) const
102 if( point < mPoints.size() )
104 return mPoints[ point ].GetScreenPosition();
106 return Vector2::ZERO;
109 float TouchData::GetRadius( std::size_t point ) const
111 if( point < mPoints.size() )
113 return mPoints[ point ].GetRadius();
118 const Vector2& TouchData::GetEllipseRadius( std::size_t point ) const
120 if( point < mPoints.size() )
122 return mPoints[ point ].GetEllipseRadius();
124 return Vector2::ZERO;
127 float TouchData::GetPressure( std::size_t point ) const
129 if( point < mPoints.size() )
131 return mPoints[ point ].GetPressure();
136 Degree TouchData::GetAngle( std::size_t point ) const
138 if( point < mPoints.size() )
140 return mPoints[ point ].GetAngle();
145 const Integration::Point& TouchData::GetPoint( std::size_t point ) const
147 DALI_ASSERT_DEBUG( point < mPoints.size() && "No point at index" );
148 return mPoints[ point ];
151 Integration::Point& TouchData::GetPoint( std::size_t point )
153 DALI_ASSERT_DEBUG( point < mPoints.size() && "No point at index" );
154 return mPoints[ point ];
157 void TouchData::AddPoint( const Integration::Point& point )
159 mPoints.push_back( point );
162 Device::Class::Type TouchData::GetDeviceClass( std::size_t point ) const
164 if( point < mPoints.size() )
166 return mPoints[ point ].GetDeviceClass();
168 return Device::Class::NONE;
171 Device::Subclass::Type TouchData::GetDeviceSubclass( std::size_t point ) const
173 if( point < mPoints.size() )
175 return mPoints[ point ].GetDeviceSubclass();
177 return Device::Subclass::NONE;
180 MouseButton::Type TouchData::GetMouseButton( std::size_t point ) const
182 if( point < mPoints.size() )
184 return mPoints[ point ].GetMouseButton();
186 return MouseButton::INVALID;
189 } // namsespace Internal