2 changed files with 53 additions and 0 deletions
@ -0,0 +1,24 @@ |
|||||
|
#include "TranslateCanvasCmd.h" |
||||
|
|
||||
|
namespace ofx { |
||||
|
namespace piMapper { |
||||
|
|
||||
|
TranslateCanvasCmd::TranslateCanvasCmd(Application * app, ofPoint from, ofPoint to){ |
||||
|
_app = app; |
||||
|
_from = from; |
||||
|
_to = to; |
||||
|
} |
||||
|
|
||||
|
void TranslateCanvasCmd::exec(){ |
||||
|
ofLogNotice("TranslateCanvasCmd", "exec"); |
||||
|
_app->getState()->setTranslation(_to); |
||||
|
} |
||||
|
|
||||
|
void TranslateCanvasCmd::undo(){ |
||||
|
ofLogNotice("TranslateCanvasCmd", "undo"); |
||||
|
_app->getState()->setTranslation(_from); |
||||
|
} |
||||
|
|
||||
|
} // namespace piMapper
|
||||
|
} // namespace ofx
|
||||
|
|
@ -0,0 +1,29 @@ |
|||||
|
// TranslateCanvasCmd
|
||||
|
// Stores and restores the canvas of a mode/state.
|
||||
|
// Created by Krisjanis Rijnieks 2016-09-13
|
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
#include "BaseCmd.h" |
||||
|
#include "BaseSurface.h" |
||||
|
#include "Application.h" |
||||
|
|
||||
|
namespace ofx { |
||||
|
namespace piMapper { |
||||
|
|
||||
|
class TranslateCanvasCmd : public BaseUndoCmd { |
||||
|
|
||||
|
public: |
||||
|
TranslateCanvasCmd(Application * app, ofPoint from, ofPoint to); |
||||
|
void exec(); |
||||
|
void undo(); |
||||
|
|
||||
|
private: |
||||
|
Application * _app; |
||||
|
ofPoint _from; |
||||
|
ofPoint _to; |
||||
|
}; |
||||
|
|
||||
|
} // namespace piMapper
|
||||
|
} // namespace ofx
|
||||
|
|
Loading…
Reference in new issue