3608d34d8a2d4d760320284eceadc0a873a90818
[platform/core/uifw/dali-core.git] / dali / public-api / events / pan-gesture.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/public-api/events/pan-gesture.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23
24 namespace Dali
25 {
26
27 PanGesture::PanGesture(Gesture::State state)
28 : Gesture(Gesture::Pan, state),
29   numberOfTouches(1)
30 {
31 }
32
33 PanGesture::PanGesture( const PanGesture& rhs )
34 : Gesture( rhs ),
35   velocity( rhs.velocity ),
36   displacement( rhs.displacement ),
37   position( rhs.position ),
38   screenVelocity( rhs.screenVelocity ),
39   screenDisplacement( rhs.screenDisplacement ),
40   screenPosition( rhs.screenPosition ),
41   numberOfTouches( rhs.numberOfTouches )
42 {
43 }
44
45 PanGesture& PanGesture::operator=( const PanGesture& rhs )
46 {
47   Gesture::operator=(rhs);
48   velocity = rhs.velocity;
49   displacement = rhs.displacement;
50   position = rhs.position;
51   screenVelocity = rhs.screenVelocity;
52   screenDisplacement = rhs.screenDisplacement;
53   screenPosition = rhs.screenPosition;
54   numberOfTouches = rhs.numberOfTouches;
55
56   return *this;
57 }
58
59 PanGesture::~PanGesture()
60 {
61 }
62
63 float PanGesture::GetSpeed() const
64 {
65   return velocity.Length();
66 }
67
68 float PanGesture::GetDistance() const
69 {
70   return displacement.Length();
71 }
72
73 float PanGesture::GetScreenSpeed() const
74 {
75   return screenVelocity.Length();
76 }
77
78 float PanGesture::GetScreenDistance() const
79 {
80   return screenDisplacement.Length();
81 }
82
83 } // namespace Dali