diff --git a/modules/sidebar/NotifGroupList.qml b/modules/sidebar/NotifGroupList.qml index fdcaf30a..aeec4c62 100644 --- a/modules/sidebar/NotifGroupList.qml +++ b/modules/sidebar/NotifGroupList.qml @@ -65,8 +65,8 @@ LazyListView { Component.onCompleted: modelData?.lock(this) Component.onDestruction: modelData?.unlock(this) - LazyListView.preferredHeight: modelData?.closed ? 0 : notifInner.nonAnimHeight - LazyListView.visibleHeight: modelData?.closed ? 0 : notifInner.implicitHeight + LazyListView.preferredHeight: modelData?.closed || LazyListView.removing ? 0 : notifInner.nonAnimHeight + LazyListView.visibleHeight: modelData?.closed || LazyListView.removing ? 0 : notifInner.implicitHeight implicitHeight: notifInner.implicitHeight opacity: LazyListView.removing || LazyListView.adding ? 0 : 1 diff --git a/plugin/src/Caelestia/Components/lazylistview.cpp b/plugin/src/Caelestia/Components/lazylistview.cpp index c9291cfd..36b49301 100644 --- a/plugin/src/Caelestia/Components/lazylistview.cpp +++ b/plugin/src/Caelestia/Components/lazylistview.cpp @@ -367,9 +367,29 @@ void LazyListView::updatePolish() { it->pendingInsert = false; it->readyDelayStarted = false; - // Position correctly before making visible - if (idx >= 0 && idx < static_cast(m_layout.size())) - item->setY(m_layout[idx].targetY - m_contentY); + // Set initial y to visual position (based on current visible heights) + if (idx >= 0 && idx < static_cast(m_layout.size())) { + qreal visualY = 0; + bool hasVisItem = false; + for (int i = 0; i < static_cast(m_layout.size()); ++i) { + qreal h; + auto dit = m_delegates.find(i); + if (dit != m_delegates.end() && dit->item) + h = delegateVisibleHeight(dit->item); + else + h = m_layout[i].heightKnown ? m_layout[i].height : effectiveEstimatedHeight(); + if (h > 0) { + if (hasVisItem) + visualY += m_spacing; + hasVisItem = true; + } + if (i == idx) + break; + if (h > 0) + visualY += h; + } + item->setY(visualY - m_contentY); + } item->setVisible(true); auto* att = @@ -378,6 +398,11 @@ void LazyListView::updatePolish() { att->setAdding(false); att->setReady(true); } + + // Animate from visual position to layout position + if (idx >= 0 && idx < static_cast(m_layout.size())) + item->setProperty("y", m_layout[idx].targetY - m_contentY); + polish(); }); }