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. 4
      src/Surfaces/SurfaceManagerGui.cpp
  3. 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){
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){

4
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

7
src/Surfaces/SurfaceManagerGui.h

@ -49,15 +49,18 @@ class SurfaceManagerGui {
void onVertexSelected(int & vertexIndex);
void onVertexUnselected(int & vertexIndex);
ofVec2f clickPosition;
bool bDrag;
private:
SurfaceManager * surfaceManager;
MediaServer * mediaServer;
TextureEditor textureEditor;
ProjectionEditor projectionEditor;
SourcesEditor sourcesEditor;
int guiMode;
bool bDrag;
ofVec2f clickPosition;
CmdManager * _cmdManager;
};

Loading…
Cancel
Save