Fix problem with ContextMenu triggering on button up and button down.

This is fixed by clearing the ButtonPressedMap in the KeyboardMouseDevice every update.
Previously, this button would never be cleared, causing other controller actions mapped to the same button to have the incorrect state.
In this case, ContextMenu action would become 2 when pressed and 1 when released, anytime after the right mouse button was pressed.
This commit is contained in:
Anthony J. Thibault 2017-03-27 14:26:17 -07:00
parent 5796cbc898
commit a0c42bacdb

View file

@ -25,6 +25,7 @@ void KeyboardMouseDevice::pluginUpdate(float deltaTime, const controller::InputC
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
userInputMapper->withLock([&, this]() {
_inputDevice->update(deltaTime, inputCalibrationData);
eraseMouseClicked();
_inputDevice->_axisStateMap[MOUSE_AXIS_X] = _lastCursor.x();
_inputDevice->_axisStateMap[MOUSE_AXIS_Y] = _lastCursor.y();
@ -78,8 +79,6 @@ void KeyboardMouseDevice::mousePressEvent(QMouseEvent* event) {
_mousePressPos = event->pos();
_clickDeadspotActive = true;
eraseMouseClicked();
}
void KeyboardMouseDevice::mouseReleaseEvent(QMouseEvent* event) {
@ -122,7 +121,6 @@ void KeyboardMouseDevice::mouseMoveEvent(QMouseEvent* event) {
const int CLICK_EVENT_DEADSPOT = 6; // pixels
if (_clickDeadspotActive && (_mousePressPos - currentPos).manhattanLength() > CLICK_EVENT_DEADSPOT) {
eraseMouseClicked();
_clickDeadspotActive = false;
}
}