-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWorkspace.h
More file actions
38 lines (30 loc) · 1.38 KB
/
Copy pathWorkspace.h
File metadata and controls
38 lines (30 loc) · 1.38 KB
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
36
37
38
#ifndef WORKSPACE_H
#define WORKSPACE_H
#include "Shape.h"
#include <QRectF>
#include <QPointF>
/// White drawing page and scrollable scene helpers.
namespace Workspace {
/// Default visible white page (pageRect).
QRectF defaultPageRect();
/// Initial scene scroll area: pageRect padded by 200px on each side.
QRectF defaultSceneRect();
/// pageRect from default page united with shape bounds (shrinks when shapes move back).
QRectF pageRectForShapeBounds(const QRectF &shapesBounds, double margin = 200.0);
QRectF sceneRectForPageAndBounds(const QRectF &pageRect, const QRectF &shapesBounds,
double pageScenePad = 200.0, double shapePad = 300.0);
/// Clamp invalid/empty rects to sane defaults.
QRectF sanitizeRect(const QRectF &rect, const QRectF &fallback = QRectF());
QRectF rect();
QRectF baseRect();
bool containsPoint(const QPointF &p);
bool containsSceneBounds(const QRectF &bounds);
QRectF sceneBoundsForTransform(const Shape &shape, const Transform &t);
QPointF clampTopLeft(const Shape &shape, const QPointF &topLeft,
const QRectF &workspace = rect());
Transform clampTransform(const Shape &shape, const Transform &proposed,
const QRectF &workspace = rect());
bool transformFits(const Shape &shape, const Transform &t,
const QRectF &workspace = rect());
} // namespace Workspace
#endif // WORKSPACE_H