aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--karlgui/src/globals.rs2
-rw-r--r--karlgui/src/views/calendar.rs37
2 files changed, 24 insertions, 15 deletions
diff --git a/karlgui/src/globals.rs b/karlgui/src/globals.rs
index 48af280..fca2e86 100644
--- a/karlgui/src/globals.rs
+++ b/karlgui/src/globals.rs
@@ -73,7 +73,7 @@ impl Globals {
self.client.send_sync(ServerboundPacket::ListInstances {
task,
range: Some(start.timestamp())..Some(end.timestamp()),
- limit: 100,
+ limit: 4069,
});
&None
}
diff --git a/karlgui/src/views/calendar.rs b/karlgui/src/views/calendar.rs
index 1e869af..6bec067 100644
--- a/karlgui/src/views/calendar.rs
+++ b/karlgui/src/views/calendar.rs
@@ -28,8 +28,8 @@ impl Calendar {
.column(Size::exact(50.0))
.columns(Size::remainder(), 7)
.header(50.0, |mut tr| {
+ tr.col(|_| {});
for d in 0..7 {
- tr.col(|_| {});
tr.col(|ui| {
ui.heading(weekday_to_str(
(start_dt + Duration::days(d as i64))
@@ -44,9 +44,9 @@ impl Calendar {
.body(|mut tb| {
tb.row(height, |mut tr| {
tr.col(|ui| {
+ let (response, p) =
+ ui.allocate_painter(Vec2::new(50.0, height), Sense::hover());
for h in 0..24 {
- let (response, p) =
- ui.allocate_painter(Vec2::new(50.0, height), Sense::hover());
p.text(
response.rect.min + Vec2::new(0.0, h as f32 / 24.0 * height),
egui::Align2::LEFT_TOP,
@@ -90,23 +90,32 @@ impl Calendar {
+ (r.end.minute() as f32 / 60.0))
/ 24.0
* height;
+ let rect = Rect::from_two_pos(
+ rect.min + Vec2::new(0.0, rect_start),
+ rect.min + Vec2::new(10.0, rect_end),
+ );
+
+ if let Some(p) = response.hover_pos() {
+ if rect.contains(p) {
+ response.clone().on_hover_ui_at_pointer(|ui| {
+ ui.heading(&task.name);
+ ui.label(&format!(
+ "from {} to {}",
+ r.start, r.end
+ ));
+ if let Some(d) = &task.description {
+ ui.label(d);
+ }
+ });
+ }
+ }
ui.painter().rect(
- Rect::from_two_pos(
- rect.min + Vec2::new(0.0, rect_start),
- rect.min + Vec2::new(10.0, rect_end),
- ),
+ rect,
0.0,
Color32::KHAKI,
Stroke::new(0.0, Color32::WHITE),
);
}
-
- response.on_hover_ui_at_pointer(|ui| {
- ui.heading(&task.name);
- if let Some(d) = &task.description {
- ui.label(d);
- }
- });
}
});
});