background: fix clock movement jumping abruptly

This commit is contained in:
end-4
2025-09-24 08:29:04 +02:00
parent 0498d7ea98
commit 6707487d3c
@@ -266,11 +266,7 @@ Variants {
horizontalCenter: undefined horizontalCenter: undefined
verticalCenter: undefined verticalCenter: undefined
leftMargin: bgRoot.movableXSpace + ((root.fixedClockPosition ? root.fixedClockX : bgRoot.clockX * bgRoot.effectiveWallpaperScale) - implicitWidth / 2) leftMargin: bgRoot.movableXSpace + ((root.fixedClockPosition ? root.fixedClockX : bgRoot.clockX * bgRoot.effectiveWallpaperScale) - implicitWidth / 2)
topMargin: { topMargin: bgRoot.movableYSpace + ((root.fixedClockPosition ? root.fixedClockY : bgRoot.clockY * bgRoot.effectiveWallpaperScale) - implicitHeight / 2)
if (bgRoot.shouldBlur)
return bgRoot.modelData.height / 3;
return bgRoot.movableYSpace + ((root.fixedClockPosition ? root.fixedClockY : bgRoot.clockY * bgRoot.effectiveWallpaperScale) - implicitHeight / 2);
}
Behavior on leftMargin { Behavior on leftMargin {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this) animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
} }
@@ -300,7 +296,6 @@ Variants {
} }
} }
sourceComponent: ColumnLayout { sourceComponent: ColumnLayout {
id: clock
spacing: 8 spacing: 8
Loader { Loader {
@@ -345,33 +340,37 @@ Variants {
active: visible active: visible
sourceComponent: CookieClock {} sourceComponent: CookieClock {}
} }
}
Item { Item {
Layout.alignment: { anchors {
if (bgRoot.textHorizontalAlignment === Text.AlignHCenter || root.clockStyle === "cookie") top: clockLoader.bottom
return Qt.AlignHCenter; topMargin: 8
return (bgRoot.textHorizontalAlignment === Text.AlignLeft ? Qt.AlignLeft : Qt.AlignRight) horizontalCenter: (bgRoot.textHorizontalAlignment === Text.AlignHCenter || root.clockStyle === "cookie") ? clockLoader.horizontalCenter : undefined
left: (bgRoot.textHorizontalAlignment === Text.AlignLeft) ? clockLoader.left : undefined
right: (bgRoot.textHorizontalAlignment === Text.AlignRight) ? clockLoader.right : undefined
leftMargin: -26
rightMargin: -26
} }
Layout.leftMargin: -26
Layout.rightMargin: -26
implicitWidth: statusTextBg.implicitWidth implicitWidth: statusTextBg.implicitWidth
implicitHeight: statusTextBg.implicitHeight implicitHeight: statusTextBg.implicitHeight
StyledRectangularShadow { StyledRectangularShadow {
target: statusTextBg target: statusTextBg
visible: statusTextBg.visible && cookieClockLoader.active visible: statusTextBg.visible && root.clockStyle === "cookie"
opacity: statusTextBg.opacity opacity: statusTextBg.opacity
} }
Rectangle { Rectangle {
id: statusTextBg id: statusTextBg
anchors.centerIn: parent
clip: true clip: true
opacity: (safetyStatusText.shown || lockStatusText.shown) ? 1 : 0 opacity: (safetyStatusText.shown || lockStatusText.shown) ? 1 : 0
visible: opacity > 0 visible: opacity > 0
implicitHeight: statusTextRow.implicitHeight + 5 * 2 implicitHeight: statusTextRow.implicitHeight + 5 * 2
implicitWidth: statusTextRow.implicitWidth + 5 * 2 implicitWidth: statusTextRow.implicitWidth + 5 * 2
radius: Appearance.rounding.small radius: Appearance.rounding.small
color: CF.ColorUtils.transparentize(Appearance.colors.colSecondaryContainer, cookieClockLoader.active ? 0 : 1) color: CF.ColorUtils.transparentize(Appearance.colors.colSecondaryContainer, root.clockStyle === "cookie" ? 0 : 1)
Behavior on implicitWidth { Behavior on implicitWidth {
animation: Appearance.animation.elementResize.numberAnimation.createObject(this) animation: Appearance.animation.elementResize.numberAnimation.createObject(this)
@@ -413,7 +412,6 @@ Variants {
} }
} }
} }
}
// Components // Components
component ClockText: StyledText { component ClockText: StyledText {