mirror of https://github.com/odrling/Aegisub
When zooming, fix the center sample in place
Originally committed to SVN as r4910.
This commit is contained in:
parent
82eddf53ea
commit
30cd87bcb3
|
@ -678,6 +678,9 @@ void AudioDisplay::SetZoomLevel(int new_zoom_level)
|
||||||
|
|
||||||
if (pixel_samples != new_samples_per_pixel)
|
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;
|
pixel_samples = new_samples_per_pixel;
|
||||||
audio_renderer->SetSamplesPerPixel(pixel_samples);
|
audio_renderer->SetSamplesPerPixel(pixel_samples);
|
||||||
|
|
||||||
|
@ -686,9 +689,11 @@ void AudioDisplay::SetZoomLevel(int new_zoom_level)
|
||||||
else
|
else
|
||||||
pixel_audio_width = 1;
|
pixel_audio_width = 1;
|
||||||
|
|
||||||
scrollbar->ChangeLengths(pixel_audio_width, GetClientSize().GetWidth());
|
scrollbar->ChangeLengths(pixel_audio_width, client_width);
|
||||||
timeline->ChangeZoom(pixel_samples);
|
timeline->ChangeZoom(pixel_samples);
|
||||||
|
|
||||||
|
ScrollSampleToCenter(center_sample);
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue