From 20ba473e85f16f690301b3f2dab7d8eb65e249bf Mon Sep 17 00:00:00 2001 From: Vikram Bhaskaran Date: Tue, 13 Oct 2026 01:24:35 +1100 Subject: [PATCH] Let the deep-zoom preview margin cover wide local filters. --- crates/ui-egui/src/region.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/region.rs b/crates/ui-egui/src/region.rs index 8fe29e135..d8daaaf93 100644 --- a/crates/ui-egui/src/region.rs +++ b/crates/ui-egui/src/region.rs @@ -11,7 +11,9 @@ use lightcraft_engine::pipeline::PixelWindow; /// Windows start and end on multiples of this many pixels of the zoomed frame. pub const SNAP: usize = 256; /// The most context rendered beyond the visible pixels (a multiple of [`SNAP`]). -pub const MAX_MARGIN: usize = 768; +/// 4.5 % of an 11:1 view of a 24 MP frame, snapped to [`SNAP`]. The old 768 px cap left Dehaze +/// tens of codes off the full-frame render from 4:1 up (#1146). +pub const MAX_MARGIN: usize = 3072; /// The most a window may span on either axis: a bound on its texture whatever the window size. pub const MAX_SPAN: usize = if cfg!(target_arch = "wasm32") { 3072 } else { 6144 }; @@ -484,7 +486,8 @@ mod tests { fn the_margin_grows_with_the_zoom_up_to_a_cap() { assert_eq!(margin_for(1000), SNAP, "never less than one grid step"); assert!(margin_for(8000) > margin_for(3000)); - assert_eq!(margin_for(48_000), MAX_MARGIN); + assert_eq!(margin_for(48_000), 2304, "4.5 % of an 8:1 frame, under the cap"); + assert_eq!(margin_for(80_000), MAX_MARGIN); assert_eq!(margin_for(0), SNAP); assert!(margin_for(usize::MAX) <= MAX_MARGIN); for l in [100, 3000, 8000, 48_000, 400_000] {