Browse Source

Use exact image coordinates in the desktop crop editor

master
evgeny 5 days ago
parent
commit
87b8c6bd3a
  1. 3
      tools/chatgui/src/avatars/avatarcrop.cpp

3
tools/chatgui/src/avatars/avatarcrop.cpp

@ -7,6 +7,7 @@
#include <QLabel>
#include <QMouseEvent>
#include <QPainter>
#include <QPainterPath>
#include <QPointer>
#include <QPushButton>
#include <QRunnable>
@ -31,7 +32,7 @@ public:
}
QRectF selection() const {
const double s = scale();
const QPointF top = rect().center() + offset - QPointF(image.width()*s/2, image.height()*s/2);
const QPointF top = QPointF(width()/2.0,height()/2.0) + offset - QPointF(image.width()*s/2, image.height()*s/2);
const QRectF f = frame();
return {(f.x()-top.x())/s/image.width(), (f.y()-top.y())/s/image.height(), f.width()/s/image.width(), f.height()/s/image.height()};
}

Loading…
Cancel
Save