History

Mouse coordinate fix.

Andrzej Kapolka committed 12 years ago

Commit c2cd23a1 parent 5bdad184 files · +28 −6Browse files

Showing the changes to interface/src/Application.cpp (1 of 4 files). Show all

Unified · Split

interface/src/Application.cpp+15−6
@@ -1166,8 +1166,7 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) { · 1165 unmodified lines
11661166 _seenMouseMove = true;
11671167 }
11681168
1169− _mouseX = event->x();
1170− _mouseY = event->y();
1169+ setMousePosition(event, deviceID);
11711170 }
11721171
11731172 void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
@@ -1181,8 +1180,7 @@ void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { · 7 unmodified lines
11811180
11821181 if (activeWindow() == _window) {
11831182 if (event->button() == Qt::LeftButton) {
1184− _mouseX = event->x();
1185− _mouseY = event->y();
1183+ setMousePosition(event, deviceID);
11861184 _mouseDragStartedX = _mouseX;
11871185 _mouseDragStartedY = _mouseY;
11881186 _mousePressed = true;
@@ -1213,8 +1211,7 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { · 24 unmodified lines
12131211
12141212 if (activeWindow() == _window) {
12151213 if (event->button() == Qt::LeftButton) {
1216− _mouseX = event->x();
1217− _mouseY = event->y();
1214+ setMousePosition(event, deviceID);
12181215 _mousePressed = false;
12191216 checkBandwidthMeterClick();
12201217 if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
@@ -2328,6 +2325,18 @@ int Application::sendNackPackets() { · 1107 unmodified lines
23282325 return packetsSent;
23292326 }
23302327
2328+void Application::setMousePosition(QMouseEvent* event, unsigned int deviceID) {
2329+ if (deviceID > 0) {
2330+ // simulated events are in device coordinates
2331+ _mouseX = event->x();
2332+ _mouseY = event->y();
2333+
2334+ } else {
2335+ _mouseX = _glWidget->getDeviceX(event->x());
2336+ _mouseY = _glWidget->getDeviceY(event->y());
2337+ }
2338+}
2339+
23312340 void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
23322341
23332342 //qDebug() << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t