sharkdp/binocle

View is shifted with non-integer display scaling factor

Open

#64 创建于 2025年1月1日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)Rust (41 fork)github user discovery
bughelp wanted

仓库指标

Star
 (1,307 star)
PR 合并指标
 (PR 指标待抓取)

描述

Hello, with non-integer screen scaling factors (mine is 150% in the attached screenshot) the pixels view does not originate from the top left corner so some screen real-estate is lost

I kind of fixed it by modifying the following snippet but it does not apply when resizing the window...

In event_loop.rs : L54 let (mut pixels, mut gui) = { let scale_factor = window.scale_factor(); let forced_scale_factor = if (scale_factor-scale_factor.floor()) > 0.5 { scale_factor.ceil() } else { scale_factor.floor() }; let window_size = LogicalSize::new(WIDTH, HEIGHT).to_physical(forced_scale_factor); window.set_inner_size(window_size); let surface_texture = SurfaceTexture::new(window_size.width, window_size.height, &window); let pixels = Pixels::new(WIDTH, HEIGHT, surface_texture)?; let gui = Gui::new( &event_loop, window_size.width, window_size.height, scale_factor as f32, &pixels, ); (pixels, gui) };

Thanks for the great software !

贡献者指南