mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 00:13:53 +02:00
cleanup
This commit is contained in:
parent
b00f572e1a
commit
c3a78ed151
2 changed files with 10 additions and 8 deletions
|
@ -68,9 +68,11 @@ void KeyboardMouseDevice::mouseReleaseEvent(QMouseEvent* event, unsigned int dev
|
|||
auto input = makeInput((Qt::MouseButton) event->button());
|
||||
_buttonPressedMap.erase(input.getChannel());
|
||||
|
||||
// if we pressed and released at the same location, then create a "_CLICKED" input for this button
|
||||
// we might want to add some small tolerance to this so if you do a small drag it still counts as
|
||||
// a clicked.
|
||||
if (_mousePressAt == event->pos()) {
|
||||
auto input = makeInput((Qt::MouseButton) event->button(), true); // clicked
|
||||
auto result = _buttonPressedMap.insert(input.getChannel());
|
||||
_buttonPressedMap.insert(makeInput((Qt::MouseButton) event->button(), true).getChannel());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,13 +159,13 @@ controller::Input KeyboardMouseDevice::makeInput(Qt::Key code) const {
|
|||
controller::Input KeyboardMouseDevice::makeInput(Qt::MouseButton code, bool quickClicked) const {
|
||||
switch (code) {
|
||||
case Qt::LeftButton:
|
||||
return controller::Input(_deviceID, quickClicked ? MOUSE_BUTTON_LEFT_QUICK_CLICK :
|
||||
return controller::Input(_deviceID, quickClicked ? MOUSE_BUTTON_LEFT_CLICKED :
|
||||
MOUSE_BUTTON_LEFT, controller::ChannelType::BUTTON);
|
||||
case Qt::RightButton:
|
||||
return controller::Input(_deviceID, quickClicked ? MOUSE_BUTTON_RIGHT_QUICK_CLICK :
|
||||
return controller::Input(_deviceID, quickClicked ? MOUSE_BUTTON_RIGHT_CLICKED :
|
||||
MOUSE_BUTTON_RIGHT, controller::ChannelType::BUTTON);
|
||||
case Qt::MiddleButton:
|
||||
return controller::Input(_deviceID, quickClicked ? MOUSE_BUTTON_MIDDLE_QUICK_CLICK :
|
||||
return controller::Input(_deviceID, quickClicked ? MOUSE_BUTTON_MIDDLE_CLICKED :
|
||||
MOUSE_BUTTON_MIDDLE, controller::ChannelType::BUTTON);
|
||||
default:
|
||||
return controller::Input();
|
||||
|
|
|
@ -37,9 +37,9 @@ public:
|
|||
MOUSE_BUTTON_LEFT = KEYBOARD_LAST + 1,
|
||||
MOUSE_BUTTON_RIGHT,
|
||||
MOUSE_BUTTON_MIDDLE,
|
||||
MOUSE_BUTTON_LEFT_QUICK_CLICK,
|
||||
MOUSE_BUTTON_RIGHT_QUICK_CLICK,
|
||||
MOUSE_BUTTON_MIDDLE_QUICK_CLICK,
|
||||
MOUSE_BUTTON_LEFT_CLICKED,
|
||||
MOUSE_BUTTON_RIGHT_CLICKED,
|
||||
MOUSE_BUTTON_MIDDLE_CLICKED,
|
||||
};
|
||||
|
||||
enum MouseAxisChannel {
|
||||
|
|
Loading…
Reference in a new issue