Browse Source

Fix not being able to drag vertices in projection mapping mode

master
Krisjanis Rijnieks 9 years ago
parent
commit
fa71960821
  1. 3
      src/Application/States/ProjectionMappingState.cpp
  2. 11
      src/Surfaces/SurfaceManagerGui.cpp
  3. 6
      src/UserInterface/ProjectionEditor.cpp

3
src/Application/States/ProjectionMappingState.cpp

@ -283,14 +283,17 @@ void ProjectionMappingState::onKeyPressed(Application * app, ofKeyEventArgs & ar
void ProjectionMappingState::onMousePressed(Application * app, ofMouseEventArgs & args){ void ProjectionMappingState::onMousePressed(Application * app, ofMouseEventArgs & args){
Gui::instance()->onMousePressed(args); Gui::instance()->onMousePressed(args);
app->getGui()->mousePressed(args);
} }
void ProjectionMappingState::onMouseReleased(Application * app, ofMouseEventArgs & args){ void ProjectionMappingState::onMouseReleased(Application * app, ofMouseEventArgs & args){
Gui::instance()->onMouseReleased(args); Gui::instance()->onMouseReleased(args);
app->getGui()->mouseReleased(args);
} }
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);
} }
void ProjectionMappingState::onJointPressed(Application * app, GuiJointEvent & e){ void ProjectionMappingState::onJointPressed(Application * app, GuiJointEvent & e){

11
src/Surfaces/SurfaceManagerGui.cpp

@ -163,16 +163,23 @@ void SurfaceManagerGui::mouseReleased(ofMouseEventArgs & args){
} }
void SurfaceManagerGui::mouseDragged(ofMouseEventArgs & args){ void SurfaceManagerGui::mouseDragged(ofMouseEventArgs & args){
textureEditor.mouseDragged(args); if(guiMode == GuiMode::TEXTURE_MAPPING){
textureEditor.mouseDragged(args);
}else if(guiMode == GuiMode::PROJECTION_MAPPING){
projectionEditor.mouseDragged(args);
}
if(bDrag){ if(bDrag){
ofVec2f mousePosition = ofVec2f(args.x, args.y); ofVec2f mousePosition = ofVec2f(args.x, args.y);
ofVec2f distance = mousePosition - clickPosition; ofVec2f distance = mousePosition - clickPosition;
if(guiMode == GuiMode::PROJECTION_MAPPING){ if(guiMode == GuiMode::PROJECTION_MAPPING){
// add this distance to all vertices in surface
// 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
textureEditor.moveTexCoords(distance); textureEditor.moveTexCoords(distance);
} }
clickPosition = mousePosition; clickPosition = mousePosition;

6
src/UserInterface/ProjectionEditor.cpp

@ -78,6 +78,12 @@ void ProjectionEditor::draw(){
} }
void ProjectionEditor::mouseDragged(ofMouseEventArgs & args){ void ProjectionEditor::mouseDragged(ofMouseEventArgs & args){
// Pass args to joint mouse events
for(unsigned int i = 0; i < joints.size(); ++i){
joints[i]->mouseDragged(args);
}
ofVec2f mousePosition = ofVec2f(args.x, args.y); ofVec2f mousePosition = ofVec2f(args.x, args.y);
// Collect all vertices of the projection surfaces // Collect all vertices of the projection surfaces

Loading…
Cancel
Save