837 angle += 360.0; |
837 angle += 360.0; |
838 while (angle > 360.0) |
838 while (angle > 360.0) |
839 angle -= 360.0; |
839 angle -= 360.0; |
840 } |
840 } |
841 |
841 |
|
842 void GLRenderer::addDrawnVertex (vertex pos) { |
|
843 // If we picked an already-existing vertex, stop drawing |
|
844 for (vertex& vert : m_drawedVerts) { |
|
845 if (vert == pos) { |
|
846 endDraw (true); |
|
847 return; |
|
848 } |
|
849 } |
|
850 |
|
851 m_drawedVerts << pos; |
|
852 } |
|
853 |
842 // ============================================================================= |
854 // ============================================================================= |
843 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
855 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
844 // ============================================================================= |
856 // ============================================================================= |
845 void GLRenderer::mouseReleaseEvent (QMouseEvent* ev) { |
857 void GLRenderer::mouseReleaseEvent (QMouseEvent* ev) { |
846 const bool wasLeft = (m_lastButtons & Qt::LeftButton) && !(ev->buttons() & Qt::LeftButton); |
858 const bool wasLeft = (m_lastButtons & Qt::LeftButton) && !(ev->buttons() & Qt::LeftButton); |
847 const bool wasRight = (m_lastButtons & Qt::RightButton) && !(ev->buttons() & Qt::RightButton); |
859 const bool wasRight = (m_lastButtons & Qt::RightButton) && !(ev->buttons() & Qt::RightButton); |
848 const bool wasMid = (m_lastButtons & Qt::MidButton) && !(ev->buttons() & Qt::MidButton); |
860 const bool wasMid = (m_lastButtons & Qt::MidButton) && !(ev->buttons() & Qt::MidButton); |
|
861 printf ("totalmove: %lu\n", m_totalmove); |
849 |
862 |
850 if (wasLeft) { |
863 if (wasLeft) { |
851 // Check if we selected a camera icon |
864 // Check if we selected a camera icon |
852 if (!m_rangepick) { |
865 if (!m_rangepick) { |
853 for (CameraIcon& info : g_CameraIcons) { |
866 for (CameraIcon& info : g_CameraIcons) { |
946 if (m_drawedVerts.size () == 0) |
945 if (m_drawedVerts.size () == 0) |
947 m_rectdraw = false; |
946 m_rectdraw = false; |
948 |
947 |
949 update (); |
948 update (); |
950 } |
949 } |
|
950 |
|
951 m_totalmove = 0; |
951 } |
952 } |
952 |
953 |
953 // ============================================================================= |
954 // ============================================================================= |
954 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
955 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
955 // ============================================================================= |
956 // ============================================================================= |
956 void GLRenderer::mousePressEvent (QMouseEvent* ev) { |
957 void GLRenderer::mousePressEvent (QMouseEvent* ev) { |
957 if (ev->buttons () & Qt::LeftButton) |
958 m_totalmove = 0; |
958 m_totalmove = 0; |
|
959 |
959 |
960 if (ev->modifiers () & Qt::ShiftModifier) { |
960 if (ev->modifiers () & Qt::ShiftModifier) { |
961 m_rangepick = true; |
961 m_rangepick = true; |
962 m_rangeStart.setX (ev->x ()); |
962 m_rangeStart.setX (ev->x ()); |
963 m_rangeStart.setY (ev->y ()); |
963 m_rangeStart.setY (ev->y ()); |