a whole lotta work!!

- refactoring
- completely changed the tooling (adding elements)
- better re-use for more stable editing
- new elements
- ui adjustments
- LINT for stair-editing
- many more changes
This commit is contained in:
2016-08-29 19:05:46 +02:00
parent 86c76b1284
commit fa06320219
51 changed files with 880 additions and 318 deletions

View File

@@ -0,0 +1,59 @@
#ifndef TOOLMOVEMAP_H
#define TOOLMOVEMAP_H
#include "Tool.h"
#include "../MapView2D.h"
/**
* this tool allows moving the 2D map
*/
class ToolMoveMap : public Tool {
private:
bool mouseIsDown = false;
Point3 startOffset;
int sx;
int sy;
const std::string getName() const override {
return "MapMove";
}
public:
virtual bool mousePressEvent(MapView2D* m, QMouseEvent* e) override {
if (e->button() == Qt::MouseButton::MidButton) {
mouseIsDown = true;
this->sx = e->x();
this->sy = e->y();
this->startOffset = m->getScaler().getOffset();
return true;
}
return false;
}
virtual bool mouseMoveEvent(MapView2D* m, QMouseEvent* e) override {
if (!mouseIsDown) {return false;}
m->getScaler().setOffset(startOffset);
m->getScaler().addOffset(e->x()-sx, e->y()-sy);
return true;
}
virtual bool mouseReleaseEvent(MapView2D* m, QMouseEvent* e) override {
(void) m;
(void) e;
mouseIsDown = false;
return false;
}
// virtual void keyPressEvent(MapView2D* m, QKeyEvent* e) override {
// (void) m;
// (void) e;
// // TODO: move on arrow keys?
// }
};
#endif // TOOLMOVEMAP_H