Merge pull request #916 from pravdomil/claude/composition-maximize-zoom-fit-86627e

Viewer: Fit up to 100% follows the panel size

# Conflicts:
#	crates/ui-egui/src/panels/viewer_tools.rs
#	crates/ui-egui/tests/ui_viewer.rs
This commit is contained in:
Brandon Thomas
2026-10-12 04:22:53 -04:00
6 changed files with 68 additions and 14 deletions
+3 -1
View File
@@ -795,6 +795,8 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
let (cw, ch) = (comp.width as f32, comp.height as f32);
let fit = ((area.width() - 40.0) / cw).min((area.height() - 40.0) / ch).max(0.01);
// Fit up to 100% follows the panel's size like Fit does, and stops at 100%.
let fit = if app.ui.viewer.fit_up_to_100 { fit.min(1.0 / ctx.pixels_per_point()) } else { fit };
ctx.data_mut(|d| d.insert_temp(egui::Id::new("viewer-fit"), fit));
let zoom = app.ui.viewer.zoom.unwrap_or(fit);
let center = area.center() + vec2(app.ui.viewer.pan[0], app.ui.viewer.pan[1]);
@@ -1952,7 +1954,7 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
vt::draw_snap(&ctx, &painter, &map, &ectx);
vt::rulers(app, ui, &map, outer, area);
vt::bottom_bar(app, ui, bar, zoom, fit, time, &comp);
vt::bottom_bar(app, ui, bar, zoom, time, &comp);
if err_h > 0.0 {
super::expr_bar::draw(app, ui, err_bar, cid);
}