adjust size
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -2752,7 +2752,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "my-clock"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"embed-resource",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "my-clock"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
14
src/main.rs
14
src/main.rs
@@ -151,7 +151,7 @@ slint::slint! {
|
||||
(is_hour ? rgba(0, 0, 0, 0.5) : rgba(0, 0, 0, 0.25));
|
||||
stroke-width: is_hour ? root.clock_size * 0.007 : root.clock_size * 0.0035;
|
||||
property <float> angle: i * 6;
|
||||
property <float> start_r: is_hour ? 42 : 45;
|
||||
property <float> start_r: is_hour ? 43 : 45;
|
||||
MoveTo {
|
||||
x: 50 + Math.sin(parent.angle * 1deg) * parent.start_r;
|
||||
y: 50 - Math.cos(parent.angle * 1deg) * parent.start_r;
|
||||
@@ -168,12 +168,12 @@ slint::slint! {
|
||||
{t: "8", a: 240}, {t: "9", a: 270}, {t: "10", a: 300}, {t: "11", a: 330}
|
||||
] : Text {
|
||||
property <float> rad: entry.a * 3.14159 / 180;
|
||||
property <length> r: parent.width * 0.38;
|
||||
property <length> r: parent.width * 0.39;
|
||||
x: parent.width / 2 + Math.sin(rad * 1rad) * r - self.width / 2;
|
||||
y: parent.height / 2 - Math.cos(rad * 1rad) * r - self.height / 2;
|
||||
text: entry.t;
|
||||
color: root.is_dark_mode ? rgba(255, 255, 255, 0.8) : rgba(0, 0, 0, 0.7);
|
||||
font-size: parent.width * 0.06;
|
||||
font-size: parent.width * 0.05;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
@@ -184,8 +184,8 @@ slint::slint! {
|
||||
stroke-width: root.clock_size * 0.017;
|
||||
MoveTo { x: 50; y: 50; }
|
||||
LineTo {
|
||||
x: 50 + Math.sin(root.hour * 1deg) * 22;
|
||||
y: 50 - Math.cos(root.hour * 1deg) * 22;
|
||||
x: 50 + Math.sin(root.hour * 1deg) * 23;
|
||||
y: 50 - Math.cos(root.hour * 1deg) * 23;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,8 +196,8 @@ slint::slint! {
|
||||
stroke-width: root.clock_size * 0.012;
|
||||
MoveTo { x: 50; y: 50; }
|
||||
LineTo {
|
||||
x: 50 + Math.sin(root.minute * 1deg) * 32;
|
||||
y: 50 - Math.cos(root.minute * 1deg) * 32;
|
||||
x: 50 + Math.sin(root.minute * 1deg) * 35;
|
||||
y: 50 - Math.cos(root.minute * 1deg) * 35;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user