change 'rotating' dateStyle radius, fix bubble dateStyle

This commit is contained in:
darksignal7
2025-10-07 21:46:40 +03:00
parent f74a4f056e
commit 68ea59328e
4 changed files with 15 additions and 16 deletions
@@ -11,7 +11,7 @@ Item {
MaterialCookie { MaterialCookie {
z: 5 z: 5
sides: 4 sides: bubbleIndex === 0 ? 4 : 1
anchors.centerIn: parent anchors.centerIn: parent
color: bubbleIndex === 0.0 ? Appearance.colors.colPrimaryContainer : Appearance.colors.colTertiaryContainer color: bubbleIndex === 0.0 ? Appearance.colors.colPrimaryContainer : Appearance.colors.colTertiaryContainer
implicitSize: root.style === "bubble" ? root.dateSquareSize : 0 implicitSize: root.style === "bubble" ? root.dateSquareSize : 0
@@ -16,11 +16,6 @@ Item {
// Rotating date // Rotating date
Loader { Loader {
opacity: root.style === "rotating" ? 1.0 : 0
Behavior on opacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
anchors.fill: parent anchors.fill: parent
active: opacity > 0 active: opacity > 0
sourceComponent: RotatingDate {} sourceComponent: RotatingDate {}
@@ -39,17 +34,19 @@ Item {
} }
active: height > 0 active: height > 0
sourceComponent: RectangleDate {}
anchors { anchors {
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
right: parent.right right: parent.right
rightMargin: 10 rightMargin: 10
} }
sourceComponent: RectangleDate {
color: root.colBackground
radius: Appearance.rounding.small
}
} }
// Date bubble style day // Date bubble / day
Loader { Loader {
property real targetSize: root.style === "bubble" ? root.dateSquareSize : 0 property real targetSize: root.style === "bubble" ? root.dateSquareSize : 0
Behavior on targetSize { Behavior on targetSize {
@@ -70,7 +67,7 @@ Item {
} }
} }
// Date bubble month // Date bubble / month
Loader { Loader {
property real targetSize: root.style === "bubble" ? root.dateSquareSize : 0 property real targetSize: root.style === "bubble" ? root.dateSquareSize : 0
Behavior on targetSize { Behavior on targetSize {
@@ -81,7 +78,6 @@ Item {
height: targetSize height: targetSize
active: targetSize > 0 active: targetSize > 0
anchors { anchors {
right: parent.right right: parent.right
top: parent.top top: parent.top
@@ -8,8 +8,6 @@ import QtQuick
Rectangle { Rectangle {
z: 1 z: 1
color: root.colBackground
radius: Appearance.rounding.small
StyledText { StyledText {
opacity: root.style === "rect" ? 1.0 : 0 opacity: root.style === "rect" ? 1.0 : 0
Behavior on opacity { Behavior on opacity {
@@ -8,19 +8,24 @@ import QtQuick
Canvas { Canvas {
z: 0 z: 0
opacity: root.style === "rotating" ? 1.0 : 0
Behavior on opacity {
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
}
rotation: { rotation: {
if (!Config.options.time.secondPrecision) if (!Config.options.time.secondPrecision)
return 0; return 0;
return (secondHandLoader.item.rotation + 45); // +45 degrees to align text's center return (secondHandLoader.item.rotation + 45); // +45 degrees to align text's center
} }
onPaint: { onPaint: {
var ctx = getContext("2d"); var ctx = getContext("2d");
ctx.clearRect(0, 0, width, height); ctx.clearRect(0, 0, width, height);
ctx.font = "700 30px " + Appearance.font.family.title; ctx.font = "700 30px " + Appearance.font.family.title;
var text = Qt.locale().toString(DateTime.clock.date, "ddd dd"); var text = Qt.locale().toString(DateTime.clock.date, "ddd dd");
var radius = 78; var radius = 65;
var angleStep = Math.PI / 2.35 / text.length; var angleStep = Math.PI / 2.35 / text.length;
for (var i = 0; i < text.length; i++) { for (var i = 0; i < text.length; i++) {