if (this.PART_ScrollViewer is ScrollViewer scroller) {
double multiplier;
if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) {
multiplier = e.Delta > 0 ? 1.05 : 0.95;
}
else {
multiplier = e.Delta > 0 ? 1.1 : 0.9;
}
double oldzoom = this.UnitZoom;
double newzoom = TimelineUtils.ClampUnit(oldzoom * multiplier);
this.UnitZoom = newzoom;
newzoom = this.UnitZoom;
{
double full_horizontal_offset = scroller.HorizontalOffset / this.UnitZoom;
double visible_pixels = newzoom * this.ActualWidth;
double width_ratio = (scroller.ExtentWidth / newzoom) / this.ActualWidth;
double width_ratio_1 = scroller.ExtentWidth / this.ActualWidth;
double ratio_diff = width_ratio_1 / width_ratio;
double pixels_difference = (this.ActualWidth / oldzoom) - (this.ActualWidth / newzoom);
double actual_pixel_change = pixels_difference * newzoom;
double side_ratio_x = (scroller.HorizontalOffset / 2) / full_horizontal_offset;
double new_offset = full_horizontal_offset - actual_pixel_change;
scroller.ScrollToHorizontalOffset(scroller.HorizontalOffset + new_offset);
return;
}
}
if (this.PART_ScrollViewer is ScrollViewer scroller) {
double multiplier;
if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) {
multiplier = e.Delta > 0 ? 1.05 : 0.95;
}
else {
multiplier = e.Delta > 0 ? 1.1 : 0.9;
}
double oldzoom = this.UnitZoom;
double newzoom = TimelineUtils.ClampUnit(oldzoom * multiplier);
this.UnitZoom = newzoom;
newzoom = this.UnitZoom;
{
double full_horizontal_offset = scroller.HorizontalOffset / this.UnitZoom;
double visible_pixels = newzoom * this.ActualWidth;
double width_ratio = (scroller.ExtentWidth / newzoom) / this.ActualWidth;
double width_ratio_1 = scroller.ExtentWidth / this.ActualWidth;
double ratio_diff = width_ratio_1 / width_ratio;
double pixels_difference = (this.ActualWidth / oldzoom) - (this.ActualWidth / newzoom);
double actual_pixel_change = pixels_difference * newzoom;
double side_ratio_x = (scroller.HorizontalOffset / 2) / full_horizontal_offset;
double new_offset = full_horizontal_offset - actual_pixel_change;
scroller.ScrollToHorizontalOffset(scroller.HorizontalOffset + new_offset);
return;
}
}