mirror of
https://github.com/storytold/deckcraft.git
synced 2026-10-27 20:16:50 -06:00
Merge PR #224 from justinjohn0306: Notes and Presenter View: long notes scroll, presenter controls show (#221)
# Conflicts: # crates/ui-egui/src/show.rs
This commit is contained in:
@@ -1711,6 +1711,10 @@ fn presenter_window(ctx: &egui::Context, show: &mut Show, doc: &Presentation, no
|
||||
// The presenter clock only moves when this window is drawn again.
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(500));
|
||||
let mut actions = vec![];
|
||||
// The presenter window is dark; default buttons draw dark text on it (#221).
|
||||
let button = |ui: &mut Ui, s: &str| {
|
||||
ui.add(egui::Button::new(egui::RichText::new(s).size(15.0).color(Color32::WHITE)).fill(Color32::from_gray(60)).min_size(vec2(0.0, 30.0)))
|
||||
};
|
||||
ctx.show_viewport_immediate(
|
||||
egui::ViewportId::from_hash_of("deckcraft_presenter"),
|
||||
egui::ViewportBuilder::default().with_title("Presenter View — DeckCraft").with_inner_size([1100.0, 700.0]),
|
||||
@@ -1733,13 +1737,13 @@ fn presenter_window(ctx: &egui::Context, show: &mut Show, doc: &Presentation, no
|
||||
ui.add_space(20.0);
|
||||
ui.label(egui::RichText::new(format!("Slide {} of {}", cur + 1, doc.slides.len())).size(16.0).color(Color32::from_gray(200)));
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
if ui.button("End Show").clicked() {
|
||||
if button(ui, "End Show").clicked() {
|
||||
*keep = false;
|
||||
}
|
||||
if ui.button("Next ▶").clicked() {
|
||||
if button(ui, "Next ▶").clicked() {
|
||||
actions.push(show.state.next(doc));
|
||||
}
|
||||
if ui.button("◀ Previous").clicked() {
|
||||
if button(ui, "◀ Previous").clicked() {
|
||||
actions.push(show.state.prev(doc));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -145,15 +145,22 @@ pub fn notes_pane(app: &mut SlideApp, ui: &mut Ui) {
|
||||
app.notes_buf.2 = current.clone();
|
||||
}
|
||||
let mut buf = app.notes_buf.2.clone();
|
||||
let r = ui.add(
|
||||
egui::TextEdit::multiline(&mut buf)
|
||||
.id(id)
|
||||
.hint_text("Click to add notes")
|
||||
.frame(egui::Frame::NONE)
|
||||
.desired_width(f32::INFINITY)
|
||||
.desired_rows(2)
|
||||
.font(theme::font(13.0)),
|
||||
);
|
||||
// Long notes scroll inside the pane instead of spilling over the slide (#221).
|
||||
let r = egui::ScrollArea::vertical()
|
||||
.max_height(ui.available_height())
|
||||
.auto_shrink([false, false])
|
||||
.show(ui, |ui| {
|
||||
ui.add(
|
||||
egui::TextEdit::multiline(&mut buf)
|
||||
.id(id)
|
||||
.hint_text("Click to add notes")
|
||||
.frame(egui::Frame::NONE)
|
||||
.desired_width(f32::INFINITY)
|
||||
.desired_rows(2)
|
||||
.font(theme::font(13.0)),
|
||||
)
|
||||
})
|
||||
.inner;
|
||||
app.notes_buf.2 = buf.clone();
|
||||
if r.lost_focus() && buf != current {
|
||||
let _ = app.run("slide.notes", json!({"text": buf, "index": idx}));
|
||||
|
||||
Reference in New Issue
Block a user