summaryrefslogtreecommitdiffstats
path: root/Project/ControlEditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Project/ControlEditor.cpp')
-rw-r--r--Project/ControlEditor.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Project/ControlEditor.cpp b/Project/ControlEditor.cpp
index 3638a42..3b6f8a5 100644
--- a/Project/ControlEditor.cpp
+++ b/Project/ControlEditor.cpp
@@ -103,7 +103,7 @@ ControlEditor::ControlEditor(wxWindow* parent)
m_glContext = new wxGLContext(m_glCanvas);
m_camera = new Camera();
m_selectionRect = wxRect2DDouble(0, 0, 0, 0);
- //m_camera->SetScale(1.2);
+ // m_camera->SetScale(1.2);
}
ControlEditor::~ControlEditor()
{
@@ -282,6 +282,7 @@ void ControlEditor::OnDoubleClick(wxMouseEvent& event)
Element* element = *it;
if(element->Contains(m_camera->ScreenToWorld(clickPoint))) {
element->ShowForm(this, element);
+ CheckConnections();
auto childList = element->GetChildList();
for(auto itC = childList.begin(), itEndC = childList.end(); itC != itEndC; ++itC) {
ConnectionLine* line = static_cast<ConnectionLine*>(*itC);
@@ -668,3 +669,15 @@ std::vector<ConnectionLine*>::iterator ControlEditor::DeleteLineFromList(std::ve
if(cLine) delete cLine;
return it;
}
+
+void ControlEditor::CheckConnections()
+{
+ for(auto it = m_connectionList.begin(); it != m_connectionList.end(); ++it) {
+ ConnectionLine* cLine = *it;
+ if(cLine->GetType() == ConnectionLine::ELEMENT_ELEMENT) {
+ if(cLine->GetParentList().size() < 2){
+ it = DeleteLineFromList(it);
+ }
+ }
+ }
+}