forked from Shinonome/dots-hyprland
make rotating date indicator rotate with secondHand
This commit is contained in:
@@ -109,6 +109,7 @@ Item {
|
|||||||
|
|
||||||
// Second hand
|
// Second hand
|
||||||
Loader {
|
Loader {
|
||||||
|
id: secondHandLoader
|
||||||
active: Config.options.time.secondPrecision && Config.options.background.clock.cookie.secondHandStyle !== "none"
|
active: Config.options.time.secondPrecision && Config.options.background.clock.cookie.secondHandStyle !== "none"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
sourceComponent: SecondHand {
|
sourceComponent: SecondHand {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ Item {
|
|||||||
property string style: "rotating"
|
property string style: "rotating"
|
||||||
property color colOnBackground: Appearance.colors.colOnSecondaryContainer
|
property color colOnBackground: Appearance.colors.colOnSecondaryContainer
|
||||||
property color colOnSecondary: Appearance.colors.colOnSecondaryContainer
|
property color colOnSecondary: Appearance.colors.colOnSecondaryContainer
|
||||||
|
|
||||||
|
|
||||||
Canvas {
|
Canvas {
|
||||||
z: 0
|
z: 0
|
||||||
@@ -19,14 +20,14 @@ Item {
|
|||||||
height: parent.height
|
height: parent.height
|
||||||
rotation: {
|
rotation: {
|
||||||
if (!Config.options.time.secondPrecision) return 0;
|
if (!Config.options.time.secondPrecision) return 0;
|
||||||
return secondHand.rotation + 45 // +45 degrees to align with minute hand
|
return secondHandLoader.item.rotation + 45 // +45 degrees to align with minute hand
|
||||||
}
|
}
|
||||||
|
|
||||||
opacity: root.style === "rotating" ? 1.0 : 0
|
opacity: root.style === "rotating" ? 1.0 : 0
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
animation: Appearance.animation.elementMoveFast.numberAnimation.createObject(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
onPaint: {
|
onPaint: {
|
||||||
var ctx = getContext("2d");
|
var ctx = getContext("2d");
|
||||||
ctx.clearRect(0, 0, width, height);
|
ctx.clearRect(0, 0, width, height);
|
||||||
|
|||||||
Reference in New Issue
Block a user