diff --git a/src/Application/States/ProjectionMappingState.cpp b/src/Application/States/ProjectionMappingState.cpp index 38a622f..7904df7 100644 --- a/src/Application/States/ProjectionMappingState.cpp +++ b/src/Application/States/ProjectionMappingState.cpp @@ -297,7 +297,15 @@ void ProjectionMappingState::onMouseReleased(Application * app, ofMouseEventArgs void ProjectionMappingState::onMouseDragged(Application * app, ofMouseEventArgs & args){ Gui::instance()->onMouseDragged(args); - app->getGui()->mouseDragged(args); + app->getGui()->getProjectionEditor()->mouseDragged(args); + + // TODO: Handle app->getGui()->clickPosition and app->getGui()->bDrag locally. + if(app->getGui()->bDrag){ + ofVec2f mousePosition = ofVec2f(args.x, args.y); + ofVec2f distance = mousePosition - app->getGui()->clickPosition; + app->getGui()->getProjectionEditor()->moveSelectedSurface(distance); + app->getGui()->clickPosition = mousePosition; + } } void ProjectionMappingState::onJointPressed(Application * app, GuiJointEvent & e){ diff --git a/src/Application/States/ProjectionMappingState.h b/src/Application/States/ProjectionMappingState.h index 9022e22..3df93a2 100644 --- a/src/Application/States/ProjectionMappingState.h +++ b/src/Application/States/ProjectionMappingState.h @@ -58,7 +58,7 @@ class ProjectionMappingState : public ApplicationBaseState { static ProjectionMappingState * _instance; float _surfaceScaleBeforeTransform; - + }; } // namespace piMapper diff --git a/src/Surfaces/SurfaceManagerGui.cpp b/src/Surfaces/SurfaceManagerGui.cpp index 4edece2..71bbce4 100644 --- a/src/Surfaces/SurfaceManagerGui.cpp +++ b/src/Surfaces/SurfaceManagerGui.cpp @@ -97,7 +97,7 @@ void SurfaceManagerGui::mouseDragged(ofMouseEventArgs & args){ if(guiMode == GuiMode::TEXTURE_MAPPING){ textureEditor.mouseDragged(args); }else if(guiMode == GuiMode::PROJECTION_MAPPING){ - projectionEditor.mouseDragged(args); + //projectionEditor.mouseDragged(args); } if(bDrag){ @@ -107,7 +107,7 @@ void SurfaceManagerGui::mouseDragged(ofMouseEventArgs & args){ if(guiMode == GuiMode::PROJECTION_MAPPING){ // Moves the selected surface on drag - projectionEditor.moveSelectedSurface(distance); + //projectionEditor.moveSelectedSurface(distance); }else if(guiMode == GuiMode::TEXTURE_MAPPING){ // Moves the crop area of the texture diff --git a/src/Surfaces/SurfaceManagerGui.h b/src/Surfaces/SurfaceManagerGui.h index c1284c1..7fdd191 100644 --- a/src/Surfaces/SurfaceManagerGui.h +++ b/src/Surfaces/SurfaceManagerGui.h @@ -48,6 +48,9 @@ class SurfaceManagerGui { void onSurfaceSelected(int & surfaceIndex); void onVertexSelected(int & vertexIndex); void onVertexUnselected(int & vertexIndex); + + ofVec2f clickPosition; + bool bDrag; private: SurfaceManager * surfaceManager; @@ -55,9 +58,9 @@ class SurfaceManagerGui { TextureEditor textureEditor; ProjectionEditor projectionEditor; SourcesEditor sourcesEditor; + int guiMode; - bool bDrag; - ofVec2f clickPosition; + CmdManager * _cmdManager; };