Fix various typos and code style issues

This commit is contained in:
Rémi Verschelde
2024-11-28 16:56:14 +01:00
parent 0eadbdb5d0
commit 88e81ee730
23 changed files with 116 additions and 114 deletions

View File

@@ -1298,12 +1298,12 @@ void AnimationTimelineEdit::_zoom_changed(double) {
double timeline_right = timeline_left + timeline_width_seconds;
double timeline_center = timeline_left + timeline_width_seconds / 2.0;
if (zoom_callback_occured) { // Zooming with scroll wheel will focus on the position of the mouse.
if (zoom_callback_occurred) { // Zooming with scroll wheel will focus on the position of the mouse.
double zoom_scroll_origin_norm = (zoom_scroll_origin.x - get_name_limit()) / timeline_width_pixels;
zoom_scroll_origin_norm = MAX(zoom_scroll_origin_norm, 0);
zoom_pivot = timeline_left + timeline_width_seconds * zoom_scroll_origin_norm;
zoom_pivot_delta = updated_timeline_width_seconds * zoom_scroll_origin_norm;
zoom_callback_occured = false;
zoom_callback_occurred = false;
} else { // Zooming with slider will depend on the current play position.
// If the play position is not in range, or exactly in the center, zoom in on the center.
if (get_play_position() < timeline_left || get_play_position() > timeline_left + timeline_width_seconds || get_play_position() == timeline_center) {
@@ -1952,7 +1952,7 @@ void AnimationTimelineEdit::_pan_callback(Vector2 p_scroll_vec, Ref<InputEvent>
void AnimationTimelineEdit::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputEvent> p_event) {
double current_zoom_value = get_zoom()->get_value();
zoom_scroll_origin = p_origin;
zoom_callback_occured = true;
zoom_callback_occurred = true;
get_zoom()->set_value(MAX(0.01, current_zoom_value - (1.0 - p_zoom_factor)));
}