clean-up plugin files
C++ / fmt (pull_request) Successful in 9s
JS/TS / fmt (pull_request) Successful in 11s
JS/TS / lint (pull_request) Successful in 15s
Python / static (pull_request) Successful in 55s
Rust / fmt (pull_request) Successful in 32s
Rust / build (pull_request) Successful in 1m52s
C++ / build (pull_request) Successful in 3m56s
Rust / clippy (pull_request) Successful in 1m30s
Python / verify (pull_request) Successful in 3m3s
C++ / clang-tidy (pull_request) Successful in 5m20s
C++ / fmt (pull_request) Successful in 9s
JS/TS / fmt (pull_request) Successful in 11s
JS/TS / lint (pull_request) Successful in 15s
Python / static (pull_request) Successful in 55s
Rust / fmt (pull_request) Successful in 32s
Rust / build (pull_request) Successful in 1m52s
C++ / build (pull_request) Successful in 3m56s
Rust / clippy (pull_request) Successful in 1m30s
Python / verify (pull_request) Successful in 3m3s
C++ / clang-tidy (pull_request) Successful in 5m20s
This commit is contained in:
@@ -199,20 +199,10 @@ void CarouselView::setMaxWidth(qreal v) {
|
||||
|
||||
emit maxWidthChanged();
|
||||
|
||||
/*
|
||||
* Advertise the target width immediately.
|
||||
*
|
||||
* The parent QML object can then animate its own implicitWidth
|
||||
* immediately instead of waiting for the delegate geometry.
|
||||
*/
|
||||
const qreal targetWidth = targetWidthForMaxWidth(m_maxWidth);
|
||||
|
||||
setImplicitWidth(targetWidth);
|
||||
|
||||
/*
|
||||
* Grow the instantiated delegate pool if the new maximum needs
|
||||
* more items. Never throw them away during a resize.
|
||||
*/
|
||||
m_layoutCapacity =
|
||||
qMax(m_layoutCapacity, layoutCapacityForWidth(m_maxWidth));
|
||||
|
||||
@@ -269,27 +259,10 @@ void CarouselView::geometryChange(const QRectF& newGeo, const QRectF& oldGeo) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* The carousel is horizontally centered.
|
||||
*
|
||||
* Changing its width therefore moves the local coordinate system
|
||||
* by half the width delta. Keep the logical content stationary by
|
||||
* moving contentX by the opposite amount.
|
||||
*
|
||||
* Crucially, do this directly instead of recomputing a logical
|
||||
* index and converting it back. That avoids quantization and
|
||||
* floating-point drift on every animation frame.
|
||||
*/
|
||||
const qreal delta = (newWidth - oldWidth) / 2.0;
|
||||
|
||||
m_contentX -= delta;
|
||||
|
||||
/*
|
||||
* A running glide/flick animation is expressed in contentX
|
||||
* coordinates too. Shift both endpoints by exactly the same
|
||||
* amount so the animation continues seamlessly in the new
|
||||
* geometry.
|
||||
*/
|
||||
auto shiftAnimation = [delta](QVariantAnimation* anim) {
|
||||
if (anim->state() != QAbstractAnimation::Running) {
|
||||
return;
|
||||
@@ -356,9 +329,6 @@ CarouselView::Arrangement CarouselView::arrangementForCount(int n) const {
|
||||
sideWidth += size;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is exactly the original full arrangement width.
|
||||
*/
|
||||
a.width = F + 2.0 * n * sp + 2.0 * sideWidth;
|
||||
|
||||
a.centers.append(0);
|
||||
@@ -403,15 +373,6 @@ qreal CarouselView::targetWidthForMaxWidth(qreal maxWidth) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This deliberately preserves the old behavior:
|
||||
*
|
||||
* choose the largest complete arrangement whose outermost
|
||||
* delegate can remain at minEdgeWidth.
|
||||
*
|
||||
* Therefore the component's desired width can be smaller than
|
||||
* maxWidth.
|
||||
*/
|
||||
const int n = layoutCapacityForWidth(maxWidth);
|
||||
|
||||
return arrangementForCount(n).width;
|
||||
@@ -444,24 +405,11 @@ void CarouselView::rebuildArrangement() {
|
||||
|
||||
const Arrangement full = arrangementForCount(m_layoutCapacity);
|
||||
|
||||
/*
|
||||
* If the current width can display the complete capacity
|
||||
* arrangement, use that exact geometry.
|
||||
*/
|
||||
if (W >= full.width) {
|
||||
a = full;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Otherwise find the complete arrangement immediately above W.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* width(8) >= W >= width(7)
|
||||
*
|
||||
* means we're in the 8 -> 7 transition.
|
||||
*/
|
||||
int highN = 1;
|
||||
|
||||
for (int n = 1; n <= m_layoutCapacity; ++n) {
|
||||
@@ -488,10 +436,6 @@ void CarouselView::rebuildArrangement() {
|
||||
|
||||
t = qBound<qreal>(0.0, t, 1.0);
|
||||
|
||||
/*
|
||||
* Keep the outgoing slot instantiated and visible while it
|
||||
* smoothly transitions to zero.
|
||||
*/
|
||||
a.n = highN;
|
||||
a.width = W;
|
||||
|
||||
@@ -505,12 +449,6 @@ void CarouselView::rebuildArrangement() {
|
||||
|
||||
a.sizes[highN] = high.sizes[highN] * (1.0 - t);
|
||||
|
||||
/*
|
||||
* All normal gaps stay constant.
|
||||
*
|
||||
* Only the gap immediately before the disappearing delegate
|
||||
* collapses together with that delegate.
|
||||
*/
|
||||
a.outerSpacing = m_itemSpacing * (1.0 - t);
|
||||
|
||||
a.centers.append(0);
|
||||
@@ -909,10 +847,6 @@ void CarouselView::relayout() {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Keep enough slots for the largest layout we've needed.
|
||||
* The currently visible count is determined by m_arrangement.
|
||||
*/
|
||||
const int half = m_layoutCapacity + 2;
|
||||
|
||||
const int lo = m_currentVirtualIndex - half;
|
||||
|
||||
Reference in New Issue
Block a user