Reduce answer review scroll redraws
This commit is contained in:
@@ -60,6 +60,8 @@ var stem_plain_text := ""
|
||||
var explanation_plain_text := ""
|
||||
var highlight_drag_source := ""
|
||||
var timer_color_state := ""
|
||||
var last_timer_bar_value := -1.0
|
||||
var last_timer_display_seconds := -1
|
||||
var pending_correct_advance := false
|
||||
var question_text_scale := 1.0
|
||||
var presented_choices: Array = []
|
||||
@@ -1268,6 +1270,8 @@ func _load_question() -> void:
|
||||
flagged = false
|
||||
selected_choice = ""
|
||||
current_answer = {}
|
||||
last_timer_bar_value = -1.0
|
||||
last_timer_display_seconds = -1
|
||||
flag_button.button_pressed = false
|
||||
_refresh_toolbar_state()
|
||||
_clear_answer_review()
|
||||
@@ -2094,7 +2098,10 @@ func _update_timer_bar() -> void:
|
||||
return
|
||||
var is_core_timer := BlockSessionService.session_kind == "core"
|
||||
var ratio := BlockSessionService.get_session_timer_ratio()
|
||||
timer_bar.value = ratio * 100.0
|
||||
var next_value := ratio * 100.0
|
||||
if last_timer_bar_value < 0.0 or absf(next_value - last_timer_bar_value) >= 0.1:
|
||||
last_timer_bar_value = next_value
|
||||
timer_bar.value = next_value
|
||||
if is_core_timer and timer_label.visible:
|
||||
_set_timer_display(int(floor(BlockSessionService.get_core_question_total_elapsed_seconds())))
|
||||
var color_state := "blue"
|
||||
@@ -2114,6 +2121,9 @@ func _set_timer_display(total_seconds: int) -> void:
|
||||
if timer_label == null:
|
||||
return
|
||||
var safe_seconds := maxi(0, total_seconds)
|
||||
if safe_seconds == last_timer_display_seconds:
|
||||
return
|
||||
last_timer_display_seconds = safe_seconds
|
||||
timer_label.text = "%02d:%02d" % [int(floor(float(safe_seconds) / 60.0)), safe_seconds % 60]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user