mirror of
https://github.com/overte-org/overte.git
synced 2025-04-09 10:45:24 +02:00
tweaks to click
This commit is contained in:
parent
eb598bd3d3
commit
4fddc86851
2 changed files with 4 additions and 3 deletions
|
@ -64,8 +64,8 @@ void KeyboardMouseDevice::mousePressEvent(QMouseEvent* event, unsigned int devic
|
|||
// key pressed again ? without catching the release event ?
|
||||
}
|
||||
_lastCursor = event->pos();
|
||||
_mousePressAt = event->pos();
|
||||
_mousePressTime = usecTimestampNow();
|
||||
_mouseMoved = false;
|
||||
|
||||
eraseMouseClicked();
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ void KeyboardMouseDevice::mouseReleaseEvent(QMouseEvent* event, unsigned int dev
|
|||
// input for this button we might want to add some small tolerance to this so if you do a small drag it
|
||||
// till counts as a clicked.
|
||||
static const int CLICK_TIME = USECS_PER_MSEC * 500; // 500 ms to click
|
||||
if (_mousePressAt == event->pos() && (usecTimestampNow() - _mousePressTime < CLICK_TIME)) {
|
||||
if (!_mouseMoved && (usecTimestampNow() - _mousePressTime < CLICK_TIME)) {
|
||||
_inputDevice->_buttonPressedMap.insert(_inputDevice->makeInput((Qt::MouseButton) event->button(), true).getChannel());
|
||||
}
|
||||
}
|
||||
|
@ -100,6 +100,7 @@ void KeyboardMouseDevice::mouseMoveEvent(QMouseEvent* event, unsigned int device
|
|||
_inputDevice->_axisStateMap[MOUSE_AXIS_Y_NEG] = (currentMove.y() > 0 ? currentMove.y() : 0.0f);
|
||||
|
||||
_lastCursor = currentPos;
|
||||
_mouseMoved = true;
|
||||
|
||||
eraseMouseClicked();
|
||||
}
|
||||
|
|
|
@ -115,8 +115,8 @@ public:
|
|||
|
||||
protected:
|
||||
QPoint _lastCursor;
|
||||
QPoint _mousePressAt;
|
||||
quint64 _mousePressTime;
|
||||
bool _mouseMoved;
|
||||
glm::vec2 _lastTouch;
|
||||
std::shared_ptr<InputDevice> _inputDevice { std::make_shared<InputDevice>() };
|
||||
|
||||
|
|
Loading…
Reference in a new issue