When zooming, fix the center sample in place

Originally committed to SVN as r4910.
This commit is contained in:
Thomas Goyne 2010-12-08 08:09:37 +00:00
parent 82eddf53ea
commit 30cd87bcb3
1 changed files with 6 additions and 1 deletions

View File

@ -678,6 +678,9 @@ void AudioDisplay::SetZoomLevel(int new_zoom_level)
if (pixel_samples != new_samples_per_pixel)
{
int client_width = GetClientSize().GetWidth();
int64_t center_sample = int64_t(scroll_left + client_width / 2) * pixel_samples;
pixel_samples = new_samples_per_pixel;
audio_renderer->SetSamplesPerPixel(pixel_samples);
@ -686,9 +689,11 @@ void AudioDisplay::SetZoomLevel(int new_zoom_level)
else
pixel_audio_width = 1;
scrollbar->ChangeLengths(pixel_audio_width, GetClientSize().GetWidth());
scrollbar->ChangeLengths(pixel_audio_width, client_width);
timeline->ChangeZoom(pixel_samples);
ScrollSampleToCenter(center_sample);
Refresh();
}
}