update blobs
This commit is contained in:
@@ -73,7 +73,9 @@ void BlobGroup::markShapeDirty(BlobShape* source) {
|
|||||||
source->polish();
|
source->polish();
|
||||||
source->update();
|
source->update();
|
||||||
|
|
||||||
// Use cached padded rects to find spatial neighbors
|
// Use actual current geometry (not cached rects) to find spatial neighbors.
|
||||||
|
// Cached rects can be stale when multiple shapes move simultaneously,
|
||||||
|
// causing the blob background to desync from panels that changed size.
|
||||||
const float pad = static_cast<float>(m_smoothing) * 2.0f;
|
const float pad = static_cast<float>(m_smoothing) * 2.0f;
|
||||||
const QRectF srcRect(static_cast<double>(source->m_cachedPaddedX - pad),
|
const QRectF srcRect(static_cast<double>(source->m_cachedPaddedX - pad),
|
||||||
static_cast<double>(source->m_cachedPaddedY - pad), static_cast<double>(source->m_cachedPaddedW + pad * 2.0f),
|
static_cast<double>(source->m_cachedPaddedY - pad), static_cast<double>(source->m_cachedPaddedW + pad * 2.0f),
|
||||||
@@ -82,8 +84,9 @@ void BlobGroup::markShapeDirty(BlobShape* source) {
|
|||||||
for (auto* shape : std::as_const(m_shapes)) {
|
for (auto* shape : std::as_const(m_shapes)) {
|
||||||
if (shape == source)
|
if (shape == source)
|
||||||
continue;
|
continue;
|
||||||
const QRectF otherRect(static_cast<double>(shape->m_cachedPaddedX), static_cast<double>(shape->m_cachedPaddedY),
|
const QPointF shapeScene = shape->mapToScene(QPointF(0, 0));
|
||||||
static_cast<double>(shape->m_cachedPaddedW), static_cast<double>(shape->m_cachedPaddedH));
|
const QRectF otherRect(shapeScene.x(), shapeScene.y(),
|
||||||
|
static_cast<double>(shape->width()), static_cast<double>(shape->height()));
|
||||||
if (srcRect.intersects(otherRect)) {
|
if (srcRect.intersects(otherRect)) {
|
||||||
shape->polish();
|
shape->polish();
|
||||||
shape->update();
|
shape->update();
|
||||||
|
|||||||
Reference in New Issue
Block a user