33 bool hoverEvent(QHoverEvent *e, Qt::CursorShape *cursor)
override;
41 void paint(QPainter *painter)
override;
61 void updateTransform(
double new_x,
double new_y,
double new_r,
double new_w,
double new_h) {
62 if (abs(new_x -
x()) > 0.01 || abs(new_y -
y()) > 0.01) {
63 translate_to_apply_ = QPointF(new_x -
x(), new_y -
y());
66 if (abs(new_r -
rotation()) > 0.01) {
67 rotation_to_apply_ = new_r -
rotation();
68 applyRotate(
boundingRect().center(), rotation_to_apply_);
70 if (abs(new_w -
width()) > 0.01 || abs(new_h -
height()) > 0.01) {
71 scale_x_to_apply_ = new_w /
width();
72 scale_y_to_apply_ = new_h /
height();
97 void applyScale(QPointF center,
double scale_x,
double scale_y,
bool temporarily =
false);
100 void applyRotate(QPointF center,
double rotation,
bool temporarily =
false);
102 Control hitTest(QPointF clickPoint,
float tolerance);
104 QPointF controls_[8];
106 QPointF action_center_;
107 QRectF bounding_rect_;
109 QList<ShapePtr> selections_;
111 double scale_x_to_apply_;
112 double scale_y_to_apply_;
113 double rotation_to_apply_;
114 QPointF translate_to_apply_;
118 double rotated_from_;
119 QSizeF transformed_from_;
122 bool bbox_need_recalc_;
Definition: canvas-control.h:16
Canvas & canvas()
Definition: canvas-control.cpp:34
In-canvas controls with its own painting and event handling functions.
Definition: canvas-control.h:8