Browse Source

Implement ProjectionMappingMode::moveSelection

Use the method when arrow keys are pressed instead of creating commands directly
master
Krisjanis Rijnieks 9 years ago
parent
commit
94cbfcab79
  1. 22
      src/Application/Modes/ProjectionMappingMode.cpp
  2. 1
      src/Application/Modes/ProjectionMappingMode.h

22
src/Application/Modes/ProjectionMappingMode.cpp

@ -175,33 +175,33 @@ void ProjectionMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & arg
case OF_KEY_UP:
if(app->isShiftKeyDown()){
app->getCmdManager()->exec(new MvSelectionCmd(app->getSurfaceManager(), ofVec2f(0.0f, -10.0f)));
moveSelection(app, ofVec2f(0.0f, -10.0f));
}else{
app->getCmdManager()->exec(new MvSelectionCmd(app->getSurfaceManager(), ofVec2f(0.0f, -1.0f)));
moveSelection(app, ofVec2f(0.0f, -1.0f));
}
break;
case OF_KEY_DOWN:
if(app->isShiftKeyDown()){
app->getCmdManager()->exec(new MvSelectionCmd(app->getSurfaceManager(), ofVec2f(0.0f, 10.0f)));
moveSelection(app, ofVec2f(0.0f, 10.0f));
}else{
app->getCmdManager()->exec(new MvSelectionCmd(app->getSurfaceManager(), ofVec2f(0.0f, 1.0f)));
moveSelection(app, ofVec2f(0.0f, 1.0f));
}
break;
case OF_KEY_LEFT:
if(app->isShiftKeyDown()){
app->getCmdManager()->exec(new MvSelectionCmd(app->getSurfaceManager(), ofVec2f(-10.0f, 0.0f)));
moveSelection(app, ofVec2f(-10.0f, 0.0f));
}else{
app->getCmdManager()->exec(new MvSelectionCmd(app->getSurfaceManager(), ofVec2f(-1.0f, 0.0f)));
moveSelection(app, ofVec2f(-1.0f, 0.0f));
}
break;
case OF_KEY_RIGHT:
if(app->isShiftKeyDown()){
app->getCmdManager()->exec(new MvSelectionCmd(app->getSurfaceManager(), ofVec2f(10.0f, 0.0f)));
moveSelection(app, ofVec2f(10.0f, 0.0f));
}else{
app->getCmdManager()->exec(new MvSelectionCmd(app->getSurfaceManager(), ofVec2f(1.0f, 0.0f)));
moveSelection(app, ofVec2f(1.0f, 0.0f));
}
break;
@ -444,5 +444,11 @@ void ProjectionMappingMode::selectPrevSurface(Application * app){
}
}
void ProjectionMappingMode::moveSelection(Application * app, ofVec2f by){
app->getCmdManager()->exec(
new MvSelectionCmd(
app->getSurfaceManager(), by));
}
} // namespace piMapper
} // namespace ofx

1
src/Application/Modes/ProjectionMappingMode.h

@ -58,6 +58,7 @@ class ProjectionMappingMode : public ApplicationBaseMode {
void selectSurface(Application * app, int i);
void selectNextSurface(Application * app);
void selectPrevSurface(Application * app);
void moveSelection(Application * app, ofVec2f by);
private:
ProjectionMappingMode();

Loading…
Cancel
Save