From d78cd8f02ee0b5b8066e1d174b0e8cf83b96e785 Mon Sep 17 00:00:00 2001 From: Krisjanis Rijnieks Date: Fri, 28 Oct 2016 21:45:27 +0300 Subject: [PATCH] Add TextureMappingMode::moveSelection Discovery: the method used this far did not have an undoable command. Added a TODO as well. --- src/Application/Modes/TextureMappingMode.cpp | 13 +++++++++---- src/Application/Modes/TextureMappingMode.h | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Application/Modes/TextureMappingMode.cpp b/src/Application/Modes/TextureMappingMode.cpp index 76cb98b..6eecac9 100644 --- a/src/Application/Modes/TextureMappingMode.cpp +++ b/src/Application/Modes/TextureMappingMode.cpp @@ -85,19 +85,19 @@ void TextureMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & args){ switch(args.key){ case OF_KEY_LEFT: - Gui::instance()->getTextureEditorWidget().moveSelection(ofVec2f(-moveStep, 0.0f)); + moveSelection(app, ofVec2f(-moveStep, 0.0f)); break; case OF_KEY_RIGHT: - Gui::instance()->getTextureEditorWidget().moveSelection(ofVec2f(moveStep, 0.0f)); + moveSelection(app, ofVec2f(moveStep, 0.0f)); break; case OF_KEY_UP: - Gui::instance()->getTextureEditorWidget().moveSelection(ofVec2f(0.0f, -moveStep)); + moveSelection(app, ofVec2f(0.0f, -moveStep)); break; case OF_KEY_DOWN: - Gui::instance()->getTextureEditorWidget().moveSelection(ofVec2f(0.0f, moveStep)); + moveSelection(app, ofVec2f(0.0f, moveStep)); break; case '>': @@ -267,6 +267,11 @@ void TextureMappingMode::drawTexture(Application * app){ } } +void TextureMappingMode::moveSelection(Application * app, ofVec2f by){ + // TODO: Create an undoable command out of this + Gui::instance()->getTextureEditorWidget().moveSelection(by); +} + ofPoint TextureMappingMode::getTranslation(){ return _canvasTranslate; } diff --git a/src/Application/Modes/TextureMappingMode.h b/src/Application/Modes/TextureMappingMode.h index 244e1f8..997c7bb 100644 --- a/src/Application/Modes/TextureMappingMode.h +++ b/src/Application/Modes/TextureMappingMode.h @@ -33,6 +33,7 @@ class TextureMappingMode : public ApplicationBaseMode { void onMouseReleased(Application * app, ofMouseEventArgs & args); void onMouseDragged(Application * app, ofMouseEventArgs & args); void drawTexture(Application * app); + void moveSelection(Application * app, ofVec2f by); void onGuiEvent(Application * app, GuiEvent & e){}