forked from CCOMJHC/camp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscaledview.h
35 lines (28 loc) · 833 Bytes
/
scaledview.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef SCALEDVIEW_H
#define SCALEDVIEW_H
#include <QSize>
#include <QPointF>
class ScaledView
{
public:
ScaledView();
void setScale(double scale);
double scale() const;
void setOffset(QPointF const &offset);
QPointF const &offset() const;
void setSizeInPixels(QSize const &psize);
QSize const & sizeInPixels() const;
/// Origin of transformed coordinate system in screen space
QPointF scaledOffset() const;
QPointF transform(QPointF const &screenPoint) const;
void zoomIn(QPoint const &mousePosition);
void zoomOut(QPoint const &mousePosition);
void zoom(QPoint const &mousePosition, double zoomFactor);
void pan(QPointF const &deltaMouse);
private:
double m_scale;
QPointF m_offset;
QSize m_sizeInPixels;
double m_zoomFactor;
};
#endif // SCALEDVIEW_H