Skip to content

Commit

Permalink
Fix playback position label update in Audio Stream Importer
Browse files Browse the repository at this point in the history
The current playback position label doesn't get updated if the playhead is not visible. The label is updated in `_draw_indicator()` at the end of the function, but we return early if the calculated offset falls outside the valid range. This fix moves the label updating above this check, ensuring that the label always gets updated regardless of the visibility of the playhead.

Fixes godotengine#86550.

(cherry picked from commit 155bebf)
  • Loading branch information
alessandrofama authored and akien-mga committed Mar 11, 2024
1 parent 3ebb5ea commit fddd0a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions editor/import/audio_stream_import_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ void AudioStreamImportSettings::_draw_indicator() {
rect.size.height -= y_ofs;
}

_current_label->set_text(String::num(_current, 2).pad_decimals(2) + " /");

float ofs_x = (_current - zoom_bar->get_value()) * rect.size.width / zoom_bar->get_page();
if (ofs_x < 0 || ofs_x >= rect.size.width) {
return;
Expand Down Expand Up @@ -310,8 +312,6 @@ void AudioStreamImportSettings::_draw_indicator() {
}
}
}

_current_label->set_text(String::num(_current, 2).pad_decimals(2) + " /");
}

void AudioStreamImportSettings::_on_indicator_mouse_exited() {
Expand Down

0 comments on commit fddd0a5

Please sign in to comment.