fix: blobs ignoring updates if moving too slow

This commit is contained in:
2 * r + 2 * t 2026-04-07 18:39:48 +10:00
parent d778734c67
commit 77ab4b8350
2 changed files with 9 additions and 4 deletions

View file

@ -69,13 +69,16 @@ void BlobShape::geometryChange(const QRectF& newGeometry, const QRectF& oldGeome
QQuickItem::geometryChange(newGeometry, oldGeometry);
updateCenteredDeformMatrix();
if (m_group) {
// Only trigger redraw if the change is visually meaningful
const auto dx = std::abs(newGeometry.x() - oldGeometry.x());
const auto dy = std::abs(newGeometry.y() - oldGeometry.y());
// Accumulate sub-pixel drift so slow movements don't desync the shader
m_pendingDx += static_cast<float>(newGeometry.x() - oldGeometry.x());
m_pendingDy += static_cast<float>(newGeometry.y() - oldGeometry.y());
const auto dw = std::abs(newGeometry.width() - oldGeometry.width());
const auto dh = std::abs(newGeometry.height() - oldGeometry.height());
if (dx > 0.5 || dy > 0.5 || dw > 0.5 || dh > 0.5)
if (std::abs(m_pendingDx) > 0.5f || std::abs(m_pendingDy) > 0.5f || dw > 0.5 || dh > 0.5) {
m_pendingDx = 0;
m_pendingDy = 0;
m_group->markShapeDirty(this);
}
}
}

View file

@ -70,6 +70,8 @@ protected:
QRectF m_localPaddedRect;
QVector<BlobRectData> m_cachedRects;
int m_cachedMyIndex = -2;
float m_pendingDx = 0;
float m_pendingDy = 0;
bool m_cachedHasInverted = false;
float m_cachedInvertedRadius = 0;
float m_cachedInvertedOuter[4] = {};