2
* Copyright 2012 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License, as
6
* published by the Free Software Foundation; either version 2.1 or 3.0
9
* This program is distributed in the hope that it will be useful, but
10
* WITHOUT ANY WARRANTY; without even the implied warranties of
11
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12
* PURPOSE. See the applicable version of the GNU Lesser General Public
13
* License for more details.
15
* You should have received a copy of both the GNU Lesser General Public
16
* License along with this program. If not, see <http://www.gnu.org/licenses/>
18
* Authored by: Daniel d'Andrada <daniel.dandrada@canonical.com>
22
#include "GestureEvent.h"
23
#include "NuxCore/Logger.h"
29
nux::logging::Logger logger("nux.gestureevent");
32
GestureEvent::GestureEvent()
34
// that's how many fingers you have on your hand (duh).
35
// Can't have gestures with more than that many touch points.
39
void GestureEvent::Accept()
42
status = geis_gesture_accept(geis_, geis_group_, gesture_id_);
43
if (status != GEIS_STATUS_SUCCESS)
45
LOG_WARNING(logger) << "Failed to accept gesture with id " << gesture_id_;
49
void GestureEvent::Reject()
52
status = geis_gesture_reject(geis_, geis_group_, gesture_id_);
53
if (status != GEIS_STATUS_SUCCESS)
55
LOG_WARNING(logger) << "Failed to reject gesture with id " << gesture_id_;
59
void GestureEvent::Reset()
66
focus_.x = focus_.y = 0.0f;
67
delta_.x = delta_.y = 0.0f;
70
angular_velocity_ = 0.0f;
72
velocity_.x = velocity_.y = 0.0f;
75
radial_velocity_ = 0.0f;
76
is_construction_finished_ = false;
79
geis_group_ = nullptr;