update blobs
This commit is contained in:
@@ -239,6 +239,8 @@ Variants {
|
||||
property real extraHeight: panels.popouts.isDetached ? 0 : 0.2
|
||||
|
||||
deformAmount: panels.popouts.isDetached ? 0.05 * Config.appearance.deform.scale : panels.popouts.hasCurrent ? 0.15 * Config.appearance.deform.scale : 0.1 * Config.appearance.deform.scale
|
||||
targetHeight: panels.popouts.height * (1 + extraHeight)
|
||||
targetWidth: panels.popouts.width
|
||||
implicitHeight: panels.popouts.height * (1 + extraHeight)
|
||||
implicitWidth: panels.popouts.width
|
||||
panel: panels.popouts
|
||||
@@ -380,6 +382,8 @@ Variants {
|
||||
property real deformAmount: 0.15
|
||||
required property Item panel
|
||||
|
||||
targetHeight: panel.height
|
||||
targetWidth: panel.width
|
||||
deformScale: deformAmount / 10000
|
||||
group: blobGroup
|
||||
implicitHeight: panel.height
|
||||
|
||||
@@ -59,6 +59,20 @@ void BlobShape::setRadius(qreal r) {
|
||||
m_group->markDirty();
|
||||
}
|
||||
|
||||
void BlobShape::setTargetWidth(qreal w) {
|
||||
if (qFuzzyCompare(m_targetWidth, w))
|
||||
return;
|
||||
m_targetWidth = w;
|
||||
emit targetWidthChanged();
|
||||
}
|
||||
|
||||
void BlobShape::setTargetHeight(qreal h) {
|
||||
if (qFuzzyCompare(m_targetHeight, h))
|
||||
return;
|
||||
m_targetHeight = h;
|
||||
emit targetHeightChanged();
|
||||
}
|
||||
|
||||
void BlobShape::componentComplete() {
|
||||
QQuickItem::componentComplete();
|
||||
if (m_group)
|
||||
@@ -118,6 +132,17 @@ void BlobShape::updatePolish() {
|
||||
if (!m_group)
|
||||
return;
|
||||
|
||||
// Check if target dimensions (panel size) have changed since last polish.
|
||||
// This catches cases where the panel's implicit size changes but the
|
||||
// BlobRect's geometry doesn't update (e.g. parent Rectangle doesn't
|
||||
// respect implicit sizes), which would otherwise skip dirty marking.
|
||||
if (!qFuzzyCompare(m_targetWidth, m_lastPolishTargetWidth) ||
|
||||
!qFuzzyCompare(m_targetHeight, m_lastPolishTargetHeight)) {
|
||||
m_lastPolishTargetWidth = m_targetWidth;
|
||||
m_lastPolishTargetHeight = m_targetHeight;
|
||||
m_group->markDirty();
|
||||
}
|
||||
|
||||
// Ensure all shapes have up-to-date physics (only once per frame)
|
||||
m_group->ensurePhysicsUpdated();
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ Q_PROPERTY(BlobGroup* group READ group WRITE setGroup NOTIFY groupChanged)
|
||||
Q_PROPERTY(qreal radius READ radius WRITE setRadius NOTIFY radiusChanged)
|
||||
Q_PROPERTY(QMatrix4x4 deformMatrix READ deformMatrix NOTIFY deformMatrixChanged)
|
||||
Q_PROPERTY(QMatrix4x4 rawDeformMatrix READ rawDeformMatrix NOTIFY rawDeformMatrixChanged)
|
||||
Q_PROPERTY(qreal targetWidth READ targetWidth WRITE setTargetWidth NOTIFY targetWidthChanged)
|
||||
Q_PROPERTY(qreal targetHeight READ targetHeight WRITE setTargetHeight NOTIFY targetHeightChanged)
|
||||
|
||||
friend class BlobGroup;
|
||||
|
||||
@@ -42,10 +44,23 @@ QMatrix4x4 rawDeformMatrix() const {
|
||||
}
|
||||
|
||||
signals:
|
||||
void groupChanged();
|
||||
void radiusChanged();
|
||||
void deformMatrixChanged();
|
||||
void rawDeformMatrixChanged();
|
||||
void groupChanged();
|
||||
void radiusChanged();
|
||||
void deformMatrixChanged();
|
||||
void rawDeformMatrixChanged();
|
||||
void targetWidthChanged();
|
||||
void targetHeightChanged();
|
||||
|
||||
public:
|
||||
qreal targetWidth() const {
|
||||
return m_targetWidth;
|
||||
}
|
||||
void setTargetWidth(qreal w);
|
||||
|
||||
qreal targetHeight() const {
|
||||
return m_targetHeight;
|
||||
}
|
||||
void setTargetHeight(qreal h);
|
||||
|
||||
protected:
|
||||
void componentComplete() override;
|
||||
@@ -84,8 +99,12 @@ 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_pendingDy = 0;
|
||||
qreal m_targetWidth = 0;
|
||||
qreal m_targetHeight = 0;
|
||||
qreal m_lastPolishTargetWidth = -1;
|
||||
qreal m_lastPolishTargetHeight = -1;
|
||||
bool m_cachedHasInverted = false;
|
||||
float m_cachedInvertedRadius = 0;
|
||||
float m_cachedInvertedOuter[4] = {};
|
||||
float m_cachedInvertedInner[4] = {};
|
||||
|
||||
Reference in New Issue
Block a user