do not align to scene coordinates for transformations beyond
translations
This commit is contained in:
parent
966d8a6a2e
commit
be53343375
@ -31,8 +31,16 @@
|
|||||||
#include <qquickwindow.h>
|
#include <qquickwindow.h>
|
||||||
#include <qsgsimplerectnode.h>
|
#include <qsgsimplerectnode.h>
|
||||||
|
|
||||||
|
QSK_QT_PRIVATE_BEGIN
|
||||||
|
#include <private/qquickitem_p.h>
|
||||||
|
QSK_QT_PRIVATE_END
|
||||||
|
|
||||||
static inline QRectF qskSceneAlignedRect( const QQuickItem* item, const QRectF& rect )
|
static inline QRectF qskSceneAlignedRect( const QQuickItem* item, const QRectF& rect )
|
||||||
{
|
{
|
||||||
|
const auto transform = QQuickItemPrivate::get( item )->itemToWindowTransform();
|
||||||
|
if ( transform.type() > QTransform::TxTranslate )
|
||||||
|
return rect;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Aligning rect according to scene coordinates, so that
|
Aligning rect according to scene coordinates, so that
|
||||||
we don't run into rounding issues downstream, where values
|
we don't run into rounding issues downstream, where values
|
||||||
@ -42,7 +50,7 @@ static inline QRectF qskSceneAlignedRect( const QQuickItem* item, const QRectF&
|
|||||||
|
|
||||||
const auto ratio = item->window()->devicePixelRatio();
|
const auto ratio = item->window()->devicePixelRatio();
|
||||||
|
|
||||||
const auto pos = item->mapToScene( rect.topLeft() ) * ratio;
|
const auto pos = transform.map( rect.topLeft() ) * ratio;
|
||||||
const auto size = rect.size() * ratio;
|
const auto size = rect.size() * ratio;
|
||||||
|
|
||||||
const qreal x = qRound( pos.x() ) / ratio;
|
const qreal x = qRound( pos.x() ) / ratio;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user