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/internal/event/events/touch-event-impl.h>
22 #include <dali/public-api/actors/actor.h>
30 TouchEventPtr TouchEvent::Clone( const TouchEvent& other )
32 TouchEventPtr touchEvent( new TouchEvent );
33 touchEvent->mPoints = other.mPoints;
34 touchEvent->mTime = other.mTime;
38 int32_t TouchEvent::GetDeviceId( std::size_t point ) const
40 if( point < mPoints.size() )
42 return mPoints[ point ].GetDeviceId();
47 PointState::Type TouchEvent::GetState( std::size_t point ) const
49 if( point < mPoints.size() )
51 return mPoints[ point ].GetState();
53 return PointState::FINISHED;
56 Dali::Actor TouchEvent::GetHitActor( std::size_t point ) const
58 if( point < mPoints.size() )
60 return mPoints[ point ].GetHitActor();
65 const Vector2& TouchEvent::GetLocalPosition( std::size_t point ) const
67 if( point < mPoints.size() )
69 return mPoints[ point ].GetLocalPosition();
74 const Vector2& TouchEvent::GetScreenPosition( std::size_t point ) const
76 if( point < mPoints.size() )
78 return mPoints[ point ].GetScreenPosition();
83 float TouchEvent::GetRadius( std::size_t point ) const
85 if( point < mPoints.size() )
87 return mPoints[ point ].GetRadius();
92 const Vector2& TouchEvent::GetEllipseRadius( std::size_t point ) const
94 if( point < mPoints.size() )
96 return mPoints[ point ].GetEllipseRadius();
101 float TouchEvent::GetPressure( std::size_t point ) const
103 if( point < mPoints.size() )
105 return mPoints[ point ].GetPressure();
110 Degree TouchEvent::GetAngle( std::size_t point ) const
112 if( point < mPoints.size() )
114 return mPoints[ point ].GetAngle();
119 const Integration::Point& TouchEvent::GetPoint( std::size_t point ) const
121 DALI_ASSERT_DEBUG( point < mPoints.size() && "No point at index" );
122 return mPoints[ point ];
125 Integration::Point& TouchEvent::GetPoint( std::size_t point )
127 DALI_ASSERT_DEBUG( point < mPoints.size() && "No point at index" );
128 return mPoints[ point ];
131 Device::Class::Type TouchEvent::GetDeviceClass( std::size_t point ) const
133 if( point < mPoints.size() )
135 return mPoints[ point ].GetDeviceClass();
137 return Device::Class::NONE;
140 Device::Subclass::Type TouchEvent::GetDeviceSubclass( std::size_t point ) const
142 if( point < mPoints.size() )
144 return mPoints[ point ].GetDeviceSubclass();
146 return Device::Subclass::NONE;
149 MouseButton::Type TouchEvent::GetMouseButton( std::size_t point ) const
151 if( point < mPoints.size() )
153 return mPoints[ point ].GetMouseButton();
155 return MouseButton::INVALID;
158 void TouchEvent::AddPoint( const Integration::Point& point )
160 mPoints.push_back( point );
163 } // namsespace Internal