diff --git a/src/Application/Modes/ProjectionMappingMode.cpp b/src/Application/Modes/ProjectionMappingMode.cpp index 30d00dc..09a9b35 100644 --- a/src/Application/Modes/ProjectionMappingMode.cpp +++ b/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 \ No newline at end of file diff --git a/src/Application/Modes/ProjectionMappingMode.h b/src/Application/Modes/ProjectionMappingMode.h index 732a4d4..e6cc2df 100644 --- a/src/Application/Modes/ProjectionMappingMode.h +++ b/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();