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
1166 _seenMouseMove = true;1166 _seenMouseMove = true;
1167 }1167 }
1168 1168
1169 _mouseX = event->x();1169 setMousePosition(event, deviceID);
1170 _mouseY = event->y();
1171}1170}
1172 1171
1173void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {1172void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) {
@@ -1181,8 +1180,7 @@ void Application::mousePressEvent(QMouseEvent* event, unsigned int deviceID) { · 7 unmodified lines
1181 1180
1182 if (activeWindow() == _window) {1181 if (activeWindow() == _window) {
1183 if (event->button() == Qt::LeftButton) {1182 if (event->button() == Qt::LeftButton) {
1184 _mouseX = event->x();1183 setMousePosition(event, deviceID);
1185 _mouseY = event->y();
1186 _mouseDragStartedX = _mouseX;1184 _mouseDragStartedX = _mouseX;
1187 _mouseDragStartedY = _mouseY;1185 _mouseDragStartedY = _mouseY;
1188 _mousePressed = true;1186 _mousePressed = true;
@@ -1213,8 +1211,7 @@ void Application::mouseReleaseEvent(QMouseEvent* event, unsigned int deviceID) { · 24 unmodified lines
1213 1211
1214 if (activeWindow() == _window) {1212 if (activeWindow() == _window) {
1215 if (event->button() == Qt::LeftButton) {1213 if (event->button() == Qt::LeftButton) {
1216 _mouseX = event->x();1214 setMousePosition(event, deviceID);
1217 _mouseY = event->y();
1218 _mousePressed = false;1215 _mousePressed = false;
1219 checkBandwidthMeterClick();1216 checkBandwidthMeterClick();
1220 if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {1217 if (Menu::getInstance()->isOptionChecked(MenuOption::Stats)) {
@@ -2328,6 +2325,18 @@ int Application::sendNackPackets() { · 1107 unmodified lines
2328 return packetsSent;2325 return packetsSent;
2329}2326}
2330 2327
2328void 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
2331void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {2340void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
2332 2341
2333 //qDebug() << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();2342 //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