Save the current mouse press point @param p mouse click point */
| 1204 | @param p mouse click point |
| 1205 | */ |
| 1206 | void G4OpenGLQtViewer::G4MousePressEvent(QMouseEvent *evnt) |
| 1207 | { |
| 1208 | if (evnt->button() == Qt::RightButton) { |
| 1209 | return; |
| 1210 | } |
| 1211 | if ((evnt->button() & Qt::LeftButton) && (! (evnt->modifiers() & Qt::ControlModifier ))){ |
| 1212 | fGLWidget->setMouseTracking(true); |
| 1213 | fAutoMove = false; // stop automove |
| 1214 | fLastPos1 = evnt->pos(); |
| 1215 | fLastPos2 = fLastPos1; |
| 1216 | fLastPos3 = fLastPos2; |
| 1217 | fLastEventTime->start(); |
| 1218 | if (fUiQt != NULL) { |
| 1219 | |
| 1220 | if (fUiQt->IsIconZoomInSelected()) { // zoomIn |
| 1221 | // Move click point to center of OGL |
| 1222 | |
| 1223 | float deltaX = ((float)getWinWidth()/2-evnt->pos().x()); |
| 1224 | float deltaY = ((float)getWinHeight()/2-evnt->pos().y()); |
| 1225 | |
| 1226 | G4double coefTrans = 0; |
| 1227 | coefTrans = ((G4double)GetSceneNearWidth())/((G4double)getWinWidth()); |
| 1228 | if (getWinHeight() <getWinWidth()) { |
| 1229 | coefTrans = ((G4double)GetSceneNearWidth())/((G4double)getWinHeight()); |
| 1230 | } |
| 1231 | fVP.IncrementPan(-deltaX*coefTrans,deltaY*coefTrans,0); |
| 1232 | fVP.SetZoomFactor(1.5 * fVP.GetZoomFactor()); |
| 1233 | |
| 1234 | updateQWidget(); |
| 1235 | |
| 1236 | } else if (fUiQt->IsIconZoomOutSelected()) { // zoomOut |
| 1237 | // Move click point to center of OGL |
| 1238 | moveScene(((float)getWinWidth()/2-evnt->pos().x()),((float)getWinHeight()/2-evnt->pos().y()),0,true); |
| 1239 | |
| 1240 | fVP.SetZoomFactor(0.75 * fVP.GetZoomFactor()); |
| 1241 | updateQWidget(); |
| 1242 | |
| 1243 | } else if (fUiQt->IsIconRotateSelected() ) { |
| 1244 | |
| 1245 | if (fShiftKeyPress) { // move |
| 1246 | fGLWidget->setCursor(QCursor(Qt::SizeAllCursor)); |
| 1247 | |
| 1248 | } else { // rotate |
| 1249 | fGLWidget->setCursor(QCursor(Qt::ClosedHandCursor)); |
| 1250 | } |
| 1251 | } else if (fUiQt->IsIconMoveSelected()) { |
| 1252 | fGLWidget->setCursor(QCursor(Qt::SizeAllCursor)); |
| 1253 | } else if (fUiQt->IsIconPickSelected()) { |
| 1254 | fGLWidget->setCursor(QCursor(Qt::PointingHandCursor)); |
| 1255 | } |
| 1256 | } |
| 1257 | } |
| 1258 | } |
| 1259 | |
| 1260 | /** |
| 1261 | */ |
nothing calls this directly
no test coverage detected