fix: blobs ignoring updates if moving too slow
This commit is contained in:
parent
d778734c67
commit
77ab4b8350
2 changed files with 9 additions and 4 deletions
|
|
@ -69,14 +69,17 @@ void BlobShape::geometryChange(const QRectF& newGeometry, const QRectF& oldGeome
|
||||||
QQuickItem::geometryChange(newGeometry, oldGeometry);
|
QQuickItem::geometryChange(newGeometry, oldGeometry);
|
||||||
updateCenteredDeformMatrix();
|
updateCenteredDeformMatrix();
|
||||||
if (m_group) {
|
if (m_group) {
|
||||||
// Only trigger redraw if the change is visually meaningful
|
// Accumulate sub-pixel drift so slow movements don't desync the shader
|
||||||
const auto dx = std::abs(newGeometry.x() - oldGeometry.x());
|
m_pendingDx += static_cast<float>(newGeometry.x() - oldGeometry.x());
|
||||||
const auto dy = std::abs(newGeometry.y() - oldGeometry.y());
|
m_pendingDy += static_cast<float>(newGeometry.y() - oldGeometry.y());
|
||||||
const auto dw = std::abs(newGeometry.width() - oldGeometry.width());
|
const auto dw = std::abs(newGeometry.width() - oldGeometry.width());
|
||||||
const auto dh = std::abs(newGeometry.height() - oldGeometry.height());
|
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);
|
m_group->markShapeDirty(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlobShape::updateCenteredDeformMatrix() {
|
void BlobShape::updateCenteredDeformMatrix() {
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,8 @@ protected:
|
||||||
QRectF m_localPaddedRect;
|
QRectF m_localPaddedRect;
|
||||||
QVector<BlobRectData> m_cachedRects;
|
QVector<BlobRectData> m_cachedRects;
|
||||||
int m_cachedMyIndex = -2;
|
int m_cachedMyIndex = -2;
|
||||||
|
float m_pendingDx = 0;
|
||||||
|
float m_pendingDy = 0;
|
||||||
bool m_cachedHasInverted = false;
|
bool m_cachedHasInverted = false;
|
||||||
float m_cachedInvertedRadius = 0;
|
float m_cachedInvertedRadius = 0;
|
||||||
float m_cachedInvertedOuter[4] = {};
|
float m_cachedInvertedOuter[4] = {};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue