Adapt page zoom to the screen with an opt-in fixed page area
This commit is contained in:
parent
edfae03ff4
commit
364ee1e59a
|
|
@ -2245,7 +2245,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pdf-presenter"
|
||||
version = "0.1.54"
|
||||
version = "0.1.55"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"]
|
|||
resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.54"
|
||||
version = "0.1.55"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter"
|
||||
|
|
|
|||
|
|
@ -39,6 +39,12 @@ pub fn tr<'a>(ctx: &egui::Context, text: &'a str) -> &'a str {
|
|||
return text;
|
||||
}
|
||||
match text {
|
||||
"Keep fitted page area when zooming" => {
|
||||
"Conserver la zone ajustée de la page pendant le zoom"
|
||||
}
|
||||
"By default, zoom expands the page to fill the screen without stretching. Enable this option to keep the original page-shaped area." => {
|
||||
"Par défaut, le zoom agrandit la page pour remplir l’écran sans déformation. Activez cette option pour conserver la zone initiale de la page."
|
||||
}
|
||||
"Enable page zoom" => "Activer le zoom des diapositives",
|
||||
"Page zoom" => "Zoom de la diapositive",
|
||||
"Reset zoom" => "Réinitialiser le zoom",
|
||||
|
|
|
|||
|
|
@ -233,11 +233,13 @@ impl NativeWindow {
|
|||
.as_ref()
|
||||
.is_some_and(|f| f.path == frame.info.path)
|
||||
{
|
||||
let target = presenter_ui::fitted_slide(
|
||||
let (next, response) = presenter_ui::zoom_gestures_in(
|
||||
ui,
|
||||
ui.max_rect(),
|
||||
[frame.info.width, frame.info.height],
|
||||
view,
|
||||
setup.zoom.keep_fitted_area,
|
||||
);
|
||||
let (next, response) = presenter_ui::zoom_gestures(ui, target, view);
|
||||
if setup.setup_controls {
|
||||
response.context_menu(|ui| {
|
||||
if ui
|
||||
|
|
@ -254,13 +256,16 @@ impl NativeWindow {
|
|||
view = next;
|
||||
}
|
||||
}
|
||||
presenter_ui::paint_slide_zoomed(
|
||||
presenter_ui::paint_slide_adapted(
|
||||
ui.painter(),
|
||||
ui.max_rect(),
|
||||
tex.id(),
|
||||
[frame.info.width, frame.info.height],
|
||||
setup.map(|s| s.slide_colors).unwrap_or_default(),
|
||||
view,
|
||||
crate::zoom::Sync {
|
||||
view,
|
||||
..setup.map(|s| s.zoom).unwrap_or_default()
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,12 +41,57 @@ pub fn paint_slide_zoomed(
|
|||
colors: crate::settings::SlideColors,
|
||||
view: crate::zoom::View,
|
||||
) {
|
||||
let target = fitted_slide(rect, dimensions);
|
||||
paint_slide_adapted(
|
||||
painter,
|
||||
rect,
|
||||
texture,
|
||||
dimensions,
|
||||
colors,
|
||||
crate::zoom::Sync {
|
||||
enabled: true,
|
||||
view,
|
||||
keep_fitted_area: true,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
}
|
||||
/// Visible page rectangle and texture crop; geometry never exceeds the viewport.
|
||||
pub fn zoom_geometry(
|
||||
rect: Rect,
|
||||
dimensions: [u32; 2],
|
||||
view: crate::zoom::View,
|
||||
keep_fitted_area: bool,
|
||||
) -> (Rect, Rect) {
|
||||
let view = view.normalized();
|
||||
let fitted = fitted_slide(rect, dimensions);
|
||||
if keep_fitted_area || view.scale == 1. {
|
||||
return (fitted, view.uv());
|
||||
}
|
||||
let enlarged = fitted.size() * view.scale;
|
||||
let size = enlarged.min(rect.size());
|
||||
let span = size / enlarged;
|
||||
let center =
|
||||
Vec2::new(view.center[0], view.center[1]).clamp(span * 0.5, Vec2::splat(1.) - span * 0.5);
|
||||
(
|
||||
Rect::from_center_size(rect.center(), size),
|
||||
Rect::from_center_size(center.to_pos2(), span),
|
||||
)
|
||||
}
|
||||
/// Adapt to the viewport using the existing buffered texture, with no rerender.
|
||||
pub fn paint_slide_adapted(
|
||||
painter: &egui::Painter,
|
||||
rect: Rect,
|
||||
texture: egui::TextureId,
|
||||
dimensions: [u32; 2],
|
||||
colors: crate::settings::SlideColors,
|
||||
zoom: crate::zoom::Sync,
|
||||
) {
|
||||
let view = zoom.normalized().view;
|
||||
let (target, uv) = zoom_geometry(rect, dimensions, view, zoom.keep_fitted_area);
|
||||
let [r, g, b] = colors.fit_padding;
|
||||
painter.rect_filled(rect, 0., Color32::from_rgb(r, g, b));
|
||||
let [r, g, b] = colors.page_background;
|
||||
painter.rect_filled(target, 0., Color32::from_rgb(r, g, b));
|
||||
let uv = view.uv();
|
||||
// Separate clip bands keep large moving crops parallel in the bounded CPU
|
||||
// renderer pool. Every band reads the same texture; no image is duplicated.
|
||||
let pixels = target.area() * painter.ctx().pixels_per_point().powi(2);
|
||||
|
|
@ -77,6 +122,26 @@ pub fn zoom_gestures(
|
|||
target: Rect,
|
||||
view: crate::zoom::View,
|
||||
) -> (crate::zoom::View, egui::Response) {
|
||||
zoom_gestures_in(
|
||||
ui,
|
||||
target,
|
||||
[
|
||||
target.width().max(1.) as u32,
|
||||
target.height().max(1.) as u32,
|
||||
],
|
||||
view,
|
||||
true,
|
||||
)
|
||||
}
|
||||
/// Screen-adapted gestures anchor the actual visible crop, including page padding.
|
||||
pub fn zoom_gestures_in(
|
||||
ui: &mut Ui,
|
||||
rect: Rect,
|
||||
dimensions: [u32; 2],
|
||||
view: crate::zoom::View,
|
||||
keep_fitted_area: bool,
|
||||
) -> (crate::zoom::View, egui::Response) {
|
||||
let (target, uv) = zoom_geometry(rect, dimensions, view, keep_fitted_area);
|
||||
let response = ui.interact(target, ui.id().with("page-zoom"), Sense::click_and_drag());
|
||||
let mut next = view;
|
||||
if response.hovered() {
|
||||
|
|
@ -85,23 +150,24 @@ pub fn zoom_gestures(
|
|||
i.smooth_scroll_delta = Vec2::ZERO;
|
||||
scroll
|
||||
});
|
||||
if scroll != 0.
|
||||
&& let Some(pos) = response.hover_pos()
|
||||
{
|
||||
let anchor = (pos - target.min) / target.size();
|
||||
next = next.zoom_at(
|
||||
next.scale * (scroll * 0.002).clamp(-0.7, 0.7).exp(),
|
||||
[anchor.x, anchor.y],
|
||||
);
|
||||
}
|
||||
let pinch = ui.input(|i| i.zoom_delta());
|
||||
if pinch != 1. {
|
||||
next = next.zoom_at(next.scale * pinch, [0.5; 2]);
|
||||
if scroll != 0. || pinch != 1. {
|
||||
next.scale =
|
||||
(view.scale * (scroll * 0.002).clamp(-0.7, 0.7).exp() * pinch).clamp(1., 8.);
|
||||
let pos = response.hover_pos().unwrap_or(target.center());
|
||||
let source = uv.min + (pos - target.min) / target.size() * uv.size();
|
||||
let (new_target, new_uv) = zoom_geometry(rect, dimensions, next, keep_fitted_area);
|
||||
let center = source - (pos - new_target.center()) / new_target.size() * new_uv.size();
|
||||
let half = new_uv.size() * 0.5;
|
||||
let center = center.to_vec2().clamp(half, Vec2::splat(1.) - half);
|
||||
next.center = [center.x, center.y];
|
||||
}
|
||||
}
|
||||
if response.dragged_by(egui::PointerButton::Primary) {
|
||||
let delta = ui.input(|i| i.pointer.delta()) / target.size();
|
||||
next = next.pan([delta.x, delta.y]);
|
||||
let delta = ui.input(|i| i.pointer.delta()) / target.size() * uv.size();
|
||||
let half = uv.size() * 0.5;
|
||||
let center = (uv.center().to_vec2() - delta).clamp(half, Vec2::splat(1.) - half);
|
||||
next.center = [center.x, center.y];
|
||||
}
|
||||
if response.double_clicked() {
|
||||
next = Default::default();
|
||||
|
|
@ -159,13 +225,13 @@ impl UiState {
|
|||
TextureOptions::LINEAR,
|
||||
)
|
||||
});
|
||||
paint_slide_zoomed(
|
||||
paint_slide_adapted(
|
||||
ui.painter(),
|
||||
rect,
|
||||
tex.id(),
|
||||
[frame.info.width, frame.info.height],
|
||||
s.settings.slide_colors,
|
||||
view,
|
||||
crate::zoom::Sync { view, ..s.zoom },
|
||||
);
|
||||
} else {
|
||||
ui.painter().text(
|
||||
|
|
@ -757,8 +823,13 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) {
|
|||
if s.route_trial.is_none()
|
||||
&& let Some(frame) = s.frame(page)
|
||||
{
|
||||
let target = fitted_slide(area, [frame.info.width, frame.info.height]);
|
||||
let (view, response) = zoom_gestures(ui, target, s.zoom.view);
|
||||
let (view, response) = zoom_gestures_in(
|
||||
ui,
|
||||
area,
|
||||
[frame.info.width, frame.info.height],
|
||||
s.zoom.view,
|
||||
s.zoom.keep_fitted_area,
|
||||
);
|
||||
response.on_hover_text(tr(
|
||||
&locale,
|
||||
"Scroll to zoom · drag to pan · double-click to reset",
|
||||
|
|
@ -1979,6 +2050,11 @@ fn menu(ui: &mut Ui, s: &mut Studio) {
|
|||
ui.set_width(370.);
|
||||
let mut enabled = s.settings.zoom_enabled;
|
||||
if ui.checkbox(&mut enabled, tr(&locale, "Enable page zoom")).changed() { s.enable_zoom(enabled); }
|
||||
if ui.checkbox(&mut s.settings.zoom_keep_fitted_area, tr(&locale, "Keep fitted page area when zooming")).changed() {
|
||||
s.set_zoom(s.zoom.view);
|
||||
s.save_preferences();
|
||||
}
|
||||
ui.small(tr(&locale, "By default, zoom expands the page to fill the screen without stretching. Enable this option to keep the original page-shaped area."));
|
||||
ui.small(tr(&locale, "Zoom reuses buffered images: no extra PDF rendering or image memory. Enlarged slides may look softer. Software drawing can slow down on large or multiple displays."));
|
||||
ui.separator();
|
||||
if ui.checkbox(&mut s.settings.auto_show,tr(&locale,"Show presentation automatically when opening a document")).changed() {s.save_preferences();}
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ pub struct Settings {
|
|||
pub buffer_mib: u32,
|
||||
pub auto_show: bool,
|
||||
pub zoom_enabled: bool,
|
||||
pub zoom_keep_fitted_area: bool,
|
||||
pub theme: crate::theme::Theme,
|
||||
pub language: crate::localization::Language,
|
||||
}
|
||||
|
|
@ -268,6 +269,7 @@ impl Default for Settings {
|
|||
buffer_mib: default_buffer_mib(),
|
||||
auto_show: true,
|
||||
zoom_enabled: false,
|
||||
zoom_keep_fitted_area: false,
|
||||
theme: Default::default(),
|
||||
language: Default::default(),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1118,6 +1118,7 @@ impl Studio {
|
|||
(self.generation << 32) | u64::from(self.target_edge)
|
||||
}
|
||||
pub fn set_zoom(&mut self, view: crate::zoom::View) {
|
||||
self.zoom.keep_fitted_area = self.settings.zoom_keep_fitted_area;
|
||||
self.zoom.set(self.settings.zoom_enabled, view);
|
||||
self.new_zoom = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ impl View {
|
|||
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Sync {
|
||||
pub enabled: bool,
|
||||
#[serde(default)]
|
||||
pub keep_fitted_area: bool,
|
||||
pub view: View,
|
||||
pub epoch: u64,
|
||||
pub serial: u64,
|
||||
|
|
|
|||
|
|
@ -212,6 +212,7 @@ fn independent_output_acknowledges_frames_and_blanking() {
|
|||
},
|
||||
epoch: sequence * 2,
|
||||
serial: 0,
|
||||
keep_fitted_area: false,
|
||||
},
|
||||
sequence,
|
||||
page,
|
||||
|
|
@ -251,6 +252,7 @@ fn independent_output_acknowledges_frames_and_blanking() {
|
|||
},
|
||||
epoch: sequence * 2 + 1,
|
||||
serial: 0,
|
||||
keep_fitted_area: false,
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -93,12 +93,16 @@ fn settings_default_opt_out_roundtrip_and_warning_threshold() {
|
|||
assert!(!Settings::default().zoom_enabled);
|
||||
let old: Settings = toml::from_str("version=1").unwrap();
|
||||
assert!(!old.zoom_enabled);
|
||||
assert!(!old.zoom_keep_fitted_area);
|
||||
assert!(!Settings::default().zoom_keep_fitted_area);
|
||||
let enabled = Settings {
|
||||
zoom_enabled: true,
|
||||
zoom_keep_fitted_area: true,
|
||||
..Default::default()
|
||||
};
|
||||
let restored: Settings = toml::from_str(&toml::to_string(&enabled).unwrap()).unwrap();
|
||||
assert!(restored.zoom_enabled);
|
||||
assert!(restored.zoom_keep_fitted_area);
|
||||
let mut watch = PerformanceWatch::default();
|
||||
assert!(!watch.observe(false, Duration::from_secs(1)));
|
||||
assert!(!watch.observe(true, Duration::from_millis(40)));
|
||||
|
|
@ -221,13 +225,17 @@ fn buffered_zoom_drawing_measurement() {
|
|||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
pdf_presenter::presenter_ui::paint_slide_zoomed(
|
||||
pdf_presenter::presenter_ui::paint_slide_adapted(
|
||||
ui.painter(),
|
||||
rect,
|
||||
texture.id(),
|
||||
[1920, 1080],
|
||||
[210, 297],
|
||||
Default::default(),
|
||||
view,
|
||||
Sync {
|
||||
enabled: true,
|
||||
view,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
@ -439,3 +447,157 @@ fn parallel_crop_bands_have_no_seams_at_fractional_boundaries() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn portrait_zoom_fills_screen_without_stretching_or_out_of_bounds_pixels() {
|
||||
use pdf_presenter::presenter_ui::zoom_geometry;
|
||||
for size in [
|
||||
Vec2::new(1920., 1080.),
|
||||
Vec2::new(1080., 1920.),
|
||||
Vec2::new(640., 480.),
|
||||
] {
|
||||
let rect = Rect::from_min_size(Pos2::new(12., 18.), size);
|
||||
for dimensions in [[210, 297], [297, 210]] {
|
||||
let (fitted, _) = zoom_geometry(rect, dimensions, View::default(), false);
|
||||
for scale in [1., 1.5, 3., 8.] {
|
||||
for center in [[0.5; 2], [0.; 2], [1.; 2]] {
|
||||
let view = View { scale, center };
|
||||
let (target, uv) = zoom_geometry(rect, dimensions, view, false);
|
||||
assert!(rect.contains_rect(target));
|
||||
assert!(Rect::from_min_max(Pos2::ZERO, Pos2::new(1., 1.)).contains_rect(uv));
|
||||
let x_scale = target.width() / (uv.width() * dimensions[0] as f32);
|
||||
let y_scale = target.height() / (uv.height() * dimensions[1] as f32);
|
||||
assert!((x_scale - y_scale).abs() < 0.001, "page was stretched");
|
||||
if scale >= 3. {
|
||||
assert_eq!(target, rect);
|
||||
}
|
||||
assert_eq!(zoom_geometry(rect, dimensions, view, true).0, fitted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn adapted_portrait_pixels_fill_padding_without_uploading_another_texture() {
|
||||
let ctx = Context::default();
|
||||
let texture = ctx.load_texture(
|
||||
"portrait",
|
||||
egui::ColorImage::filled([21, 30], egui::Color32::RED),
|
||||
TextureOptions::LINEAR,
|
||||
);
|
||||
let rect = Rect::from_min_size(Pos2::ZERO, Vec2::new(320., 180.));
|
||||
let mut renderer = EguiSoftwareRender::new(ColorFieldOrder::Bgra);
|
||||
let mut pixels = vec![0u32; 320 * 180];
|
||||
for (index, (scale, keep_fitted_area)) in [(1., false), (3., false), (3., true)]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
{
|
||||
let output = ctx.run_ui(
|
||||
RawInput {
|
||||
screen_rect: Some(rect),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
pdf_presenter::presenter_ui::paint_slide_adapted(
|
||||
ui.painter(),
|
||||
rect,
|
||||
texture.id(),
|
||||
[21, 30],
|
||||
Default::default(),
|
||||
Sync {
|
||||
enabled: true,
|
||||
keep_fitted_area,
|
||||
view: View {
|
||||
scale,
|
||||
center: [0.5; 2],
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
if index > 0 {
|
||||
assert!(output.textures_delta.set.is_empty());
|
||||
}
|
||||
let primitives = ctx.tessellate(output.shapes, output.pixels_per_point);
|
||||
renderer.render(
|
||||
&mut BufferMutRef::new(bytemuck::cast_slice_mut(&mut pixels), 320, 180),
|
||||
&primitives,
|
||||
&output.textures_delta,
|
||||
output.pixels_per_point,
|
||||
);
|
||||
let edge = pixels[90 * 320 + 4] & 0xffffff;
|
||||
let center = pixels[90 * 320 + 160] & 0xffffff;
|
||||
if index == 1 {
|
||||
assert_eq!(edge, center);
|
||||
} else {
|
||||
assert_ne!(edge, center);
|
||||
}
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn portrait_screen_adapting_gestures_pan_visible_area_and_reset() {
|
||||
let ctx = Context::default();
|
||||
let target = Rect::from_min_max(Pos2::new(40., 40.), Pos2::new(440., 240.));
|
||||
let mut view = View::default();
|
||||
let mut time = 0.;
|
||||
let mut render = |events: Vec<egui::Event>| {
|
||||
time += 0.04;
|
||||
let _ = ctx.run_ui(
|
||||
RawInput {
|
||||
screen_rect: Some(Rect::from_min_size(Pos2::ZERO, Vec2::new(500., 300.))),
|
||||
events,
|
||||
time: Some(time),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
view = pdf_presenter::presenter_ui::zoom_gestures_in(
|
||||
ui,
|
||||
target,
|
||||
[210, 297],
|
||||
view,
|
||||
false,
|
||||
)
|
||||
.0;
|
||||
},
|
||||
);
|
||||
view
|
||||
};
|
||||
let center = target.center();
|
||||
render(vec![egui::Event::PointerMoved(center)]);
|
||||
render(vec![egui::Event::MouseWheel {
|
||||
unit: egui::MouseWheelUnit::Point,
|
||||
phase: egui::TouchPhase::Move,
|
||||
delta: Vec2::new(0., 300.),
|
||||
modifiers: egui::Modifiers::NONE,
|
||||
}]);
|
||||
let mut zoom = View::default();
|
||||
for _ in 0..30 {
|
||||
zoom = render(vec![]);
|
||||
}
|
||||
assert!(zoom.scale > 1.2);
|
||||
let click = |pos, pressed| egui::Event::PointerButton {
|
||||
pos,
|
||||
button: egui::PointerButton::Primary,
|
||||
pressed,
|
||||
modifiers: egui::Modifiers::NONE,
|
||||
};
|
||||
render(vec![click(center, true)]);
|
||||
let moved = center + Vec2::new(40., 10.);
|
||||
let panned = render(vec![egui::Event::PointerMoved(moved)]);
|
||||
assert!(panned.center[1] < zoom.center[1]);
|
||||
assert_eq!(
|
||||
panned.center[0], 0.5,
|
||||
"page width still fits; horizontal panning should stop"
|
||||
);
|
||||
render(vec![click(moved, false)]);
|
||||
for _ in 0..20 {
|
||||
render(vec![]);
|
||||
}
|
||||
for _ in 0..2 {
|
||||
render(vec![click(moved, true)]);
|
||||
zoom = render(vec![click(moved, false)]);
|
||||
}
|
||||
assert_eq!(zoom, View::default());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,15 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
### 0.1.55
|
||||
|
||||
- Let zoom expand portrait/landscape pages into each screen without stretching,
|
||||
instead of trapping them inside the original fitted area. Save an opt-in
|
||||
“Keep fitted page area when zooming” preference. Keep buffered texture reuse,
|
||||
bounded drawing, pointer anchoring and shared zoom/center across outputs.
|
||||
Linux regression checks cover aspect ratio, screen fill, edges, settings and
|
||||
pixel output without new texture uploads. Physical multiscreen testing remains open.
|
||||
|
||||
### 0.1.54
|
||||
|
||||
- Add globally saved, default-off page zoom (1×–8×), wheel/pinch zoom, drag panning
|
||||
|
|
|
|||
|
|
@ -337,3 +337,24 @@ unchanged cached primitive; moving crops deliberately invalidate that cache.
|
|||
These numbers include egui tessellation and software buffer drawing, exclude native
|
||||
surface/compositor/monitor latency, and are not a guaranteed display frame rate.
|
||||
The in-app watcher measures the actual native window draw/presentation call.
|
||||
|
||||
|
||||
## Screen-adapting zoom — 0.1.55
|
||||
|
||||
The default now grows the fitted page by the zoom factor into the entire viewport,
|
||||
then derives a clipped texture rectangle. Geometry never exceeds the viewport and
|
||||
UVs remain within the original image. No image resampling jobs, uploads or larger
|
||||
image buffers are added. The saved `zoom_keep_fitted_area` opt-in retains v0.1.54
|
||||
geometry. Each output computes its own aspect-correct crop from shared scale/center;
|
||||
input uses the actual visible UV span for anchoring and panning. Tests exercise
|
||||
portrait and landscape pages/screens, bounded edge panning and actual software pixels.
|
||||
The manual drawing benchmark now uses A4 page proportions on widescreen outputs.
|
||||
|
||||
Linux validation: formatting, warnings-denied Clippy/rustdoc, the full workspace
|
||||
coverage suite (including native window tests), and 13 Python helper tests pass.
|
||||
Whole-application line coverage is 86.25%. The release binary is rebuilt. On the
|
||||
same local i5-8500, the A4-proportioned crop benchmark reports moving-frame medians
|
||||
of 5.18/4.70 ms at 1080p (4×/8×) and 15.94/15.50 ms at 4K, maximum 16.87 ms.
|
||||
The synthetic texture remains 1920×1080; page metadata supplies A4 proportions to
|
||||
exercise viewport expansion. These are software-drawing measurements, not physical
|
||||
display latency. Windows/macOS were not built or runtime-tested for this change.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
version = 1
|
||||
auto_show = true
|
||||
zoom_enabled = false
|
||||
zoom_keep_fitted_area = false
|
||||
theme = "midra"
|
||||
language = "system"
|
||||
presenter_fullscreen = true
|
||||
|
|
|
|||
|
|
@ -143,8 +143,10 @@ are private same-executable presenter/worker traffic, never output-host traffic.
|
|||
HostState adds `zoom {enabled, view {scale, center}, epoch, serial}` and
|
||||
`zoom_only` (false by default). Scale is bounded to 1–8 and center is normalized
|
||||
page UV coordinates, clamped to keep the full crop inside the page. Disabled or
|
||||
invalid views normalize to a complete fitted page. The viewport keeps the slide's
|
||||
aspect ratio and draws a cropped texture rectangle with constant-sized geometry.
|
||||
invalid views normalize to a complete fitted page. Since 0.1.55, zoom also carries `keep_fitted_area` (missing defaults false).
|
||||
The default preserves page proportions while expanding into each viewport, clipping
|
||||
overflow with bounded UVs and geometry. True retains the original fitted rectangle.
|
||||
Visible crop/edge clamping is local to each viewport; scale and page center are shared.
|
||||
No higher-resolution request, texture upload or image buffer is created by zoom.
|
||||
Large crops split into disjoint clip bands on a pool capped at four CPU threads;
|
||||
scanline interpolation uses O(viewport width) scratch memory.
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ with an error, without rewriting the bad file. Missing files use defaults. Reads
|
|||
bounded to 4 MiB. Writes validate then atomically replace using a same-directory
|
||||
flushed temporary file. Unknown fields are ignored and not preserved on round trip.
|
||||
|
||||
- `zoom_keep_fitted_area`: boolean, default false, added in 0.1.55. Missing fields
|
||||
migrate to screen-adapting zoom: preserve aspect ratio while expanding into the
|
||||
viewport, cropping overflow. True retains the original fitted page area. This
|
||||
global preference does not change cached render resolution or enable zoom.
|
||||
- `zoom_enabled`: boolean, default false, added in 0.1.54. Global opt-in for
|
||||
presenter/current-slide and output zoom gestures. Missing fields in older v1
|
||||
files retain normal non-zoom behavior. Menu → Preferences saves this setting
|
||||
|
|
|
|||
|
|
@ -324,13 +324,21 @@ and [format contract](interfaces/presentation-notes.md#importing-txt-and-markdow
|
|||
Zoom is **off by default**. Enable **Menu → Preferences → Enable page zoom**.
|
||||
The preference is saved globally; it does not change presentation visibility.
|
||||
|
||||
By default, zoom expands the page into the available screen area without stretching.
|
||||
For example, an A4 portrait page fills a widescreen display as you zoom in; drag to
|
||||
see the cropped top/bottom. Each screen adapts to its own dimensions. To retain
|
||||
the original page-shaped area and its margins, enable **Menu → Preferences →
|
||||
Keep fitted page area when zooming**. This choice is saved globally. It changes
|
||||
the visible area, not the cached image resolution.
|
||||
|
||||
- On the **current slide preview** or any **presentation screen**, scroll up/down
|
||||
to zoom in/out (1×–8×). The point under the mouse stays anchored when possible.
|
||||
- Hold the left mouse button and drag to move the enlarged image. Movement stops
|
||||
at the page edges. Double-click to reset to the complete fitted slide.
|
||||
- **Menu → Page zoom** also has a zoom slider and **Reset zoom** button. If the
|
||||
current preview is hidden, show it in Layout to pan from the presenter.
|
||||
- All mirrored presenter/current previews and presentation outputs share the crop.
|
||||
- All mirrored presenter/current previews and presentation outputs share zoom and
|
||||
page center; different screen shapes can show different amounts of the page.
|
||||
Previous/next previews, All slides thumbnails and browser previews stay unzoomed.
|
||||
Moving to another slide or opening another presentation resets zoom. Display
|
||||
swaps/fullscreen changes preserve it. Zoom gestures pause during display trials.
|
||||
|
|
|
|||
Loading…
Reference in New Issue