src/gldraw.cpp

changeset 264
4299b818a816
parent 263
d7b534057d61
child 265
955c0aabfebf
equal deleted inserted replaced
263:d7b534057d61 264:4299b818a816
957 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 957 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
958 // ============================================================================= 958 // =============================================================================
959 void GLRenderer::mousePressEvent (QMouseEvent* ev) { 959 void GLRenderer::mousePressEvent (QMouseEvent* ev) {
960 m_totalmove = 0; 960 m_totalmove = 0;
961 961
962 if (ev->modifiers () & Qt::ShiftModifier) { 962 if (ev->modifiers () & Qt::ControlModifier) {
963 m_rangepick = true; 963 m_rangepick = true;
964 m_rangeStart.setX (ev->x ()); 964 m_rangeStart.setX (ev->x ());
965 m_rangeStart.setY (ev->y ()); 965 m_rangeStart.setY (ev->y ());
966 m_addpick = (m_keymods & Qt::ControlModifier); 966 m_addpick = (m_keymods & Qt::AltModifier);
967 ev->accept ();
967 } 968 }
968 969
969 m_lastButtons = ev->buttons (); 970 m_lastButtons = ev->buttons ();
970 } 971 }
971 972
975 void GLRenderer::mouseMoveEvent (QMouseEvent* ev) { 976 void GLRenderer::mouseMoveEvent (QMouseEvent* ev) {
976 int dx = ev->x () - m_pos.x (); 977 int dx = ev->x () - m_pos.x ();
977 int dy = ev->y () - m_pos.y (); 978 int dy = ev->y () - m_pos.y ();
978 m_totalmove += abs (dx) + abs (dy); 979 m_totalmove += abs (dx) + abs (dy);
979 980
980 if (ev->buttons () & Qt::LeftButton && !m_rangepick) { 981 const bool left = ev->buttons () & Qt::LeftButton,
981 m_rotX = m_rotX + (dy); 982 mid = ev->buttons () & Qt::MidButton,
982 m_rotY = m_rotY + (dx); 983 shift = ev->modifiers () & Qt::ShiftModifier;
983 984
984 clampAngle (m_rotX); 985 if (mid || (left && shift)) {
985 clampAngle (m_rotY);
986 }
987
988 if (ev->buttons () & Qt::MidButton) {
989 m_panX += 0.03f * dx * (zoom () / 7.5f); 986 m_panX += 0.03f * dx * (zoom () / 7.5f);
990 m_panY -= 0.03f * dy * (zoom () / 7.5f); 987 m_panY -= 0.03f * dy * (zoom () / 7.5f);
991 m_panning = true; 988 m_panning = true;
989 } else if (left && !m_rangepick && camera () == Free) {
990 m_rotX = m_rotX + (dy);
991 m_rotY = m_rotY + (dx);
992
993 clampAngle (m_rotX);
994 clampAngle (m_rotY);
992 } 995 }
993 996
994 // Start the tool tip timer 997 // Start the tool tip timer
995 if (!m_drawToolTip) 998 if (!m_drawToolTip)
996 m_toolTipTimer->start (1000); 999 m_toolTipTimer->start (1000);

mercurial