From 007cb3269021b977b87d38c07abe70a82da6d479 Mon Sep 17 00:00:00 2001 From: zach Date: Sun, 19 Apr 2026 22:21:49 +0200 Subject: [PATCH] test blob bounciness --- Drawers/Windows.qml | 16 +++++++++++++--- Modules/ClipWrapper.qml | 6 +++++- Modules/Updates/UpdatesPopout.qml | 2 +- Modules/Wrapper.qml | 3 +-- Plugins/ZShell/Blobs/blobrect.cpp | 4 ++-- Plugins/ZShell/Blobs/blobshape.cpp | 17 ++--------------- Plugins/ZShell/Blobs/blobshape.hpp | 10 +++------- shell.qml | 2 +- 8 files changed, 28 insertions(+), 32 deletions(-) diff --git a/Drawers/Windows.qml b/Drawers/Windows.qml index 460484f..790b9c6 100644 --- a/Drawers/Windows.qml +++ b/Drawers/Windows.qml @@ -219,10 +219,20 @@ Variants { PanelBg { id: popoutBg - deformAmount: 0.15 * Config.appearance.deform.scale - implicitWidth: panels.popouts.width + // Extra height to prevent vertical movement deformation partially detaching panel from bar + 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 + implicitHeight: panels.popouts.height * (1 + extraHeight) + implicitWidth: panels.popoutsWrapper.width panel: panels.popoutsWrapper radius: (panels.popouts.currentName.startsWith("audio") || panels.popouts.currentName.startsWith("updates")) ? Appearance.rounding.normal : Appearance.rounding.smallest + y: panels.popoutsWrapper.y + panels.popouts.y + bar.implicitHeight - panels.popouts.height * extraHeight + + Behavior on extraHeight { + Anim { + } + } } PanelBg { @@ -342,7 +352,7 @@ Variants { required property Item panel deformScale: deformAmount / 10000 - group: panel.width > 0 && panel.height > 0 ? blobGroup : null + group: blobGroup implicitHeight: panel.height implicitWidth: panel.width radius: Appearance.rounding.smallest diff --git a/Modules/ClipWrapper.qml b/Modules/ClipWrapper.qml index d9265d0..6b735f5 100644 --- a/Modules/ClipWrapper.qml +++ b/Modules/ClipWrapper.qml @@ -17,12 +17,16 @@ Item { implicitWidth: content.implicitWidth visible: width > 0 && height > 0 x: { - const off = content.currentCenter - content.nonAnimWidth / 2; + if (content.isDetached) + return (parent.width - content.nonAnimWidth) / 2; + + const off = content.currentCenter - Config.barConfig.border - content.nonAnimWidth / 2; const diff = parent.width - Math.floor(off + content.nonAnimWidth); if (diff < 0) return off + diff; return Math.floor(Math.max(off, 0)); } + y: content.isDetached ? (parent.height - content.nonAnimHeight) / 2 : 0 Behavior on offsetScale { Anim { diff --git a/Modules/Updates/UpdatesPopout.qml b/Modules/Updates/UpdatesPopout.qml index c8b7dd3..4284c3e 100644 --- a/Modules/Updates/UpdatesPopout.qml +++ b/Modules/Updates/UpdatesPopout.qml @@ -25,7 +25,7 @@ CustomClippingRect { anchors.centerIn: parent height: 200 visible: script.values.length === 0 - width: 300 + width: 600 MaterialIcon { id: noUpdatesIcon diff --git a/Modules/Wrapper.qml b/Modules/Wrapper.qml index 8b7f4e9..8bf0ab7 100644 --- a/Modules/Wrapper.qml +++ b/Modules/Wrapper.qml @@ -15,6 +15,7 @@ Item { property real currentCenter property alias currentName: popoutState.currentName property string detachedMode + 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 @@ -50,8 +51,6 @@ Item { implicitWidth: nonAnimWidth Behavior on implicitHeight { - enabled: root.offsetScale < 1 - Anim { duration: root.animLength easing.bezierCurve: root.animCurve diff --git a/Plugins/ZShell/Blobs/blobrect.cpp b/Plugins/ZShell/Blobs/blobrect.cpp index dc03432..aeedae1 100644 --- a/Plugins/ZShell/Blobs/blobrect.cpp +++ b/Plugins/ZShell/Blobs/blobrect.cpp @@ -14,8 +14,6 @@ BlobRect::~BlobRect() { } void BlobRect::updatePolish() { - BlobShape::updatePolish(); - if (m_physicsActive) { // Check if deformation is visually imperceptible float totalDelta = std::abs(m_dm00 - 1.0f) + std::abs(m_dm01) + std::abs(m_dm11 - 1.0f); @@ -41,6 +39,8 @@ void BlobRect::updatePolish() { Qt::QueuedConnection); } } + + BlobShape::updatePolish(); } void BlobRect::updatePhysics() { diff --git a/Plugins/ZShell/Blobs/blobshape.cpp b/Plugins/ZShell/Blobs/blobshape.cpp index d284a5e..40a7eab 100644 --- a/Plugins/ZShell/Blobs/blobshape.cpp +++ b/Plugins/ZShell/Blobs/blobshape.cpp @@ -68,21 +68,8 @@ void BlobShape::componentComplete() { void BlobShape::geometryChange(const QRectF& newGeometry, const QRectF& oldGeometry) { QQuickItem::geometryChange(newGeometry, oldGeometry); updateCenteredDeformMatrix(); - if (m_group) { - // Accumulate sub-pixel drift so slow movements don't desync the shader - m_pendingDx += static_cast(newGeometry.x() - oldGeometry.x()); - m_pendingDy += static_cast(newGeometry.y() - oldGeometry.y()); - m_pendingDw += static_cast(newGeometry.width() - oldGeometry.width()); - m_pendingDh += static_cast(newGeometry.height() - oldGeometry.height()); - - if (std::abs(m_pendingDx) > 0.5f || std::abs(m_pendingDy) > 0.5f || - std::abs(m_pendingDw) > 0.5f || std::abs(m_pendingDh) > 0.5f) { - m_pendingDx = 0; - m_pendingDy = 0; - m_pendingDw = 0; - m_pendingDh = 0; - m_group->markShapeDirty(this); - } + if (m_group && newGeometry != oldGeometry) { + m_group->markShapeDirty(this); } } diff --git a/Plugins/ZShell/Blobs/blobshape.hpp b/Plugins/ZShell/Blobs/blobshape.hpp index f130c23..4acfe1d 100644 --- a/Plugins/ZShell/Blobs/blobshape.hpp +++ b/Plugins/ZShell/Blobs/blobshape.hpp @@ -82,13 +82,9 @@ float m_cachedPaddedW = 0; float m_cachedPaddedH = 0; QRectF m_localPaddedRect; QVector m_cachedRects; -int m_cachedMyIndex = -2; -float m_pendingDx = 0; -float m_pendingDy = 0; -float m_pendingDw = 0; -float m_pendingDh = 0; -bool m_cachedHasInverted = false; -float m_cachedInvertedRadius = 0; + int m_cachedMyIndex = -2; + bool m_cachedHasInverted = false; + float m_cachedInvertedRadius = 0; float m_cachedInvertedOuter[4] = {}; float m_cachedInvertedInner[4] = {}; }; diff --git a/shell.qml b/shell.qml index 92e91f9..9bf3bc9 100644 --- a/shell.qml +++ b/shell.qml @@ -1,6 +1,6 @@ //@ pragma UseQApplication //@ pragma Env QSG_RENDER_LOOP=threaded -//@ pragma Env QSG_RHI_BACKEND=vulkan +// @ pragma Env QSG_RHI_BACKEND=vulkan //@ pragma Env QSG_USE_SIMPLE_ANIMATION_DRIVER=0 //@ pragma Env QS_NO_RELOAD_POPUP=1 //@ pragma Env QT_SCALE_FACTOR_ROUNDING_POLICY=Round