Compare commits
2 Commits
8c22855dd8
...
76e55b01e4
| Author | SHA1 | Date | |
|---|---|---|---|
| 76e55b01e4 | |||
| 550630feaa |
@@ -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
|
||||
|
||||
@@ -24,7 +24,7 @@ Item {
|
||||
const diff = parent.width - Math.floor(off + content.nonAnimWidth);
|
||||
if (diff < 0)
|
||||
return off + diff;
|
||||
return Math.max(off, 0);
|
||||
return Math.floor(Math.max(off, 0));
|
||||
}
|
||||
y: content.isDetached ? (parent.height - content.nonAnimHeight) / 2 : 0
|
||||
|
||||
|
||||
+1
-1
@@ -15,8 +15,8 @@ Item {
|
||||
property real currentCenter
|
||||
property alias currentName: popoutState.currentName
|
||||
property string detachedMode
|
||||
property alias hasCurrent: popoutState.hasCurrent
|
||||
readonly property bool isDetached: detachedMode.length > 0
|
||||
property alias hasCurrent: popoutState.hasCurrent
|
||||
readonly property real nonAnimHeight: children.find(c => c.shouldBeActive)?.implicitHeight ?? content.implicitHeight
|
||||
readonly property real nonAnimWidth: children.find(c => c.shouldBeActive)?.implicitWidth ?? content.implicitWidth
|
||||
required property real offsetScale
|
||||
|
||||
@@ -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)
|
||||
@@ -77,26 +91,6 @@ void BlobShape::geometryChange(const QRectF& newGeometry, const QRectF& oldGeome
|
||||
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;
|
||||
// Update cached padded values immediately so markShapeDirty() uses
|
||||
// current dimensions for neighbor-finding. The values are also updated
|
||||
// in updatePolish() later, but that happens after markShapeDirty()
|
||||
// has already used them to find intersecting shapes.
|
||||
if (isInvertedRect()) {
|
||||
const QPointF scenePos = mapToScene(QPointF(0, 0));
|
||||
m_cachedPaddedX = static_cast<float>(scenePos.x());
|
||||
m_cachedPaddedY = static_cast<float>(scenePos.y());
|
||||
m_cachedPaddedW = static_cast<float>(newGeometry.width());
|
||||
m_cachedPaddedH = static_cast<float>(newGeometry.height());
|
||||
} else {
|
||||
const QPointF scenePos = mapToScene(QPointF(0, 0));
|
||||
const float hw = static_cast<float>(newGeometry.width()) * 0.5f;
|
||||
const float hh = static_cast<float>(newGeometry.height()) * 0.5f;
|
||||
const float totalPad = static_cast<float>(m_group->smoothing()) + deformPadding(m_deformMatrix, hw, hh);
|
||||
m_cachedPaddedX = static_cast<float>(scenePos.x()) - totalPad;
|
||||
m_cachedPaddedY = static_cast<float>(scenePos.y()) - totalPad;
|
||||
m_cachedPaddedW = static_cast<float>(newGeometry.width()) + 2.0f * totalPad;
|
||||
m_cachedPaddedH = static_cast<float>(newGeometry.height()) + 2.0f * totalPad;
|
||||
}
|
||||
m_group->markShapeDirty(this);
|
||||
}
|
||||
}
|
||||
@@ -138,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;
|
||||
|
||||
@@ -46,6 +48,19 @@ 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;
|
||||
@@ -85,6 +100,10 @@ QVector<BlobRectData> m_cachedRects;
|
||||
int m_cachedMyIndex = -2;
|
||||
float m_pendingDx = 0;
|
||||
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] = {};
|
||||
|
||||
Reference in New Issue
Block a user