From 7511e8300a92cba1eafce016aa691f261d42ac16 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Sun, 7 Feb 2016 13:35:45 +0100 Subject: [PATCH] Use `SelVertexCmd` and fix `onVertexChanged` in `SurfaceManagerGui` --- src/Surfaces/SurfaceManagerGui.cpp | 9 +++++++++ src/Surfaces/SurfaceManagerGui.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/Surfaces/SurfaceManagerGui.cpp b/src/Surfaces/SurfaceManagerGui.cpp index 751fe71..917cfd6 100644 --- a/src/Surfaces/SurfaceManagerGui.cpp +++ b/src/Surfaces/SurfaceManagerGui.cpp @@ -149,6 +149,9 @@ void SurfaceManagerGui::mousePressed(ofMouseEventArgs & args){ break; } } + + _cmdManager->exec(new SelVertexCmd(surfaceManager, jointVertIndex)); + _cmdManager->exec(new MvSurfaceVertCmd( jointVertIndex, surfaceManager->getSelectedSurface(), @@ -342,8 +345,14 @@ ProjectionEditor * SurfaceManagerGui::getProjectionEditor(){ void SurfaceManagerGui::onVertexChanged(int & i){ //cout << "VERTEX CHANGED: " << vertex.x << ", " << vertex.y << endl; + bool isDragged = projectionEditor.getJoints()->at(i)->isDragged(); projectionEditor.createJoints(); projectionEditor.getJoints()->at(i)->select(); + if(isDragged){ + projectionEditor.getJoints()->at(i)->startDrag(); + }else{ + projectionEditor.getJoints()->at(i)->stopDrag(); + } } void SurfaceManagerGui::onVerticesChanged(vector & vertices){ diff --git a/src/Surfaces/SurfaceManagerGui.h b/src/Surfaces/SurfaceManagerGui.h index 210d977..0f240ee 100644 --- a/src/Surfaces/SurfaceManagerGui.h +++ b/src/Surfaces/SurfaceManagerGui.h @@ -16,6 +16,7 @@ #include "MvSurfaceVertCmd.h" #include "MvAllTexCoordsCmd.h" #include "MvTexCoordCmd.h" +#include "SelVertexCmd.h" namespace ofx { namespace piMapper {