Give presenter clocks their configured row height
This commit is contained in:
parent
c319eacbc4
commit
8b193dfec6
|
|
@ -2245,7 +2245,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pdf-presenter"
|
||||
version = "0.1.56"
|
||||
version = "0.1.57"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"]
|
|||
resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.56"
|
||||
version = "0.1.57"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter"
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ fn timer_height(s: &Studio, position: TimerPosition) -> f32 {
|
|||
]
|
||||
.into_iter()
|
||||
.filter(|(w, p)| w.show && *p == position)
|
||||
.map(|(w, _)| w.size + 32.)
|
||||
.map(|(w, _)| w.size * 1.3 + 36.)
|
||||
.fold(0., f32::max)
|
||||
}
|
||||
fn timers(ui: &mut Ui, s: &Studio, position: TimerPosition) {
|
||||
|
|
@ -584,7 +584,7 @@ fn side_timers(
|
|||
if size == 0. || !original.is_positive() {
|
||||
continue;
|
||||
}
|
||||
let width = ((size - 32.) * 3.6 + 24.).min(original.width() * 0.32);
|
||||
let width = ((size - 36.) / 1.3 * 3.6 + 24.).min(original.width() * 0.32);
|
||||
let column = if is_left {
|
||||
Rect::from_min_max(
|
||||
original.min,
|
||||
|
|
@ -661,9 +661,19 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
ui.close();
|
||||
}
|
||||
});
|
||||
let header_height = (timer_height(s, TimerPosition::Header) + 20.)
|
||||
.max(64.)
|
||||
.min(screen.height() * 0.35);
|
||||
let header_timer_height = timer_height(s, TimerPosition::Header);
|
||||
let separate_header_timers =
|
||||
header_timer_height > 100. || (header_timer_height > 0. && screen.width() < 1100.);
|
||||
let header_controls_height = 44.;
|
||||
let header_height = (header_timer_height
|
||||
+ 20.
|
||||
+ if separate_header_timers {
|
||||
header_controls_height
|
||||
} else {
|
||||
0.
|
||||
})
|
||||
.max(64.)
|
||||
.min(screen.height() * 0.35);
|
||||
let mut body = screen.shrink(16.);
|
||||
if s.layout.header {
|
||||
body.min.y += header_height;
|
||||
|
|
@ -712,9 +722,12 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
} else {
|
||||
body.max.y -= height + 8.;
|
||||
}
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(rect), |ui| {
|
||||
ui.horizontal(|ui| timers(ui, s, position));
|
||||
});
|
||||
ui.scope_builder(
|
||||
egui::UiBuilder::new()
|
||||
.max_rect(rect)
|
||||
.layout(egui::Layout::left_to_right(egui::Align::Center)),
|
||||
|ui| timers(ui, s, position),
|
||||
);
|
||||
}
|
||||
}
|
||||
let preview_visible = s.layout.previous.show || s.layout.current.show || s.layout.next.show;
|
||||
|
|
@ -934,8 +947,12 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
if header {
|
||||
let rect = Rect::from_min_size(screen.min, Vec2::new(screen.width(), header_height));
|
||||
ui.painter().rect_filled(rect, 0., ui.visuals().window_fill);
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(rect.shrink(10.)), |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
let mut controls = rect.shrink(10.);
|
||||
if separate_header_timers {
|
||||
controls.max.y = controls.min.y + header_controls_height - 8.;
|
||||
}
|
||||
ui.scope_builder(egui::UiBuilder::new().max_rect(controls), |ui| {
|
||||
ui.with_layout(egui::Layout::left_to_right(egui::Align::Center), |ui| {
|
||||
if bar_visibility_button(ui, s.layout.header, true).clicked() {
|
||||
s.layout.header = !s.layout.header;
|
||||
native.header_until = now;
|
||||
|
|
@ -999,9 +1016,23 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
{
|
||||
s.actions.push(Action::Blank);
|
||||
}
|
||||
timers(ui, s, TimerPosition::Header);
|
||||
if !separate_header_timers {
|
||||
timers(ui, s, TimerPosition::Header);
|
||||
}
|
||||
});
|
||||
});
|
||||
if separate_header_timers {
|
||||
let timer_rect = Rect::from_min_max(
|
||||
rect.min + Vec2::new(10., 10. + header_controls_height),
|
||||
rect.max - Vec2::splat(10.),
|
||||
);
|
||||
ui.scope_builder(
|
||||
egui::UiBuilder::new()
|
||||
.max_rect(timer_rect)
|
||||
.layout(egui::Layout::left_to_right(egui::Align::Center)),
|
||||
|ui| timers(ui, s, TimerPosition::Header),
|
||||
);
|
||||
}
|
||||
}
|
||||
if footer {
|
||||
let rect = Rect::from_min_size(
|
||||
|
|
|
|||
|
|
@ -589,6 +589,31 @@ fn timer_presets_reserve_space_and_progress_tracks_navigation() {
|
|||
let current = text_rect(&output.shapes, "CURRENT 1 / 30").unwrap();
|
||||
assert!(elapsed.bottom() < current.top());
|
||||
assert!(clock.top() > current.bottom());
|
||||
assert!(
|
||||
text_rect(&output.shapes, "00:00").unwrap().height() >= 65.,
|
||||
"the above-slides timer must use its configured size, not button-row height"
|
||||
);
|
||||
let clock_value = chrono::Local::now().format("%H:%M").to_string();
|
||||
assert!(text_rect(&output.shapes, &clock_value).unwrap().height() >= 65.);
|
||||
for font_size in [28., 72., 160.] {
|
||||
s.layout.header = true;
|
||||
s.layout.elapsed_position = TimerPosition::Header;
|
||||
s.layout.clock_position = TimerPosition::Header;
|
||||
s.layout.elapsed.size = font_size;
|
||||
s.layout.clock.size = font_size;
|
||||
let header = render(&mut s);
|
||||
let elapsed = text_rect(&header.shapes, "00:00").unwrap();
|
||||
assert!(
|
||||
elapsed.height() >= font_size * 0.85,
|
||||
"header font {font_size}: {elapsed:?}"
|
||||
);
|
||||
assert!(elapsed.bottom() < text_rect(&header.shapes, "CURRENT 1 / 30").unwrap().top());
|
||||
}
|
||||
s.layout.header = false;
|
||||
s.layout.elapsed_position = TimerPosition::AboveSlides;
|
||||
s.layout.clock_position = TimerPosition::BelowNotes;
|
||||
s.layout.elapsed.size = 72.;
|
||||
s.layout.clock.size = 72.;
|
||||
assert!(text_rect(&output.shapes, "Slide 1 / 30").is_none());
|
||||
s.layout.slide_progress = true;
|
||||
for page in [0, 14, 29] {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,16 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
### 0.1.57
|
||||
|
||||
- Fix tiny clock/timer text in the header, above slides and below notes: use the
|
||||
reserved row height and account for labels/padding. Put large header timers,
|
||||
or timers in narrow windows, on a separate row below the menu controls.
|
||||
Regression checks verify rendered text size and separation from slides.
|
||||
Linux workspace tests, 13 Python tests, formatting and warnings-denied
|
||||
Clippy/rustdoc pass; release binary rebuilt. Coverage measurement failed twice
|
||||
on corrupt LLVM worker profiles after the tests passed.
|
||||
|
||||
### 0.1.56
|
||||
|
||||
- Move the presenter header fullscreen button after Menu, Displays, All slides
|
||||
|
|
|
|||
Loading…
Reference in New Issue