R6.13 round 2 fix: the worker turns in input order; scrolls by gesture

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ZacharyZhang-NYandClaude Opus 5.5 committed 2026-10-15 20:35:43 -04:00
1 parent d427d05b96
commit 407ce00ab9
17 files changed
+91 -109

No files matched your search

+1 -2
View File
@@ -99,7 +99,6 @@ impl Host for Deck {
view.fit_page(cx);
view.turn_parts();
});
cx.subscribe(view, move |deck, view, turn: &ely_lok::Turn, cx| deck.turn(id, &view, turn.0, cx)).detach();
}
// Pictures follow the kernel's light or dark scheme.
let dark = view.read(cx).dark();
@@ -267,7 +266,7 @@ impl Deck {
Ok(((slides, at), (design, objects, notes, remarks, (motion, media)), size, history)) => {
tab.extra.read_at = Some(at);
log::info!("show: tab {id} has {} parts", slides.list.len());
// A queued turn outranks a read made before it.
// A queued turn or part outranks an earlier read.
view.update(cx, |view, _| {
if view.settled() {
view.set_part(slides.current)
+1 -15
View File
@@ -9,11 +9,10 @@ use ely_gpui_component::{
};
use ely_office::prelude::*;
use gpui::{
Action, App, Context, Div, Entity, InteractiveElement as _, IntoElement, Menu, MenuItem,
Action, App, Context, Div, InteractiveElement as _, IntoElement, Menu, MenuItem,
ParentElement as _, Render, RenderImage, Role, StatefulInteractiveElement as _, Styled as _,
WeakEntity, Window, actions, div, img, prelude::FluentBuilder as _, px,
};
use ely_lok::LokView;
use image::{Frame, ImageBuffer, Rgba};
use crate::deck::Deck;
@@ -99,19 +98,6 @@ impl Deck {
self.run_active(id, &[], cx);
}
/// Shows the slide `step` away, as the strip would.
pub(crate) fn turn(&mut self, id: u64, view: &Entity<LokView>, step: i32, cx: &mut Context<Self>) {
let Some(count) = self.tab(id).map(|tab| tab.extra.slides.list.len()).filter(|count| *count > 0) else {
return;
};
// From the part asked last, so quick turns add up.
let shown = view.read(cx).part();
let part = (shown as i64 + i64::from(step)).clamp(0, count as i64 - 1) as usize;
if part != shown {
view.update(cx, |view, _| view.show_part(part));
}
}
/// Paints the next missing or stale slide picture.
pub fn paint_next(&mut self, id: u64, cx: &mut Context<Self>) {
let Some(tab) = self.tab(id) else {
+4
View File
@@ -64,4 +64,8 @@ fn the_wheel_and_up_down_turn_slides() {
shown.simulate_keystrokes("tab down");
assert_eq!(current(&mut shown, &deck), 0, "Down after Tab moves, not turns");
assert!(shown.update(|_, app| selection(app, &deck)).is_some(), "Tab picked an object");
// A turn lands before the keys queued after it.
shown.simulate_keystrokes("escape down tab down");
assert_eq!(current(&mut shown, &deck), 1, "Down turns, then moves");
assert!(shown.update(|_, app| selection(app, &deck)).is_some(), "Tab picked on the new slide");
}