Browse Source

Add TextureMappingMode::moveSelection

Discovery: the method used this far did not have an undoable command. Added a TODO as well.
master
Krisjanis Rijnieks 9 years ago
parent
commit
d78cd8f02e
  1. 13
      src/Application/Modes/TextureMappingMode.cpp
  2. 1
      src/Application/Modes/TextureMappingMode.h

13
src/Application/Modes/TextureMappingMode.cpp

@ -85,19 +85,19 @@ void TextureMappingMode::onKeyPressed(Application * app, ofKeyEventArgs & args){
switch(args.key){ switch(args.key){
case OF_KEY_LEFT: case OF_KEY_LEFT:
Gui::instance()->getTextureEditorWidget().moveSelection(ofVec2f(-moveStep, 0.0f)); moveSelection(app, ofVec2f(-moveStep, 0.0f));
break; break;
case OF_KEY_RIGHT: case OF_KEY_RIGHT:
Gui::instance()->getTextureEditorWidget().moveSelection(ofVec2f(moveStep, 0.0f)); moveSelection(app, ofVec2f(moveStep, 0.0f));
break; break;
case OF_KEY_UP: case OF_KEY_UP:
Gui::instance()->getTextureEditorWidget().moveSelection(ofVec2f(0.0f, -moveStep)); moveSelection(app, ofVec2f(0.0f, -moveStep));
break; break;
case OF_KEY_DOWN: case OF_KEY_DOWN:
Gui::instance()->getTextureEditorWidget().moveSelection(ofVec2f(0.0f, moveStep)); moveSelection(app, ofVec2f(0.0f, moveStep));
break; break;
case '>': 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(){ ofPoint TextureMappingMode::getTranslation(){
return _canvasTranslate; return _canvasTranslate;
} }

1
src/Application/Modes/TextureMappingMode.h

@ -33,6 +33,7 @@ class TextureMappingMode : public ApplicationBaseMode {
void onMouseReleased(Application * app, ofMouseEventArgs & args); void onMouseReleased(Application * app, ofMouseEventArgs & args);
void onMouseDragged(Application * app, ofMouseEventArgs & args); void onMouseDragged(Application * app, ofMouseEventArgs & args);
void drawTexture(Application * app); void drawTexture(Application * app);
void moveSelection(Application * app, ofVec2f by);
void onGuiEvent(Application * app, GuiEvent & e){} void onGuiEvent(Application * app, GuiEvent & e){}

Loading…
Cancel
Save