initial commit
This commit is contained in:
28
mapview/tools/ToolMapZoom.h
Normal file
28
mapview/tools/ToolMapZoom.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef TOOLMAPZOOM_H
|
||||
#define TOOLMAPZOOM_H
|
||||
|
||||
#include "Tool.h"
|
||||
#include "../MapView2D.h"
|
||||
|
||||
class ToolMapZoom : public Tool {
|
||||
|
||||
public:
|
||||
|
||||
virtual void wheelEvent(MapView2D* m, QWheelEvent* e) override {
|
||||
|
||||
Scaler& s = m->getScaler();
|
||||
|
||||
if (e->delta() < 0) {
|
||||
s.setScale(s.getScale() * 0.5);
|
||||
} else {
|
||||
s.setScale(s.getScale() / 0.5);
|
||||
}
|
||||
|
||||
if (s.getScale() > 1000) {s.setScale(1000);}
|
||||
if (s.getScale() < 5) {s.setScale(5);}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // TOOLMAPZOOM_H
|
||||
Reference in New Issue
Block a user