Browse Source

Add `ScaleSurfaceDnCmd`

master
Krisjanis Rijnieks 9 years ago
parent
commit
aa4309637d
  1. 23
      src/Commands/ScaleSurfaceDnCmd.cpp
  2. 25
      src/Commands/ScaleSurfaceDnCmd.h

23
src/Commands/ScaleSurfaceDnCmd.cpp

@ -0,0 +1,23 @@
#include "ScaleSurfaceDnCmd.h"
namespace ofx {
namespace piMapper {
ScaleSurfaceDnCmd::ScaleSurfaceDnCmd(BaseSurface * selectedSurface, float by){
_selectedSurface = selectedSurface;
_by = by;
}
void ScaleSurfaceDnCmd::exec(){
ofLogNotice("ScaleSurfaceDnCmd", "exec");
_selectedSurface->scaleTo(1.0f - _by);
}
void ScaleSurfaceDnCmd::undo(){
ofLogNotice("ScaleSurfaceCmd", "undo");
_selectedSurface->scaleTo(1.0f / (1.0f - _by));
}
} // namespace piMapper
} // namespace ofx

25
src/Commands/ScaleSurfaceDnCmd.h

@ -0,0 +1,25 @@
#pragma once
#include "BaseCmd.h"
#include "BaseSurface.h"
namespace ofx {
namespace piMapper {
class ScaleSurfaceDnCmd : public BaseUndoCmd {
public:
ScaleSurfaceDnCmd(BaseSurface * selectedSurface, float by);
void exec();
void undo();
private:
BaseSurface * _selectedSurface;
float _by;
};
} // namespace piMapper
} // namespace ofx
Loading…
Cancel
Save