move zoom scaling out of ::zoom_to_show() and into the caller

This commit is contained in:
Paul Davis 2025-01-26 15:50:42 -07:00
parent 27de5bdb22
commit 0015cc8c68

View file

@ -1998,7 +1998,7 @@ Pianoroll::set_region (std::shared_ptr<ARDOUR::MidiRegion> r)
{
EditingContext::TempoMapScope tms (*this, map);
/* Compute zoom level to show entire source plus some margin if possible */
zoom_to_show (timecnt_t (timepos_t (max_zoom_extent ().second.beats())));
zoom_to_show (timecnt_t (timepos_t (max_extents_scale() * max_zoom_extent ().second.samples())));
}
@ -2013,9 +2013,9 @@ Pianoroll::zoom_to_show (Temporal::timecnt_t const & duration)
}
/* make it 20% wider than we need */
samplecnt_t samples = (samplecnt_t) floor (max_extents_scale() * duration.samples());
samplecnt_t spp = floor (samples / _visible_canvas_width);
samplecnt_t samples = duration.samples();
samplecnt_t spp = floor (samples / _track_canvas_width);
reset_zoom (spp);
}