diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2016-09-06 18:32:47 -0300 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2016-09-06 18:32:47 -0300 |
commit | 697baaa3cc92e945d2301238dc9bcabffdb465ef (patch) | |
tree | 01f3de93600a1036c8d693c5c8150434ebf75731 /Project/Transformer.cpp | |
parent | d93ef357da510f2515556ff2cb51688a4e068805 (diff) | |
download | PSP.git-697baaa3cc92e945d2301238dc9bcabffdb465ef.tar.gz PSP.git-697baaa3cc92e945d2301238dc9bcabffdb465ef.tar.xz PSP.git-697baaa3cc92e945d2301238dc9bcabffdb465ef.zip |
Counter clockwise rotation implemented
Diffstat (limited to 'Project/Transformer.cpp')
-rw-r--r-- | Project/Transformer.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Project/Transformer.cpp b/Project/Transformer.cpp index ce1d12e..0bb32d8 100644 --- a/Project/Transformer.cpp +++ b/Project/Transformer.cpp @@ -147,14 +147,17 @@ bool Transformer::Intersects(wxRect2DDouble rect) const return RotatedRectanglesIntersects(m_rect, rect, m_angle, 0.0); } -void Transformer::Rotate() +void Transformer::Rotate(bool clockwise) { - m_angle += m_rotationAngle; + double rotAngle = m_rotationAngle; + if(!clockwise) rotAngle = -m_rotationAngle; + + m_angle += rotAngle; if(m_angle >= 360.0) m_angle = 0.0; // Rotate all the points, except the switches and buses points. for(int i = 2; i < (int)m_pointList.size() - 2; i++) { - m_pointList[i] = RotateAtPosition(m_pointList[i], m_rotationAngle); + m_pointList[i] = RotateAtPosition(m_pointList[i], rotAngle); } } @@ -219,7 +222,8 @@ void Transformer::StartMove(wxPoint2DDouble position) bool Transformer::GetContextMenu(wxMenu& menu) { menu.Append(ID_EDIT_TRANSFORMER, _("Edit tranformer")); - menu.Append(ID_ROTATE, _("Rotate")); + menu.Append(ID_ROTATE_CLOCK, _("Rotate clockwise")); + menu.Append(ID_ROTATE_COUNTERCLOCK, _("Rotate counter-clockwise")); menu.Append(ID_DELETE, _("Delete")); return true; } |