Browse Source

Refactor `SurfaceManagerGui` texture editor onMousePressed routine

master
Krisjanis Rijnieks 9 years ago
parent
commit
60488bc219
  1. 33
      src/Surfaces/SurfaceManagerGui.cpp

33
src/Surfaces/SurfaceManagerGui.cpp

@ -91,17 +91,20 @@ void SurfaceManagerGui::mousePressed(ofMouseEventArgs & args){
if(guiMode == GuiMode::NONE){
return;
}else if(guiMode == GuiMode::TEXTURE_MAPPING){
bool bSurfaceSelected = false;
CircleJoint * hitJoint =
textureEditor.hitTestJoints(ofVec2f(args.x, args.y));
if(surfaceManager->getSelectedSurface() == 0){
return;
}
CircleJoint * hitJoint = textureEditor.hitTestJoints(ofVec2f(args.x, args.y));
if(hitJoint != 0){
textureEditor.unselectAllJoints();
textureEditor.unselectAllJoints();
hitJoint->select();
hitJoint->startDrag();
bSurfaceSelected = true;
int jointIndex;
int jointIndex = -1;
for(int i = 0; i < textureEditor.getJoints().size(); i++){
if(textureEditor.getJoints()[i] == hitJoint){
jointIndex = i;
@ -109,22 +112,10 @@ void SurfaceManagerGui::mousePressed(ofMouseEventArgs & args){
}
}
if(jointIndex != -1){
// TODO: emit event through the GUI singleton
_cmdManager->exec(new MvTexCoordCmd(jointIndex, &textureEditor));
}
}else{
textureEditor.unselectAllJoints();
}
if(surfaceManager->getSelectedSurface() != 0 && !bSurfaceSelected){
// hittest texture area to see if we are hitting the texture surface
if(surfaceManager->getSelectedSurface()->getTextureHitArea().inside(
args.x, args.y)){
}else if(surfaceManager->getSelectedSurface()->getTextureHitArea().inside(args.x, args.y)){
// TODO: move these to a separate routine
clickPosition = ofVec2f(args.x, args.y);
startDrag();
@ -133,7 +124,9 @@ void SurfaceManagerGui::mousePressed(ofMouseEventArgs & args){
surfaceManager->getSelectedSurface(),
&textureEditor));
}
}else{
// TODO: Create command for this
textureEditor.unselectAllJoints();
}
}else if(guiMode == GuiMode::PROJECTION_MAPPING){

Loading…
Cancel
Save