Browse Source

Move projection editor mouseDragged part to ProjectionMappingState

master
Krisjanis Rijnieks 9 years ago
parent
commit
0a15a972f9
  1. 10
      src/Application/States/ProjectionMappingState.cpp
  2. 2
      src/Application/States/ProjectionMappingState.h
  3. 4
      src/Surfaces/SurfaceManagerGui.cpp
  4. 7
      src/Surfaces/SurfaceManagerGui.h

10
src/Application/States/ProjectionMappingState.cpp

@ -297,7 +297,15 @@ void ProjectionMappingState::onMouseReleased(Application * app, ofMouseEventArgs
void ProjectionMappingState::onMouseDragged(Application * app, ofMouseEventArgs & args){ void ProjectionMappingState::onMouseDragged(Application * app, ofMouseEventArgs & args){
Gui::instance()->onMouseDragged(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){ void ProjectionMappingState::onJointPressed(Application * app, GuiJointEvent & e){

2
src/Application/States/ProjectionMappingState.h

@ -58,7 +58,7 @@ class ProjectionMappingState : public ApplicationBaseState {
static ProjectionMappingState * _instance; static ProjectionMappingState * _instance;
float _surfaceScaleBeforeTransform; float _surfaceScaleBeforeTransform;
}; };
} // namespace piMapper } // namespace piMapper

4
src/Surfaces/SurfaceManagerGui.cpp

@ -97,7 +97,7 @@ void SurfaceManagerGui::mouseDragged(ofMouseEventArgs & args){
if(guiMode == GuiMode::TEXTURE_MAPPING){ if(guiMode == GuiMode::TEXTURE_MAPPING){
textureEditor.mouseDragged(args); textureEditor.mouseDragged(args);
}else if(guiMode == GuiMode::PROJECTION_MAPPING){ }else if(guiMode == GuiMode::PROJECTION_MAPPING){
projectionEditor.mouseDragged(args); //projectionEditor.mouseDragged(args);
} }
if(bDrag){ if(bDrag){
@ -107,7 +107,7 @@ void SurfaceManagerGui::mouseDragged(ofMouseEventArgs & args){
if(guiMode == GuiMode::PROJECTION_MAPPING){ if(guiMode == GuiMode::PROJECTION_MAPPING){
// Moves the selected surface on drag // Moves the selected surface on drag
projectionEditor.moveSelectedSurface(distance); //projectionEditor.moveSelectedSurface(distance);
}else if(guiMode == GuiMode::TEXTURE_MAPPING){ }else if(guiMode == GuiMode::TEXTURE_MAPPING){
// Moves the crop area of the texture // Moves the crop area of the texture

7
src/Surfaces/SurfaceManagerGui.h

@ -48,6 +48,9 @@ class SurfaceManagerGui {
void onSurfaceSelected(int & surfaceIndex); void onSurfaceSelected(int & surfaceIndex);
void onVertexSelected(int & vertexIndex); void onVertexSelected(int & vertexIndex);
void onVertexUnselected(int & vertexIndex); void onVertexUnselected(int & vertexIndex);
ofVec2f clickPosition;
bool bDrag;
private: private:
SurfaceManager * surfaceManager; SurfaceManager * surfaceManager;
@ -55,9 +58,9 @@ class SurfaceManagerGui {
TextureEditor textureEditor; TextureEditor textureEditor;
ProjectionEditor projectionEditor; ProjectionEditor projectionEditor;
SourcesEditor sourcesEditor; SourcesEditor sourcesEditor;
int guiMode; int guiMode;
bool bDrag;
ofVec2f clickPosition;
CmdManager * _cmdManager; CmdManager * _cmdManager;
}; };

Loading…
Cancel
Save