Fix calendar events not using minutes

This commit is contained in:
Vyn 2025-07-04 10:47:11 +02:00
parent 6acb97df79
commit e94ed17de9
Signed by: vyn
GPG key ID: E1B2BE34E7A971E7

View file

@ -82,13 +82,15 @@ export component Calendar inherits Rectangle {
}
if day.date == root.current-date : Rectangle {
background: Palette.red;
x: 0px;
x: 1px;
y: day-start-y + hour-spacing * root.current-time.hour + (root.current-time.minute / 60 * hour-spacing);
width: parent.width;
width: parent.width - 1px;
height: 1px;
z: 100;
}
for event[event-index] in day.events : Rectangle {
private property <length> start-point: day-start-y + hour-spacing * event.starts_at.hour + hour-spacing * (event.starts-at.minute / 60);
private property <int> duration: (event.ends-at.hour * 60 + event.ends-at.minute) - (event.starts-at.hour * 60 + event.starts-at.minute);
Rectangle {
width: 100%;
height: 100%;
@ -99,8 +101,8 @@ export component Calendar inherits Rectangle {
border-radius: 4px;
x: 8px;
width: parent.width - 16px;
y: day-start-y + hour-spacing * event.starts_at.hour;
height: hour-spacing * (event.ends_at.hour - event.starts_at.hour) - 2px;
y: start-point;
height: hour-spacing * (duration / 60) - 2px;
clip: true;
HorizontalLayout {
Rectangle {