diff options
author | Thales1330 <thaleslima.ufu@gmail.com> | 2016-08-25 18:09:39 -0300 |
---|---|---|
committer | Thales1330 <thaleslima.ufu@gmail.com> | 2016-08-25 18:09:39 -0300 |
commit | 8e00906e0517b335a6c33f682334bda3c1eadb69 (patch) | |
tree | 73a05e149d2fe0bc55cfd81cef9048d51a61f251 /Project/Workspace.cpp | |
parent | c36a96b8a152b98e406c352462435070b46f2dcd (diff) | |
download | PSP.git-8e00906e0517b335a6c33f682334bda3c1eadb69.tar.gz PSP.git-8e00906e0517b335a6c33f682334bda3c1eadb69.tar.xz PSP.git-8e00906e0517b335a6c33f682334bda3c1eadb69.zip |
Line finally done
Diffstat (limited to 'Project/Workspace.cpp')
-rw-r--r-- | Project/Workspace.cpp | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/Project/Workspace.cpp b/Project/Workspace.cpp index 68e8464..22d3858 100644 --- a/Project/Workspace.cpp +++ b/Project/Workspace.cpp @@ -247,6 +247,27 @@ void Workspace::OnLeftClickUp(wxMouseEvent& event) for(auto it = m_elementList.begin(); it != m_elementList.end(); ++it) { Element* element = *it; + // The user was moving a pickbox. + if(m_mode == MODE_MOVE_PICKBOX) { + // Catch only the element that have the pickbox shown. + if(element->IsPickboxShown()) { + // If the element is a bus, check if a node is outside. + if(typeid(*element) == typeid(Bus)) { + // Get all the bus children. + for(int i = 0; i < (int)m_elementList.size(); i++) { + Element* child = m_elementList[i]; + for(int j = 0; j < (int)child->GetParentList().size(); j++) { + Element* parent = child->GetParentList()[j]; + // The child have a parent that is the element. + if(parent == element) { + child->UpdateNodes(); + } + } + } + } + } + } + if(m_mode == MODE_SELECTION_RECT) { if(element->Intersects(m_selectionRect)) { element->SetSelected(); @@ -393,9 +414,10 @@ void Workspace::OnMouseMotion(wxMouseEvent& event) // Parent's element moving... for(int i = 0; i < (int)element->GetParentList().size(); i++) { Element* parent = element->GetParentList()[i]; - if(parent) { - if(parent->IsSelected()) { - element->MoveNode(parent, m_camera->ScreenToWorld(event.GetPosition())); + if(parent) { + if(parent->IsSelected()) { + element->MoveNode(parent, + m_camera->ScreenToWorld(event.GetPosition())); } } } @@ -492,9 +514,9 @@ void Workspace::OnKeyDown(wxKeyEvent& event) // Parent's element rotating... for(int i = 0; i < (int)element->GetParentList().size(); i++) { Element* parent = element->GetParentList()[i]; - if(parent) { // Check if parent is not null - if(parent->IsSelected()) { - element->RotateNode(parent); + if(parent) { // Check if parent is not null + if(parent->IsSelected()) { + element->RotateNode(parent); } } } |